Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +16 −1 Original line number Diff line number Diff line Loading @@ -1903,7 +1903,22 @@ class DesktopTasksController( /** Move task to the next display which can host desktop tasks. */ fun moveToNextDesktopDisplay(taskId: Int) = moveToNextDisplay(taskId) { displayId -> desktopState.isDesktopModeSupportedOnDisplay(displayId) if (!desktopState.isDesktopModeSupportedOnDisplay(displayId)) { logD( "moveToNextDesktopDisplay: Skip displayId=$displayId as desktop mode " + "is not supported." ) return@moveToNextDisplay false } if (!getFocusedNonDesktopTasks(displayId).isEmpty()) { logD( "moveToNextDesktopDisplay: Skip displayId=$displayId as the focused " + "task is not desktop task focused non desktop tasks." ) return@moveToNextDisplay false } logD("moveToNextDesktopDisplay: Choose displayId=$displayId for the next display.") return@moveToNextDisplay true } /** Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -4112,6 +4112,31 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() moveToNextDesktopDisplay_moveIifDesktopModeSupportedOnDestination(false) } @Test fun moveToNextDesktopDisplay_dontMoveIfDestinationFocusesFullscreenTask() { // Set up displays whenever(rootTaskDisplayAreaOrganizer.displayIds) .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY)) taskRepository.addDesk(displayId = SECOND_DISPLAY, deskId = 2) desktopState.overrideDesktopModeSupportPerDisplay[SECOND_DISPLAY] = true // Set up a focused fullscreen task on the secondary display val fullscreenTask = setUpFullscreenTask(displayId = SECOND_DISPLAY) fullscreenTask.isFocused = true // Set up a task on the default display val task = setUpFreeformTask(displayId = DEFAULT_DISPLAY) controller.moveToNextDesktopDisplay(task.taskId) verify(transitions, never()) .startTransition( eq(TRANSIT_CHANGE), any<WindowContainerTransaction>(), isA(DesktopModeMoveToDisplayTransitionHandler::class.java), ) } @Test fun getTaskWindowingMode() { val fullscreenTask = setUpFullscreenTask() Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +16 −1 Original line number Diff line number Diff line Loading @@ -1903,7 +1903,22 @@ class DesktopTasksController( /** Move task to the next display which can host desktop tasks. */ fun moveToNextDesktopDisplay(taskId: Int) = moveToNextDisplay(taskId) { displayId -> desktopState.isDesktopModeSupportedOnDisplay(displayId) if (!desktopState.isDesktopModeSupportedOnDisplay(displayId)) { logD( "moveToNextDesktopDisplay: Skip displayId=$displayId as desktop mode " + "is not supported." ) return@moveToNextDisplay false } if (!getFocusedNonDesktopTasks(displayId).isEmpty()) { logD( "moveToNextDesktopDisplay: Skip displayId=$displayId as the focused " + "task is not desktop task focused non desktop tasks." ) return@moveToNextDisplay false } logD("moveToNextDesktopDisplay: Choose displayId=$displayId for the next display.") return@moveToNextDisplay true } /** Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -4112,6 +4112,31 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() moveToNextDesktopDisplay_moveIifDesktopModeSupportedOnDestination(false) } @Test fun moveToNextDesktopDisplay_dontMoveIfDestinationFocusesFullscreenTask() { // Set up displays whenever(rootTaskDisplayAreaOrganizer.displayIds) .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY)) taskRepository.addDesk(displayId = SECOND_DISPLAY, deskId = 2) desktopState.overrideDesktopModeSupportPerDisplay[SECOND_DISPLAY] = true // Set up a focused fullscreen task on the secondary display val fullscreenTask = setUpFullscreenTask(displayId = SECOND_DISPLAY) fullscreenTask.isFocused = true // Set up a task on the default display val task = setUpFreeformTask(displayId = DEFAULT_DISPLAY) controller.moveToNextDesktopDisplay(task.taskId) verify(transitions, never()) .startTransition( eq(TRANSIT_CHANGE), any<WindowContainerTransaction>(), isA(DesktopModeMoveToDisplayTransitionHandler::class.java), ) } @Test fun getTaskWindowingMode() { val fullscreenTask = setUpFullscreenTask() Loading