diff options
| author | 2023-02-08 07:46:49 +0000 | |
|---|---|---|
| committer | 2023-02-08 07:46:49 +0000 | |
| commit | 0b3ff82173f877f24b62962abb695800fc6dbdcd (patch) | |
| tree | 79c3bcd488f7f74031d12a89aed1e7677f420682 | |
| parent | d4768d6e089112fa707e8ac40f7039ff94c42839 (diff) | |
| parent | ac7dff13d37f10571bd305f3c66685daa18d89d2 (diff) | |
Merge "Support entering split screen with a shortcut and an intent" into tm-qpr-dev
3 files changed, 52 insertions, 34 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl index 56aa742b8626..81e118a31b73 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/ISplitScreen.aidl @@ -122,9 +122,9 @@ interface ISplitScreen { * Start a pair of intents using legacy transition system. */ oneway void startIntentsWithLegacyTransition(in PendingIntent pendingIntent1, - in Bundle options1, in PendingIntent pendingIntent2, in Bundle options2, - int splitPosition, float splitRatio, in RemoteAnimationAdapter adapter, - in InstanceId instanceId) = 18; + in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2, + in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, float splitRatio, + in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 18; /** * Start a pair of intents in one transition. diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java index 7cb5cf2ea177..36da4cf12706 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenController.java @@ -583,9 +583,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, } private void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, - @Nullable Bundle options1, PendingIntent pendingIntent2, - @Nullable Bundle options2, @SplitPosition int splitPosition, - float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { + @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, + PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, + @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, + RemoteAnimationAdapter adapter, InstanceId instanceId) { Intent fillInIntent1 = null; Intent fillInIntent2 = null; final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1); @@ -605,9 +606,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, Toast.LENGTH_SHORT).show(); } } - mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1, - pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter, - instanceId); + mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, + shortcutInfo1, options1, pendingIntent2, fillInIntent2, shortcutInfo2, options2, + splitPosition, splitRatio, adapter, instanceId); } @Override @@ -1037,13 +1038,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter, @Override public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, - @Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable Bundle options2, - @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter, - InstanceId instanceId) { + @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, + PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2, + @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, + RemoteAnimationAdapter adapter, InstanceId instanceId) { executeRemoteCallWithTaskPermission(mController, "startIntentsWithLegacyTransition", (controller) -> - controller.startIntentsWithLegacyTransition( - pendingIntent1, options1, pendingIntent2, options2, splitPosition, + controller.startIntentsWithLegacyTransition(pendingIntent1, shortcutInfo1, + options1, pendingIntent2, shortcutInfo2, options2, splitPosition, splitRatio, adapter, instanceId) ); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index 219f87eac7f2..0f18ddaba218 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -692,9 +692,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Starts a pair of intents using legacy transition. */ void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, Intent fillInIntent1, - @Nullable Bundle options1, PendingIntent pendingIntent2, Intent fillInIntent2, - @Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio, - RemoteAnimationAdapter adapter, InstanceId instanceId) { + @Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1, + @Nullable PendingIntent pendingIntent2, Intent fillInIntent2, + @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, + @SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter, + InstanceId instanceId) { final WindowContainerTransaction wct = new WindowContainerTransaction(); if (options1 == null) options1 = new Bundle(); if (pendingIntent2 == null) { @@ -703,15 +705,23 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter)); options1 = activityOptions.toBundle(); addActivityOptions(options1, null /* launchTarget */); - wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); + if (shortcutInfo1 != null) { + wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1); + } else { + wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); + } mSyncQueue.queue(wct); return; } addActivityOptions(options1, mSideStage); - wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); - startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, options2, splitPosition, - splitRatio, adapter, instanceId); + if (shortcutInfo1 != null) { + wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1); + } else { + wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1); + } + startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, shortcutInfo2, options2, + splitPosition, splitRatio, adapter, instanceId); } void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent, @@ -763,18 +773,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void startWithLegacyTransition(WindowContainerTransaction wct, @Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent, - @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio, - RemoteAnimationAdapter adapter, InstanceId instanceId) { + @Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle mainOptions, + @SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter, + InstanceId instanceId) { startWithLegacyTransition(wct, INVALID_TASK_ID, mainPendingIntent, mainFillInIntent, - mainOptions, sidePosition, splitRatio, adapter, instanceId); + mainShortcutInfo, mainOptions, sidePosition, splitRatio, adapter, instanceId); } private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId, @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) { startWithLegacyTransition(wct, mainTaskId, null /* mainPendingIntent */, - null /* mainFillInIntent */, mainOptions, sidePosition, splitRatio, adapter, - instanceId); + null /* mainFillInIntent */, null /* mainShortcutInfo */, mainOptions, sidePosition, + splitRatio, adapter, instanceId); } /** @@ -784,8 +795,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, */ private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId, @Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent, - @Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio, - RemoteAnimationAdapter adapter, InstanceId instanceId) { + @Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle options, + @SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter, + InstanceId instanceId) { if (!isSplitScreenVisible()) { exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RECREATE_SPLIT); } @@ -809,15 +821,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mMainStage.activate(wct, false /* reparent */); } - if (mainOptions == null) mainOptions = new Bundle(); - addActivityOptions(mainOptions, mMainStage); - mainOptions = wrapAsSplitRemoteAnimation(adapter, mainOptions); + if (options == null) options = new Bundle(); + addActivityOptions(options, mMainStage); + options = wrapAsSplitRemoteAnimation(adapter, options); updateWindowBounds(mSplitLayout, wct); - if (mainTaskId == INVALID_TASK_ID) { - wct.sendPendingIntent(mainPendingIntent, mainFillInIntent, mainOptions); + + // TODO(b/268008375): Merge APIs to start a split pair into one. + if (mainTaskId != INVALID_TASK_ID) { + wct.startTask(mainTaskId, options); + } else if (mainShortcutInfo != null) { + wct.startShortcut(mContext.getPackageName(), mainShortcutInfo, options); } else { - wct.startTask(mainTaskId, mainOptions); + wct.sendPendingIntent(mainPendingIntent, mainFillInIntent, options); } wct.reorder(mRootTaskInfo.token, true); |