Fix empty side stage after dropping foreground app icon to split

To prevent it entering stage split with empty side stage root, update to
not activate split explicitly when dropping app icons to split. Only
active stage split when the target activity is actually launching in
the side stage root.

Fix: 193200163
Test: drap and drop app icons to enter split, observed it won't active
stage split if the app is already showing in foreground.

Change-Id: I1cad96f6265eb1a14369bfc708871f701764066a
This commit is contained in:
Jerry Chang
2021-07-20 09:14:35 +00:00
parent 1f172ff7de
commit 51b387294d

View File

@@ -372,7 +372,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
if (options == null) {
options = new Bundle();
}
updateActivityOptions(options, position, wct);
updateActivityOptions(options, position);
break;
}
case STAGE_TYPE_MAIN: {
@@ -387,7 +387,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
if (options == null) {
options = new Bundle();
}
updateActivityOptions(options, position, wct);
updateActivityOptions(options, position);
break;
}
default:
@@ -480,22 +480,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
opts.putParcelable(KEY_LAUNCH_ROOT_TASK_TOKEN, stage.mRootTaskInfo.token);
}
void updateActivityOptions(Bundle opts, @SplitPosition int position,
@Nullable WindowContainerTransaction wct) {
void updateActivityOptions(Bundle opts, @SplitPosition int position) {
addActivityOptions(opts, position == mSideStagePosition ? mSideStage : mMainStage);
if (!mMainStage.isActive()) {
// Activate the main stage in anticipation of an app launch.
boolean needsApply = wct == null;
if (needsApply) {
wct = new WindowContainerTransaction();
}
mMainStage.activate(getMainStageBounds(), wct);
mSideStage.setBounds(getSideStageBounds(), wct);
if (needsApply) {
mTaskOrganizer.applyTransaction(wct);
}
}
}
void registerSplitScreenListener(SplitScreen.SplitScreenListener listener) {