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

Commit bded2b5e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Revert "Bunlde ClientTransactionItems when enter/exit PiP"" into main

parents 0c665990 a5dca25e
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -2403,14 +2403,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            return false;
        }

        return resumeFocusedTasksTopActivitiesUnchecked(targetRootTask, target, targetOptions,
                deferPause);
    }

    @VisibleForTesting
    boolean resumeFocusedTasksTopActivitiesUnchecked(
            Task targetRootTask, ActivityRecord target, ActivityOptions targetOptions,
            boolean deferPause) {
        boolean result = false;
        if (targetRootTask != null && (targetRootTask.isTopRootTaskInDisplayArea()
                || getTopDisplayFocusedRootTask() == targetRootTask)) {
+2 −19
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_WINDOW_ORGANI
import static com.android.server.wm.ActivityRecord.State.PAUSING;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
import static com.android.server.wm.ActivityTaskManagerService.enforceTaskPermission;
import static com.android.server.wm.ActivityTaskManagerService.isPip2ExperimentEnabled;
import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_PINNED_TASK;
import static com.android.server.wm.Task.FLAG_FORCE_HIDDEN_FOR_TASK_ORG;
@@ -838,8 +837,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
    }

    private int applyTaskChanges(Task tr, WindowContainerTransaction.Change c) {
        final boolean wasPrevFocusableAndVisible = tr.isFocusableAndVisible();

        int effects = applyChanges(tr, c);
        final SurfaceControl.Transaction t = c.getBoundsChangeTransaction();

@@ -885,17 +882,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                boolean canEnterPip = activity.checkEnterPictureInPictureState(
                        "applyTaskChanges", true /* beforeStopping */);
                if (canEnterPip) {
                    mService.mTaskSupervisor.beginDeferResume();
                    try {
                    canEnterPip = mService.mActivityClientController
                            .requestPictureInPictureMode(activity);
                    } finally {
                        mService.mTaskSupervisor.endDeferResume();
                        if (canEnterPip && !isPip2ExperimentEnabled()) {
                            // Wait until the transaction is applied to only resume once.
                            effects |= TRANSACT_EFFECTS_LIFECYCLE;
                        }
                    }
                }
                if (!canEnterPip) {
                    // Restore the flag to its previous state when the activity cannot enter PIP.
@@ -904,11 +892,6 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            }
        }

        // Activity in this Task may resume/pause when enter/exit pip.
        if (wasPrevFocusableAndVisible != tr.isFocusableAndVisible()) {
            effects |= TRANSACT_EFFECTS_LIFECYCLE;
        }

        return effects;
    }

+2 −4
Original line number Diff line number Diff line
@@ -1681,8 +1681,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
        WindowContainerToken wct = rootTask.mRemoteToken.toWindowContainerToken();
        t.setWindowingMode(wct, WINDOWING_MODE_PINNED);
        mWm.mAtmService.mWindowOrganizerController.applyTransaction(t);
        verify(mWm.mAtmService.mRootWindowContainer).resumeFocusedTasksTopActivitiesUnchecked(any(),
                any(), any(), anyBoolean());
        verify(mWm.mAtmService.mRootWindowContainer).resumeFocusedTasksTopActivities();

        clearInvocations(mWm.mAtmService.mRootWindowContainer);
        // The token for the PIP root task may have changed when the task entered PIP mode, so do
@@ -1691,8 +1690,7 @@ public class WindowOrganizerTests extends WindowTestsBase {
                record.getRootTask().mRemoteToken.toWindowContainerToken();
        t.setWindowingMode(newToken, WINDOWING_MODE_FULLSCREEN);
        mWm.mAtmService.mWindowOrganizerController.applyTransaction(t);
        verify(mWm.mAtmService.mRootWindowContainer).resumeFocusedTasksTopActivitiesUnchecked(any(),
                any(), any(), anyBoolean());
        verify(mWm.mAtmService.mRootWindowContainer).resumeFocusedTasksTopActivities();
    }

    @Test