Merge "Revert "Implement two intents or shortcuts to active split"" into udc-dev

This commit is contained in:
Tony Huang
2023-04-06 08:21:25 +00:00
committed by Android (Google) Code Review
3 changed files with 6 additions and 82 deletions

View File

@@ -129,10 +129,9 @@ 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 ShortcutInfo shortcutInfo1, oneway void startIntents(in PendingIntent pendingIntent1, in Bundle options1,
in Bundle options1, in PendingIntent pendingIntent2, in ShortcutInfo shortcutInfo2, in PendingIntent pendingIntent2, in Bundle options2, int splitPosition,
in Bundle options2, int splitPosition, float splitRatio, float splitRatio, in RemoteTransition remoteTransition, in InstanceId instanceId) = 19;
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

View File

@@ -626,35 +626,6 @@ 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) {
@@ -1095,17 +1066,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
} }
@Override @Override
public void startIntents(PendingIntent pendingIntent1, @Nullable ShortcutInfo shortcutInfo1, public void startIntents(PendingIntent pendingIntent1, @Nullable Bundle options1,
@Nullable Bundle options1, PendingIntent pendingIntent2, PendingIntent pendingIntent2, @Nullable Bundle options2,
@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) {
executeRemoteCallWithTaskPermission(mController, "startIntents", // TODO(b/259368992): To be implemented.
(controller) ->
controller.startIntents(pendingIntent1, shortcutInfo1,
options1, pendingIntent2, shortcutInfo2, options2,
splitPosition, splitRatio, remoteTransition, instanceId)
);
} }
@Override @Override

View File

@@ -682,46 +682,6 @@ 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,