Merge "Support entering split screen with a shortcut and an intent" into tm-qpr-dev
This commit is contained in:
@@ -122,9 +122,9 @@ interface ISplitScreen {
|
|||||||
* Start a pair of intents using legacy transition system.
|
* Start a pair of intents using legacy transition system.
|
||||||
*/
|
*/
|
||||||
oneway void startIntentsWithLegacyTransition(in PendingIntent pendingIntent1,
|
oneway void startIntentsWithLegacyTransition(in PendingIntent pendingIntent1,
|
||||||
in Bundle options1, in PendingIntent pendingIntent2, in Bundle options2,
|
in ShortcutInfo shortcutInfo1, in Bundle options1, in PendingIntent pendingIntent2,
|
||||||
int splitPosition, float splitRatio, in RemoteAnimationAdapter adapter,
|
in ShortcutInfo shortcutInfo2, in Bundle options2, int splitPosition, float splitRatio,
|
||||||
in InstanceId instanceId) = 18;
|
in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 18;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a pair of intents in one transition.
|
* Start a pair of intents in one transition.
|
||||||
|
|||||||
@@ -583,9 +583,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
|
private void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
|
||||||
@Nullable Bundle options1, PendingIntent pendingIntent2,
|
@Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
|
||||||
@Nullable Bundle options2, @SplitPosition int splitPosition,
|
PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
|
||||||
float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
@Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
|
||||||
|
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||||
Intent fillInIntent1 = null;
|
Intent fillInIntent1 = null;
|
||||||
Intent fillInIntent2 = null;
|
Intent fillInIntent2 = null;
|
||||||
final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1);
|
final String packageName1 = SplitScreenUtils.getPackageName(pendingIntent1);
|
||||||
@@ -605,9 +606,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
Toast.LENGTH_SHORT).show();
|
Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1, options1,
|
mStageCoordinator.startIntentsWithLegacyTransition(pendingIntent1, fillInIntent1,
|
||||||
pendingIntent2, fillInIntent2, options2, splitPosition, splitRatio, adapter,
|
shortcutInfo1, options1, pendingIntent2, fillInIntent2, shortcutInfo2, options2,
|
||||||
instanceId);
|
splitPosition, splitRatio, adapter, instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1037,13 +1038,14 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
|
public void startIntentsWithLegacyTransition(PendingIntent pendingIntent1,
|
||||||
@Nullable Bundle options1, PendingIntent pendingIntent2, @Nullable Bundle options2,
|
@Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
|
||||||
@SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter,
|
PendingIntent pendingIntent2, @Nullable ShortcutInfo shortcutInfo2,
|
||||||
InstanceId instanceId) {
|
@Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
|
||||||
|
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||||
executeRemoteCallWithTaskPermission(mController, "startIntentsWithLegacyTransition",
|
executeRemoteCallWithTaskPermission(mController, "startIntentsWithLegacyTransition",
|
||||||
(controller) ->
|
(controller) ->
|
||||||
controller.startIntentsWithLegacyTransition(
|
controller.startIntentsWithLegacyTransition(pendingIntent1, shortcutInfo1,
|
||||||
pendingIntent1, options1, pendingIntent2, options2, splitPosition,
|
options1, pendingIntent2, shortcutInfo2, options2, splitPosition,
|
||||||
splitRatio, adapter, instanceId)
|
splitRatio, adapter, instanceId)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -692,9 +692,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
|
|
||||||
/** Starts a pair of intents using legacy transition. */
|
/** Starts a pair of intents using legacy transition. */
|
||||||
void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, Intent fillInIntent1,
|
void startIntentsWithLegacyTransition(PendingIntent pendingIntent1, Intent fillInIntent1,
|
||||||
@Nullable Bundle options1, PendingIntent pendingIntent2, Intent fillInIntent2,
|
@Nullable ShortcutInfo shortcutInfo1, @Nullable Bundle options1,
|
||||||
@Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
|
@Nullable PendingIntent pendingIntent2, Intent fillInIntent2,
|
||||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
@Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2,
|
||||||
|
@SplitPosition int splitPosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
if (options1 == null) options1 = new Bundle();
|
if (options1 == null) options1 = new Bundle();
|
||||||
if (pendingIntent2 == null) {
|
if (pendingIntent2 == null) {
|
||||||
@@ -703,15 +705,23 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter));
|
activityOptions.update(ActivityOptions.makeRemoteAnimation(adapter));
|
||||||
options1 = activityOptions.toBundle();
|
options1 = activityOptions.toBundle();
|
||||||
addActivityOptions(options1, null /* launchTarget */);
|
addActivityOptions(options1, null /* launchTarget */);
|
||||||
|
if (shortcutInfo1 != null) {
|
||||||
|
wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1);
|
||||||
|
} else {
|
||||||
wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
|
wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
|
||||||
|
}
|
||||||
mSyncQueue.queue(wct);
|
mSyncQueue.queue(wct);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
addActivityOptions(options1, mSideStage);
|
addActivityOptions(options1, mSideStage);
|
||||||
|
if (shortcutInfo1 != null) {
|
||||||
|
wct.startShortcut(mContext.getPackageName(), shortcutInfo1, options1);
|
||||||
|
} else {
|
||||||
wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
|
wct.sendPendingIntent(pendingIntent1, fillInIntent1, options1);
|
||||||
startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, options2, splitPosition,
|
}
|
||||||
splitRatio, adapter, instanceId);
|
startWithLegacyTransition(wct, pendingIntent2, fillInIntent2, shortcutInfo2, options2,
|
||||||
|
splitPosition, splitRatio, adapter, instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent,
|
void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent, Intent fillInIntent,
|
||||||
@@ -763,18 +773,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
|
|
||||||
private void startWithLegacyTransition(WindowContainerTransaction wct,
|
private void startWithLegacyTransition(WindowContainerTransaction wct,
|
||||||
@Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
|
@Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
|
||||||
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle mainOptions,
|
||||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
startWithLegacyTransition(wct, INVALID_TASK_ID, mainPendingIntent, mainFillInIntent,
|
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,
|
private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
|
||||||
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
||||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||||
startWithLegacyTransition(wct, mainTaskId, null /* mainPendingIntent */,
|
startWithLegacyTransition(wct, mainTaskId, null /* mainPendingIntent */,
|
||||||
null /* mainFillInIntent */, mainOptions, sidePosition, splitRatio, adapter,
|
null /* mainFillInIntent */, null /* mainShortcutInfo */, mainOptions, sidePosition,
|
||||||
instanceId);
|
splitRatio, adapter, instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -784,8 +795,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
*/
|
*/
|
||||||
private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
|
private void startWithLegacyTransition(WindowContainerTransaction wct, int mainTaskId,
|
||||||
@Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
|
@Nullable PendingIntent mainPendingIntent, @Nullable Intent mainFillInIntent,
|
||||||
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable ShortcutInfo mainShortcutInfo, @Nullable Bundle options,
|
||||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
@SplitPosition int sidePosition, float splitRatio, RemoteAnimationAdapter adapter,
|
||||||
|
InstanceId instanceId) {
|
||||||
if (!isSplitScreenVisible()) {
|
if (!isSplitScreenVisible()) {
|
||||||
exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RECREATE_SPLIT);
|
exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RECREATE_SPLIT);
|
||||||
}
|
}
|
||||||
@@ -809,15 +821,19 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
mMainStage.activate(wct, false /* reparent */);
|
mMainStage.activate(wct, false /* reparent */);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainOptions == null) mainOptions = new Bundle();
|
if (options == null) options = new Bundle();
|
||||||
addActivityOptions(mainOptions, mMainStage);
|
addActivityOptions(options, mMainStage);
|
||||||
mainOptions = wrapAsSplitRemoteAnimation(adapter, mainOptions);
|
options = wrapAsSplitRemoteAnimation(adapter, options);
|
||||||
|
|
||||||
updateWindowBounds(mSplitLayout, wct);
|
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 {
|
} else {
|
||||||
wct.startTask(mainTaskId, mainOptions);
|
wct.sendPendingIntent(mainPendingIntent, mainFillInIntent, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
wct.reorder(mRootTaskInfo.token, true);
|
wct.reorder(mRootTaskInfo.token, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user