Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -1262,8 +1262,7 @@ class DesktopTasksController( wct.reparent(task.token, displayAreaInfo.token, /* onTop= */ true) } // TODO: b/391485148 - pass in the moving-to-desk |task| here to apply task-limit policy. val activationRunnable = addDeskActivationChanges(destinationDeskId, wct) val activationRunnable = addDeskActivationChanges(destinationDeskId, wct, task) if (Flags.enableDisplayFocusInShellTransitions()) { // Bring the destination display to top with includingParents=true, so that the Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +32 −1 Original line number Diff line number Diff line Loading @@ -3125,6 +3125,36 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).reorderTaskToFront(wct, targetDeskId, task2) } @Test @EnableFlags(Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND) fun moveToNextDisplay_toDesktopInOtherDisplay_appliesTaskLimit() { val transition = Binder() val sourceDeskId = 0 val targetDeskId = 2 taskRepository.addDesk(displayId = SECOND_DISPLAY, deskId = targetDeskId) taskRepository.setDeskInactive(deskId = targetDeskId) val targetDeskTasks = (1..MAX_TASK_LIMIT + 1).map { _ -> setUpFreeformTask(displayId = SECOND_DISPLAY, deskId = targetDeskId) } // Set up two display ids whenever(rootTaskDisplayAreaOrganizer.displayIds) .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY)) // Create a mock for the target display area: second display val secondDisplayArea = DisplayAreaInfo(MockToken().token(), SECOND_DISPLAY, 0) whenever(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(SECOND_DISPLAY)) .thenReturn(secondDisplayArea) whenever(transitions.startTransition(eq(TRANSIT_CHANGE), any(), anyOrNull())) .thenReturn(transition) val task = setUpFreeformTask(displayId = DEFAULT_DISPLAY, deskId = sourceDeskId) controller.moveToNextDisplay(task.taskId) val wct = getLatestTransition() assertNotNull(wct) verify(desksOrganizer).minimizeTask(wct, targetDeskId, targetDeskTasks[0]) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY, Loading Loading @@ -3194,10 +3224,11 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).activateDesk(any(), eq(targetDeskId)) verify(desksTransitionsObserver) .addPendingTransition( DeskTransition.ActivateDesk( DeskTransition.ActiveDeskWithTask( token = transition, displayId = SECOND_DISPLAY, deskId = targetDeskId, enterTaskId = task.taskId, ) ) } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +1 −2 Original line number Diff line number Diff line Loading @@ -1262,8 +1262,7 @@ class DesktopTasksController( wct.reparent(task.token, displayAreaInfo.token, /* onTop= */ true) } // TODO: b/391485148 - pass in the moving-to-desk |task| here to apply task-limit policy. val activationRunnable = addDeskActivationChanges(destinationDeskId, wct) val activationRunnable = addDeskActivationChanges(destinationDeskId, wct, task) if (Flags.enableDisplayFocusInShellTransitions()) { // Bring the destination display to top with includingParents=true, so that the Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +32 −1 Original line number Diff line number Diff line Loading @@ -3125,6 +3125,36 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).reorderTaskToFront(wct, targetDeskId, task2) } @Test @EnableFlags(Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND) fun moveToNextDisplay_toDesktopInOtherDisplay_appliesTaskLimit() { val transition = Binder() val sourceDeskId = 0 val targetDeskId = 2 taskRepository.addDesk(displayId = SECOND_DISPLAY, deskId = targetDeskId) taskRepository.setDeskInactive(deskId = targetDeskId) val targetDeskTasks = (1..MAX_TASK_LIMIT + 1).map { _ -> setUpFreeformTask(displayId = SECOND_DISPLAY, deskId = targetDeskId) } // Set up two display ids whenever(rootTaskDisplayAreaOrganizer.displayIds) .thenReturn(intArrayOf(DEFAULT_DISPLAY, SECOND_DISPLAY)) // Create a mock for the target display area: second display val secondDisplayArea = DisplayAreaInfo(MockToken().token(), SECOND_DISPLAY, 0) whenever(rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(SECOND_DISPLAY)) .thenReturn(secondDisplayArea) whenever(transitions.startTransition(eq(TRANSIT_CHANGE), any(), anyOrNull())) .thenReturn(transition) val task = setUpFreeformTask(displayId = DEFAULT_DISPLAY, deskId = sourceDeskId) controller.moveToNextDisplay(task.taskId) val wct = getLatestTransition() assertNotNull(wct) verify(desksOrganizer).minimizeTask(wct, targetDeskId, targetDeskTasks[0]) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY, Loading Loading @@ -3194,10 +3224,11 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() verify(desksOrganizer).activateDesk(any(), eq(targetDeskId)) verify(desksTransitionsObserver) .addPendingTransition( DeskTransition.ActivateDesk( DeskTransition.ActiveDeskWithTask( token = transition, displayId = SECOND_DISPLAY, deskId = targetDeskId, enterTaskId = task.taskId, ) ) } Loading