Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopBackNavTransitionObserver.kt +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ class DesktopBackNavTransitionObserver( val desktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (desktopRepository.isExitingDesktopTask(change)) { logD("removeTaskIfNeeded taskId=%d", taskInfo.taskId) desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopRepository.kt +3 −7 Original line number Diff line number Diff line Loading @@ -929,14 +929,10 @@ class DesktopRepository( * * TODO: b/389960283 - consider using [removeTaskFromDesk] instead. */ fun removeTask(displayId: Int, taskId: Int) { fun removeTask(taskId: Int) { logD("Removes freeform task: taskId=%d", taskId) if (displayId == INVALID_DISPLAY) { // Removes the original display id of the task. getDisplayIdForTask(taskId)?.let { removeTaskFromDisplay(it, taskId) } } else { removeTaskFromDisplay(displayId, taskId) } } /** Removes given task from a valid [displayId] and updates the repository state. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTaskChangeListener.kt +10 −10 Original line number Diff line number Diff line Loading @@ -33,18 +33,18 @@ class DesktopTaskChangeListener( override fun onTaskOpening(taskInfo: RunningTaskInfo) { logD("onTaskOpening for taskId=%d, displayId=%d", taskInfo.taskId, taskInfo.displayId) val desktopRepository: DesktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.taskId) return } if ( !desktopState.isDesktopModeSupportedOnDisplay(taskInfo.displayId) && DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue ) { return } val desktopRepository: DesktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) return } if (isFreeformTask(taskInfo) && !desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.addTask(taskInfo.displayId, taskInfo.taskId, taskInfo.isVisible) } Loading @@ -70,7 +70,7 @@ class DesktopTaskChangeListener( // fullscreen, // remove the task from the desktop repository since it is no longer a freeform task. if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } else if (isFreeformTask(taskInfo)) { // If the task is already active in the repository, then moves task to the front, // else adds the task. Loading Loading @@ -105,7 +105,7 @@ class DesktopTaskChangeListener( // When the task change is from a task in the desktop repository which is now fullscreen, // remove the task from the desktop repository since it is no longer a freeform task. if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } if (isFreeformTask(taskInfo)) { // If the task is already active in the repository, then it only moves the task to the Loading Loading @@ -150,11 +150,11 @@ class DesktopTaskChangeListener( if (isMinimized) { desktopRepository.updateTask(taskInfo.displayId, taskInfo.taskId, isVisible = false) } else { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } else { desktopRepository.removeClosingTask(taskInfo.taskId) desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener, // triggered on a task and the task is closing. It will be marked as minimized in // [DesktopTasksTransitionObserver] before it gets here. repository.removeClosingTask(taskInfo.taskId); repository.removeTask(taskInfo.displayId, taskInfo.taskId); repository.removeTask(taskInfo.taskId); } } // TODO: b/367268649 - This listener shouldn't need to call the transition observer directly Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +1 −2 Original line number Diff line number Diff line Loading @@ -322,8 +322,7 @@ public class RecentTasksController implements TaskStackListenerCallback, @Override public void onRecentTaskRemovedForAddTask(int taskId) { mDesktopUserRepositories.ifPresent( desktopUserRepositories -> desktopUserRepositories.getCurrent().removeTask( INVALID_DISPLAY, taskId)); desktopUserRepositories -> desktopUserRepositories.getCurrent().removeTask(taskId)); } public void onTaskAdded(RunningTaskInfo taskInfo) { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopBackNavTransitionObserver.kt +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ class DesktopBackNavTransitionObserver( val desktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (desktopRepository.isExitingDesktopTask(change)) { logD("removeTaskIfNeeded taskId=%d", taskInfo.taskId) desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopRepository.kt +3 −7 Original line number Diff line number Diff line Loading @@ -929,14 +929,10 @@ class DesktopRepository( * * TODO: b/389960283 - consider using [removeTaskFromDesk] instead. */ fun removeTask(displayId: Int, taskId: Int) { fun removeTask(taskId: Int) { logD("Removes freeform task: taskId=%d", taskId) if (displayId == INVALID_DISPLAY) { // Removes the original display id of the task. getDisplayIdForTask(taskId)?.let { removeTaskFromDisplay(it, taskId) } } else { removeTaskFromDisplay(displayId, taskId) } } /** Removes given task from a valid [displayId] and updates the repository state. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTaskChangeListener.kt +10 −10 Original line number Diff line number Diff line Loading @@ -33,18 +33,18 @@ class DesktopTaskChangeListener( override fun onTaskOpening(taskInfo: RunningTaskInfo) { logD("onTaskOpening for taskId=%d, displayId=%d", taskInfo.taskId, taskInfo.displayId) val desktopRepository: DesktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.taskId) return } if ( !desktopState.isDesktopModeSupportedOnDisplay(taskInfo.displayId) && DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue ) { return } val desktopRepository: DesktopRepository = desktopUserRepositories.getProfile(taskInfo.userId) if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) return } if (isFreeformTask(taskInfo) && !desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.addTask(taskInfo.displayId, taskInfo.taskId, taskInfo.isVisible) } Loading @@ -70,7 +70,7 @@ class DesktopTaskChangeListener( // fullscreen, // remove the task from the desktop repository since it is no longer a freeform task. if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } else if (isFreeformTask(taskInfo)) { // If the task is already active in the repository, then moves task to the front, // else adds the task. Loading Loading @@ -105,7 +105,7 @@ class DesktopTaskChangeListener( // When the task change is from a task in the desktop repository which is now fullscreen, // remove the task from the desktop repository since it is no longer a freeform task. if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } if (isFreeformTask(taskInfo)) { // If the task is already active in the repository, then it only moves the task to the Loading Loading @@ -150,11 +150,11 @@ class DesktopTaskChangeListener( if (isMinimized) { desktopRepository.updateTask(taskInfo.displayId, taskInfo.taskId, isVisible = false) } else { desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } else { desktopRepository.removeClosingTask(taskInfo.taskId) desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId) desktopRepository.removeTask(taskInfo.taskId) } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +1 −1 Original line number Diff line number Diff line Loading @@ -139,7 +139,7 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener, // triggered on a task and the task is closing. It will be marked as minimized in // [DesktopTasksTransitionObserver] before it gets here. repository.removeClosingTask(taskInfo.taskId); repository.removeTask(taskInfo.displayId, taskInfo.taskId); repository.removeTask(taskInfo.taskId); } } // TODO: b/367268649 - This listener shouldn't need to call the transition observer directly Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +1 −2 Original line number Diff line number Diff line Loading @@ -322,8 +322,7 @@ public class RecentTasksController implements TaskStackListenerCallback, @Override public void onRecentTaskRemovedForAddTask(int taskId) { mDesktopUserRepositories.ifPresent( desktopUserRepositories -> desktopUserRepositories.getCurrent().removeTask( INVALID_DISPLAY, taskId)); desktopUserRepositories -> desktopUserRepositories.getCurrent().removeTask(taskId)); } public void onTaskAdded(RunningTaskInfo taskInfo) { Loading