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

This commit is contained in:
Ats Jenk
2023-02-23 18:30:19 +00:00
committed by Android (Google) Code Review

View File

@@ -85,7 +85,7 @@ class DesktopTasksController(
fun showDesktopApps() { fun showDesktopApps() {
ProtoLog.v(WM_SHELL_DESKTOP_MODE, "showDesktopApps") ProtoLog.v(WM_SHELL_DESKTOP_MODE, "showDesktopApps")
val wct = WindowContainerTransaction() val wct = WindowContainerTransaction()
bringDesktopAppsToFront(wct, force = true) bringDesktopAppsToFront(wct)
// Execute transaction if there are pending operations // Execute transaction if there are pending operations
if (!wct.isEmpty) { if (!wct.isEmpty) {
@@ -156,19 +156,9 @@ class DesktopTasksController(
?: WINDOWING_MODE_UNDEFINED ?: WINDOWING_MODE_UNDEFINED
} }
private fun bringDesktopAppsToFront(wct: WindowContainerTransaction, force: Boolean = false) { private fun bringDesktopAppsToFront(wct: WindowContainerTransaction) {
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
}
ProtoLog.v(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront") ProtoLog.v(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront")
val activeTasks = desktopModeTaskRepository.getActiveTasks()
// First move home to front and then other tasks on top of it // First move home to front and then other tasks on top of it
moveHomeTaskToFront(wct) moveHomeTaskToFront(wct)