Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d99b340b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rename `removeFreeformTask` to `removeTask` in DesktopRepository." into main

parents 553d7405 bdc9525a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -470,7 +470,7 @@ class DesktopRepository(
     * Removes [taskId] from the respective display. If [INVALID_DISPLAY], the original display id
     * will be looked up from the task id.
     */
    fun removeFreeformTask(displayId: Int, taskId: Int) {
    fun removeTask(displayId: Int, taskId: Int) {
        logD("Removes freeform task: taskId=%d", taskId)
        if (displayId == INVALID_DISPLAY) {
            // Removes the original display id of the task.
+5 −5
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ class DesktopTaskChangeListener(private val desktopUserRepositories: DesktopUser
        val desktopRepository: DesktopRepository =
            desktopUserRepositories.getProfile(taskInfo.userId)
        if (!isFreeformTask(taskInfo) && desktopRepository.isActiveTask(taskInfo.taskId)) {
            desktopRepository.removeFreeformTask(taskInfo.displayId, taskInfo.taskId)
            desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId)
            return
        }
        if (isFreeformTask(taskInfo)) {
@@ -50,7 +50,7 @@ class DesktopTaskChangeListener(private val desktopUserRepositories: DesktopUser
            desktopRepository.updateTask(taskInfo.displayId, taskInfo.taskId, taskInfo.isVisible)
        } else {
            // Case 2: Freeform task is changed outside Desktop Mode.
            desktopRepository.removeFreeformTask(taskInfo.displayId, taskInfo.taskId)
            desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId)
        }
    }

@@ -60,7 +60,7 @@ class DesktopTaskChangeListener(private val desktopUserRepositories: DesktopUser
    // Any changes to [DesktopRepository] from this method should be made carefully to minimize risk
    // of race conditions and possible duplications with [onTaskChanging].
    override fun onNonTransitionTaskChanging(taskInfo: RunningTaskInfo) {
        // TODO: b/367268953 - Propapagate usages from FreeformTaskListener to this method.
        // TODO: b/367268953 - Propagate usages from FreeformTaskListener to this method.
    }

    override fun onTaskMovingToFront(taskInfo: RunningTaskInfo) {
@@ -68,7 +68,7 @@ class DesktopTaskChangeListener(private val desktopUserRepositories: DesktopUser
            desktopUserRepositories.getProfile(taskInfo.userId)
        if (!desktopRepository.isActiveTask(taskInfo.taskId)) return
        if (!isFreeformTask(taskInfo)) {
            desktopRepository.removeFreeformTask(taskInfo.displayId, taskInfo.taskId)
            desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId)
        }
        // TODO: b/367268953 - Connect this with DesktopRepository for handling
        // task moving to front for tasks in windowing mode.
@@ -90,7 +90,7 @@ class DesktopTaskChangeListener(private val desktopUserRepositories: DesktopUser
            // A task that's vanishing should be removed:
            // - If it's closed by the X button which means it's marked as a closing task.
            desktopRepository.removeClosingTask(taskInfo.taskId)
            desktopRepository.removeFreeformTask(taskInfo.displayId, taskInfo.taskId)
            desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId)
        } else {
            desktopRepository.updateTask(taskInfo.displayId, taskInfo.taskId, isVisible = false)
            desktopRepository.minimizeTask(taskInfo.displayId, taskInfo.taskId)
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ class DesktopTasksTransitionObserver(
                desktopRepository.isActiveTask(taskInfo.taskId) &&
                    taskInfo.windowingMode != WINDOWING_MODE_FREEFORM
            ) {
                desktopRepository.removeFreeformTask(taskInfo.displayId, taskInfo.taskId)
                desktopRepository.removeTask(taskInfo.displayId, taskInfo.taskId)
            }
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,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.removeFreeformTask(taskInfo.displayId, taskInfo.taskId);
                repository.removeTask(taskInfo.displayId, taskInfo.taskId);
            }
        }
        mWindowDecorationViewModel.onTaskVanished(taskInfo);
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ public class RecentTasksController implements TaskStackListenerCallback,
    @Override
    public void onRecentTaskRemovedForAddTask(int taskId) {
        mDesktopUserRepositories.ifPresent(
                desktopUserRepositories -> desktopUserRepositories.getCurrent().removeFreeformTask(
                desktopUserRepositories -> desktopUserRepositories.getCurrent().removeTask(
                        INVALID_DISPLAY, taskId));
    }

Loading