Don't rely on intent to call back from activity tracker

- The intent is not updated in certain cases which means that the
  callback may not be made if Launcher gets recreated. Instead
  have the tracker manage the set of registered callbacks.
- This change allows AbsSwipeUpHandler to continue to receive
  onActivityInit calls even if Launcher restarts, and also to
  handle a case where restarting while waiting for a page-settling
  callback will continue to finish the gesture.

Bug: 183962705
Test: Force recreate at various points in the gesture

Change-Id: Ib5ead8c868e798e26e56776f57bd715c79d087cd
This commit is contained in:
Winson Chung
2021-06-08 11:50:13 -07:00
parent f2ec20325b
commit 1c2d522d1b
10 changed files with 62 additions and 60 deletions

View File

@@ -184,9 +184,7 @@ public class OverviewCommandHelper {
.newHandler(gestureState, cmd.createTime);
interactionHandler.setGestureEndCallback(
() -> onTransitionComplete(cmd, interactionHandler));
Intent intent = new Intent(interactionHandler.getLaunchIntent());
interactionHandler.initWhenReady(intent);
interactionHandler.initWhenReady();
RecentsAnimationListener recentAnimListener = new RecentsAnimationListener() {
@Override
@@ -212,6 +210,7 @@ public class OverviewCommandHelper {
cmd.mActiveCallbacks.addListener(recentAnimListener);
mTaskAnimationManager.notifyRecentsAnimationState(recentAnimListener);
} else {
Intent intent = new Intent(interactionHandler.getLaunchIntent());
intent.putExtra(INTENT_EXTRA_LOG_TRACE_ID, gestureState.getGestureId());
cmd.mActiveCallbacks = mTaskAnimationManager.startRecentsAnimation(
gestureState, intent, interactionHandler);