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 {
|
try {
|
||||||
int result = Settings.System.getIntForUser(context.getContentResolver(),
|
int result = Settings.System.getIntForUser(context.getContentResolver(),
|
||||||
Settings.System.DESKTOP_MODE, UserHandle.USER_CURRENT);
|
Settings.System.DESKTOP_MODE, UserHandle.USER_CURRENT);
|
||||||
ProtoLog.d(WM_SHELL_DESKTOP_MODE, "isDesktopModeEnabled=%s", result);
|
|
||||||
return result != 0;
|
return result != 0;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ProtoLog.e(WM_SHELL_DESKTOP_MODE, "Failed to read DESKTOP_MODE setting %s", 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.
|
* 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)
|
val added = activeTasks.add(taskId)
|
||||||
if (added) {
|
if (added) {
|
||||||
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
||||||
}
|
}
|
||||||
|
return added
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove task with given [taskId] from active tasks.
|
* 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)
|
val removed = activeTasks.remove(taskId)
|
||||||
if (removed) {
|
if (removed) {
|
||||||
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
activeTasksListeners.onEach { it.onActiveTasksChanged() }
|
||||||
}
|
}
|
||||||
|
return removed
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -87,11 +87,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (DesktopModeStatus.IS_SUPPORTED && taskInfo.isVisible) {
|
if (DesktopModeStatus.IS_SUPPORTED && taskInfo.isVisible) {
|
||||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
if (repository.addActiveTask(taskInfo.taskId)) {
|
||||||
mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId));
|
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||||
mDesktopModeTaskRepository.ifPresent(
|
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, true));
|
}
|
||||||
|
repository.updateVisibleFreeformTasks(taskInfo.taskId, true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,11 +104,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mTasks.remove(taskInfo.taskId);
|
mTasks.remove(taskInfo.taskId);
|
||||||
|
|
||||||
if (DesktopModeStatus.IS_SUPPORTED) {
|
if (DesktopModeStatus.IS_SUPPORTED) {
|
||||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||||
"Removing active freeform task: #%d", taskInfo.taskId);
|
if (repository.removeActiveTask(taskInfo.taskId)) {
|
||||||
mDesktopModeTaskRepository.ifPresent(it -> it.removeActiveTask(taskInfo.taskId));
|
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||||
mDesktopModeTaskRepository.ifPresent(
|
"Removing active freeform task: #%d", taskInfo.taskId);
|
||||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, false));
|
}
|
||||||
|
repository.updateVisibleFreeformTasks(taskInfo.taskId, false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Transitions.ENABLE_SHELL_TRANSITIONS) {
|
if (!Transitions.ENABLE_SHELL_TRANSITIONS) {
|
||||||
@@ -123,13 +127,15 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
|
|||||||
mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo);
|
mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo);
|
||||||
|
|
||||||
if (DesktopModeStatus.IS_SUPPORTED) {
|
if (DesktopModeStatus.IS_SUPPORTED) {
|
||||||
if (taskInfo.isVisible) {
|
mDesktopModeTaskRepository.ifPresent(repository -> {
|
||||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
if (taskInfo.isVisible) {
|
||||||
"Adding active freeform task: #%d", taskInfo.taskId);
|
if (repository.addActiveTask(taskInfo.taskId)) {
|
||||||
mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId));
|
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DESKTOP_MODE,
|
||||||
}
|
"Adding active freeform task: #%d", taskInfo.taskId);
|
||||||
mDesktopModeTaskRepository.ifPresent(
|
}
|
||||||
it -> it.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible));
|
}
|
||||||
|
repository.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user