From 8d72018a872d403d4d0f0e16186f46ab49a9ebb5 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Mon, 18 Apr 2022 18:17:28 -0700 Subject: [PATCH] Don't allow swiping to HintState if we're already in HintState Context: there was a bug where you could get stuck in HintState if you did the following (timing is critical): 1. Short swipe from nav region towards HintState, but not far enough or fast enough to commit before letting go; this cancels the state animation, returning towards Normal (but, crucially, StateManager still has state set as Hint) 2. While previous animation is animating back to Normal, swipe up again, but this time faster/farther to actually reach Hint; this time, the animation does go towards Hint, but gets stuck there. The reason it gets stuck is because StateManager thinks we're already in Hint from step 1, so doesn't call onStateTransitionEnd(Hint) in step 2. Thus, we never get QuickstepLauncher#onStateSetEnd(Hint), which is what we rely on to return to Normal. The simple fix is to prevent the second swipe in the first place. Test: short swipe followed immediately by fast fling from nav region on home successfully stays in Normal state intead of getting stuck in HintState Test: NexusLauncherOutOfProcTests: com.google.android.apps.nexuslauncher.TaplTestsNexus Fixes: 228276181 Change-Id: I54c371c8518a9a220e75c98003331b552d8bf8af --- .../NoButtonNavbarToOverviewTouchController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index 4da1d41091..8faabc9561 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -86,7 +86,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch @Override protected boolean canInterceptTouch(MotionEvent ev) { mDidTouchStartInNavBar = (ev.getEdgeFlags() & EDGE_NAV_BAR) != 0; - return super.canInterceptTouch(ev); + return super.canInterceptTouch(ev) && !mLauncher.isInState(HINT_STATE); } @Override