Loading services/core/java/com/android/server/wm/DisplayArea.java +17 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,23 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { } } @Override void resolveOverrideConfiguration(Configuration newParentConfiguration) { super.resolveOverrideConfiguration(newParentConfiguration); final Configuration resolvedConfig = getResolvedOverrideConfiguration(); final Rect overrideBounds = resolvedConfig.windowConfiguration.getBounds(); final Rect overrideAppBounds = resolvedConfig.windowConfiguration.getAppBounds(); final Rect parentAppBounds = newParentConfiguration.windowConfiguration.getAppBounds(); // If there is no override of appBounds, restrict appBounds to the override bounds. if (!overrideBounds.isEmpty() && (overrideAppBounds == null || overrideAppBounds.isEmpty()) && parentAppBounds != null && !parentAppBounds.isEmpty()) { final Rect appBounds = new Rect(overrideBounds); appBounds.intersect(parentAppBounds); resolvedConfig.windowConfiguration.setAppBounds(appBounds); } } @Override boolean isOrganized() { return mOrganizer != null; Loading services/tests/wmtests/src/com/android/server/wm/DisplayAreaTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.server.wm; import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION; Loading Loading @@ -50,6 +50,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.os.Binder; import android.platform.test.annotations.Presubmit; Loading Loading @@ -407,6 +408,32 @@ public class DisplayAreaTest extends WindowTestsBase { childBounds1, windowToken.getMaxBounds()); } @Test public void testRestrictAppBoundsToOverrideBounds() { final RootDisplayArea root = new DisplayAreaPolicyBuilderTest.SurfacelessDisplayAreaRoot(mWm); final DisplayArea<DisplayArea> da = new DisplayArea<>(mWm, ANY, "Test_DA"); root.addChild(da, POSITION_TOP); final Rect displayBounds = new Rect(0, 0, 1800, 2800); final Rect displayAppBounds = new Rect(0, 100, 1800, 2800); final Rect daBounds = new Rect(0, 1400, 1800, 2800); root.setBounds(displayBounds); // DA inherit parent app bounds. final Configuration displayConfig = new Configuration(); displayConfig.windowConfiguration.setAppBounds(displayAppBounds); root.onRequestedOverrideConfigurationChanged(displayConfig); assertEquals(displayAppBounds, da.getConfiguration().windowConfiguration.getAppBounds()); // Restrict DA appBounds to override Bounds da.setBounds(daBounds); final Rect expectedDaAppBounds = new Rect(daBounds); expectedDaAppBounds.intersect(displayAppBounds); assertEquals(expectedDaAppBounds, da.getConfiguration().windowConfiguration.getAppBounds()); } @Test public void testGetOrientation() { final DisplayArea.Tokens area = new DisplayArea.Tokens(mWm, ABOVE_TASKS, "test"); Loading services/tests/wmtests/src/com/android/server/wm/DualDisplayAreaGroupPolicyTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.server.wm; import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; Loading Loading
services/core/java/com/android/server/wm/DisplayArea.java +17 −0 Original line number Diff line number Diff line Loading @@ -461,6 +461,23 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { } } @Override void resolveOverrideConfiguration(Configuration newParentConfiguration) { super.resolveOverrideConfiguration(newParentConfiguration); final Configuration resolvedConfig = getResolvedOverrideConfiguration(); final Rect overrideBounds = resolvedConfig.windowConfiguration.getBounds(); final Rect overrideAppBounds = resolvedConfig.windowConfiguration.getAppBounds(); final Rect parentAppBounds = newParentConfiguration.windowConfiguration.getAppBounds(); // If there is no override of appBounds, restrict appBounds to the override bounds. if (!overrideBounds.isEmpty() && (overrideAppBounds == null || overrideAppBounds.isEmpty()) && parentAppBounds != null && !parentAppBounds.isEmpty()) { final Rect appBounds = new Rect(overrideBounds); appBounds.intersect(parentAppBounds); resolvedConfig.windowConfiguration.setAppBounds(appBounds); } } @Override boolean isOrganized() { return mOrganizer != null; Loading
services/tests/wmtests/src/com/android/server/wm/DisplayAreaTest.java +28 −1 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ package com.android.server.wm; import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_PRESENTATION; Loading Loading @@ -50,6 +50,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Rect; import android.os.Binder; import android.platform.test.annotations.Presubmit; Loading Loading @@ -407,6 +408,32 @@ public class DisplayAreaTest extends WindowTestsBase { childBounds1, windowToken.getMaxBounds()); } @Test public void testRestrictAppBoundsToOverrideBounds() { final RootDisplayArea root = new DisplayAreaPolicyBuilderTest.SurfacelessDisplayAreaRoot(mWm); final DisplayArea<DisplayArea> da = new DisplayArea<>(mWm, ANY, "Test_DA"); root.addChild(da, POSITION_TOP); final Rect displayBounds = new Rect(0, 0, 1800, 2800); final Rect displayAppBounds = new Rect(0, 100, 1800, 2800); final Rect daBounds = new Rect(0, 1400, 1800, 2800); root.setBounds(displayBounds); // DA inherit parent app bounds. final Configuration displayConfig = new Configuration(); displayConfig.windowConfiguration.setAppBounds(displayAppBounds); root.onRequestedOverrideConfigurationChanged(displayConfig); assertEquals(displayAppBounds, da.getConfiguration().windowConfiguration.getAppBounds()); // Restrict DA appBounds to override Bounds da.setBounds(daBounds); final Rect expectedDaAppBounds = new Rect(daBounds); expectedDaAppBounds.intersect(displayAppBounds); assertEquals(expectedDaAppBounds, da.getConfiguration().windowConfiguration.getAppBounds()); } @Test public void testGetOrientation() { final DisplayArea.Tokens area = new DisplayArea.Tokens(mWm, ABOVE_TASKS, "test"); Loading
services/tests/wmtests/src/com/android/server/wm/DualDisplayAreaGroupPolicyTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.server.wm; import static android.content.ActivityInfoProto.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; Loading