From bd535c46d758b502f68329e4664045d653bfe9b4 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 19 Dec 2022 17:14:18 +0000 Subject: [PATCH] Only skip stash animation when going to/from Launcher - Added a cehck on chagnedFlags before skipping stash animation, in additional to !isHotseatIconOnTopWhenAligned check Fix: 262835548 Test: manual Change-Id: I5a90213bc0b3f34609a074ba887adbf113e04120 --- .../taskbar/TaskbarStashController.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 95337ce77d..29b8ee3b5d 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -492,7 +492,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba /* isStashed= */ false, placeholderDuration, /* startDelay= */ 0, - /* animateBg= */ false); + /* animateBg= */ false, + /* changedFlags=*/ 0); animation.play(mAnimator); } @@ -503,8 +504,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * @param startDelay how many milliseconds to delay the animation after starting it. * @param animateBg whether the taskbar's background should be animated */ - private void createAnimToIsStashed( - boolean isStashed, long duration, long startDelay, boolean animateBg) { + private void createAnimToIsStashed(boolean isStashed, long duration, long startDelay, + boolean animateBg, int changedFlags) { if (mAnimator != null) { mAnimator.cancel(); } @@ -542,8 +543,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba final float firstHalfDurationScale; final float secondHalfDurationScale; - boolean isHotseatIconOnTopWhenAligned = - mControllers.uiController.isHotseatIconOnTopWhenAligned(); + // If Hotseat is not the top element during animation to/from Launcher, fade in/out a + // already stashed Taskbar. + boolean skipStashAnimation = !mControllers.uiController.isHotseatIconOnTopWhenAligned() + && hasAnyFlag(changedFlags, FLAG_IN_APP); if (isStashed) { firstHalfDurationScale = 0.75f; secondHalfDurationScale = 0.5f; @@ -565,8 +568,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mTaskbarStashedHandleAlpha.animateToValue(1) ); - // If Hotseat is not the top element, an already stashed Taskbar should fade in. - if (!isHotseatIconOnTopWhenAligned) { + if (skipStashAnimation) { fullLengthAnimatorSet.setInterpolator(INSTANT); firstHalfAnimatorSet.setInterpolator(INSTANT); } @@ -591,9 +593,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mIconAlphaForStash.animateToValue(1) ); - // If Hotseat is not the top element, the stashed Taskbar should fade out without - // unstashing. - if (!isHotseatIconOnTopWhenAligned) { + if (skipStashAnimation) { fullLengthAnimatorSet.setInterpolator(FINAL_FRAME); secondHalfAnimatorSet.setInterpolator(FINAL_FRAME); } @@ -986,7 +986,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba mIsHotseatIconOnTopWhenAligned = isHotseatIconOnTopWhenAligned; // This sets mAnimator. - createAnimToIsStashed(mIsStashed, duration, startDelay, /* animateBg= */ true); + createAnimToIsStashed( + mIsStashed, duration, startDelay, /* animateBg= */ true, changedFlags); if (start) { mAnimator.start(); }