Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +0 −1 Original line number Diff line number Diff line Loading @@ -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); Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeTaskRepository.kt +8 −2 Original line number Diff line number Diff line Loading @@ -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 } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +23 −17 Original line number Diff line number Diff line Loading @@ -87,11 +87,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { } if (DesktopModeStatus.IS_SUPPORTED && taskInfo.isVisible) { mDesktopModeTaskRepository.ifPresent(repository -> { if (repository.addActiveTask(taskInfo.taskId)) { 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)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, true); }); } } Loading @@ -102,11 +104,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { mTasks.remove(taskInfo.taskId); if (DesktopModeStatus.IS_SUPPORTED) { mDesktopModeTaskRepository.ifPresent(repository -> { if (repository.removeActiveTask(taskInfo.taskId)) { 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)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, false); }); } if (!Transitions.ENABLE_SHELL_TRANSITIONS) { Loading @@ -123,13 +127,15 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo); if (DesktopModeStatus.IS_SUPPORTED) { 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); mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId)); } mDesktopModeTaskRepository.ifPresent( it -> it.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible); }); } } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeStatus.java +0 −1 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeTaskRepository.kt +8 −2 Original line number Diff line number Diff line Loading @@ -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 } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/freeform/FreeformTaskListener.java +23 −17 Original line number Diff line number Diff line Loading @@ -87,11 +87,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { } if (DesktopModeStatus.IS_SUPPORTED && taskInfo.isVisible) { mDesktopModeTaskRepository.ifPresent(repository -> { if (repository.addActiveTask(taskInfo.taskId)) { 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)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, true); }); } } Loading @@ -102,11 +104,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { mTasks.remove(taskInfo.taskId); if (DesktopModeStatus.IS_SUPPORTED) { mDesktopModeTaskRepository.ifPresent(repository -> { if (repository.removeActiveTask(taskInfo.taskId)) { 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)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, false); }); } if (!Transitions.ENABLE_SHELL_TRANSITIONS) { Loading @@ -123,13 +127,15 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener { mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo); if (DesktopModeStatus.IS_SUPPORTED) { 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); mDesktopModeTaskRepository.ifPresent(it -> it.addActiveTask(taskInfo.taskId)); } mDesktopModeTaskRepository.ifPresent( it -> it.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible)); } repository.updateVisibleFreeformTasks(taskInfo.taskId, taskInfo.isVisible); }); } } Loading