Introducing WindowConfiguration

Used to house configurations that don't affect resources and that
we don't want to communicate to apps, but need to be propagated
along side Configuration.

Test: bit FrameworksServicesTests:com.android.server.wm.WindowConfigurationTests
Test: adb shell am instrument -w -e package com.android.server.wm com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I97de3efbe6d5e1d3b07156a8cfbce9be5eae5cb5
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index e9e073c..a2e3067 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -46,6 +46,7 @@
 import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
 import static android.content.pm.ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE;
 import static android.content.pm.ActivityInfo.CONFIG_UI_MODE;
+import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
 import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
 import static android.content.pm.ActivityInfo.FLAG_SHOW_WHEN_LOCKED;
 import static android.content.pm.ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
@@ -429,11 +430,11 @@
                                 pw.print("\"");
                         pw.print(" primaryColor=");
                         pw.println(Integer.toHexString(taskDescription.getPrimaryColor()));
-                        pw.print(prefix); pw.print("  backgroundColor=");
+                        pw.print(prefix + " backgroundColor=");
                         pw.println(Integer.toHexString(taskDescription.getBackgroundColor()));
-                        pw.print(prefix); pw.print("  statusBarColor=");
+                        pw.print(prefix + " statusBarColor=");
                         pw.println(Integer.toHexString(taskDescription.getStatusBarColor()));
-                        pw.print(prefix); pw.print("  navigationBarColor=");
+                        pw.print(prefix + " navigationBarColor=");
                         pw.println(Integer.toHexString(taskDescription.getNavigationBarColor()));
             }
             if (iconFilename == null && taskDescription.getIcon() != null) {
@@ -2311,9 +2312,9 @@
         // We must base this on the parent configuration, because we set our override
         // configuration's appBounds based on the result of this method. If we used our own
         // configuration, it would be influenced by past invocations.
-        final Configuration configuration = getParent().getConfiguration();
-        final int containingAppWidth = configuration.appBounds.width();
-        final int containingAppHeight = configuration.appBounds.height();
+        final Rect appBounds = getParent().getConfiguration().windowConfiguration.getAppBounds();
+        final int containingAppWidth = appBounds.width();
+        final int containingAppHeight = appBounds.height();
         int maxActivityWidth = containingAppWidth;
         int maxActivityHeight = containingAppHeight;
 
@@ -2342,8 +2343,7 @@
         outBounds.set(0, 0, maxActivityWidth, maxActivityHeight);
         // Position the activity frame on the opposite side of the nav bar.
         final int navBarPosition = service.mWindowManager.getNavBarPosition();
-        final int left = navBarPosition == NAV_BAR_LEFT
-                ? configuration.appBounds.right - outBounds.width() : 0;
+        final int left = navBarPosition == NAV_BAR_LEFT ? appBounds.right - outBounds.width() : 0;
         outBounds.offsetTo(left, 0 /* top */);
     }
 
@@ -2574,6 +2574,10 @@
                 changes &= ~CONFIG_SMALLEST_SCREEN_SIZE;
             }
         }
+        // We don't want window configuration to cause relaunches.
+        if ((changes & CONFIG_WINDOW_CONFIGURATION) != 0) {
+            changes &= ~CONFIG_WINDOW_CONFIGURATION;
+        }
 
         return changes;
     }
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index 2df773e..2e7f822 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1205,8 +1205,9 @@
         final int leftInset = mTmpRect.left;
         final int topInset = mTmpRect.top;
         // appBounds at the root level should mirror the app screen size.
-        config.setAppBounds(leftInset /*left*/, topInset /*top*/, leftInset + displayInfo.appWidth /*right*/,
-                topInset + displayInfo.appHeight /*bottom*/);
+        config.windowConfiguration.setAppBounds(leftInset /* left */, topInset /* top */,
+                leftInset + displayInfo.appWidth /* right */,
+                topInset + displayInfo.appHeight /* bottom */);
         final boolean rotated = (displayInfo.rotation == Surface.ROTATION_90
                 || displayInfo.rotation == Surface.ROTATION_270);
 
diff --git a/services/core/java/com/android/server/wm/DockedStackDividerController.java b/services/core/java/com/android/server/wm/DockedStackDividerController.java
index 2b45d67..ce21991 100644
--- a/services/core/java/com/android/server/wm/DockedStackDividerController.java
+++ b/services/core/java/com/android/server/wm/DockedStackDividerController.java
@@ -241,8 +241,8 @@
             final int leftInset = mTmpRect.left;
             final int topInset = mTmpRect.top;
 
