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

Commit b3b4077a authored by Omar Elmekkawy's avatar Omar Elmekkawy
Browse files

Stop depending on transitions for tasks moving displays.

On switching users, getDeskIdForTask returns null for tasks that are
in the newly activated desk due to the repositories not being updated
before the onTransitionReady signal.

This CL stops depending on transitions to break tiling when a task is
moved across displays, and instead breaks tiling when the code to move
the task runs.

Flag: com.android.window.flags.enable_tile_resizing
Test: Unit tests and on device testing
Bug: 416304871
Change-Id: Ib83bc321cb1d578997d6c132c7d7ac14186384f0
parent 78a65802
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1834,7 +1834,7 @@ class DesktopTasksController(
            logW("moveToDisplay: desk not found for display: $displayId")
            return
        }

        snapEventHandler.removeTaskIfTiled(task.displayId, task.taskId)
        // TODO: b/393977830 and b/397437641 - do not assume that freeform==desktop.
        if (!task.isFreeform) {
            addMoveToDeskTaskChanges(wct = wct, task = task, deskId = destinationDeskId)
+1 −4
Original line number Diff line number Diff line
@@ -462,7 +462,7 @@ class DesktopTilingWindowDecoration(
                            taskInfo.isFullscreen,
                        )

                    !isActiveTaskWithinDesk(taskInfo.taskId) ->
                    !taskInfo.isFreeform ->
                        removeTaskIfTiled(
                            taskInfo.taskId,
                            taskVanished = true,
@@ -489,9 +489,6 @@ class DesktopTilingWindowDecoration(
        }
    }

    private fun isActiveTaskWithinDesk(taskId: Int): Boolean =
        desktopUserRepositories.current.getDeskIdForTask(taskId) == deskId

    private fun handleTaskBroughtToFront(taskId: Int) {
        if (taskId == leftTaskResizingHelper?.taskInfo?.taskId) {
            leftTaskResizingHelper?.onAppBecomingVisible()
+1 −0
Original line number Diff line number Diff line
@@ -4044,6 +4044,7 @@ class DesktopTasksControllerTest(flags: FlagsParameterization) : ShellTestCase()
                any<WindowContainerTransaction>(),
                isA(DesktopModeMoveToDisplayTransitionHandler::class.java),
            )
        verify(snapEventHandler, verificationMode).removeTaskIfTiled(task.displayId, task.taskId)
    }

    @Test