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

Commit 3c49eec1 authored by Ats Jenk's avatar Ats Jenk Committed by Automerger Merge Worker
Browse files

Merge "Always execute logic to move desktop apps to front" into tm-qpr-dev am: b4fb274e

parents dc535ab3 b4fb274e
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ class DesktopTasksController(
    fun showDesktopApps() {
        ProtoLog.v(WM_SHELL_DESKTOP_MODE, "showDesktopApps")
        val wct = WindowContainerTransaction()
        bringDesktopAppsToFront(wct, force = true)
        bringDesktopAppsToFront(wct)

        // Execute transaction if there are pending operations
        if (!wct.isEmpty) {
@@ -156,19 +156,9 @@ class DesktopTasksController(
            ?: WINDOWING_MODE_UNDEFINED
    }

    private fun bringDesktopAppsToFront(wct: WindowContainerTransaction, force: Boolean = false) {
        val activeTasks = desktopModeTaskRepository.getActiveTasks()

        // Skip if all tasks are already visible
        if (!force && activeTasks.all(desktopModeTaskRepository::isVisibleTask)) {
            ProtoLog.d(
                WM_SHELL_DESKTOP_MODE,
                "bringDesktopAppsToFront: active tasks are already in front, skipping."
            )
            return
        }

    private fun bringDesktopAppsToFront(wct: WindowContainerTransaction) {
        ProtoLog.v(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront")
        val activeTasks = desktopModeTaskRepository.getActiveTasks()

        // First move home to front and then other tasks on top of it
        moveHomeTaskToFront(wct)