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

Commit 0e04f067 authored by Graciela Wissen Putri's avatar Graciela Wissen Putri
Browse files

Don't use task that is closing to calculate cascading position

Flag: EXEMPT bug fix
Fix: 407094842
Test: atest DesktopTasksControllerTest
Change-Id: I9dea1f14dd73fe3734d8940686fe23c5e1f7acbd
parent 8fee1444
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -3286,7 +3286,9 @@ class DesktopTasksController(
        displayLayout.getStableBoundsForDesktopMode(stableBounds)

        val activeTasks = taskRepository.getExpandedTasksIdsInDeskOrdered(deskId)
        activeTasks.firstOrNull()?.let { activeTask ->
        activeTasks
            .firstOrNull { !taskRepository.isClosingTask(it) }
            ?.let { activeTask ->
                shellTaskOrganizer.getRunningTaskInfo(activeTask)?.let {
                    cascadeWindow(
                        context.resources,
+23 −0
Original line number Diff line number Diff line
@@ -1292,6 +1292,29 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
        assertNull(wct, "should not handle request")
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_CASCADING_WINDOWS)
    fun addMoveToDeskTaskChanges_activeButClosingTask_cascadeNotApplied() {
        setUpLandscapeDisplay()
        val stableBounds = Rect()
        displayLayout.getStableBoundsForDesktopMode(stableBounds)

        val closingTask = setUpFreeformTask(bounds = DEFAULT_LANDSCAPE_BOUNDS)
        taskRepository.addClosingTask(
            displayId = DEFAULT_DISPLAY,
            deskId = 0,
            taskId = closingTask.taskId,
        )

        val task = setUpFullscreenTask()
        val wct = WindowContainerTransaction()
        controller.addMoveToDeskTaskChanges(wct, task, deskId = 0)

        val finalBounds = findBoundsChange(wct, task)
        assertThat(stableBounds.getDesktopTaskPosition(finalBounds!!))
            .isEqualTo(DesktopTaskPosition.Center)
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_CASCADING_WINDOWS)
    fun addMoveToDeskTaskChanges_positionBottomRight() {