Use getOrCreateRootHomeTask in ActivityStartController
Allow #getOrCreateRootHomeTask() to take argument onTop for the position
to create the home stack at.
Also don't allow untrusted secondary display to have system decorations.
Bug: 153624902
Test: atest CtsWindowManagerDeviceTestCases:MultiDisplaySystemDecorationTests
Change-Id: I12d0cfcf2436da3619abd314febddb05610e57f2
diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java
index 0a1ee2b..7d0c6aa 100644
--- a/services/core/java/com/android/server/wm/TaskDisplayArea.java
+++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java
@@ -1451,16 +1451,23 @@
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;
}