Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeTransitionSource.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.os.Parcelable /** Transition source types for Desktop Mode. */ enum class DesktopModeTransitionSource : Parcelable { /** Transitions that originated from an adb command. */ ADB_COMMAND, /** Transitions that originated as a consequence of task dragging. */ TASK_DRAG, /** Transitions that originated from an app from Overview. */ Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeShellCommandHandler.kt +2 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.desktopmode import android.app.ActivityTaskManager.INVALID_TASK_ID import android.window.DesktopExperienceFlags import com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.UnminimizeReason import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource.ADB_COMMAND import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource.UNKNOWN import com.android.wm.shell.sysui.ShellCommandHandler import com.android.wm.shell.transition.FocusTransitionObserver Loading Loading @@ -85,8 +86,7 @@ class DesktopModeShellCommandHandler( pw.println("Error: desk id should be an integer") return false } controller.moveTaskToDesk(taskId = taskId, deskId = deskId, transitionSource = UNKNOWN) pw.println("Not implemented.") controller.moveTaskToDesk(taskId = taskId, deskId = deskId, transitionSource = ADB_COMMAND) return true } Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +15 −3 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ class DesktopTasksController( remoteTransition: RemoteTransition? = null, callback: IMoveToDesktopCallback? = null, ): Boolean { logV("moveTaskToDesk taskId=%d deskId=%d source=%s", taskId, deskId, transitionSource) val runningTask = shellTaskOrganizer.getRunningTaskInfo(taskId) if (runningTask != null) { return moveRunningTaskToDesk( Loading Loading @@ -2789,6 +2790,12 @@ class DesktopTasksController( ) { val targetDisplayId = taskRepository.getDisplayForDesk(deskId) val displayLayout = displayController.getDisplayLayout(targetDisplayId) ?: return logV( "addMoveToDeskTaskChanges taskId=%d deskId=%d displayId=%d", task.taskId, deskId, targetDisplayId, ) val inheritedTaskBounds = getInheritedExistingTaskBounds(taskRepository, shellTaskOrganizer, task, deskId) if (inheritedTaskBounds != null) { Loading Loading @@ -3075,10 +3082,15 @@ class DesktopTasksController( // TODO: b/362720497 - should this be true in other places? Can it be calculated locally // without having to specify the value? addPendingLaunchTransition: Boolean = false, ): RunOnTransitStart? { logV("addDeskActivationChanges newTaskId=%d deskId=%d", newTask?.taskId, deskId) ): RunOnTransitStart { val newTaskIdInFront = newTask?.taskId val displayId = taskRepository.getDisplayForDesk(deskId) logV( "addDeskActivationChanges newTaskId=%d deskId=%d displayId=%d", newTask?.taskId, deskId, displayId, ) if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) { val taskIdToMinimize = bringDesktopAppsToFront(displayId, wct, newTask?.taskId) return { transition -> Loading Loading @@ -3131,7 +3143,7 @@ class DesktopTasksController( return { transition -> val activateDeskTransition = if (newTaskIdInFront != null) { DeskTransition.ActiveDeskWithTask( DeskTransition.ActivateDeskWithTask( token = transition, displayId = displayId, deskId = deskId, Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/multidesks/DeskTransition.kt +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ sealed interface DeskTransition { } /** A transition to activate a desk by moving an outside task to it. */ data class ActiveDeskWithTask( data class ActivateDeskWithTask( override val token: IBinder, val displayId: Int, val deskId: Int, Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/multidesks/DesksTransitionObserver.kt +21 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.desktopmode.multidesks import android.os.IBinder import android.view.Display.INVALID_DISPLAY import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.window.DesktopExperienceFlags Loading Loading @@ -175,14 +176,29 @@ class DesksTransitionObserver( deskId = deskTransition.deskId, ) } is DeskTransition.ActiveDeskWithTask -> { val withTask = is DeskTransition.ActivateDeskWithTask -> { val deskId = deskTransition.deskId val deskChange = info.changes.find { change -> desksOrganizer.isDeskChange(change, deskId) } if (deskChange != null) { val deskChangeDisplayId = deskChange.taskInfo?.displayId ?: INVALID_DISPLAY if (deskChangeDisplayId != deskTransition.displayId) { logW( "ActivateDeskWithTask: expected displayId=%d but got displayId=%d", deskTransition.displayId, deskChangeDisplayId, ) } } else { logW("ActivateDeskWithTask: did not find desk change") } val taskChange = info.changes.find { change -> change.taskInfo?.taskId == deskTransition.enterTaskId && change.taskInfo?.isVisibleRequested == true && desksOrganizer.getDeskAtEnd(change) == deskTransition.deskId } withTask?.let { if (taskChange != null) { desktopRepository.setActiveDesk( displayId = deskTransition.displayId, deskId = deskTransition.deskId, Loading @@ -193,6 +209,8 @@ class DesksTransitionObserver( taskId = deskTransition.enterTaskId, isVisible = true, ) } else { logW("ActivateDeskWithTask: did not find task change") } } is DeskTransition.DeactivateDesk -> handleDeactivateDeskTransition(info, deskTransition) Loading Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeTransitionSource.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.os.Parcelable /** Transition source types for Desktop Mode. */ enum class DesktopModeTransitionSource : Parcelable { /** Transitions that originated from an adb command. */ ADB_COMMAND, /** Transitions that originated as a consequence of task dragging. */ TASK_DRAG, /** Transitions that originated from an app from Overview. */ Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeShellCommandHandler.kt +2 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.desktopmode import android.app.ActivityTaskManager.INVALID_TASK_ID import android.window.DesktopExperienceFlags import com.android.wm.shell.desktopmode.DesktopModeEventLogger.Companion.UnminimizeReason import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource.ADB_COMMAND import com.android.wm.shell.shared.desktopmode.DesktopModeTransitionSource.UNKNOWN import com.android.wm.shell.sysui.ShellCommandHandler import com.android.wm.shell.transition.FocusTransitionObserver Loading Loading @@ -85,8 +86,7 @@ class DesktopModeShellCommandHandler( pw.println("Error: desk id should be an integer") return false } controller.moveTaskToDesk(taskId = taskId, deskId = deskId, transitionSource = UNKNOWN) pw.println("Not implemented.") controller.moveTaskToDesk(taskId = taskId, deskId = deskId, transitionSource = ADB_COMMAND) return true } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +15 −3 Original line number Diff line number Diff line Loading @@ -618,6 +618,7 @@ class DesktopTasksController( remoteTransition: RemoteTransition? = null, callback: IMoveToDesktopCallback? = null, ): Boolean { logV("moveTaskToDesk taskId=%d deskId=%d source=%s", taskId, deskId, transitionSource) val runningTask = shellTaskOrganizer.getRunningTaskInfo(taskId) if (runningTask != null) { return moveRunningTaskToDesk( Loading Loading @@ -2789,6 +2790,12 @@ class DesktopTasksController( ) { val targetDisplayId = taskRepository.getDisplayForDesk(deskId) val displayLayout = displayController.getDisplayLayout(targetDisplayId) ?: return logV( "addMoveToDeskTaskChanges taskId=%d deskId=%d displayId=%d", task.taskId, deskId, targetDisplayId, ) val inheritedTaskBounds = getInheritedExistingTaskBounds(taskRepository, shellTaskOrganizer, task, deskId) if (inheritedTaskBounds != null) { Loading Loading @@ -3075,10 +3082,15 @@ class DesktopTasksController( // TODO: b/362720497 - should this be true in other places? Can it be calculated locally // without having to specify the value? addPendingLaunchTransition: Boolean = false, ): RunOnTransitStart? { logV("addDeskActivationChanges newTaskId=%d deskId=%d", newTask?.taskId, deskId) ): RunOnTransitStart { val newTaskIdInFront = newTask?.taskId val displayId = taskRepository.getDisplayForDesk(deskId) logV( "addDeskActivationChanges newTaskId=%d deskId=%d displayId=%d", newTask?.taskId, deskId, displayId, ) if (!DesktopExperienceFlags.ENABLE_MULTIPLE_DESKTOPS_BACKEND.isTrue) { val taskIdToMinimize = bringDesktopAppsToFront(displayId, wct, newTask?.taskId) return { transition -> Loading Loading @@ -3131,7 +3143,7 @@ class DesktopTasksController( return { transition -> val activateDeskTransition = if (newTaskIdInFront != null) { DeskTransition.ActiveDeskWithTask( DeskTransition.ActivateDeskWithTask( token = transition, displayId = displayId, deskId = deskId, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/multidesks/DeskTransition.kt +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ sealed interface DeskTransition { } /** A transition to activate a desk by moving an outside task to it. */ data class ActiveDeskWithTask( data class ActivateDeskWithTask( override val token: IBinder, val displayId: Int, val deskId: Int, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/multidesks/DesksTransitionObserver.kt +21 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.desktopmode.multidesks import android.os.IBinder import android.view.Display.INVALID_DISPLAY import android.view.WindowManager.TRANSIT_CHANGE import android.view.WindowManager.TRANSIT_CLOSE import android.window.DesktopExperienceFlags Loading Loading @@ -175,14 +176,29 @@ class DesksTransitionObserver( deskId = deskTransition.deskId, ) } is DeskTransition.ActiveDeskWithTask -> { val withTask = is DeskTransition.ActivateDeskWithTask -> { val deskId = deskTransition.deskId val deskChange = info.changes.find { change -> desksOrganizer.isDeskChange(change, deskId) } if (deskChange != null) { val deskChangeDisplayId = deskChange.taskInfo?.displayId ?: INVALID_DISPLAY if (deskChangeDisplayId != deskTransition.displayId) { logW( "ActivateDeskWithTask: expected displayId=%d but got displayId=%d", deskTransition.displayId, deskChangeDisplayId, ) } } else { logW("ActivateDeskWithTask: did not find desk change") } val taskChange = info.changes.find { change -> change.taskInfo?.taskId == deskTransition.enterTaskId && change.taskInfo?.isVisibleRequested == true && desksOrganizer.getDeskAtEnd(change) == deskTransition.deskId } withTask?.let { if (taskChange != null) { desktopRepository.setActiveDesk( displayId = deskTransition.displayId, deskId = deskTransition.deskId, Loading @@ -193,6 +209,8 @@ class DesksTransitionObserver( taskId = deskTransition.enterTaskId, isVisible = true, ) } else { logW("ActivateDeskWithTask: did not find task change") } } is DeskTransition.DeactivateDesk -> handleDeactivateDeskTransition(info, deskTransition) Loading