Merge "Use getOrCreateRootHomeTask in ActivityStartController" into rvc-dev

This commit is contained in:
Chris Li
2020-05-19 02:35:26 +00:00
committed by Android (Google) Code Review
4 changed files with 15 additions and 9 deletions

View File

@@ -19,7 +19,6 @@ package com.android.server.wm;
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL;
@@ -193,9 +192,7 @@ public class ActivityStartController {
final ActivityStack homeStack;
try {
// Make sure home stack exists on display area.
// TODO(b/153624902): Replace with TaskDisplayArea#getOrCreateRootHomeTask()
homeStack = taskDisplayArea.getOrCreateStack(WINDOWING_MODE_UNDEFINED,
ACTIVITY_TYPE_HOME, ON_TOP);
homeStack = taskDisplayArea.getOrCreateRootHomeTask(ON_TOP);
} finally {
mSupervisor.endDeferResume();
}

View File

@@ -4700,9 +4700,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
boolean supportsSystemDecorations() {
return (mWmService.mDisplayWindowSettings.shouldShowSystemDecorsLocked(this)
|| (mDisplay.getFlags() & FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0
|| (mWmService.mForceDesktopModeOnExternalDisplays && !isUntrustedVirtualDisplay()))
|| mWmService.mForceDesktopModeOnExternalDisplays)
// VR virtual display will be used to run and render 2D app within a VR experience.
&& mDisplayId != mWmService.mVr2dDisplayId;
&& mDisplayId != mWmService.mVr2dDisplayId
// Do not show system decorations on untrusted virtual display.
&& !isUntrustedVirtualDisplay();
}
/**

View File

@@ -1369,7 +1369,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
calculateDefaultMinimalSizeOfResizeableTasks();
final TaskDisplayArea defaultTaskDisplayArea = getDefaultTaskDisplayArea();
defaultTaskDisplayArea.getOrCreateRootHomeTask();
defaultTaskDisplayArea.getOrCreateRootHomeTask(ON_TOP);
positionChildAt(POSITION_TOP, defaultTaskDisplayArea.mDisplayContent,
false /* includingParents */);
}

View File

@@ -1461,16 +1461,23 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
return mChildren.get(index);
}
@Nullable
ActivityStack getOrCreateRootHomeTask() {
return getOrCreateRootHomeTask(false /* onTop */);
}
/**
* Returns the existing home stack or creates and returns a new one if it should exist for the
* display.
* @param onTop Only be used when there is no existing home stack. If true the home stack will
* be created at the top of the display, else at the bottom.
*/
@Nullable
ActivityStack getOrCreateRootHomeTask() {
ActivityStack getOrCreateRootHomeTask(boolean onTop) {
ActivityStack homeTask = getRootHomeTask();
if (homeTask == null && mDisplayContent.supportsSystemDecorations()
&& !mDisplayContent.isUntrustedVirtualDisplay()) {
homeTask = createStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, false /* onTop */);
homeTask = createStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_HOME, onTop);
}
return homeTask;
}