Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +6 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,12 @@ class DesktopTasksController( transitions.dispatchRequest(SYNTHETIC_TRANSITION, requestInfo, /* skip= */ null) wct.merge(requestRes.second, true) // In multi-activity case, we explicitly reorder the parent task to the back so that it // is not brought to the front and shown when the child task breaks off into PiP. if (taskInfo.numActivities > 1) { wct.reorder(taskInfo.token, /* onTop= */ false) } // If the task minimizing to PiP is the last task, modify wct to perform Desktop cleanup var desktopExitRunnable: RunOnTransitStart? = null if (isLastTask) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +8 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,14 @@ public class PipTransition extends PipTransitionController implements if (pipActivityChange == null) { return false; } // In multi-activity case, set the parent's leash to invisible while we're animating to PiP TransitionInfo.Change parentBeforePip = pipActivityChange.getLastParent() != null ? getChangeByToken(info, pipActivityChange.getLastParent()) : null; if (parentBeforePip != null && TransitionUtil.isClosingMode(parentBeforePip.getMode())) { startTransaction.setAlpha(parentBeforePip.getLeash(), 0); } mFinishCallback = finishCallback; final SurfaceControl pipLeash = getLeash(pipChange); Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +15 −0 Original line number Diff line number Diff line Loading @@ -4020,6 +4020,21 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() arg.lastValue.assertPendingIntent(launchHomeIntent(DEFAULT_DISPLAY)) } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_PIP) fun onPipTaskMinimize_multiActivity_reordersParentToBack() { val task = setUpPipTask(autoEnterEnabled = true).apply { numActivities = 2 } // Add a second task so that entering PiP does not trigger Desktop cleanup setUpFreeformTask(deskId = DEFAULT_DISPLAY) minimizePipTask(task) val arg = argumentCaptor<WindowContainerTransaction>() verify(freeformTaskTransitionStarter).startPipTransition(arg.capture()) assertThat(arg.lastValue.hierarchyOps.size).isEqualTo(1) arg.lastValue.assertReorderAt(index = 0, task, toTop = false) } @Test fun onDesktopWindowMinimize_singleActiveTask_noWallpaperActivityToken_doesntRemoveWallpaper() { val task = setUpFreeformTask(active = true) Loading services/core/java/com/android/server/wm/Task.java +6 −0 Original line number Diff line number Diff line Loading @@ -4772,6 +4772,12 @@ class Task extends TaskFragment { mTransitionController.collect(topActivity); final Task lastParentBeforePip = topActivity.getLastParentBeforePip(); // Collect the last parent before moving it to front to make sure we have the // latest view hierarchy information if (isPip2ExperimentEnabled) { mTransitionController.collect(lastParentBeforePip); } // Reset the activity windowing mode to match the parent. topActivity.getRequestedOverrideConfiguration() .windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +6 −0 Original line number Diff line number Diff line Loading @@ -1072,6 +1072,12 @@ class DesktopTasksController( transitions.dispatchRequest(SYNTHETIC_TRANSITION, requestInfo, /* skip= */ null) wct.merge(requestRes.second, true) // In multi-activity case, we explicitly reorder the parent task to the back so that it // is not brought to the front and shown when the child task breaks off into PiP. if (taskInfo.numActivities > 1) { wct.reorder(taskInfo.token, /* onTop= */ false) } // If the task minimizing to PiP is the last task, modify wct to perform Desktop cleanup var desktopExitRunnable: RunOnTransitStart? = null if (isLastTask) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +8 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,14 @@ public class PipTransition extends PipTransitionController implements if (pipActivityChange == null) { return false; } // In multi-activity case, set the parent's leash to invisible while we're animating to PiP TransitionInfo.Change parentBeforePip = pipActivityChange.getLastParent() != null ? getChangeByToken(info, pipActivityChange.getLastParent()) : null; if (parentBeforePip != null && TransitionUtil.isClosingMode(parentBeforePip.getMode())) { startTransaction.setAlpha(parentBeforePip.getLeash(), 0); } mFinishCallback = finishCallback; final SurfaceControl pipLeash = getLeash(pipChange); Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +15 −0 Original line number Diff line number Diff line Loading @@ -4020,6 +4020,21 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() arg.lastValue.assertPendingIntent(launchHomeIntent(DEFAULT_DISPLAY)) } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_PIP) fun onPipTaskMinimize_multiActivity_reordersParentToBack() { val task = setUpPipTask(autoEnterEnabled = true).apply { numActivities = 2 } // Add a second task so that entering PiP does not trigger Desktop cleanup setUpFreeformTask(deskId = DEFAULT_DISPLAY) minimizePipTask(task) val arg = argumentCaptor<WindowContainerTransaction>() verify(freeformTaskTransitionStarter).startPipTransition(arg.capture()) assertThat(arg.lastValue.hierarchyOps.size).isEqualTo(1) arg.lastValue.assertReorderAt(index = 0, task, toTop = false) } @Test fun onDesktopWindowMinimize_singleActiveTask_noWallpaperActivityToken_doesntRemoveWallpaper() { val task = setUpFreeformTask(active = true) Loading
services/core/java/com/android/server/wm/Task.java +6 −0 Original line number Diff line number Diff line Loading @@ -4772,6 +4772,12 @@ class Task extends TaskFragment { mTransitionController.collect(topActivity); final Task lastParentBeforePip = topActivity.getLastParentBeforePip(); // Collect the last parent before moving it to front to make sure we have the // latest view hierarchy information if (isPip2ExperimentEnabled) { mTransitionController.collect(lastParentBeforePip); } // Reset the activity windowing mode to match the parent. topActivity.getRequestedOverrideConfiguration() .windowConfiguration.setWindowingMode(WINDOWING_MODE_UNDEFINED); Loading