Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −4 Original line number Diff line number Diff line Loading @@ -3018,12 +3018,15 @@ class DesktopTasksController( val displayId = task.displayId val inDesktop = isAnyDeskActive(displayId) val isTransparentTask = desktopModeCompatPolicy.isTransparentTask(task) val isFreeform = task.isFreeform logV( "handleIncompatibleTaskLaunch taskId=%d displayId=%d isTransparent=%b inDesktop=%b", "handleIncompatibleTaskLaunch taskId=%d displayId=%d isTransparent=%b inDesktop=%b" + " isFreeform=%b", taskId, displayId, isTransparentTask, inDesktop, isFreeform, ) if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) { if (!inDesktop && !forceEnterDesktop(displayId)) return null Loading Loading @@ -3051,14 +3054,14 @@ class DesktopTasksController( runOnTransitStart?.invoke(transition) return wct } if (!inDesktop) { logD("handleIncompatibleTaskLaunch not in desktop, nothing to do") if (!inDesktop && !isFreeform) { logD("handleIncompatibleTaskLaunch not in desktop, not a freeform task, nothing to do") return null } // Both opaque and transparent incompatible tasks need to be forced to fullscreen, but // opaque ones force-exit the desktop while transparent ones are just shown on top of the // desktop while keeping it active. val willExitDesktop = !isTransparentTask val willExitDesktop = inDesktop && !isTransparentTask if (willExitDesktop) { logD("handleIncompatibleTaskLaunch forcing task to fullscreen and exiting desktop") } else { Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -5226,6 +5226,38 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).moveTaskToDesk(wct, deskId, task) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODALS_POLICY, Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND, ) fun handleRequest_exemptFromDesktopFreeformTask_notInDesktop_returnSwitchToFullscreenWCT() { taskRepository.setDeskInactive(deskId = 0) val tda = DisplayAreaInfo(MockToken().token(), DEFAULT_DISPLAY, /* featureId= */ 0).apply { configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FREEFORM } whenever(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)).thenReturn(tda) val freeformExemptTask = createFreeformTask(displayId = DEFAULT_DISPLAY).apply { baseActivity = ComponentName( context.resources.getString(com.android.internal.R.string.config_systemUi), /* cls= */ "", ) } val wct = controller.handleRequest(Binder(), createTransition(freeformExemptTask)) assertNotNull(wct, "Should handle request") val mode = assertNotNull( wct.changes[freeformExemptTask.token.asBinder()]?.windowingMode, "Should have change for freeform task", ) assertThat(mode).isEqualTo(WINDOWING_MODE_FULLSCREEN) } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODALS_POLICY) @DisableFlags( Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −4 Original line number Diff line number Diff line Loading @@ -3018,12 +3018,15 @@ class DesktopTasksController( val displayId = task.displayId val inDesktop = isAnyDeskActive(displayId) val isTransparentTask = desktopModeCompatPolicy.isTransparentTask(task) val isFreeform = task.isFreeform logV( "handleIncompatibleTaskLaunch taskId=%d displayId=%d isTransparent=%b inDesktop=%b", "handleIncompatibleTaskLaunch taskId=%d displayId=%d isTransparent=%b inDesktop=%b" + " isFreeform=%b", taskId, displayId, isTransparentTask, inDesktop, isFreeform, ) if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) { if (!inDesktop && !forceEnterDesktop(displayId)) return null Loading Loading @@ -3051,14 +3054,14 @@ class DesktopTasksController( runOnTransitStart?.invoke(transition) return wct } if (!inDesktop) { logD("handleIncompatibleTaskLaunch not in desktop, nothing to do") if (!inDesktop && !isFreeform) { logD("handleIncompatibleTaskLaunch not in desktop, not a freeform task, nothing to do") return null } // Both opaque and transparent incompatible tasks need to be forced to fullscreen, but // opaque ones force-exit the desktop while transparent ones are just shown on top of the // desktop while keeping it active. val willExitDesktop = !isTransparentTask val willExitDesktop = inDesktop && !isTransparentTask if (willExitDesktop) { logD("handleIncompatibleTaskLaunch forcing task to fullscreen and exiting desktop") } else { Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +32 −0 Original line number Diff line number Diff line Loading @@ -5226,6 +5226,38 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).moveTaskToDesk(wct, deskId, task) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODALS_POLICY, Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND, ) fun handleRequest_exemptFromDesktopFreeformTask_notInDesktop_returnSwitchToFullscreenWCT() { taskRepository.setDeskInactive(deskId = 0) val tda = DisplayAreaInfo(MockToken().token(), DEFAULT_DISPLAY, /* featureId= */ 0).apply { configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FREEFORM } whenever(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)).thenReturn(tda) val freeformExemptTask = createFreeformTask(displayId = DEFAULT_DISPLAY).apply { baseActivity = ComponentName( context.resources.getString(com.android.internal.R.string.config_systemUi), /* cls= */ "", ) } val wct = controller.handleRequest(Binder(), createTransition(freeformExemptTask)) assertNotNull(wct, "Should handle request") val mode = assertNotNull( wct.changes[freeformExemptTask.token.asBinder()]?.windowingMode, "Should have change for freeform task", ) assertThat(mode).isEqualTo(WINDOWING_MODE_FULLSCREEN) } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODALS_POLICY) @DisableFlags( Loading