Merge "Clean up desktop mode logging" into tm-qpr-dev am: fac53656ed
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20283458 Change-Id: I73491a0e1956c5bdef673b1403bd358766c0f2a6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -48,7 +48,6 @@ public class DesktopModeStatus {
|
||||
try {
|
||||
int result = Settings.System.getIntForUser(context.getContentResolver(),
|
||||
Settings.System.DESKTOP_MODE, UserHandle.USER_CURRENT);
|
||||
ProtoLog.d(WM_SHELL_DESKTOP_MODE, "isDesktopModeEnabled=%s", result);
|
||||
return result != 0;
|
||||
} catch (Exception e) {
|
||||
ProtoLog.e(WM_SHELL_DESKTOP_MODE, "Failed to read DESKTOP_MODE setting %s", e);
|
||||
|
||||
@@ -69,22 +69,28 @@ class DesktopModeTaskRepository {
|
||||
|
||||
/**
|
||||
* Mark a task with given [taskId] as active.
|
||||
*
|
||||
* @return `true` if the task was not active
|
||||
*/
|
||||
fun addActiveTask(taskId: Int) {
|
||||
fun addActiveTask(taskId: Int): Boolean {
|
||||
val added = activeTasks.add(taskId)
|
||||
if (added) {
|
||||
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
||||
}
|
||||
return added
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove task with given [taskId] from active tasks.
|
||||
*
|
||||
* @return `true` if the task was active
|
||||
*/
|
||||
fun removeActiveTask(taskId: Int) {
|
||||
fun removeActiveTask(taskId: Int): Boolean {
|
||||
val removed = activeTasks.remove(taskId)
|
||||
if (removed) {
|
||||
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
||||
}
|
||||
return removed
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -87,11 +87,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
}
|
||||
|
||||
if (DesktopModeStatus.IS_SUPPORTED && taskInfo.isVisible) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||
mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId));
|
||||
mDesktopModeTaskRepository.ifPresent(
|
||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, true));
|
||||
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||
if (repository.addActiveTask(taskInfo.taskId)) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||
}
|
||||
repository.updateVisibleFreeformTasks(taskInfo.taskId, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,11 +104,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
mTasks.remove(taskInfo.taskId);
|
||||
|
||||
if (DesktopModeStatus.IS_SUPPORTED) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Removing active freeform task: #%d", taskInfo.taskId);
|
||||
mDesktopModeTaskRepository.ifPresent(it -> it.removeActiveTask(taskInfo.taskId));
|
||||
mDesktopModeTaskRepository.ifPresent(
|
||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, false));
|
||||
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||
if (repository.removeActiveTask(taskInfo.taskId)) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Removing active freeform task: #%d", taskInfo.taskId);
|
||||
}
|
||||
repository.updateVisibleFreeformTasks(taskInfo.taskId, false);
|
||||
});
|
||||
}
|
||||
|
||||
if (!Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||
@@ -123,13 +127,15 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo);
|
||||
|
||||
if (DesktopModeStatus.IS_SUPPORTED) {
|
||||
if (taskInfo.isVisible) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||
mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId));
|
||||
}
|
||||
mDesktopModeTaskRepository.ifPresent(
|
||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible));
|
||||
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||
if (taskInfo.isVisible) {
|
||||
if (repository.addActiveTask(taskInfo.taskId)) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||
}
|
||||
}
|
||||
repository.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user