From 4a9a67816dc39e45ba8779177d5bef05e024db0b Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 15 Feb 2024 09:58:57 -0800 Subject: [PATCH] Prevent taskbar reset animation from playing when gesture is in progress. This fixes the bug that appears when you launch an app and immediately swipe up on taskbar. Fixes: 278617335 Test: launch app, immediately swipe up on taskbar Flag: NONE Change-Id: I56eddfae9c81b1ef827622cf0f13ffd26fadd5c3 --- .../taskbar/TaskbarTranslationController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java index 916b1e6c43..144c0c25c8 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarTranslationController.java @@ -53,6 +53,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable private boolean mHasSprungOnceThisGesture; private @Nullable ValueAnimator mSpringBounce; + private boolean mGestureInProgress; private boolean mGestureEnded; private boolean mAnimationToHomeRunning; @@ -155,7 +156,12 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable /** * Returns an animation to reset the taskbar translation to {@code 0}. */ - public ObjectAnimator createAnimToResetTranslation(long duration) { + public ValueAnimator createAnimToResetTranslation(long duration) { + if (mGestureInProgress) { + // Return an empty animator as the translation will reset itself after gesture ends. + return ValueAnimator.ofFloat(0).setDuration(duration); + } + ObjectAnimator animator = mTranslationYForSwipe.animateToValue(0); animator.setInterpolator(Interpolators.LINEAR); animator.setDuration(duration); @@ -192,6 +198,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable mAnimationToHomeRunning = false; cancelSpringIfExists(); reset(); + mGestureInProgress = true; } /** * Called when there is movement to move the taskbar. @@ -215,6 +222,7 @@ public class TaskbarTranslationController implements TaskbarControllers.Loggable mGestureEnded = true; startSpring(); } + mGestureInProgress = false; } }