Fix bug where unstash animation plays twice.
Fixes: 282056846
Change-Id: I372444684fafd246369f6bc1e77c5e6fbb651c6f
Flag: ENABLE_TRANSIENT_TASKBAR
Test: open app, then very quickly swipe to unstash taskbar
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java
index d65b5c0..f87c21e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarSpringOnStashController.java
@@ -17,6 +17,7 @@
import static com.android.launcher3.anim.AnimatedFloat.VALUE;
+import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import androidx.annotation.Nullable;
@@ -85,6 +86,15 @@
.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 c2175f2..1727dd3 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -799,6 +799,9 @@
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 @@
&& 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;