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

Commit ce3ca40b authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Continue pausing after entering pip2

Make sure we schedulePauseActivity after
moving the pip activity to a pinned root task.

Recall that moveActivityToPinnedRootTask is getting
called after PipTransition#handleRequest() in PiP2
since the entry bounds are needed in startWct.

Bug: 315532935
Test: atest CtsWindowManagerDeviceActivity:PinnedStackTests\
        #testAutoEnterPipIsInPictureInPictureModeInOnPause
Test: manually auto-enter PiP in 3-btn-nav
Change-Id: I8d754403f895582dacb41e43846c51b273a6f032
parent 04afd06a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP
import static android.window.WindowContainerTransaction.HierarchyOp.HIERARCHY_OP_TYPE_START_SHORTCUT;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_WINDOW_ORGANIZER;
import static com.android.server.wm.ActivityRecord.State.PAUSING;
import static com.android.server.wm.ActivityTaskManagerService.enforceTaskPermission;
import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS;
@@ -1178,6 +1179,14 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                mService.mRootWindowContainer.moveActivityToPinnedRootTask(
                        pipActivity, null /* launchIntoPipHostActivity */,
                        "moveActivityToPinnedRootTask", null /* transition */, entryBounds);

                // Continue the pausing process after potential task reparenting.
                if (pipActivity.isState(PAUSING) && pipActivity.mPauseSchedulePendingForPip) {
                    pipActivity.getTask().schedulePauseActivity(
                            pipActivity, false /* userLeaving */,
                            false /* pauseImmediately */, true /* autoEnteringPip */, "auto-pip");
                }

                effects |= TRANSACT_EFFECTS_LIFECYCLE;
                break;
            }