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

Commit 05035c67 authored by Jorge Gil's avatar Jorge Gil
Browse files

Remove immersive task from repository when task is removed

When a task is removed from the active task list (i.e. it is no longer a
desktop task), make sure to mark it as no longer immersive if it was
immersive.

This change also updates the persistence repository with a desktop id
(using display id as there are no desktops yet) because otherwise
multi-display unit tests always modify the same desktop, which is
causing failures if a second display's repository data is non-null.

Flag: com.android.window.flags.enable_fully_immersive_in_desktop
Fix: 378172979
Test: enter desktop immersive, exit desktop to fullscreen or split, go
back to desktop, verify immersive button is responsive and the task can
re-enter immersive.

Change-Id: I2dcf6a7acca34dc60ae15b2a725a0d05048468eb
parent 2034639b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -411,6 +411,12 @@ class DesktopRepository (
            desktopTaskDataByDisplayId[displayId]?.freeformTasksInZOrder?.toDumpString())
        // Remove task from unminimized task if it is minimized.
        unminimizeTask(displayId, taskId)
        // Mark task as not in immersive if it was immersive.
        setTaskInFullImmersiveState(
            displayId = displayId,
            taskId = taskId,
            immersive = false
        )
        removeActiveTask(taskId)
        removeVisibleTask(taskId)
        if (DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_PERSISTENCE.isTrue()) {
@@ -487,6 +493,9 @@ class DesktopRepository (
            mainCoroutineScope.launch {
                try {
                    persistentRepository.addOrUpdateDesktop(
                        // Use display id as desktop id for now since only once desktop per display
                        // is supported.
                        desktopId = displayId,
                        visibleTasks = desktopTaskDataByDisplayIdCopy.visibleTasks,
                        minimizedTasks = desktopTaskDataByDisplayIdCopy.minimizedTasks,
                        freeformTasksInZOrder = desktopTaskDataByDisplayIdCopy.freeformTasksInZOrder