From ba7dba3983b95bc4dfe33fd4a6362cd11a31abd4 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 15 Oct 2018 15:28:03 -0700 Subject: [PATCH] Fixing state not set properly when configuration changes and remote animation callback comes after threshold is crossed The transition length is updated when removeAnimations is received. If the gesture delta is crossed before that, we were ending up in long-swipe mode as due to an incomplete check. Bug: 117549010 Change-Id: If5471c538ac51b84f176a1fad42112e84046da63 --- .../android/quickstep/WindowTransformSwipeHandler.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java index 9991552987..dab5ddcf25 100644 --- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -538,7 +538,7 @@ public class WindowTransformSwipeHandler { public void updateDisplacement(float displacement) { // We are moving in the negative x/y direction displacement = -displacement; - if (displacement > mTransitionDragLength) { + if (displacement > mTransitionDragLength && mTransitionDragLength > 0) { mCurrentShift.updateValue(1); if (!mBgLongSwipeMode) { @@ -813,8 +813,12 @@ public class WindowTransformSwipeHandler { long startMillis = SystemClock.uptimeMillis(); executeOnUiThread(() -> { // Animate the launcher components at the same time as the window, always on UI thread. - if (mLauncherTransitionController != null && !mWasLauncherAlreadyVisible - && start != end && duration > 0) { + if (mLauncherTransitionController == null) { + return; + } + if (start == end || duration <= 0) { + mLauncherTransitionController.getAnimationPlayer().end(); + } else { // Adjust start progress and duration in case we are on a different thread. long elapsedMillis = SystemClock.uptimeMillis() - startMillis; elapsedMillis = Utilities.boundToRange(elapsedMillis, 0, duration);