Merge "Support starts a pair of intent/shortcut and task to split" into tm-qpr-dev am: 3750d8945c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20105610 Change-Id: I92cb2d7e7e74ff6b5dcf4520bc1111282ae4217a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -83,6 +83,20 @@ interface ISplitScreen {
|
|||||||
int splitPosition, float splitRatio, in RemoteTransition remoteTransition,
|
int splitPosition, float splitRatio, in RemoteTransition remoteTransition,
|
||||||
in InstanceId instanceId) = 10;
|
in InstanceId instanceId) = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a pair of intent and task in one transition.
|
||||||
|
*/
|
||||||
|
oneway void startIntentAndTask(in PendingIntent pendingIntent, in Intent fillInIntent,
|
||||||
|
in Bundle options1, int taskId, in Bundle options2, int sidePosition, float splitRatio,
|
||||||
|
in RemoteTransition remoteTransition, in InstanceId instanceId) = 16;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a pair of shortcut and task in one transition.
|
||||||
|
*/
|
||||||
|
oneway void startShortcutAndTask(in ShortcutInfo shortcutInfo, in Bundle options1, int taskId,
|
||||||
|
in Bundle options2, int splitPosition, float splitRatio,
|
||||||
|
in RemoteTransition remoteTransition, in InstanceId instanceId) = 17;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version of startTasks using legacy transition system.
|
* Version of startTasks using legacy transition system.
|
||||||
*/
|
*/
|
||||||
@@ -98,6 +112,13 @@ interface ISplitScreen {
|
|||||||
int splitPosition, float splitRatio, in RemoteAnimationAdapter adapter,
|
int splitPosition, float splitRatio, in RemoteAnimationAdapter adapter,
|
||||||
in InstanceId instanceId) = 12;
|
in InstanceId instanceId) = 12;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a pair of shortcut and task using legacy transition system.
|
||||||
|
*/
|
||||||
|
oneway void startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo,
|
||||||
|
in Bundle options1, int taskId, in Bundle options2, int splitPosition, float splitRatio,
|
||||||
|
in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 15;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blocking call that notifies and gets additional split-screen targets when entering
|
* Blocking call that notifies and gets additional split-screen targets when entering
|
||||||
* recents (for example: the dividerBar).
|
* recents (for example: the dividerBar).
|
||||||
@@ -111,11 +132,5 @@ interface ISplitScreen {
|
|||||||
* does not expect split to currently be running.
|
* does not expect split to currently be running.
|
||||||
*/
|
*/
|
||||||
RemoteAnimationTarget[] onStartingSplitLegacy(in RemoteAnimationTarget[] appTargets) = 14;
|
RemoteAnimationTarget[] onStartingSplitLegacy(in RemoteAnimationTarget[] appTargets) = 14;
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts a pair of shortcut and task using legacy transition system.
|
|
||||||
*/
|
|
||||||
oneway void startShortcutAndTaskWithLegacyTransition(in ShortcutInfo shortcutInfo,
|
|
||||||
in Bundle options1, int taskId, in Bundle options2, int splitPosition, float splitRatio,
|
|
||||||
in RemoteAnimationAdapter adapter, in InstanceId instanceId) = 15;
|
|
||||||
}
|
}
|
||||||
|
// Last id = 17
|
||||||
|
|||||||
@@ -871,6 +871,28 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
instanceId));
|
instanceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startIntentAndTask(PendingIntent pendingIntent, Intent fillInIntent,
|
||||||
|
@Nullable Bundle options1, int taskId, @Nullable Bundle options2,
|
||||||
|
@SplitPosition int splitPosition, float splitRatio,
|
||||||
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
|
executeRemoteCallWithTaskPermission(mController, "startIntentAndTask",
|
||||||
|
(controller) -> controller.mStageCoordinator.startIntentAndTask(pendingIntent,
|
||||||
|
fillInIntent, options1, taskId, options2, splitPosition, splitRatio,
|
||||||
|
remoteTransition, instanceId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startShortcutAndTask(ShortcutInfo shortcutInfo, @Nullable Bundle options1,
|
||||||
|
int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition,
|
||||||
|
float splitRatio, @Nullable RemoteTransition remoteTransition,
|
||||||
|
InstanceId instanceId) {
|
||||||
|
executeRemoteCallWithTaskPermission(mController, "startShortcutAndTask",
|
||||||
|
(controller) -> controller.mStageCoordinator.startShortcutAndTask(shortcutInfo,
|
||||||
|
options1, taskId, options2, splitPosition, splitRatio, remoteTransition,
|
||||||
|
instanceId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startShortcut(String packageName, String shortcutId, int position,
|
public void startShortcut(String packageName, String shortcutId, int position,
|
||||||
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
@Nullable Bundle options, UserHandle user, InstanceId instanceId) {
|
||||||
|
|||||||
@@ -516,14 +516,55 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Starts 2 tasks in one transition. */
|
/** Starts 2 tasks in one transition. */
|
||||||
void startTasks(int sideTaskId, @Nullable Bundle sideOptions, int mainTaskId,
|
void startTasks(int taskId1, @Nullable Bundle options1, int taskId2,
|
||||||
@Nullable Bundle mainOptions, @SplitPosition int sidePosition, float splitRatio,
|
@Nullable Bundle options2, @SplitPosition int splitPosition, float splitRatio,
|
||||||
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
mainOptions = mainOptions != null ? mainOptions : new Bundle();
|
setSideStagePosition(splitPosition, wct);
|
||||||
sideOptions = sideOptions != null ? sideOptions : new Bundle();
|
options1 = options1 != null ? options1 : new Bundle();
|
||||||
setSideStagePosition(sidePosition, wct);
|
addActivityOptions(options1, mSideStage);
|
||||||
|
wct.startTask(taskId1, options1);
|
||||||
|
|
||||||
|
startWithTask(wct, taskId2, options2, splitRatio, remoteTransition, instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Start an intent and a task to a split pair in one transition. */
|
||||||
|
void startIntentAndTask(PendingIntent pendingIntent, Intent fillInIntent,
|
||||||
|
@Nullable Bundle options1, int taskId, @Nullable Bundle options2,
|
||||||
|
@SplitPosition int splitPosition, float splitRatio,
|
||||||
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
|
setSideStagePosition(splitPosition, wct);
|
||||||
|
options1 = options1 != null ? options1 : new Bundle();
|
||||||
|
addActivityOptions(options1, mSideStage);
|
||||||
|
wct.sendPendingIntent(pendingIntent, fillInIntent, options1);
|
||||||
|
|
||||||
|
startWithTask(wct, taskId, options2, splitRatio, remoteTransition, instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Starts a shortcut and a task to a split pair in one transition. */
|
||||||
|
void startShortcutAndTask(ShortcutInfo shortcutInfo, @Nullable Bundle options1,
|
||||||
|
int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition,
|
||||||
|
float splitRatio, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
|
setSideStagePosition(splitPosition, wct);
|
||||||
|
options1 = options1 != null ? options1 : new Bundle();
|
||||||
|
addActivityOptions(options1, mSideStage);
|
||||||
|
wct.startShortcut(mContext.getPackageName(), shortcutInfo, options1);
|
||||||
|
|
||||||
|
startWithTask(wct, taskId, options2, splitRatio, remoteTransition, instanceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts with the second task to a split pair in one transition.
|
||||||
|
*
|
||||||
|
* @param wct transaction to start the first task
|
||||||
|
* @param instanceId if {@code null}, will not log. Otherwise it will be used in
|
||||||
|
* {@link SplitscreenEventLogger#logEnter(float, int, int, int, int, boolean)}
|
||||||
|
*/
|
||||||
|
private void startWithTask(WindowContainerTransaction wct, int mainTaskId,
|
||||||
|
@Nullable Bundle mainOptions, float splitRatio,
|
||||||
|
@Nullable RemoteTransition remoteTransition, InstanceId instanceId) {
|
||||||
if (mMainStage.isActive()) {
|
if (mMainStage.isActive()) {
|
||||||
mMainStage.evictAllChildren(wct);
|
mMainStage.evictAllChildren(wct);
|
||||||
mSideStage.evictAllChildren(wct);
|
mSideStage.evictAllChildren(wct);
|
||||||
@@ -538,12 +579,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
wct.setForceTranslucent(mRootTaskInfo.token, false);
|
wct.setForceTranslucent(mRootTaskInfo.token, false);
|
||||||
|
|
||||||
// Make sure the launch options will put tasks in the corresponding split roots
|
// Make sure the launch options will put tasks in the corresponding split roots
|
||||||
|
mainOptions = mainOptions != null ? mainOptions : new Bundle();
|
||||||
addActivityOptions(mainOptions, mMainStage);
|
addActivityOptions(mainOptions, mMainStage);
|
||||||
addActivityOptions(sideOptions, mSideStage);
|
|
||||||
|
|
||||||
// Add task launch requests
|
// Add task launch requests
|
||||||
wct.startTask(mainTaskId, mainOptions);
|
wct.startTask(mainTaskId, mainOptions);
|
||||||
wct.startTask(sideTaskId, sideOptions);
|
|
||||||
|
|
||||||
mSplitTransitions.startEnterTransition(
|
mSplitTransitions.startEnterTransition(
|
||||||
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null);
|
TRANSIT_SPLIT_SCREEN_PAIR_OPEN, wct, remoteTransition, this, null);
|
||||||
@@ -593,6 +633,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param wct transaction to start the first task
|
||||||
* @param instanceId if {@code null}, will not log. Otherwise it will be used in
|
* @param instanceId if {@code null}, will not log. Otherwise it will be used in
|
||||||
* {@link SplitscreenEventLogger#logEnter(float, int, int, int, int, boolean)}
|
* {@link SplitscreenEventLogger#logEnter(float, int, int, int, int, boolean)}
|
||||||
*/
|
*/
|
||||||
@@ -1728,6 +1769,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
|
|
||||||
@StageType
|
@StageType
|
||||||
private int getStageType(StageTaskListener stage) {
|
private int getStageType(StageTaskListener stage) {
|
||||||
|
if (stage == null) return STAGE_TYPE_UNDEFINED;
|
||||||
return stage == mMainStage ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
|
return stage == mMainStage ? STAGE_TYPE_MAIN : STAGE_TYPE_SIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1982,8 +2024,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: fallback logic. Probably start a new transition to exit split before applying
|
// TODO(b/250853925): fallback logic. Probably start a new transition to exit split before
|
||||||
// anything here. Ideally consolidate with transition-merging.
|
// applying anything here. Ideally consolidate with transition-merging.
|
||||||
if (info.getType() == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) {
|
if (info.getType() == TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE) {
|
||||||
if (mainChild == null && sideChild == null) {
|
if (mainChild == null && sideChild == null) {
|
||||||
throw new IllegalStateException("Launched a task in split, but didn't receive any"
|
throw new IllegalStateException("Launched a task in split, but didn't receive any"
|
||||||
|
|||||||
Reference in New Issue
Block a user