Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −2 Original line number Diff line number Diff line Loading @@ -1108,16 +1108,21 @@ class DesktopTasksController( /** Handle task closing by removing wallpaper activity if it's the last active task */ private fun handleTaskClosing(task: RunningTaskInfo): WindowContainerTransaction? { logV("handleTaskClosing") if (!isDesktopModeShowing(task.displayId)) return null val wct = WindowContainerTransaction() if (taskRepository.isOnlyVisibleNonClosingTask(task.taskId) && taskRepository.wallpaperActivityToken != null) { && taskRepository.wallpaperActivityToken != null ) { // Remove wallpaper activity when the last active task is removed removeWallpaperActivity(wct) } taskRepository.addClosingTask(task.displayId, task.taskId) // If a CLOSE or TO_BACK is triggered on a desktop task, remove the task. if (DesktopModeFlags.BACK_NAVIGATION.isEnabled(context) && taskRepository.isVisibleTask(task.taskId)) { taskRepository.isVisibleTask(task.taskId) ) { wct.removeTask(task.token) } return if (wct.isEmpty) null else wct Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -1818,6 +1818,19 @@ class DesktopTasksControllerTest : ShellTestCase() { assertNotNull(result, "Should handle request").assertRemoveAt(0, task.token) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY, ) fun handleRequest_backTransition_singleTaskNoToken_withWallpaper_notInDesktop_doesNotHandle() { val task = setUpFreeformTask() markTaskHidden(task) val result = controller.handleRequest(Binder(), createTransition(task, type = TRANSIT_TO_BACK)) assertNull(result, "Should not handle request") } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY) @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION) Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +7 −2 Original line number Diff line number Diff line Loading @@ -1108,16 +1108,21 @@ class DesktopTasksController( /** Handle task closing by removing wallpaper activity if it's the last active task */ private fun handleTaskClosing(task: RunningTaskInfo): WindowContainerTransaction? { logV("handleTaskClosing") if (!isDesktopModeShowing(task.displayId)) return null val wct = WindowContainerTransaction() if (taskRepository.isOnlyVisibleNonClosingTask(task.taskId) && taskRepository.wallpaperActivityToken != null) { && taskRepository.wallpaperActivityToken != null ) { // Remove wallpaper activity when the last active task is removed removeWallpaperActivity(wct) } taskRepository.addClosingTask(task.displayId, task.taskId) // If a CLOSE or TO_BACK is triggered on a desktop task, remove the task. if (DesktopModeFlags.BACK_NAVIGATION.isEnabled(context) && taskRepository.isVisibleTask(task.taskId)) { taskRepository.isVisibleTask(task.taskId) ) { wct.removeTask(task.token) } return if (wct.isEmpty) null else wct Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -1818,6 +1818,19 @@ class DesktopTasksControllerTest : ShellTestCase() { assertNotNull(result, "Should handle request").assertRemoveAt(0, task.token) } @Test @EnableFlags( Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY, ) fun handleRequest_backTransition_singleTaskNoToken_withWallpaper_notInDesktop_doesNotHandle() { val task = setUpFreeformTask() markTaskHidden(task) val result = controller.handleRequest(Binder(), createTransition(task, type = TRANSIT_TO_BACK)) assertNull(result, "Should not handle request") } @Test @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_WALLPAPER_ACTIVITY) @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_BACK_NAVIGATION) Loading