diff options
author | 2025-03-20 03:44:23 -0700 | |
---|---|---|
committer | 2025-03-20 03:44:23 -0700 | |
commit | 005fc9eca8c573e0e90e73f6730d9eaf44f68d14 (patch) | |
tree | 62787eea663389c8ea9b548331e444aa2491ac36 | |
parent | f6d3e7a71bb25588ef953c2ee2f7f6b3ab3f99fc (diff) | |
parent | 1e185e942de2bf59ce50d9f50a6866ea3125e947 (diff) |
Merge "Force enter desktop mode on secondary display" into main
2 files changed, 25 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt index 5f757d82c3ee..b60fd5bb6c73 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt @@ -449,6 +449,11 @@ class DesktopTasksController( return false } + // Secondary displays are always desktop-first + if (displayId != DEFAULT_DISPLAY) { + return true + } + val tdaInfo = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(displayId) // A non-organized display (e.g., non-trusted virtual displays used in CTS) doesn't have // TDA. @@ -1140,6 +1145,7 @@ class DesktopTasksController( } val t = if (remoteTransition == null) { + logV("startLaunchTransition -- no remoteTransition -- wct = $launchTransaction") desktopMixedTransitionHandler.startLaunchTransition( transitionType = transitionType, wct = launchTransaction, diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt index a1ada11b8d93..b8c2273e1465 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt @@ -4287,6 +4287,25 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase() } @Test + @EnableFlags( + Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY, + Flags.FLAG_ENABLE_MULTIPLE_DESKTOPS_BACKEND, + ) + fun handleRequest_fullscreenTask_noInDesk_enforceDesktop_secondaryDisplay_movesToDesk() { + val deskId = 5 + taskRepository.addDesk(displayId = SECONDARY_DISPLAY_ID, deskId = deskId) + taskRepository.setDeskInactive(deskId) + whenever(desktopWallpaperActivityTokenProvider.getToken()).thenReturn(null) + whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true) + + val fullscreenTask = createFullscreenTask(displayId = SECONDARY_DISPLAY_ID) + val wct = controller.handleRequest(Binder(), createTransition(fullscreenTask)) + + assertNotNull(wct, "should handle request") + verify(desksOrganizer).moveTaskToDesk(wct, deskId, fullscreenTask) + } + + @Test fun handleRequest_fullscreenTask_notInDesk_enforceDesktop_fullscreenDisplay_returnNull() { taskRepository.setDeskInactive(deskId = 0) whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true) |