From b0b2a9acd0db64d6af130db6e6d41cd74c871985 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Wed, 24 Feb 2021 13:58:35 -0800 Subject: [PATCH] Continue receiving key events from input consumer after settling into Overview This builds on ag/13732971. In live tile mode after settling into overview, recents_animation_input_consumer should have the focus, and thus we will need to extend the lifecycle of input consumers so that key events can be routed to launcher Overall, since live tile extends the lifecycle of certain private variables of AbsSwipeHandler, I am thinking of doing a refactor by putting those things into a separate class, but it might be too big for this change. TODO: I've verified that this change works while if we don't process motion events, it would cause b/182932863. Will investigate on that. Fixes: 181404912 Test: Cherry pick ag/13732971; Go to overview; Swipe back; Observe the animation to go back to app Change-Id: I5afd397be387b75f373442781dd1d00560dca99e --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 7 ++++++- .../com/android/quickstep/TaskAnimationManager.java | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 6da2201dc9..30945007a9 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1334,7 +1334,11 @@ public abstract class AbsSwipeUpHandler, } private void invalidateHandler() { - mInputConsumerProxy.destroy(); + if (!LIVE_TILE.get() || !mActivityInterface.isInLiveTileMode() + || mGestureState.getEndTarget() != RECENTS) { + mInputConsumerProxy.destroy(); + mTaskAnimationManager.setLiveTileCleanUpHandler(null); + } endRunningWindowAnim(false /* cancel */); if (mGestureEndCallback != null) { @@ -1526,6 +1530,7 @@ public abstract class AbsSwipeUpHandler, apps[apps.length - 1] = appearedTaskTarget; launchOtherTaskInLiveTileMode(appearedTaskTarget.taskId, apps); }); + mTaskAnimationManager.setLiveTileCleanUpHandler(mInputConsumerProxy::destroy); ActivityManagerWrapper.getInstance().registerTaskStackListener( mLiveTileRestartListener); } diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index 02c27636fc..9a454f2bd7 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -50,6 +50,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn private GestureState mLastGestureState; private RemoteAnimationTargetCompat mLastAppearedTaskTarget; private Consumer mLaunchOtherTaskHandler; + private Runnable mLiveTileCleanUpHandler; private Context mCtx; TaskAnimationManager(Context ctx) { @@ -169,6 +170,10 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn mLaunchOtherTaskHandler = handler; } + public void setLiveTileCleanUpHandler(Runnable runnable) { + mLiveTileCleanUpHandler = runnable; + } + /** * Finishes the running recents animation. */ @@ -206,6 +211,11 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn * Cleans up the recents animation entirely. */ private void cleanUpRecentsAnimation() { + if (mLiveTileCleanUpHandler != null) { + mLiveTileCleanUpHandler.run(); + mLiveTileCleanUpHandler = null; + } + // Release all the target leashes if (mTargets != null) { mTargets.release();