Cancel gestures on launcher destroy

A wide variety of gesture navigation bugs were caused if launcher happened to be recreated mid-gesture and we didn't handle it gracefully. Updated lifecycle callbacks to immediately cancel the ongoing gesture if launcher is destroyed.

Fixes: 244593270
Fixes: 257976590
Test: forcefully(programmatically) recreate on every other gesture nav handle touch down; check that following gestures are not broken and animations are not frozen
Change-Id: Ia8e936e26a42cfe26fc6bcd9eefb25d37bc08749
This commit is contained in:
Schneider Victor-tulias
2022-11-28 14:22:20 -08:00
parent 691c6e511f
commit 65dda6d03e
11 changed files with 243 additions and 118 deletions

View File

@@ -37,7 +37,7 @@ public class ActiveGestureErrorDetector {
ON_SETTLED_ON_END_TARGET, START_RECENTS_ANIMATION, FINISH_RECENTS_ANIMATION,
CANCEL_RECENTS_ANIMATION, SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION,
CLEANUP_SCREENSHOT, SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED,
FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER,
FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED,
/**
* These GestureEvents are specifically associated to state flags that get set in
@@ -162,6 +162,13 @@ public class ActiveGestureErrorDetector {
+ "before/without setting end target to new task",
writer);
break;
case LAUNCHER_DESTROYED:
errorDetected |= printErrorIfTrue(
true,
prefix,
/* errorMessage= */ "Launcher destroyed mid-gesture",
writer);
break;
case STATE_GESTURE_COMPLETED:
errorDetected |= printErrorIfTrue(
!encounteredEvents.contains(GestureEvent.MOTION_UP),