Fix wrong divider bar layering

Only creates needed adjacent roots for split screen to prevent affecting
divider bar layering adjustment unexpectedly.

Fix: 206341098
Test: WMShellUnitTests
Test: manual check there's no redundant split screen root
Change-Id: Ie259abc1ac8485c4f8c7138902e2227cfc9e5fa8
This commit is contained in:
Jerry Chang
2021-11-16 11:44:55 +08:00
parent efea2ad2d9
commit 4dd75ce7ab
3 changed files with 15 additions and 19 deletions

View File

@@ -172,6 +172,14 @@ public class LegacySplitScreenController implements DisplayController.OnDisplays
};
mWindowManager = new DividerWindowManager(mSystemWindows);
// No need to listen to display window container or create root tasks if the device is not
// using legacy split screen.
if (!context.getResources().getBoolean(com.android.internal.R.bool.config_useLegacySplit)) {
return;
}
mDisplayController.addDisplayWindowListener(this);
// Don't initialize the divider or anything until we get the default display.

View File

@@ -78,7 +78,6 @@ import android.window.TransitionRequestInfo;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;
import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.InstanceId;
import com.android.internal.protolog.common.ProtoLog;
@@ -156,10 +155,6 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private boolean mExitSplitScreenOnHide;
private boolean mKeyguardOccluded;
// TODO(b/187041611): remove this flag after totally deprecated legacy split
/** Whether the device is supporting legacy split or not. */
private boolean mUseLegacySplit;
@SplitScreen.StageType
private int mDismissTop = NO_DISMISS;
@@ -719,17 +714,9 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private void onStageRootTaskAppeared(StageListenerImpl stageListener) {
if (mMainStageListener.mHasRootTask && mSideStageListener.mHasRootTask) {
mUseLegacySplit = mContext.getResources().getBoolean(R.bool.config_useLegacySplit);
final WindowContainerTransaction wct = new WindowContainerTransaction();
// Make the stages adjacent to each other so they occlude what's behind them.
wct.setAdjacentRoots(mMainStage.mRootTaskInfo.token, mSideStage.mRootTaskInfo.token);
// Only sets side stage as launch-adjacent-flag-root when the device is not using legacy
// split to prevent new split behavior confusing users.
if (!mUseLegacySplit) {
wct.setLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
}
mTaskOrganizer.applyTransaction(wct);
}
}
@@ -739,11 +726,6 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
final WindowContainerTransaction wct = new WindowContainerTransaction();
// Deactivate the main stage if it no longer has a root task.
mMainStage.deactivate(wct);
if (!mUseLegacySplit) {
wct.clearLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
}
mTaskOrganizer.applyTransaction(wct);
}
}

View File

@@ -37,6 +37,7 @@ import android.window.WindowContainerTransaction;
import androidx.annotation.NonNull;
import com.android.internal.R;
import com.android.launcher3.icons.IconProvider;
import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.SurfaceUtils;
@@ -102,7 +103,12 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
mSurfaceSession = surfaceSession;
mIconProvider = iconProvider;
mStageTaskUnfoldController = stageTaskUnfoldController;
taskOrganizer.createRootTask(displayId, WINDOWING_MODE_MULTI_WINDOW, this);
// No need to create root task if the device is using legacy split screen.
// TODO(b/199236198): Remove this check after totally deprecated legacy split.
if (!context.getResources().getBoolean(R.bool.config_useLegacySplit)) {
taskOrganizer.createRootTask(displayId, WINDOWING_MODE_MULTI_WINDOW, this);
}
}
int getChildCount() {