Merge "Fix taskbar jumping when going home" into sc-v2-dev am: 3d206ca917

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16374170

Change-Id: I8ad15ee9afd48aeb05ae1e4e89503d0e683ca5a6
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index f3c8cf3..b2c29b2 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -195,7 +195,7 @@
         if (hasAnyFlag(changedFlags, FLAG_RESUMED)) {
             boolean isResumed = isResumed();
             ObjectAnimator anim = mIconAlignmentForResumedState
-                    .animateToValue(getCurrentIconAlignmentRatio(), isResumed ? 1 : 0)
+                    .animateToValue(isResumed ? 1 : 0)
                     .setDuration(duration);
 
             anim.addListener(new AnimatorListenerAdapter() {
@@ -351,9 +351,16 @@
 
         private void endGestureStateOverride(boolean finishedToApp) {
             mCallbacks.removeListener(this);
+
+            // Update the resumed state immediately to ensure a seamless handoff
+            boolean launcherResumed = !finishedToApp;
+            mIconAlignmentForResumedState.updateValue(launcherResumed ? 1 : 0);
+
             updateStateForFlag(FLAG_RECENTS_ANIMATION_RUNNING, false);
+            updateStateForFlag(FLAG_RESUMED, launcherResumed);
             applyState();
 
+
             TaskbarStashController controller = mControllers.taskbarStashController;
             controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
             controller.applyState();