Clean up desktop mode logging
We were logging "isDesktopModeActive" each time it was called, spamming logs. Removed it. Each time visible task info was updated, we logged that an active task was added, even if the task was already marked as active. Updated logging to only log when task is first time added to active. Same with removing from active tasks. Only logging when it is actually removed from active tasks. Bug: 244348395 Test: manual, updating logging, verified that the logs are printed Change-Id: I55075c222763c6cb08f2d0e6770aed831b78a369
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