diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java index d65b5c0f61..f87c21ece0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java @@ -17,6 +17,7 @@ package com.android.launcher3.taskbar; import static com.android.launcher3.anim.AnimatedFloat.VALUE; +import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import androidx.annotation.Nullable; @@ -85,6 +86,15 @@ public class TaskbarSpringOnStashController implements LoggableTaskbarController .build(mTranslationForStash, VALUE); } + /** + * Returns an animation to reset the stash translation back to 0 when unstashing. + */ + public @Nullable ObjectAnimator createResetAnimForUnstash() { + if (!mIsTransientTaskbar) { + return null; + } + return mTranslationForStash.animateToValue(0); + } @Override public void dumpLogs(String prefix, PrintWriter pw) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index c2175f2444..1727dd39f5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -799,6 +799,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba if (isStashed) { play(skippable, mControllers.taskbarSpringOnStashController.createSpringToStash(), 0, duration, LINEAR); + } else { + play(skippable, mControllers.taskbarSpringOnStashController.createResetAnimForUnstash(), + 0, duration, LINEAR); } mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration, @@ -1218,6 +1221,15 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba && mLastStartedTransitionType == TRANSITION_DEFAULT && animationType != TRANSITION_DEFAULT; + // It is possible for stash=false to be requested by TRANSITION_HOME_TO_APP and + // TRANSITION_DEFAULT in quick succession. In this case, we should ignore + // transitionTypeChanged because the animations are exactly the same. + if (transitionTypeChanged + && (!mIsStashed && !isStashed) + && animationType == TRANSITION_HOME_TO_APP) { + transitionTypeChanged = false; + } + if (mIsStashed != isStashed || transitionTypeChanged) { mIsStashed = isStashed; mLastStartedTransitionType = animationType;