-            config.setAppBounds(leftInset /*left*/, topInset /*top*/, leftInset + appWidth /*right*/,
-                    topInset + appHeight /*bottom*/);
+            config.windowConfiguration.setAppBounds(leftInset /*left*/, topInset /*top*/,
+                    leftInset + appWidth /*right*/, topInset + appHeight /*bottom*/);
 
             config.screenWidthDp = (int)
                     (mService.mPolicy.getConfigDisplayWidth(dw, dh, rotation, baseConfig.uiMode,
diff --git a/services/core/java/com/android/server/wm/StackWindowController.java b/services/core/java/com/android/server/wm/StackWindowController.java
index 9c44c14..358b8be 100644
--- a/services/core/java/com/android/server/wm/StackWindowController.java
+++ b/services/core/java/com/android/server/wm/StackWindowController.java
@@ -16,11 +16,9 @@
 
 package com.android.server.wm;
 
-import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
 import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
 
 import android.app.ActivityManager.StackId;
-import android.app.RemoteAction;
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Handler;
@@ -30,11 +28,9 @@
 import android.util.SparseArray;
 import android.view.DisplayInfo;
 
-import com.android.server.UiThread;
 import com.android.internal.annotations.VisibleForTesting;
 
 import java.lang.ref.WeakReference;
-import java.util.List;
 
 import static com.android.server.wm.WindowContainer.POSITION_BOTTOM;
 import static com.android.server.wm.WindowContainer.POSITION_TOP;
@@ -278,9 +274,9 @@
             int width;
             int height;
 
-            final Rect parentAppBounds = parentConfig.appBounds;
+            final Rect parentAppBounds = parentConfig.windowConfiguration.getAppBounds();
 
-            config.setAppBounds(!bounds.isEmpty() ? bounds : null);
+            config.windowConfiguration.setAppBounds(!bounds.isEmpty() ? bounds : null);
             boolean intersectParentBounds = false;
 
             if (StackId.tasksAreFloating(mStackId)) {
@@ -295,7 +291,7 @@
                     nonDecorBounds.inset(mTmpNonDecorInsets);
                     // Move app bounds to zero to apply intersection with parent correctly. They are
                     // used only for evaluating width and height, so it's OK to move them around.
-                    config.appBounds.offsetTo(0, 0);
+                    config.windowConfiguration.getAppBounds().offsetTo(0, 0);
                     intersectParentBounds = true;
                 }
                 width = (int) (stableBounds.width() / density);
@@ -319,8 +315,8 @@
                 intersectParentBounds = true;
             }
 
-            if (intersectParentBounds && config.appBounds != null) {
-                config.appBounds.intersect(parentAppBounds);
+            if (intersectParentBounds && config.windowConfiguration.getAppBounds() != null) {
+                config.windowConfiguration.getAppBounds().intersect(parentAppBounds);
             }
 
             config.screenWidthDp = width;
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java b/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java
index 2252c85..47a3a72 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityRecordTests.java
@@ -126,7 +126,7 @@
 
         // Verify with nav bar on the right.
         when(service.mWindowManager.getNavBarPosition()).thenReturn(navBarPosition);
-        task.getConfiguration().setAppBounds(taskBounds);
+        task.getConfiguration().windowConfiguration.setAppBounds(taskBounds);
         record.info.maxAspectRatio = aspectRatio;
         record.ensureActivityConfigurationLocked(0 /* globalChanges */, false /* preserveWindow */);
         assertEquals(expectedActivityBounds, record.getBounds());
diff --git a/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java b/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java
deleted file mode 100644
index 432cfc7..0000000
--- a/services/tests/servicestests/src/com/android/server/wm/AppBoundsTests.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.server.wm;
-
-import android.app.ActivityManager;
-import android.content.pm.ActivityInfo;
-import android.content.res.Configuration;
-import android.graphics.Rect;
-import android.view.DisplayInfo;
-import org.junit.Test;
-
-import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test class to exercise logic related to {@link android.content.res.Configuration#appBounds}.
- *
- * Build/Install/Run:
- *  bit FrameworksServicesTests:com.android.server.wm.AppBoundsTests
- */
-@SmallTest
-@Presubmit
-@org.junit.runner.RunWith(AndroidJUnit4.class)
-public class AppBoundsTests extends WindowTestsBase {
-    private Rect mParentBounds;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/);
-    }
-
-    /**
-     * Ensures that appBounds causes {@link android.content.pm.ActivityInfo.CONFIG_APP_BOUNDS} diff.
-     */
-    @Test
-    public void testAppBoundsConfigurationDiff() {
-        final Configuration config = new Configuration();
-        final Configuration config2 = new Configuration();
-        config.appBounds = new Rect(0, 1, 1, 0);
-        config2.appBounds = new Rect(1, 2, 2, 1);
-
-        assertEquals(ActivityInfo.CONFIG_SCREEN_SIZE, config.diff(config2));
-        assertEquals(0, config.diffPublicOnly(config2));
-    }
-
-    /**
-     * Ensures the configuration app bounds at the root level match the app dimensions.
-     */
-    @Test
-    public void testRootConfigurationBounds() throws Exception {
-        final DisplayInfo info = mDisplayContent.getDisplayInfo();
-        info.appWidth = 1024;
-        info.appHeight = 768;
-
-        final Configuration config = sWm.computeNewConfiguration(mDisplayContent.getDisplayId());
-        // The bounds should always be positioned in the top left.
-        assertEquals(config.appBounds.left, 0);
-        assertEquals(config.appBounds.top, 0);
-
-        // The bounds should equal the defined app width and height
-        assertEquals(config.appBounds.width(), info.appWidth);
-        assertEquals(config.appBounds.height(), info.appHeight);
-    }
-
-    /**
-     * Ensures that bounds are clipped to their parent.
-     */
-    @Test
-    public void testBoundsClipping() throws Exception {
-        final Rect shiftedBounds = new Rect(mParentBounds);
-        shiftedBounds.offset(10, 10);
-        final Rect expectedBounds = new Rect(mParentBounds);
-        expectedBounds.intersect(shiftedBounds);
-        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, shiftedBounds,
-                expectedBounds);
-    }
-
-    /**
-     * Ensures that empty bounds are not propagated to the configuration.
-     */
-    @Test
-    public void testEmptyBounds() throws Exception {
-        final Rect emptyBounds = new Rect();
-        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, emptyBounds,
-                null /*ExpectedBounds*/);
-    }
-
-    /**
-     * Ensures that bounds on freeform stacks are not clipped.
-     */
-    @Test
-    public void testFreeFormBounds() throws Exception {
-        final Rect freeFormBounds = new Rect(mParentBounds);
-        freeFormBounds.offset(10, 10);
-        testStackBoundsConfiguration(ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID,
-                mParentBounds, freeFormBounds, freeFormBounds);
-    }
-
-    /**
-     * Ensures that fully contained bounds are not clipped.
-     */
-    @Test
-    public void testContainedBounds() throws Exception {
-        final Rect insetBounds = new Rect(mParentBounds);
-        insetBounds.inset(5, 5, 5, 5);
-        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, insetBounds, insetBounds);
-    }
-
-    /**
-     * Ensures that full screen free form bounds are clipped
-     */
-    @Test
-    public void testFullScreenFreeFormBounds() throws Exception {
-        final Rect fullScreenBounds = new Rect(0, 0, mDisplayInfo.logicalWidth,
-                mDisplayInfo.logicalHeight);
-        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, fullScreenBounds,
-                mParentBounds);
-    }
-
-    private void testStackBoundsConfiguration(Integer stackId, Rect parentBounds, Rect bounds,
-            Rect expectedConfigBounds) {
-        final StackWindowController stackController = stackId != null ?
-                createStackControllerOnStackOnDisplay(stackId, mDisplayContent)
-                : createStackControllerOnDisplay(mDisplayContent);
-
-        final Configuration parentConfig = mDisplayContent.getConfiguration();
-        parentConfig.setAppBounds(parentBounds);
-
-        final Configuration config = new Configuration();
-        stackController.adjustConfigurationForBounds(bounds, null /*insetBounds*/,
-                new Rect() /*nonDecorBounds*/, new Rect() /*stableBounds*/, false /*overrideWidth*/,
-                false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig);
-        // Assert that both expected and actual are null or are equal to each other
-
-        assertTrue((expectedConfigBounds == null && config.appBounds == null)
-                || expectedConfigBounds.equals(config.appBounds));
-    }
-
-    /**
-     * Ensures appBounds are considered in {@link Configuration#compareTo(Configuration)}.
-     */
-    @Test
-    public void testConfigurationCompareTo() throws Exception {
-        final Configuration blankConfig = new Configuration();
-
-        final Configuration config1 = new Configuration();
-        config1.appBounds = new Rect(1, 2, 3, 4);
-
-        final Configuration config2 = new Configuration(config1);
-
-        assertEquals(config1.compareTo(config2), 0);
-
-        config2.appBounds.left = 0;
-
-        // Different bounds
-        assertNotEquals(config1.compareTo(config2), 0);
-
-        // No bounds
-        assertEquals(config1.compareTo(blankConfig), -1);
-        assertEquals(blankConfig.compareTo(config1), 1);
-
-    }
-}
diff --git a/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java b/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java
new file mode 100644
index 0000000..78643bd
--- /dev/null
+++ b/services/tests/servicestests/src/com/android/server/wm/WindowConfigurationTests.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.wm;
+
+import org.junit.Test;
+
+import android.app.WindowConfiguration;
+import android.content.res.Configuration;
+import android.graphics.Rect;
+import android.platform.test.annotations.Presubmit;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.view.DisplayInfo;
+
+import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
+import static android.app.WindowConfiguration.WINDOW_CONFIG_APP_BOUNDS;
+import static android.content.pm.ActivityInfo.CONFIG_WINDOW_CONFIGURATION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test class to for {@link android.app.WindowConfiguration}.
+ *
+ * Build/Install/Run:
+ *  bit FrameworksServicesTests:com.android.server.wm.WindowConfigurationTests
+ */
+@SmallTest
+@Presubmit
+@org.junit.runner.RunWith(AndroidJUnit4.class)
+public class WindowConfigurationTests extends WindowTestsBase {
+    private Rect mParentBounds;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        mParentBounds = new Rect(10 /*left*/, 30 /*top*/, 80 /*right*/, 60 /*bottom*/);
+    }
+
+    /** Tests {@link android.app.WindowConfiguration#diff(WindowConfiguration, boolean)}. */
+    @Test
+    public void testDiff() {
+        final Configuration config1 = new Configuration();
+        final WindowConfiguration winConfig1 = config1.windowConfiguration;
+        final Configuration config2 = new Configuration();
+        final WindowConfiguration winConfig2 = config2.windowConfiguration;
+        final Configuration config3 = new Configuration();
+        final WindowConfiguration winConfig3 = config3.windowConfiguration;
+
+        winConfig1.setAppBounds(0, 1, 1, 0);
+        winConfig2.setAppBounds(1, 2, 2, 1);
+        winConfig3.setAppBounds(winConfig1.getAppBounds());
+
+
+        assertEquals(CONFIG_WINDOW_CONFIGURATION, config1.diff(config2));
+        assertEquals(0, config1.diffPublicOnly(config2));
+        assertEquals(WINDOW_CONFIG_APP_BOUNDS,
+                winConfig1.diff(winConfig2, false /* compareUndefined */));
+
+        assertEquals(0, config1.diff(config3));
+        assertEquals(0, config1.diffPublicOnly(config3));
+        assertEquals(0, winConfig1.diff(winConfig3, false /* compareUndefined */));
+    }
+
+    /** Tests {@link android.app.WindowConfiguration#compareTo(WindowConfiguration)}. */
+    @Test
+    public void testConfigurationCompareTo() throws Exception {
+        final Configuration blankConfig = new Configuration();
+        final WindowConfiguration blankWinConfig = new WindowConfiguration();
+
+        final Configuration config1 = new Configuration();
+        final WindowConfiguration winConfig1 = config1.windowConfiguration;
+        winConfig1.setAppBounds(1, 2, 3, 4);
+
+        final Configuration config2 = new Configuration(config1);
+        final WindowConfiguration winConfig2 = config2.windowConfiguration;
+
+        assertEquals(config1.compareTo(config2), 0);
+        assertEquals(winConfig1.compareTo(winConfig2), 0);
+
+        // Different bounds
+        winConfig2.setAppBounds(0, 2, 3, 4);
+
+        assertNotEquals(config1.compareTo(config2), 0);
+        assertNotEquals(winConfig1.compareTo(winConfig2), 0);
+
+        // No bounds
+        assertEquals(config1.compareTo(blankConfig), -1);
+        assertEquals(winConfig1.compareTo(blankWinConfig), -1);
+
+        assertEquals(blankConfig.compareTo(config1), 1);
+        assertEquals(blankWinConfig.compareTo(winConfig1), 1);
+    }
+
+    /** Ensures the configuration app bounds at the root level match the app dimensions. */
+    @Test
+    public void testAppBounds_RootConfigurationBounds() throws Exception {
+        final DisplayInfo info = mDisplayContent.getDisplayInfo();
+        info.appWidth = 1024;
+        info.appHeight = 768;
+
+        final Rect appBounds = sWm.computeNewConfiguration(
+                mDisplayContent.getDisplayId()).windowConfiguration.getAppBounds();
+        // The bounds should always be positioned in the top left.
+        assertEquals(appBounds.left, 0);
+        assertEquals(appBounds.top, 0);
+
+        // The bounds should equal the defined app width and height
+        assertEquals(appBounds.width(), info.appWidth);
+        assertEquals(appBounds.height(), info.appHeight);
+    }
+
+    /** Ensures that bounds are clipped to their parent. */
+    @Test
+    public void testAppBounds_BoundsClipping() throws Exception {
+        final Rect shiftedBounds = new Rect(mParentBounds);
+        shiftedBounds.offset(10, 10);
+        final Rect expectedBounds = new Rect(mParentBounds);
+        expectedBounds.intersect(shiftedBounds);
+        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, shiftedBounds,
+                expectedBounds);
+    }
+
+    /** Ensures that empty bounds are not propagated to the configuration. */
+    @Test
+    public void testAppBounds_EmptyBounds() throws Exception {
+        final Rect emptyBounds = new Rect();
+        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, emptyBounds,
+                null /*ExpectedBounds*/);
+    }
+
+    /** Ensures that bounds on freeform stacks are not clipped. */
+    @Test
+    public void testAppBounds_FreeFormBounds() throws Exception {
+        final Rect freeFormBounds = new Rect(mParentBounds);
+        freeFormBounds.offset(10, 10);
+        testStackBoundsConfiguration(FREEFORM_WORKSPACE_STACK_ID, mParentBounds, freeFormBounds,
+                freeFormBounds);
+    }
+
+    /** Ensures that fully contained bounds are not clipped. */
+    @Test
+    public void testAppBounds_ContainedBounds() throws Exception {
+        final Rect insetBounds = new Rect(mParentBounds);
+        insetBounds.inset(5, 5, 5, 5);
+        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, insetBounds, insetBounds);
+    }
+
+    /** Ensures that full screen free form bounds are clipped */
+    @Test
+    public void testAppBounds_FullScreenFreeFormBounds() throws Exception {
+        final Rect fullScreenBounds = new Rect(0, 0, mDisplayInfo.logicalWidth,
+                mDisplayInfo.logicalHeight);
+        testStackBoundsConfiguration(null /*stackId*/, mParentBounds, fullScreenBounds,
+                mParentBounds);
+    }
+
+    private void testStackBoundsConfiguration(Integer stackId, Rect parentBounds, Rect bounds,
+            Rect expectedConfigBounds) {
+        final StackWindowController stackController = stackId != null ?
+                createStackControllerOnStackOnDisplay(stackId, mDisplayContent)
+                : createStackControllerOnDisplay(mDisplayContent);
+
+        final Configuration parentConfig = mDisplayContent.getConfiguration();
+        parentConfig.windowConfiguration.setAppBounds(parentBounds);
+
+        final Configuration config = new Configuration();
+        final WindowConfiguration winConfig = config.windowConfiguration;
+        stackController.adjustConfigurationForBounds(bounds, null /*insetBounds*/,
+                new Rect() /*nonDecorBounds*/, new Rect() /*stableBounds*/, false /*overrideWidth*/,
+                false /*overrideHeight*/, mDisplayInfo.logicalDensityDpi, config, parentConfig);
+        // Assert that both expected and actual are null or are equal to each other
+
+        assertTrue((expectedConfigBounds == null && winConfig.getAppBounds() == null)
+                || expectedConfigBounds.equals(winConfig.getAppBounds()));
+    }
+
+}