Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +14 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,20 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll } } /** * Moves a specifc task to the front. * @param taskInfo the task to show in front. */ public void moveTaskToFront(RunningTaskInfo taskInfo) { WindowContainerTransaction wct = new WindowContainerTransaction(); wct.reorder(taskInfo.token, true /* onTop */); if (Transitions.ENABLE_SHELL_TRANSITIONS) { mTransitions.startTransition(TRANSIT_TO_FRONT, wct, null); } else { mShellTaskOrganizer.applyTransaction(wct); } } /** * Turn desktop mode on or off * @param active the desired state for desktop mode setting Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +11 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,17 @@ class DesktopTasksController( } } /** Move a task to the front **/ fun moveTaskToFront(taskInfo: ActivityManager.RunningTaskInfo) { val wct = WindowContainerTransaction() wct.reorder(taskInfo.token, true) if (Transitions.ENABLE_SHELL_TRANSITIONS) { transitions.startTransition(TRANSIT_TO_FRONT, wct, null /* handler */) } else { shellTaskOrganizer.applyTransaction(wct) } } /** * Get windowing move for a given `taskId` * Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +9 −0 Original line number Diff line number Diff line Loading @@ -307,6 +307,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { } else if (id == R.id.back_button) { mTaskOperations.injectBackKey(); } else if (id == R.id.caption_handle || id == R.id.open_menu_button) { moveTaskToFront(mTaskOrganizer.getRunningTaskInfo(mTaskId)); decoration.createHandleMenu(); } else if (id == R.id.desktop_button) { mDesktopModeController.ifPresent(c -> c.setDesktopModeActive(true)); Loading @@ -327,9 +328,17 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { if (id != R.id.caption_handle && id != R.id.desktop_mode_caption) { return false; } moveTaskToFront(mTaskOrganizer.getRunningTaskInfo(mTaskId)); return mDragDetector.onMotionEvent(e); } private void moveTaskToFront(RunningTaskInfo taskInfo) { if (!taskInfo.isFocused) { mDesktopTasksController.ifPresent(c -> c.moveTaskToFront(taskInfo)); mDesktopModeController.ifPresent(c -> c.moveTaskToFront(taskInfo)); } } /** * @param e {@link MotionEvent} to process * @return {@code true} if the motion event is handled. Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeController.java +14 −0 Original line number Diff line number Diff line Loading @@ -311,6 +311,20 @@ public class DesktopModeController implements RemoteCallable<DesktopModeControll } } /** * Moves a specifc task to the front. * @param taskInfo the task to show in front. */ public void moveTaskToFront(RunningTaskInfo taskInfo) { WindowContainerTransaction wct = new WindowContainerTransaction(); wct.reorder(taskInfo.token, true /* onTop */); if (Transitions.ENABLE_SHELL_TRANSITIONS) { mTransitions.startTransition(TRANSIT_TO_FRONT, wct, null); } else { mShellTaskOrganizer.applyTransaction(wct); } } /** * Turn desktop mode on or off * @param active the desired state for desktop mode setting Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +11 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,17 @@ class DesktopTasksController( } } /** Move a task to the front **/ fun moveTaskToFront(taskInfo: ActivityManager.RunningTaskInfo) { val wct = WindowContainerTransaction() wct.reorder(taskInfo.token, true) if (Transitions.ENABLE_SHELL_TRANSITIONS) { transitions.startTransition(TRANSIT_TO_FRONT, wct, null /* handler */) } else { shellTaskOrganizer.applyTransaction(wct) } } /** * Get windowing move for a given `taskId` * Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +9 −0 Original line number Diff line number Diff line Loading @@ -307,6 +307,7 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { } else if (id == R.id.back_button) { mTaskOperations.injectBackKey(); } else if (id == R.id.caption_handle || id == R.id.open_menu_button) { moveTaskToFront(mTaskOrganizer.getRunningTaskInfo(mTaskId)); decoration.createHandleMenu(); } else if (id == R.id.desktop_button) { mDesktopModeController.ifPresent(c -> c.setDesktopModeActive(true)); Loading @@ -327,9 +328,17 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel { if (id != R.id.caption_handle && id != R.id.desktop_mode_caption) { return false; } moveTaskToFront(mTaskOrganizer.getRunningTaskInfo(mTaskId)); return mDragDetector.onMotionEvent(e); } private void moveTaskToFront(RunningTaskInfo taskInfo) { if (!taskInfo.isFocused) { mDesktopTasksController.ifPresent(c -> c.moveTaskToFront(taskInfo)); mDesktopModeController.ifPresent(c -> c.moveTaskToFront(taskInfo)); } } /** * @param e {@link MotionEvent} to process * @return {@code true} if the motion event is handled. Loading