From 51b387294d4ea4a73fbb2ddb0b59fd81c333acee Mon Sep 17 00:00:00 2001 From: Jerry Chang Date: Tue, 20 Jul 2021 09:14:35 +0000 Subject: [PATCH] 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 --- .../shell/splitscreen/StageCoordinator.java | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) 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 81ce2b7bd2a58..ccf15646d489c 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 @@ -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) {