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

Commit fb0180d6 authored by Omar Elmekkawy's avatar Omar Elmekkawy Committed by Android (Google) Code Review
Browse files

Merge "Call removeTaskIfTiled from the right places within the Controller." into main

parents 63edc7c8 47d92e09
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1173,7 +1173,7 @@ class DesktopTasksController(
            } else {
                taskRepository.isOnlyVisibleNonClosingTask(taskId = taskId, displayId = displayId)
            }

        snapEventHandler.removeTaskIfTiled(displayId, taskId)
        val isMinimizingToPip =
            DesktopExperienceFlags.ENABLE_DESKTOP_WINDOWING_PIP.isTrue &&
                (taskInfo.pictureInPictureParams?.isAutoEnterEnabled ?: false) &&
@@ -1219,7 +1219,6 @@ class DesktopTasksController(
            val transition = freeformTaskTransitionStarter.startPipTransition(wct)
            desktopExitRunnable?.invoke(transition)
        } else {
            snapEventHandler.removeTaskIfTiled(displayId, taskId)
            val willExitDesktop =
                if (
                    DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue &&
@@ -3035,11 +3034,11 @@ class DesktopTasksController(
        )
        if (taskIdToMinimize != null) {
            addPendingMinimizeTransition(transition, taskIdToMinimize, MinimizeReason.TASK_LIMIT)
            snapEventHandler.removeTaskIfTiled(task.displayId, taskIdToMinimize)
            return wct
        }
        addPendingTaskLimitTransition(transition, deskId, task.taskId)
        if (!wct.isEmpty) {
            snapEventHandler.removeTaskIfTiled(task.displayId, task.taskId)
            return wct
        }
        return null
+18 −0
Original line number Diff line number Diff line
@@ -3991,6 +3991,24 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        assertThat(wct.hierarchyOps).isEmpty()
    }

    @Test
    fun tilingBroken_onTaskMinimised() {
        val task = setUpFreeformTask()
        val transition = Binder()
        whenever(
                freeformTaskTransitionStarter.startMinimizedModeTransition(
                    any(),
                    anyInt(),
                    anyBoolean(),
                )
            )
            .thenReturn(transition)

        controller.minimizeTask(task, MinimizeReason.TASK_LIMIT)

        verify(snapEventHandler, times(1)).removeTaskIfTiled(task.displayId, task.taskId)
    }

    @Test
    fun onDesktopWindowClose_multipleActiveTasks() {
        val task1 = setUpFreeformTask()