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

Commit 76a2a458 authored by Graciela Putri's avatar Graciela Putri Committed by Android (Google) Code Review
Browse files

Merge "Don't use task that is closing to calculate cascading position" into main

parents 30aae8b5 0e04f067
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -3316,7 +3316,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
@@ -1293,6 +1293,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() {