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

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

Merge "Cleaning up enable_recents_bookend_transition flag" into main

parents eb5bff8b 670a858c
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -117,16 +117,6 @@ flag {
    }
}

flag {
    name: "enable_recents_bookend_transition"
    namespace: "multitasking"
    description: "Use a finish-transition to clean up recents instead of the finish-WCT"
    bug: "346588978"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
   name: "enable_bubble_to_fullscreen"
   namespace: "multitasking"
+46 −77
Original line number Diff line number Diff line
@@ -284,10 +284,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                break;
            }
        }
        final int transitionType = Flags.enableRecentsBookendTransition()
                ? TRANSIT_START_RECENTS_TRANSITION
                : TRANSIT_TO_FRONT;
        final IBinder transition = mTransitions.startTransition(transitionType,
        final IBinder transition = mTransitions.startTransition(TRANSIT_START_RECENTS_TRANSITION,
                wct, mixer == null ? this : mixer);
        if (mixer != null) {
            setTransitionForMixer.accept(transition);
@@ -474,8 +471,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
        // next called.
        private Pair<int[], TaskSnapshot[]> mPendingPauseSnapshotsForCancel;

        // Used to track a pending finish transition, this is only non-null if
        // enableRecentsBookendTransition() is enabled
        // Used to track a pending finish transition
        private IBinder mPendingFinishTransition;
        private IResultReceiver mPendingRunnerFinishCb;
        // This stores the pending finish transaction to merge with the actual finish transaction
@@ -1067,7 +1063,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                return;
            }

            if (Flags.enableRecentsBookendTransition()) {
            if (info.getType() == TRANSIT_END_RECENTS_TRANSITION) {
                // This is a pending finish, so merge the end transition to trigger completing
                // the cleanup of the recents transition
@@ -1086,7 +1081,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                onFinishInner(null /* wct */);
                return;
            }
            }

            if (info.getType() == TRANSIT_SLEEP) {
                ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
@@ -1557,8 +1551,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                return;
            }

            if (mFinishCB == null || (Flags.enableRecentsBookendTransition()
                    && mPendingFinishTransition != null)) {
            if (mFinishCB == null || mPendingFinishTransition != null) {
                Slog.e(TAG, "Duplicate call to finish");
                if (runnerFinishCb != null) {
                    try {
@@ -1579,21 +1572,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                    && !mWillFinishToHome
                    && mPausingTasks != null
                    && mState == STATE_NORMAL;
            if (!Flags.enableRecentsBookendTransition()) {
                // This is only necessary when the recents transition is finished using a finishWCT,
                // otherwise a new transition will notify the relevant observers
                if (returningToApp && allAppsAreTranslucent(mPausingTasks)) {
                    mHomeTransitionObserver.notifyHomeVisibilityChanged(true);
                } else if (!toHome && mState == STATE_NEW_TASK
                        && allAppsAreTranslucent(mOpeningTasks)) {
                    // We are opening a translucent app. Launcher is still visible so we do nothing.
                } else if (!toHome) {
                    // For some transitions, we may have notified home activity that it became
                    // visible. We need to notify the observer that we are no longer going home.
                    mHomeTransitionObserver.notifyHomeVisibilityChanged(false);
                }
            }

            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
                    "[%d] RecentsController.finishInner: toHome=%b userLeave=%b "
                            + "willFinishToHome=%b state=%d hasPausingTasks=%b reason=%s",
@@ -1747,7 +1725,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                            // We need to clear the WCT to send finishWCT=null for Recents.
                            wct.clear();

                            if (Flags.enableRecentsBookendTransition()) {
                            // Notify the mixers of the pending finish
                            for (int i = 0; i < mMixers.size(); ++i) {
                                mMixers.get(i).handleFinishRecents(returningToApp, wct, t);
@@ -1763,14 +1740,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                    }
                }
            }
            }

            // Notify the mixers of the pending finish
            for (int i = 0; i < mMixers.size(); ++i) {
                mMixers.get(i).handleFinishRecents(returningToApp, wct, t);
            }

            if (Flags.enableRecentsBookendTransition()) {
            if (!wct.isEmpty()) {
                if (requiresBookendTransition) {
                    ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION,
@@ -1795,11 +1770,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
                mPendingFinishTransaction = t;
                onFinishInner(null /* wct */);
            }
            } else {
                mPendingRunnerFinishCb = runnerFinishCb;
                mPendingFinishTransaction = t;
                onFinishInner(wct);
            }
        }

        /**
@@ -1931,7 +1901,6 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler,
        /**
         * A temporary transition handler used with the pending finish transition, which runs the
         * cleanup/finish logic once the pending transition is merged/handled.
         * This is only initialized if Flags.enableRecentsBookendTransition() is enabled.
         */
        private class PendingFinishTransitionHandler implements Transitions.TransitionHandler {
            @Override
+1 −5
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_RECENTS_TRANSIT
import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_SPLITSCREEN_TRANSITION_BUGFIX;
import static com.android.window.flags.Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND;
import static com.android.wm.shell.Flags.FLAG_ENABLE_PIP2;
import static com.android.wm.shell.Flags.FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION;
import static com.android.wm.shell.Flags.FLAG_FIX_BUBBLES_TO_RECENTS;
import static com.android.wm.shell.recents.RecentsTransitionStateListener.TRANSITION_STATE_ANIMATING;
import static com.android.wm.shell.recents.RecentsTransitionStateListener.TRANSITION_STATE_NOT_RUNNING;
@@ -396,7 +395,6 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
    }

    @Test
    @EnableFlags(FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION)
    public void testMerge_consumeBookendTransition() throws Exception {
        // Start and finish the transition
        final IRecentsAnimationRunner animationRunner = mock(IRecentsAnimationRunner.class);
@@ -428,7 +426,6 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
    }

    @Test
    @EnableFlags(FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION)
    public void testMerge_pendingBookendTransition_mergesTransition() throws Exception {
        // Start and finish the transition
        final IRecentsAnimationRunner animationRunner = mock(IRecentsAnimationRunner.class);
@@ -575,7 +572,6 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
    }

    @Test
    @EnableFlags(FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION)
    public void testMerge_cancelToHome_onTransitSleep() throws Exception {
        TransitionInfo mergeTransitionInfo = new TransitionInfoBuilder(TRANSIT_SLEEP)
                .build();
@@ -583,7 +579,7 @@ public class RecentsTransitionHandlerTest extends ShellTestCase {
    }

    @Test
    @EnableFlags({FLAG_ENABLE_RECENTS_BOOKEND_TRANSITION, FLAG_ENABLE_PIP2})
    @EnableFlags(FLAG_ENABLE_PIP2)
    public void testMerge_cancelToHome_onTransitRemovePip() throws Exception {
        TransitionInfo mergeTransitionInfo = new TransitionInfoBuilder(TRANSIT_REMOVE_PIP)
                .build();
+4 −16
Original line number Diff line number Diff line
@@ -386,14 +386,8 @@ public class SplitTransitionTests extends ShellTestCase {

        // Make sure it cleans-up if recents doesn't restore
        WindowContainerTransaction commitWCT = new WindowContainerTransaction();
        if (Flags.enableRecentsBookendTransition()) {
        mStageCoordinator.onRecentsInSplitAnimationFinishing(false /* returnToApp */, commitWCT,
                mock(SurfaceControl.Transaction.class));
        } else {
            mStageCoordinator.onRecentsInSplitAnimationFinishing(
                    mStageCoordinator.wctIsReorderingSplitToTop(commitWCT), commitWCT,
                    mock(SurfaceControl.Transaction.class));
        }
        assertFalse(mStageCoordinator.isSplitScreenVisible());
    }

@@ -457,14 +451,8 @@ public class SplitTransitionTests extends ShellTestCase {
        // simulate the restoreWCT being applied:
        mMainStage.onTaskAppeared(mMainChild, mock(SurfaceControl.class));
        mSideStage.onTaskAppeared(mSideChild, mock(SurfaceControl.class));
        if (Flags.enableRecentsBookendTransition()) {
        mStageCoordinator.onRecentsInSplitAnimationFinishing(true /* returnToApp */, restoreWCT,
                mock(SurfaceControl.Transaction.class));
        } else {
            mStageCoordinator.onRecentsInSplitAnimationFinishing(
                    mStageCoordinator.wctIsReorderingSplitToTop(restoreWCT), restoreWCT,
                    mock(SurfaceControl.Transaction.class));
        }
        assertTrue(mStageCoordinator.isSplitScreenVisible());
    }

+17 −30
Original line number Diff line number Diff line
@@ -706,7 +706,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub

                if ((entry.getValue().getChangeMask()
                        & WindowContainerTransaction.Change.CHANGE_FORCE_NO_PIP) != 0) {
                    if (com.android.wm.shell.Flags.enableRecentsBookendTransition()) {
                    // If we are using a bookend transition, then the transition that we need
                    // to disable pip on finish is the original transient transition, not the
                    // bookend transition
@@ -718,12 +717,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                        ProtoLog.v(WmProtoLogGroups.WM_DEBUG_WINDOW_TRANSITIONS,
                                "Set do-not-pip: no task");
                    }
                    } else {
                        // Disable entering pip (eg. when recents pretends to finish itself)
                        if (transition != null) {
                            transition.setCanPipOnFinish(false /* canPipOnFinish */);
                        }
                    }
                }
                // A bit hacky, but we need to detect "remove PiP" so that we can "wrap" the
                // setWindowingMode call in force-hidden.
@@ -1505,10 +1498,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                break;
            }
            case HIERARCHY_OP_TYPE_RESTORE_TRANSIENT_ORDER: {
                if (!com.android.wm.shell.Flags.enableRecentsBookendTransition()) {
                    // Only allow restoring transient order when finishing a transition
                    if (!chain.isFinishing()) break;
                }
                // Validate the container
                final WindowContainer container = WindowContainer.fromBinder(hop.getContainer());
                if (container == null) {
@@ -1541,7 +1530,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                final TaskDisplayArea taskDisplayArea = thisTask.getTaskDisplayArea();
                taskDisplayArea.moveRootTaskBehindRootTask(thisTask.getRootTask(), restoreAt);

                if (com.android.wm.shell.Flags.enableRecentsBookendTransition()) {
                // Because we are in a transient launch transition, the requested visibility of
                // tasks does not actually change for the transient-hide tasks, but we do want
                // the restoration of these transient-hide tasks to top to be a part of this
@@ -1551,7 +1539,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    collectingTransition.updateChangesForRestoreTransientHideTasks(
                            transientLaunchTransition);
                }
                }

                effects |= TRANSACT_EFFECTS_LIFECYCLE;
                break;