From 8239ed8733f42e2f8506a9294fe12a64dc1e1fdc Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 12 May 2021 16:36:31 -0700 Subject: [PATCH] Remove mOnRecentsScrollListener when continuing quick switch gesture Test: Quick switch from A to B, touch nav during the transition and continue quick switching to C; ensure running task doesn't jump to fullscreen randomly throughout the scroll Fixes: 186269584 Change-Id: Ibebad3d8c8e8f86c7f53a028c75bb5916369df7f --- quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index d04bfe95e2..79935d75cb 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1376,7 +1376,6 @@ public abstract class AbsSwipeUpHandler, private void invalidateHandlerWithLauncher() { endLauncherTransitionController(); - mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener); mRecentsView.onGestureAnimationEnd(); resetLauncherListeners(); } @@ -1391,12 +1390,18 @@ public abstract class AbsSwipeUpHandler, } } + /** + * Unlike invalidateHandlerWithLauncher, this is called even when switching consumers, e.g. on + * continued quick switch gesture, which cancels the previous handler but doesn't invalidate it. + */ private void resetLauncherListeners() { // Reset the callback for deferred activity launches if (!LIVE_TILE.get()) { mActivityInterface.setOnDeferredActivityLaunchCallback(null); } mActivity.getRootView().setOnApplyWindowInsetsListener(null); + + mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener); } private void resetStateForAnimationCancel() {