Do not create window decorations for split roots
Split roots (either the single-top root or stage roots) were usually excluded from having window decorations by the exclusion logic for non-leafs that exists in FreeformTaskTransitionObserver. However, once split is dismissed and the child tasks are reparented out of the stages, the two stage roots become leafs and if they were included as part of a transition, a window decoration was being created for each of them. This change excludes split roots from having a window decoration. Bug: 280499263 Test: enter split, dismiss split by dragging the divider, observe there's no crash Change-Id: I4d563176a75512232fc853232b3666d511e4c922
This commit is contained in:
@@ -337,6 +337,11 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
return isTaskInSplitScreen(taskId) && isSplitScreenVisible();
|
||||
}
|
||||
|
||||
/** Check whether the task is the single-top root or the root of one of the stages. */
|
||||
public boolean isTaskRootOrStageRoot(int taskId) {
|
||||
return mStageCoordinator.isRootOrStageRoot(taskId);
|
||||
}
|
||||
|
||||
public @SplitPosition int getSplitPosition(int taskId) {
|
||||
return mStageCoordinator.getSplitPosition(taskId);
|
||||
}
|
||||
|
||||
@@ -377,6 +377,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
return STAGE_TYPE_UNDEFINED;
|
||||
}
|
||||
|
||||
boolean isRootOrStageRoot(int taskId) {
|
||||
if (mRootTaskInfo != null && mRootTaskInfo.taskId == taskId) {
|
||||
return true;
|
||||
}
|
||||
return mMainStage.isRootTaskId(taskId) || mSideStage.isRootTaskId(taskId);
|
||||
}
|
||||
|
||||
boolean moveToStage(ActivityManager.RunningTaskInfo task, @SplitPosition int stagePosition,
|
||||
WindowContainerTransaction wct) {
|
||||
prepareEnterSplitScreen(wct, task, stagePosition);
|
||||
|
||||
@@ -286,6 +286,10 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
}
|
||||
}
|
||||
|
||||
boolean isRootTaskId(int taskId) {
|
||||
return mRootTaskInfo != null && mRootTaskInfo.taskId == taskId;
|
||||
}
|
||||
|
||||
void onResizing(Rect newBounds, Rect sideBounds, SurfaceControl.Transaction t, int offsetX,
|
||||
int offsetY, boolean immediately) {
|
||||
if (mSplitDecorManager != null && mRootTaskInfo != null) {
|
||||
|
||||
@@ -760,6 +760,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
|
||||
|
||||
private boolean shouldShowWindowDecor(RunningTaskInfo taskInfo) {
|
||||
if (taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM) return true;
|
||||
if (mSplitScreenController.isPresent()
|
||||
&& mSplitScreenController.get().isTaskRootOrStageRoot(taskInfo.taskId)) {
|
||||
return false;
|
||||
}
|
||||
return DesktopModeStatus.isProto2Enabled()
|
||||
&& taskInfo.getActivityType() == ACTIVITY_TYPE_STANDARD
|
||||
&& mDisplayController.getDisplayContext(taskInfo.displayId)
|
||||
|
||||
Reference in New Issue
Block a user