Merge "Add and update log statements for desktop proto" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4dae2bfd28
@@ -23,6 +23,8 @@ import android.util.SparseArray
|
|||||||
import androidx.core.util.forEach
|
import androidx.core.util.forEach
|
||||||
import androidx.core.util.keyIterator
|
import androidx.core.util.keyIterator
|
||||||
import androidx.core.util.valueIterator
|
import androidx.core.util.valueIterator
|
||||||
|
import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE
|
||||||
|
import com.android.wm.shell.util.KtProtoLog
|
||||||
import java.util.concurrent.Executor
|
import java.util.concurrent.Executor
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
|
|
||||||
@@ -140,6 +142,12 @@ class DesktopModeTaskRepository {
|
|||||||
|
|
||||||
val added = displayData.getOrCreate(displayId).activeTasks.add(taskId)
|
val added = displayData.getOrCreate(displayId).activeTasks.add(taskId)
|
||||||
if (added) {
|
if (added) {
|
||||||
|
KtProtoLog.d(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTaskRepo: add active task=%d displayId=%d",
|
||||||
|
taskId,
|
||||||
|
displayId
|
||||||
|
)
|
||||||
activeTasksListeners.onEach { it.onActiveTasksChanged(displayId) }
|
activeTasksListeners.onEach { it.onActiveTasksChanged(displayId) }
|
||||||
}
|
}
|
||||||
return added
|
return added
|
||||||
@@ -158,6 +166,9 @@ class DesktopModeTaskRepository {
|
|||||||
result = true
|
result = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (result) {
|
||||||
|
KtProtoLog.d(WM_SHELL_DESKTOP_MODE, "DesktopTaskRepo: remove active task=%d", taskId)
|
||||||
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,6 +232,17 @@ class DesktopModeTaskRepository {
|
|||||||
displayData[displayId]?.visibleTasks?.remove(taskId)
|
displayData[displayId]?.visibleTasks?.remove(taskId)
|
||||||
}
|
}
|
||||||
val newCount = getVisibleTaskCount(displayId)
|
val newCount = getVisibleTaskCount(displayId)
|
||||||
|
|
||||||
|
if (prevCount != newCount) {
|
||||||
|
KtProtoLog.d(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTaskRepo: update task visibility taskId=%d visible=%b displayId=%d",
|
||||||
|
taskId,
|
||||||
|
visible,
|
||||||
|
displayId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Check if count changed and if there was no tasks or this is the first task
|
// Check if count changed and if there was no tasks or this is the first task
|
||||||
if (prevCount != newCount && (prevCount == 0 || newCount == 0)) {
|
if (prevCount != newCount && (prevCount == 0 || newCount == 0)) {
|
||||||
notifyVisibleTaskListeners(displayId, newCount > 0)
|
notifyVisibleTaskListeners(displayId, newCount > 0)
|
||||||
@@ -244,6 +266,11 @@ class DesktopModeTaskRepository {
|
|||||||
* Add (or move if it already exists) the task to the top of the ordered list.
|
* Add (or move if it already exists) the task to the top of the ordered list.
|
||||||
*/
|
*/
|
||||||
fun addOrMoveFreeformTaskToTop(taskId: Int) {
|
fun addOrMoveFreeformTaskToTop(taskId: Int) {
|
||||||
|
KtProtoLog.d(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTaskRepo: add or move task to top taskId=%d",
|
||||||
|
taskId
|
||||||
|
)
|
||||||
if (freeformTasksInZOrder.contains(taskId)) {
|
if (freeformTasksInZOrder.contains(taskId)) {
|
||||||
freeformTasksInZOrder.remove(taskId)
|
freeformTasksInZOrder.remove(taskId)
|
||||||
}
|
}
|
||||||
@@ -254,6 +281,11 @@ class DesktopModeTaskRepository {
|
|||||||
* Remove the task from the ordered list.
|
* Remove the task from the ordered list.
|
||||||
*/
|
*/
|
||||||
fun removeFreeformTask(taskId: Int) {
|
fun removeFreeformTask(taskId: Int) {
|
||||||
|
KtProtoLog.d(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTaskRepo: remove freeform task from ordered list taskId=%d",
|
||||||
|
taskId
|
||||||
|
)
|
||||||
freeformTasksInZOrder.remove(taskId)
|
freeformTasksInZOrder.remove(taskId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class DesktopTasksController(
|
|||||||
|
|
||||||
/** Show all tasks, that are part of the desktop, on top of launcher */
|
/** Show all tasks, that are part of the desktop, on top of launcher */
|
||||||
fun showDesktopApps(displayId: Int) {
|
fun showDesktopApps(displayId: Int) {
|
||||||
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "showDesktopApps")
|
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: showDesktopApps")
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
// TODO(b/278084491): pass in display id
|
// TODO(b/278084491): pass in display id
|
||||||
bringDesktopAppsToFront(displayId, wct)
|
bringDesktopAppsToFront(displayId, wct)
|
||||||
@@ -130,8 +130,11 @@ class DesktopTasksController(
|
|||||||
|
|
||||||
/** Move a task to desktop */
|
/** Move a task to desktop */
|
||||||
fun moveToDesktop(task: RunningTaskInfo) {
|
fun moveToDesktop(task: RunningTaskInfo) {
|
||||||
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "moveToDesktop: %d", task.taskId)
|
KtProtoLog.v(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTasksController: moveToDesktop taskId=%d",
|
||||||
|
task.taskId
|
||||||
|
)
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
// Bring other apps to front first
|
// Bring other apps to front first
|
||||||
bringDesktopAppsToFront(task.displayId, wct)
|
bringDesktopAppsToFront(task.displayId, wct)
|
||||||
@@ -147,10 +150,12 @@ class DesktopTasksController(
|
|||||||
* Moves a single task to freeform and sets the taskBounds to the passed in bounds,
|
* Moves a single task to freeform and sets the taskBounds to the passed in bounds,
|
||||||
* startBounds
|
* startBounds
|
||||||
*/
|
*/
|
||||||
fun moveToFreeform(
|
fun moveToFreeform(taskInfo: RunningTaskInfo, startBounds: Rect) {
|
||||||
taskInfo: RunningTaskInfo,
|
KtProtoLog.v(
|
||||||
startBounds: Rect
|
WM_SHELL_DESKTOP_MODE,
|
||||||
) {
|
"DesktopTasksController: moveToFreeform with bounds taskId=%d",
|
||||||
|
taskInfo.taskId
|
||||||
|
)
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
moveHomeTaskToFront(wct)
|
moveHomeTaskToFront(wct)
|
||||||
addMoveToDesktopChanges(wct, taskInfo.getToken())
|
addMoveToDesktopChanges(wct, taskInfo.getToken())
|
||||||
@@ -165,10 +170,12 @@ class DesktopTasksController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Brings apps to front and sets freeform task bounds */
|
/** Brings apps to front and sets freeform task bounds */
|
||||||
private fun moveToDesktopWithAnimation(
|
private fun moveToDesktopWithAnimation(taskInfo: RunningTaskInfo, freeformBounds: Rect) {
|
||||||
taskInfo: RunningTaskInfo,
|
KtProtoLog.v(
|
||||||
freeformBounds: Rect
|
WM_SHELL_DESKTOP_MODE,
|
||||||
) {
|
"DesktopTasksController: moveToDesktop with animation taskId=%d",
|
||||||
|
taskInfo.taskId
|
||||||
|
)
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
bringDesktopAppsToFront(taskInfo.displayId, wct)
|
bringDesktopAppsToFront(taskInfo.displayId, wct)
|
||||||
addMoveToDesktopChanges(wct, taskInfo.getToken())
|
addMoveToDesktopChanges(wct, taskInfo.getToken())
|
||||||
@@ -190,7 +197,11 @@ class DesktopTasksController(
|
|||||||
|
|
||||||
/** Move a task to fullscreen */
|
/** Move a task to fullscreen */
|
||||||
fun moveToFullscreen(task: RunningTaskInfo) {
|
fun moveToFullscreen(task: RunningTaskInfo) {
|
||||||
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "moveToFullscreen: %d", task.taskId)
|
KtProtoLog.v(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTasksController: moveToFullscreen taskId=%d",
|
||||||
|
task.taskId
|
||||||
|
)
|
||||||
|
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
addMoveToFullscreenChanges(wct, task.token)
|
addMoveToFullscreenChanges(wct, task.token)
|
||||||
@@ -206,6 +217,11 @@ class DesktopTasksController(
|
|||||||
* status bar area
|
* status bar area
|
||||||
*/
|
*/
|
||||||
fun cancelMoveToFreeform(task: RunningTaskInfo, position: Point) {
|
fun cancelMoveToFreeform(task: RunningTaskInfo, position: Point) {
|
||||||
|
KtProtoLog.v(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTasksController: cancelMoveToFreeform taskId=%d",
|
||||||
|
task.taskId
|
||||||
|
)
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
addMoveToFullscreenChanges(wct, task.token)
|
addMoveToFullscreenChanges(wct, task.token)
|
||||||
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||||
@@ -218,6 +234,11 @@ class DesktopTasksController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun moveToFullscreenWithAnimation(task: RunningTaskInfo, position: Point) {
|
private fun moveToFullscreenWithAnimation(task: RunningTaskInfo, position: Point) {
|
||||||
|
KtProtoLog.v(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTasksController: moveToFullscreen with animation taskId=%d",
|
||||||
|
task.taskId
|
||||||
|
)
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
addMoveToFullscreenChanges(wct, task.token)
|
addMoveToFullscreenChanges(wct, task.token)
|
||||||
|
|
||||||
@@ -230,8 +251,14 @@ class DesktopTasksController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move a task to the front **/
|
/** Move a task to the front */
|
||||||
fun moveTaskToFront(taskInfo: RunningTaskInfo) {
|
fun moveTaskToFront(taskInfo: RunningTaskInfo) {
|
||||||
|
KtProtoLog.v(
|
||||||
|
WM_SHELL_DESKTOP_MODE,
|
||||||
|
"DesktopTasksController: moveTaskToFront taskId=%d",
|
||||||
|
taskInfo.taskId
|
||||||
|
)
|
||||||
|
|
||||||
val wct = WindowContainerTransaction()
|
val wct = WindowContainerTransaction()
|
||||||
wct.reorder(taskInfo.token, true)
|
wct.reorder(taskInfo.token, true)
|
||||||
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
if (Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||||
@@ -316,7 +343,7 @@ class DesktopTasksController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun bringDesktopAppsToFront(displayId: Int, wct: WindowContainerTransaction) {
|
private fun bringDesktopAppsToFront(displayId: Int, wct: WindowContainerTransaction) {
|
||||||
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "bringDesktopAppsToFront")
|
KtProtoLog.v(WM_SHELL_DESKTOP_MODE, "DesktopTasksController: bringDesktopAppsToFront")
|
||||||
val activeTasks = desktopModeTaskRepository.getActiveTasks(displayId)
|
val activeTasks = desktopModeTaskRepository.getActiveTasks(displayId)
|
||||||
|
|
||||||
// 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
|
||||||
@@ -399,7 +426,7 @@ class DesktopTasksController(
|
|||||||
if (activeTasks.any { desktopModeTaskRepository.isVisibleTask(it) }) {
|
if (activeTasks.any { desktopModeTaskRepository.isVisibleTask(it) }) {
|
||||||
KtProtoLog.d(
|
KtProtoLog.d(
|
||||||
WM_SHELL_DESKTOP_MODE,
|
WM_SHELL_DESKTOP_MODE,
|
||||||
"DesktopTasksController#handleRequest: switch fullscreen task to freeform," +
|
"DesktopTasksController: switch fullscreen task to freeform on transition" +
|
||||||
" taskId=%d",
|
" taskId=%d",
|
||||||
task.taskId
|
task.taskId
|
||||||
)
|
)
|
||||||
@@ -416,7 +443,7 @@ class DesktopTasksController(
|
|||||||
if (activeTasks.none { desktopModeTaskRepository.isVisibleTask(it) }) {
|
if (activeTasks.none { desktopModeTaskRepository.isVisibleTask(it) }) {
|
||||||
KtProtoLog.d(
|
KtProtoLog.d(
|
||||||
WM_SHELL_DESKTOP_MODE,
|
WM_SHELL_DESKTOP_MODE,
|
||||||
"DesktopTasksController#handleRequest: switch freeform task to fullscreen," +
|
"DesktopTasksController: switch freeform task to fullscreen oon transition" +
|
||||||
" taskId=%d",
|
" taskId=%d",
|
||||||
task.taskId
|
task.taskId
|
||||||
)
|
)
|
||||||
@@ -627,8 +654,6 @@ class DesktopTasksController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** The interface for calls from outside the host process. */
|
/** The interface for calls from outside the host process. */
|
||||||
@BinderThread
|
@BinderThread
|
||||||
private class IDesktopModeImpl(private var controller: DesktopTasksController?) :
|
private class IDesktopModeImpl(private var controller: DesktopTasksController?) :
|
||||||
|
|||||||
Reference in New Issue
Block a user