Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +4 −3 Original line number Original line Diff line number Diff line Loading @@ -129,9 +129,10 @@ interface ISplitScreen { /** /** * Start a pair of intents in one transition. * Start a pair of intents in one transition. */ */ oneway void startIntents(in PendingIntent pendingIntent1, in Bundle options1, oneway void startIntents(in PendingIntent pendingIntent1, in ShortcutInfo shortcutInfo1, in PendingIntent pendingIntent2, in Bundle options2, int splitPosition, in Bundle options1, in PendingIntent pendingIntent2, in ShortcutInfo shortcutInfo2, float splitRatio, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19; in Bundle options2, int splitPosition, float splitRatio, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19; /** /** * Blocking call that notifies and gets additional split-screen targets when entering * Blocking call that notifies and gets additional split-screen targets when entering Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +38 −3 Original line number Original line Diff line number Diff line Loading @@ -626,6 +626,35 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, splitPosition, splitRatio, adapter, instanceId); splitPosition, splitRatio, adapter, instanceId); } } private void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { Intent fillInIntent1 = null; Intent fillInIntent2 = null; final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1); final String packageName2 = SplitScreenUtils.getPackageName(pendingIntent2); if (samePackage(packageName1, packageName2)) { if (supportMultiInstancesSplit(packageName1)) { fillInIntent1 = new Intent(); fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent2 = new Intent(); fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK"); } else { pendingIntent2 = null; ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Cancel entering split as not supporting multi-instances"); Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text, Toast.LENGTH_SHORT).show(); } } mStageCoordinator.startIntents(pendingIntent1, fillInIntent1, shortcutInfo1, options1, pendingIntent2, fillInIntent2, shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition, instanceId); } @Override @Override public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { Loading Loading @@ -1066,11 +1095,17 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } @Override @Override public void startIntents(PendingIntent pendingIntent1, @Nullable Bundle options1, public void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1, PendingIntent pendingIntent2, @Nullable Bundle options2, @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { // TODO(b/259368992): To be implemented. executeRemoteCallWithTaskPermission(mController, "startIntents", (controller) -> controller.startIntents(pendingIntent1, shortcutInfo1, options1, pendingIntent2, shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition, instanceId) ); } } @Override @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +40 −0 Original line number Original line Diff line number Diff line Loading @@ -682,6 +682,46 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, setEnterInstanceId(instanceId); setEnterInstanceId(instanceId); } } void startIntents(PendingIntent pendingIntent1, Intent fillInIntent1, @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, PendingIntent pendingIntent2, Intent fillInIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (!mMainStage.isActive()) { // Build a request WCT that will launch both apps such that task 0 is on the main stage // while task 1 is on the side stage. mMainStage.activate(wct, false /* reparent */); } prepareEvictChildTasksIfSplitActive(wct); mSplitLayout.setDivideRatio(splitRatio); updateWindowBounds(mSplitLayout, wct); wct.reorder(mRootTaskInfo.token, true); setRootForceTranslucent(false, wct); setSideStagePosition(splitPosition, wct); options1 = options1 != null ? options1 : new Bundle(); addActivityOptions(options1, mSideStage); if (shortcutInfo1 != null) { wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1); } else { wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); } options2 = options2 != null ? options2 : new Bundle(); addActivityOptions(options2, mMainStage); if (shortcutInfo2 != null) { wct.startShortcut(mContext.getPackageName(), shortcutInfo2, options2); } else { wct.sendPendingIntent(pendingIntent2, fillInIntent2, options2); } mSplitTransitions.startEnterTransition( TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null, null); setEnterInstanceId(instanceId); } /** Starts a pair of tasks using legacy transition. */ /** Starts a pair of tasks using legacy transition. */ void startTasksWithLegacyTransition(int taskId1, @Nullable Bundle options1, void startTasksWithLegacyTransition(int taskId1, @Nullable Bundle options1, int taskId2, @Nullable Bundle options2, @SplitPosition int splitPosition, int taskId2, @Nullable Bundle options2, @SplitPosition int splitPosition, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +4 −3 Original line number Original line Diff line number Diff line Loading @@ -129,9 +129,10 @@ interface ISplitScreen { /** /** * Start a pair of intents in one transition. * Start a pair of intents in one transition. */ */ oneway void startIntents(in PendingIntent pendingIntent1, in Bundle options1, oneway void startIntents(in PendingIntent pendingIntent1, in ShortcutInfo shortcutInfo1, in PendingIntent pendingIntent2, in Bundle options2, int splitPosition, in Bundle options1, in PendingIntent pendingIntent2, in ShortcutInfo shortcutInfo2, float splitRatio, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19; in Bundle options2, int splitPosition, float splitRatio, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19; /** /** * Blocking call that notifies and gets additional split-screen targets when entering * Blocking call that notifies and gets additional split-screen targets when entering Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +38 −3 Original line number Original line Diff line number Diff line Loading @@ -626,6 +626,35 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, splitPosition, splitRatio, adapter, instanceId); splitPosition, splitRatio, adapter, instanceId); } } private void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { Intent fillInIntent1 = null; Intent fillInIntent2 = null; final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1); final String packageName2 = SplitScreenUtils.getPackageName(pendingIntent2); if (samePackage(packageName1, packageName2)) { if (supportMultiInstancesSplit(packageName1)) { fillInIntent1 = new Intent(); fillInIntent1.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); fillInIntent2 = new Intent(); fillInIntent2.addFlags(FLAG_ACTIVITY_MULTIPLE_TASK); ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Adding MULTIPLE_TASK"); } else { pendingIntent2 = null; ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Cancel entering split as not supporting multi-instances"); Toast.makeText(mContext, R.string.dock_multi_instances_not_supported_text, Toast.LENGTH_SHORT).show(); } } mStageCoordinator.startIntents(pendingIntent1, fillInIntent1, shortcutInfo1, options1, pendingIntent2, fillInIntent2, shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition, instanceId); } @Override @Override public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, public void startIntent(PendingIntent intent, @Nullable Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { @SplitPosition int position, @Nullable Bundle options) { Loading Loading @@ -1066,11 +1095,17 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } } @Override @Override public void startIntents(PendingIntent pendingIntent1, @Nullable Bundle options1, public void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1, PendingIntent pendingIntent2, @Nullable Bundle options2, @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { // TODO(b/259368992): To be implemented. executeRemoteCallWithTaskPermission(mController, "startIntents", (controller) -> controller.startIntents(pendingIntent1, shortcutInfo1, options1, pendingIntent2, shortcutInfo2, options2, splitPosition, splitRatio, remoteTransition, instanceId) ); } } @Override @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +40 −0 Original line number Original line Diff line number Diff line Loading @@ -682,6 +682,46 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, setEnterInstanceId(instanceId); setEnterInstanceId(instanceId); } } void startIntents(PendingIntent pendingIntent1, Intent fillInIntent1, @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, PendingIntent pendingIntent2, Intent fillInIntent2, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (!mMainStage.isActive()) { // Build a request WCT that will launch both apps such that task 0 is on the main stage // while task 1 is on the side stage. mMainStage.activate(wct, false /* reparent */); } prepareEvictChildTasksIfSplitActive(wct); mSplitLayout.setDivideRatio(splitRatio); updateWindowBounds(mSplitLayout, wct); wct.reorder(mRootTaskInfo.token, true); setRootForceTranslucent(false, wct); setSideStagePosition(splitPosition, wct); options1 = options1 != null ? options1 : new Bundle(); addActivityOptions(options1, mSideStage); if (shortcutInfo1 != null) { wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1); } else { wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); } options2 = options2 != null ? options2 : new Bundle(); addActivityOptions(options2, mMainStage); if (shortcutInfo2 != null) { wct.startShortcut(mContext.getPackageName(), shortcutInfo2, options2); } else { wct.sendPendingIntent(pendingIntent2, fillInIntent2, options2); } mSplitTransitions.startEnterTransition( TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null, null); setEnterInstanceId(instanceId); } /** Starts a pair of tasks using legacy transition. */ /** Starts a pair of tasks using legacy transition. */ void startTasksWithLegacyTransition(int taskId1, @Nullable Bundle options1, void startTasksWithLegacyTransition(int taskId1, @Nullable Bundle options1, int taskId2, @Nullable Bundle options2, @SplitPosition int splitPosition, int taskId2, @Nullable Bundle options2, @SplitPosition int splitPosition, Loading