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

Commit e80963da authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Allow recents animation controller to control input consumer lifecycle"

parents 42bce334 db111ee2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -435,14 +435,14 @@ final class InputMonitor {
                final RecentsAnimationController recentsAnimationController =
                        mService.getRecentsAnimationController();
                if (recentsAnimationController != null
                        && recentsAnimationController.hasInputConsumerForApp(w.mAppToken)) {
                        && recentsAnimationController.shouldApplyInputConsumer(w.mAppToken)) {
                    if (recentsAnimationController.updateInputConsumerForApp(
                            recentsAnimationInputConsumer.mWindowHandle, hasFocus)) {
                        addInputWindowHandle(recentsAnimationInputConsumer.mWindowHandle);
                        mAddRecentsAnimationInputConsumerHandle = false;
                    }
                    // Skip adding the window below regardless of whether there is an input consumer
                    // to handle it
                    // If the target app window does not yet exist, then we don't add the input
                    // consumer window, but also don't add the app window below.
                    return;
                }
            }
+15 −4
Original line number Diff line number Diff line
@@ -458,10 +458,9 @@ public class RecentsAnimationController implements DeathRecipient {
        mRunner = null;
        mCanceled = true;

        // Clear associated input consumers
        // Update the input windows after the animation is complete
        final InputMonitor inputMonitor =
                mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor();
        inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
        inputMonitor.updateInputWindowsLw(true /*force*/);

        // We have deferred all notifications to the target app as a part of the recents animation,
@@ -494,6 +493,11 @@ public class RecentsAnimationController implements DeathRecipient {
    @Override
    public void binderDied() {
        cancelAnimation(REORDER_MOVE_TO_ORIGINAL_POSITION, "binderDied");

        // Clear associated input consumers on runner death
        final InputMonitor inputMonitor =
                mService.mRoot.getDisplayContent(mDisplayId).getInputMonitor();
        inputMonitor.destroyInputConsumer(INPUT_CONSUMER_RECENTS_ANIMATION);
    }

    void checkAnimationReady(WallpaperController wallpaperController) {
@@ -516,8 +520,14 @@ public class RecentsAnimationController implements DeathRecipient {
                && isTargetOverWallpaper();
    }

    boolean hasInputConsumerForApp(AppWindowToken appToken) {
        return mInputConsumerEnabled && isAnimatingApp(appToken);
    /**
     * @return Whether to use the input consumer to override app input to route home/recents.
     */
    boolean shouldApplyInputConsumer(AppWindowToken appToken) {
        // Only apply the input consumer if it is enabled, it is not the target (home/recents)
        // being revealed with the transition, and we are actively animating the app as a part of
        // the animation
        return mInputConsumerEnabled && mTargetAppToken != appToken && isAnimatingApp(appToken);
    }

    boolean updateInputConsumerForApp(InputWindowHandle inputWindowHandle,
@@ -675,6 +685,7 @@ public class RecentsAnimationController implements DeathRecipient {
        final String innerPrefix = prefix + "  ";
        pw.print(prefix); pw.println(RecentsAnimationController.class.getSimpleName() + ":");
        pw.print(innerPrefix); pw.println("mPendingStart=" + mPendingStart);
        pw.print(innerPrefix); pw.println("mPendingAnimations=" + mPendingAnimations.size());
        pw.print(innerPrefix); pw.println("mCanceled=" + mCanceled);
        pw.print(innerPrefix); pw.println("mInputConsumerEnabled=" + mInputConsumerEnabled);
        pw.print(innerPrefix); pw.println("mSplitScreenMinimized=" + mSplitScreenMinimized);
+2 −1
Original line number Diff line number Diff line
@@ -2675,8 +2675,9 @@ public class WindowManagerService extends IWindowManager.Stub
    public void cleanupRecentsAnimation(@RecentsAnimationController.ReorderMode int reorderMode) {
        synchronized (mWindowMap) {
            if (mRecentsAnimationController != null) {
                mRecentsAnimationController.cleanupAnimation(reorderMode);
                final RecentsAnimationController controller = mRecentsAnimationController;
                mRecentsAnimationController = null;
                controller.cleanupAnimation(reorderMode);
                mAppTransition.updateBooster();
            }
        }