Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +5 −2 Original line number Diff line number Diff line Loading @@ -1689,8 +1689,11 @@ class DesktopTasksController( return WindowContainerTransaction().also { wct -> addMoveToDesktopChanges(wct, task) // In some launches home task is moved behind new task being launched. Make sure // that's not the case for launches in desktop. if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0) { // that's not the case for launches in desktop. Also, if this launch is the first // one to trigger the desktop mode (e.g., when [forceEnterDesktop()]), activate the // desktop mode here. if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0 || !isDesktopModeShowing(task.displayId)) { bringDesktopAppsToFrontBeforeShowingNewTask(task.displayId, wct, task.taskId) wct.reorder(task.token, true) } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +8 −2 Original line number Diff line number Diff line Loading @@ -1922,6 +1922,7 @@ class DesktopTasksControllerTest : ShellTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY) fun handleRequest_fullscreenTask_noTasks_enforceDesktop_freeformDisplay_returnFreeformWCT() { whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true) val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!! Loading @@ -1933,8 +1934,13 @@ class DesktopTasksControllerTest : ShellTestCase() { assertNotNull(wct, "should handle request") assertThat(wct.changes[fullscreenTask.token.asBinder()]?.windowingMode) .isEqualTo(WINDOWING_MODE_UNDEFINED) assertThat(wct.hierarchyOps).hasSize(1) wct.assertReorderAt(0, fullscreenTask, toTop = true) assertThat(wct.hierarchyOps).hasSize(3) // There are 3 hops that are happening in this case: // 1. Moving the fullscreen task to top as we add moveToDesktop() changes // 2. Pending intent for the wallpaper // 3. Bringing the fullscreen task back at the top wct.assertPendingIntentAt(1, desktopWallpaperIntent) wct.assertReorderAt(2, fullscreenTask, toTop = true) } @Test Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +5 −2 Original line number Diff line number Diff line Loading @@ -1689,8 +1689,11 @@ class DesktopTasksController( return WindowContainerTransaction().also { wct -> addMoveToDesktopChanges(wct, task) // In some launches home task is moved behind new task being launched. Make sure // that's not the case for launches in desktop. if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0) { // that's not the case for launches in desktop. Also, if this launch is the first // one to trigger the desktop mode (e.g., when [forceEnterDesktop()]), activate the // desktop mode here. if (task.baseIntent.flags.and(Intent.FLAG_ACTIVITY_TASK_ON_HOME) != 0 || !isDesktopModeShowing(task.displayId)) { bringDesktopAppsToFrontBeforeShowingNewTask(task.displayId, wct, task.taskId) wct.reorder(task.token, true) } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +8 −2 Original line number Diff line number Diff line Loading @@ -1922,6 +1922,7 @@ class DesktopTasksControllerTest : ShellTestCase() { } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY) fun handleRequest_fullscreenTask_noTasks_enforceDesktop_freeformDisplay_returnFreeformWCT() { whenever(DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(context)).thenReturn(true) val tda = rootTaskDisplayAreaOrganizer.getDisplayAreaInfo(DEFAULT_DISPLAY)!! Loading @@ -1933,8 +1934,13 @@ class DesktopTasksControllerTest : ShellTestCase() { assertNotNull(wct, "should handle request") assertThat(wct.changes[fullscreenTask.token.asBinder()]?.windowingMode) .isEqualTo(WINDOWING_MODE_UNDEFINED) assertThat(wct.hierarchyOps).hasSize(1) wct.assertReorderAt(0, fullscreenTask, toTop = true) assertThat(wct.hierarchyOps).hasSize(3) // There are 3 hops that are happening in this case: // 1. Moving the fullscreen task to top as we add moveToDesktop() changes // 2. Pending intent for the wallpaper // 3. Bringing the fullscreen task back at the top wct.assertPendingIntentAt(1, desktopWallpaperIntent) wct.assertReorderAt(2, fullscreenTask, toTop = true) } @Test Loading