Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0b2a9ac authored by Tracy Zhou's avatar Tracy Zhou
Browse files

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
parent e3ae7e3a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1334,7 +1334,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
    }

    private void invalidateHandler() {
        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<T extends StatefulActivity<S>,
                        apps[apps.length - 1] = appearedTaskTarget;
                        launchOtherTaskInLiveTileMode(appearedTaskTarget.taskId, apps);
                    });
            mTaskAnimationManager.setLiveTileCleanUpHandler(mInputConsumerProxy::destroy);
            ActivityManagerWrapper.getInstance().registerTaskStackListener(
                    mLiveTileRestartListener);
        }
+10 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
    private GestureState mLastGestureState;
    private RemoteAnimationTargetCompat mLastAppearedTaskTarget;
    private Consumer<RemoteAnimationTargetCompat> 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();