Support for setting stack windowing mode
We currently create a in stack in the windowing mode we want anytime we
want to change the windowing mode of a task which isn't optimal.
We now change the current stack windowing mode for some cases vs.
creating a new stack.
Test: go/wm-smoke
Bug: 64146578
Fixes: 68948655
Fixes: 65739235
Fixes: 29068935
Change-Id: I9fceb7d608e86610c1fb5ba59b15087a96e7401e
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
index 480b210..6b09363 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java
@@ -166,6 +166,8 @@
final ActivityDisplay display = mService.mStackSupervisor.getDefaultDisplay();
final TestActivityStack homeStack = createStackForShouldBeVisibleTest(display,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, true /* onTop */);
+ // Home stack should always be fullscreen for this test.
+ homeStack.setSupportsSplitScreen(false);
final TestActivityStack splitScreenPrimary = createStackForShouldBeVisibleTest(display,
WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, ACTIVITY_TYPE_STANDARD, true /* onTop */);
final TestActivityStack splitScreenSecondary = createStackForShouldBeVisibleTest(display,
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index 198cc6d..482d5f5 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -396,6 +396,11 @@
static final int IS_TRANSLUCENT_TRUE = 2;
private int mIsTranslucent = IS_TRANSLUCENT_UNSET;
+ static final int SUPPORTS_SPLIT_SCREEN_UNSET = 0;
+ static final int SUPPORTS_SPLIT_SCREEN_FALSE = 1;
+ static final int SUPPORTS_SPLIT_SCREEN_TRUE = 2;
+ private int mSupportsSplitScreen = SUPPORTS_SPLIT_SCREEN_UNSET;
+
TestActivityStack(ActivityDisplay display, int stackId, ActivityStackSupervisor supervisor,
int windowingMode, int activityType, boolean onTop) {
super(display, stackId, supervisor, windowingMode, activityType, onTop);
@@ -439,5 +444,23 @@
return super.isStackTranslucent(starting);
}
}
+
+ void setSupportsSplitScreen(boolean supportsSplitScreen) {
+ mSupportsSplitScreen = supportsSplitScreen
+ ? SUPPORTS_SPLIT_SCREEN_TRUE : SUPPORTS_SPLIT_SCREEN_FALSE;
+ }
+
+ @Override
+ public boolean supportsSplitScreenWindowingMode() {
+ switch (mSupportsSplitScreen) {
+ case SUPPORTS_SPLIT_SCREEN_TRUE:
+ return true;
+ case SUPPORTS_SPLIT_SCREEN_FALSE:
+ return false;
+ case SUPPORTS_SPLIT_SCREEN_UNSET:
+ default:
+ return super.supportsSplitScreenWindowingMode();
+ }
+ }
}
}