Made creation of multiple stacks more intentional.
Previous it was unintentional due to the following fixes:
- Made ACTIVITY_TYPE_UNDEFINED compatible with stacks of
ACTIVITY_TYPE_STANDARD. Any request to create an undefined stack type
ends up creates a standard type, so it makes sense for them to be
compatible.
- Made standard types of WINDOWING_MODE_UNDEFINED compatible with the
display's windowing mode. Any request to cerate a stack in an undefined
windowing mode end up creating a stack in the display's windowing mode.
- Added 'dumspys activity containers' for dumping the activity
hierarchy.
Now it is more intentional where we always create a stack for specific
stack activity types and windowing modes when getOrCreateStack is
called.
Bug: 67747409
Bug: 64146578
Test: go/wm-test
Test: Existing tests pass
Change-Id: I85935e8681113a0c06dfc15ef9891e3f91b98a02
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index f0811dd..941c371 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -480,6 +480,29 @@
}
}
+ @Override
+ public boolean isCompatible(int windowingMode, int activityType) {
+ // TODO: Should we just move this to ConfigurationContainer?
+ if (activityType == ACTIVITY_TYPE_UNDEFINED) {
+ // Undefined activity types end up in a standard stack once the stack is created on a
+ // display, so they should be considered compatible.
+ activityType = ACTIVITY_TYPE_STANDARD;
+ }
+ final ActivityDisplay display = getDisplay();
+ if (display != null) {
+ if (activityType == ACTIVITY_TYPE_STANDARD
+ && windowingMode == WINDOWING_MODE_UNDEFINED) {
+ // Standard activity types will mostly take on the windowing mode of the display if
+ // one isn't specified, so look-up a compatible stack based on the display's
+ // windowing mode.
+ windowingMode = display.getWindowingMode();
+ }
+ windowingMode =
+ display.updateWindowingModeForSplitScreenIfNeeded(windowingMode, activityType);
+ }
+ return super.isCompatible(windowingMode, activityType);
+ }
+
/** Adds the stack to specified display and calls WindowManager to do the same. */
void reparent(ActivityDisplay activityDisplay, boolean onTop) {
removeFromDisplay();