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

Commit bea6f32e authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Avoid additional focus change when entering PiP from fullscreen" into main

parents 13728691 9fb47fba
Loading
Loading
Loading
Loading
+8 −5
Original line number Original line Diff line number Diff line
@@ -2054,6 +2054,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        Transition.ReadyCondition pipChangesApplied = new Transition.ReadyCondition("movedToPip");
        Transition.ReadyCondition pipChangesApplied = new Transition.ReadyCondition("movedToPip");
        transitionController.waitFor(pipChangesApplied);
        transitionController.waitFor(pipChangesApplied);
        mService.deferWindowLayout();
        mService.deferWindowLayout();
        boolean localVisibilityDeferred = false;
        // If the caller is from WindowOrganizerController, it should be already deferred.
        if (!mTaskSupervisor.isRootVisibilityUpdateDeferred()) {
            mTaskSupervisor.setDeferRootVisibilityUpdate(true);
            localVisibilityDeferred = true;
        }
        try {
        try {
            // This will change the root pinned task's windowing mode to its original mode, ensuring
            // This will change the root pinned task's windowing mode to its original mode, ensuring
            // we only have one root task that is in pinned mode.
            // we only have one root task that is in pinned mode.
@@ -2225,14 +2231,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                mService.mTaskFragmentOrganizerController.dispatchPendingInfoChangedEvent(
                mService.mTaskFragmentOrganizerController.dispatchPendingInfoChangedEvent(
                        organizedTf);
                        organizedTf);
            }
            }

            if (taskDisplayArea.getFocusedRootTask() == rootTask) {
                taskDisplayArea.clearPreferredTopFocusableRootTask();
            }
        } finally {
        } finally {
            mService.continueWindowLayout();
            mService.continueWindowLayout();
            try {
            try {
                if (!isPip2ExperimentEnabled()) {
                if (localVisibilityDeferred) {
                    mTaskSupervisor.setDeferRootVisibilityUpdate(false);
                    ensureActivitiesVisible(null, 0, false /* preserveWindows */);
                    ensureActivitiesVisible(null, 0, false /* preserveWindows */);
                }
                }
            } finally {
            } finally {
+2 −1
Original line number Original line Diff line number Diff line
@@ -412,7 +412,8 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        // wasContained} restricts the preferred root task is set only when moving an existing
        // wasContained} restricts the preferred root task is set only when moving an existing
        // root task to top instead of adding a new root task that may be too early (e.g. in the
        // root task to top instead of adding a new root task that may be too early (e.g. in the
        // middle of launching or reparenting).
        // middle of launching or reparenting).
        final boolean isTopFocusableTask = moveToTop && child.isTopActivityFocusable();
        final boolean isTopFocusableTask = moveToTop && child != mRootPinnedTask
                && child.isTopActivityFocusable();
        if (isTopFocusableTask) {
        if (isTopFocusableTask) {
            mPreferredTopFocusableRootTask =
            mPreferredTopFocusableRootTask =
                    child.shouldBeVisible(null /* starting */) ? child : null;
                    child.shouldBeVisible(null /* starting */) ? child : null;