From f8d731a808e2ffdb77cf6525bac59bcda3045eef Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Wed, 26 May 2021 14:58:13 -0700 Subject: [PATCH] Cleanup state properly when interacting during gesture nav transition When the transition is canceled (e.g. when touching the nav bar during the transition), do the following: - Abort the RecentsView scroll including the edge effects to ensure we get onSettledOnEndTarget() immediately. - Jump to the current gesture end target state instead of the default rest state. Test: Swipe up and to the left and hold to go to overview from an app, then swipe up to home during the transition; ensure that the touch down goes to overview rather than home, and subsequently that the swipe is respected and goes to home Fixes: 189142339 Change-Id: Ie1d7dd05f45ab48968df7fdfd69fa1e1dda36d06 --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 6 +++++- .../com/android/quickstep/BaseActivityInterface.java | 12 +++++++++++- src/com/android/launcher3/PagedView.java | 9 +++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 005e9b5a7d..a78a8c32c5 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1392,6 +1392,10 @@ public abstract class AbsSwipeUpHandler, mLauncherTransitionController.getNormalController().getAnimationPlayer().end(); mLauncherTransitionController = null; } + + if (mRecentsView != null) { + mRecentsView.abortScrollerAnimation(); + } } /** @@ -1410,7 +1414,7 @@ public abstract class AbsSwipeUpHandler, private void resetStateForAnimationCancel() { boolean wasVisible = mWasLauncherAlreadyVisible || mGestureStarted; - mActivityInterface.onTransitionCancelled(wasVisible); + mActivityInterface.onTransitionCancelled(wasVisible, mGestureState.getEndTarget()); // Leave the pending invisible flag, as it may be used by wallpaper open animation. if (mActivity != null) { diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 2696cbeb79..4ae6fa8541 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -86,12 +86,22 @@ public abstract class BaseActivityInterface extends ViewGrou forceFinishScroller(true); } + /** + * Immediately finishes any overscroll effect and jumps to the end of the scroller animation. + */ + public void abortScrollerAnimation() { + mEdgeGlowLeft.finish(); + mEdgeGlowRight.finish(); + abortScrollerAnimation(true); + } + private void abortScrollerAnimation(boolean resetNextPage) { mScroller.abortAnimation(); // We need to clean up the next page here to avoid computeScrollHelper from