Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -370,9 +370,10 @@ oneway interface IStatusBar /** * Enters stage split from a current running app. * * @param displayId the id of the current display. * @param leftOrTop indicates where the stage split is. */ void enterStageSplitFromRunningApp(boolean leftOrTop); void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop); /** * Shows the media output switcher dialog. Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMode.java +3 −0 Original line number Diff line number Diff line Loading @@ -53,4 +53,7 @@ public interface DesktopMode { /** Called when requested to go to fullscreen from the current focused desktop app. */ void moveFocusedTaskToFullscreen(int displayId); /** Called when requested to go to split screen from the current focused desktop app. */ void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop); } libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +28 −10 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.annotations.ExternalThread import com.android.wm.shell.common.annotations.ShellMainThread import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT import com.android.wm.shell.desktopmode.DesktopModeTaskRepository.VisibleTasksListener import com.android.wm.shell.desktopmode.DragToDesktopTransitionHandler.DragToDesktopStateListener import com.android.wm.shell.draganddrop.DragAndDropController Loading Loading @@ -388,15 +389,9 @@ class DesktopTasksController( /** Enter fullscreen by moving the focused freeform task in given `displayId` to fullscreen. */ fun enterFullscreen(displayId: Int) { if (DesktopModeStatus.isEnabled()) { shellTaskOrganizer .getRunningTasks(displayId) .find { taskInfo -> taskInfo.isFocused && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM } getFocusedFreeformTask(displayId) ?.let { moveToFullscreenWithAnimation(it, it.positionInParent) } } } /** Move a desktop app to split screen. */ fun moveToSplit(task: RunningTaskInfo) { Loading Loading @@ -876,12 +871,28 @@ class DesktopTasksController( wct.setDensityDpi(taskInfo.token, getDefaultDensityDpi()) } /** Enter split by using the focused desktop task in given `displayId`. */ fun enterSplit( displayId: Int, leftOrTop: Boolean ) { getFocusedFreeformTask(displayId)?.let { requestSplit(it, leftOrTop) } } private fun getFocusedFreeformTask(displayId: Int): RunningTaskInfo? { return shellTaskOrganizer.getRunningTasks(displayId) .find { taskInfo -> taskInfo.isFocused && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM } } /** * Requests a task be transitioned from desktop to split select. Applies needed windowing * changes if this transition is enabled. */ @JvmOverloads fun requestSplit( taskInfo: RunningTaskInfo taskInfo: RunningTaskInfo, leftOrTop: Boolean = false, ) { val windowingMode = taskInfo.windowingMode if (windowingMode == WINDOWING_MODE_FULLSCREEN || windowingMode == WINDOWING_MODE_FREEFORM Loading @@ -889,7 +900,8 @@ class DesktopTasksController( val wct = WindowContainerTransaction() addMoveToSplitChanges(wct, taskInfo) splitScreenController.requestEnterSplitSelect(taskInfo, wct, SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds) if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds) } } Loading Loading @@ -1140,6 +1152,12 @@ class DesktopTasksController( this@DesktopTasksController.enterFullscreen(displayId) } } override fun moveFocusedTaskToStageSplit(displayId: Int, leftOrTop: Boolean) { mainExecutor.execute { this@DesktopTasksController.enterSplit(displayId, leftOrTop) } } } /** The interface for calls from outside the host process. */ Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.wm.shell.common.LaunchAdjacentController import com.android.wm.shell.common.MultiInstanceHelper import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.split.SplitScreenConstants import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createFreeformTask import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createFullscreenTask import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createHomeTask Loading Loading @@ -839,6 +840,22 @@ class DesktopTasksControllerTest : ShellTestCase() { .isEqualTo(WINDOWING_MODE_FULLSCREEN) } fun enterSplit_freeformTaskIsMovedToSplit() { val task1 = setUpFreeformTask() val task2 = setUpFreeformTask() val task3 = setUpFreeformTask() task1.isFocused = false task2.isFocused = true task3.isFocused = false controller.enterSplit(DEFAULT_DISPLAY, false) verify(splitScreenController).requestEnterSplitSelect(task2, any(), SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT, task2.configuration.windowConfiguration.bounds) } private fun setUpFreeformTask(displayId: Int = DEFAULT_DISPLAY): RunningTaskInfo { val task = createFreeformTask(displayId) whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task) Loading packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +7 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; Loading Loading @@ -111,6 +112,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.StatusBarWindowCallback; import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.unfold.progress.UnfoldTransitionProgressForwarder; import com.android.wm.shell.desktopmode.DesktopModeStatus; import com.android.wm.shell.sysui.ShellInterface; import dagger.Lazy; Loading Loading @@ -673,9 +675,13 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } @Override public void enterStageSplitFromRunningApp(boolean leftOrTop) { public void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop) { if (mOverviewProxy != null) { try { if (DesktopModeStatus.isEnabled() && (sysUiState.getFlags() & SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE) != 0) { return; } mOverviewProxy.enterStageSplitFromRunningApp(leftOrTop); } catch (RemoteException e) { Log.w(TAG_OPS, "Unable to enter stage split from the current running app"); Loading Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -370,9 +370,10 @@ oneway interface IStatusBar /** * Enters stage split from a current running app. * * @param displayId the id of the current display. * @param leftOrTop indicates where the stage split is. */ void enterStageSplitFromRunningApp(boolean leftOrTop); void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop); /** * Shows the media output switcher dialog. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMode.java +3 −0 Original line number Diff line number Diff line Loading @@ -53,4 +53,7 @@ public interface DesktopMode { /** Called when requested to go to fullscreen from the current focused desktop app. */ void moveFocusedTaskToFullscreen(int displayId); /** Called when requested to go to split screen from the current focused desktop app. */ void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop); }
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopTasksController.kt +28 −10 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.annotations.ExternalThread import com.android.wm.shell.common.annotations.ShellMainThread import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT import com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT import com.android.wm.shell.desktopmode.DesktopModeTaskRepository.VisibleTasksListener import com.android.wm.shell.desktopmode.DragToDesktopTransitionHandler.DragToDesktopStateListener import com.android.wm.shell.draganddrop.DragAndDropController Loading Loading @@ -388,15 +389,9 @@ class DesktopTasksController( /** Enter fullscreen by moving the focused freeform task in given `displayId` to fullscreen. */ fun enterFullscreen(displayId: Int) { if (DesktopModeStatus.isEnabled()) { shellTaskOrganizer .getRunningTasks(displayId) .find { taskInfo -> taskInfo.isFocused && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM } getFocusedFreeformTask(displayId) ?.let { moveToFullscreenWithAnimation(it, it.positionInParent) } } } /** Move a desktop app to split screen. */ fun moveToSplit(task: RunningTaskInfo) { Loading Loading @@ -876,12 +871,28 @@ class DesktopTasksController( wct.setDensityDpi(taskInfo.token, getDefaultDensityDpi()) } /** Enter split by using the focused desktop task in given `displayId`. */ fun enterSplit( displayId: Int, leftOrTop: Boolean ) { getFocusedFreeformTask(displayId)?.let { requestSplit(it, leftOrTop) } } private fun getFocusedFreeformTask(displayId: Int): RunningTaskInfo? { return shellTaskOrganizer.getRunningTasks(displayId) .find { taskInfo -> taskInfo.isFocused && taskInfo.windowingMode == WINDOWING_MODE_FREEFORM } } /** * Requests a task be transitioned from desktop to split select. Applies needed windowing * changes if this transition is enabled. */ @JvmOverloads fun requestSplit( taskInfo: RunningTaskInfo taskInfo: RunningTaskInfo, leftOrTop: Boolean = false, ) { val windowingMode = taskInfo.windowingMode if (windowingMode == WINDOWING_MODE_FULLSCREEN || windowingMode == WINDOWING_MODE_FREEFORM Loading @@ -889,7 +900,8 @@ class DesktopTasksController( val wct = WindowContainerTransaction() addMoveToSplitChanges(wct, taskInfo) splitScreenController.requestEnterSplitSelect(taskInfo, wct, SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds) if (leftOrTop) SPLIT_POSITION_TOP_OR_LEFT else SPLIT_POSITION_BOTTOM_OR_RIGHT, taskInfo.configuration.windowConfiguration.bounds) } } Loading Loading @@ -1140,6 +1152,12 @@ class DesktopTasksController( this@DesktopTasksController.enterFullscreen(displayId) } } override fun moveFocusedTaskToStageSplit(displayId: Int, leftOrTop: Boolean) { mainExecutor.execute { this@DesktopTasksController.enterSplit(displayId, leftOrTop) } } } /** The interface for calls from outside the host process. */ Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopTasksControllerTest.kt +17 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ import com.android.wm.shell.common.LaunchAdjacentController import com.android.wm.shell.common.MultiInstanceHelper import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.split.SplitScreenConstants import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createFreeformTask import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createFullscreenTask import com.android.wm.shell.desktopmode.DesktopTestHelpers.Companion.createHomeTask Loading Loading @@ -839,6 +840,22 @@ class DesktopTasksControllerTest : ShellTestCase() { .isEqualTo(WINDOWING_MODE_FULLSCREEN) } fun enterSplit_freeformTaskIsMovedToSplit() { val task1 = setUpFreeformTask() val task2 = setUpFreeformTask() val task3 = setUpFreeformTask() task1.isFocused = false task2.isFocused = true task3.isFocused = false controller.enterSplit(DEFAULT_DISPLAY, false) verify(splitScreenController).requestEnterSplitSelect(task2, any(), SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT, task2.configuration.windowConfiguration.bounds) } private fun setUpFreeformTask(displayId: Int = DEFAULT_DISPLAY): RunningTaskInfo { val task = createFreeformTask(displayId) whenever(shellTaskOrganizer.getRunningTaskInfo(task.taskId)).thenReturn(task) Loading
packages/SystemUI/src/com/android/systemui/recents/OverviewProxyService.java +7 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DOZING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_DEVICE_DREAMING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_GOING_AWAY; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; Loading Loading @@ -111,6 +112,7 @@ import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.phone.StatusBarWindowCallback; import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.unfold.progress.UnfoldTransitionProgressForwarder; import com.android.wm.shell.desktopmode.DesktopModeStatus; import com.android.wm.shell.sysui.ShellInterface; import dagger.Lazy; Loading Loading @@ -673,9 +675,13 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis } @Override public void enterStageSplitFromRunningApp(boolean leftOrTop) { public void moveFocusedTaskToStageSplit(int displayId, boolean leftOrTop) { if (mOverviewProxy != null) { try { if (DesktopModeStatus.isEnabled() && (sysUiState.getFlags() & SYSUI_STATE_FREEFORM_ACTIVE_IN_DESKTOP_MODE) != 0) { return; } mOverviewProxy.enterStageSplitFromRunningApp(leftOrTop); } catch (RemoteException e) { Log.w(TAG_OPS, "Unable to enter stage split from the current running app"); Loading