From dfd8b5e07d05f394f4ba74e69864e2817de342cd Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 17 Oct 2019 16:20:15 -0700 Subject: [PATCH] Fix regression from ag/9518396 - Previously, we would only cancel the current animation if sharedState.canBeContinued which was only set when mGestureEndTarget was set, which is only calculated when the swipe gesture ends, and is only true if the end target is not Launcher. In ag//9518396 the check for the null end target was moved into isRunningAnimationToLauncher(), but that call actually bakes in two checks together, which means that even when tapping the home button (where there is no gesture and no end target), it would return false. Instead, we should ensure that the gesture target is set before trying to cancel the animation. - Also fix an existing issue where if the consumer is cleaned up after the start callback is registered, but not before the callback has returned, that we may incorrectly set the wrong launcher state since the callback is made to the old gesture handler which tries to prepare the recents UI (this manifests as a blank launcher screen). Bug: 141886704 Change-Id: I642f20d631924730e98d10bb2123bd9448793fc6 --- .../com/android/quickstep/WindowTransformSwipeHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index 22ad1806b5..f1b359808d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1009,7 +1009,10 @@ public class WindowTransformSwipeHandler @Override public void onConsumerAboutToBeSwitched() { - if (!mGestureState.isRunningAnimationToLauncher()) { + if (mActivity != null) { + mActivity.setOnStartCallback(null); + } + if (mGestureState.getEndTarget() != null && !mGestureState.isRunningAnimationToLauncher()) { cancelCurrentAnimation(); } else { reset();