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

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

Merge "Defer surface layouts during recents animation setup/cleanup"

parents 6e348e24 1e6d4a9e
Loading
Loading
Loading
Loading
+80 −69
Original line number Diff line number Diff line
@@ -70,7 +70,8 @@ class RecentsAnimation implements RecentsAnimationCallbacks {

    void startRecentsActivity(Intent intent, IRecentsAnimationRunner recentsAnimationRunner,
            ComponentName recentsComponent, int recentsUid) {

        mWindowManager.deferSurfaceLayout();
        try {
            // Cancel the previous recents animation if necessary
            mWindowManager.cancelRecentsAnimation();

@@ -82,7 +83,8 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
                opts.setAvoidMoveToFront();
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_NO_ANIMATION);

            mActivityStartController.obtainStarter(intent, "startRecentsActivity_noHomeActivity")
                mActivityStartController
                        .obtainStarter(intent, "startRecentsActivity_noHomeActivity")
                        .setCallingUid(recentsUid)
                        .setCallingPackage(recentsComponent.getPackageName())
                        .setActivityOptions(SafeActivityOptions.fromBundle(opts.toBundle()))
@@ -111,14 +113,18 @@ class RecentsAnimation implements RecentsAnimationCallbacks {

            // Fetch all the surface controls and pass them to the client to get the animation
            // started
        mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this, display.mDisplayId);
            mWindowManager.initializeRecentsAnimation(recentsAnimationRunner, this,
                    display.mDisplayId);

        // If we updated the launch-behind state, update the visibility of the activities after we
        // fetch the visible tasks to be controlled by the animation
            // If we updated the launch-behind state, update the visibility of the activities after
            // we fetch the visible tasks to be controlled by the animation
            mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, PRESERVE_WINDOWS);

            // Post a timeout for the animation
            mHandler.postDelayed(mCancelAnimationRunnable, RECENTS_ANIMATION_TIMEOUT);
        } finally {
            mWindowManager.continueSurfaceLayout();
        }
    }

    @Override
@@ -128,6 +134,8 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
            if (mWindowManager.getRecentsAnimationController() == null) return;

            mWindowManager.inSurfaceTransaction(() -> {
                mWindowManager.deferSurfaceLayout();
                try {
                    mWindowManager.cleanupRecentsAnimation();

                    // Move the home stack to the front
@@ -157,6 +165,9 @@ class RecentsAnimation implements RecentsAnimationCallbacks {
                    // No reason to wait for the pausing activity in this case, as the hiding of
                    // surfaces needs to be done immediately.
                    mWindowManager.executeAppTransition();
                } finally {
                    mWindowManager.continueSurfaceLayout();
                }
            });
        }
    }