Loading services/core/java/com/android/server/wm/ActivityRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -2751,7 +2751,9 @@ final class ActivityRecord extends ConfigurationContainer { final Configuration srcConfig = task.getConfiguration(); overrideConfig.colorMode = srcConfig.colorMode; overrideConfig.densityDpi = srcConfig.densityDpi; overrideConfig.screenLayout = srcConfig.screenLayout; overrideConfig.screenLayout = srcConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); // The smallest screen width is the short side of screen bounds. Because the bounds // and density won't be changed, smallestScreenWidthDp is also fixed. overrideConfig.smallestScreenWidthDp = srcConfig.smallestScreenWidthDp; Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +26 −2 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ public class ActivityRecordTests extends ActivityTestsBase { } @Test public void testFixedScreenConfigurationWhenMovingToDisplay() { public void testSizeCompatMode_FixedScreenConfigurationWhenMovingToDisplay() { // Initialize different bounds on a new display. final ActivityDisplay newDisplay = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP); newDisplay.setBounds(0, 0, 1000, 2000); Loading @@ -431,7 +431,7 @@ public class ActivityRecordTests extends ActivityTestsBase { } @Test public void testFixedScreenBoundsWhenDisplaySizeChanged() { public void testSizeCompatMode_FixedScreenBoundsWhenDisplaySizeChanged() { when(mActivity.mAppWindowToken.getOrientationIgnoreVisibility()).thenReturn( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); mTask.getWindowConfiguration().setAppBounds(mStack.getDisplay().getBounds()); Loading @@ -446,4 +446,28 @@ public class ActivityRecordTests extends ActivityTestsBase { assertEquals(originalBounds, mActivity.getBounds()); } @Test public void testSizeCompatMode_FixedScreenLayoutSizeBits() { final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO | Configuration.SCREENLAYOUT_SIZE_NORMAL; mTask.getConfiguration().screenLayout = fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_LTR; mTask.getWindowConfiguration().setAppBounds(mStack.getDisplay().getBounds()); mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE; mActivity.info.maxAspectRatio = 1.5f; ensureActivityConfiguration(); // The initial configuration should inherit from parent. assertEquals(mTask.getConfiguration().screenLayout, mActivity.getConfiguration().screenLayout); mTask.getConfiguration().screenLayout = Configuration.SCREENLAYOUT_LAYOUTDIR_RTL | Configuration.SCREENLAYOUT_LONG_YES | Configuration.SCREENLAYOUT_SIZE_LARGE; mActivity.onConfigurationChanged(mTask.getConfiguration()); // The size and aspect ratio bits don't change, but the layout direction should be updated. assertEquals(fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_RTL, mActivity.getConfiguration().screenLayout); } } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -2751,7 +2751,9 @@ final class ActivityRecord extends ConfigurationContainer { final Configuration srcConfig = task.getConfiguration(); overrideConfig.colorMode = srcConfig.colorMode; overrideConfig.densityDpi = srcConfig.densityDpi; overrideConfig.screenLayout = srcConfig.screenLayout; overrideConfig.screenLayout = srcConfig.screenLayout & (Configuration.SCREENLAYOUT_LONG_MASK | Configuration.SCREENLAYOUT_SIZE_MASK); // The smallest screen width is the short side of screen bounds. Because the bounds // and density won't be changed, smallestScreenWidthDp is also fixed. overrideConfig.smallestScreenWidthDp = srcConfig.smallestScreenWidthDp; Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +26 −2 Original line number Diff line number Diff line Loading @@ -406,7 +406,7 @@ public class ActivityRecordTests extends ActivityTestsBase { } @Test public void testFixedScreenConfigurationWhenMovingToDisplay() { public void testSizeCompatMode_FixedScreenConfigurationWhenMovingToDisplay() { // Initialize different bounds on a new display. final ActivityDisplay newDisplay = addNewActivityDisplayAt(ActivityDisplay.POSITION_TOP); newDisplay.setBounds(0, 0, 1000, 2000); Loading @@ -431,7 +431,7 @@ public class ActivityRecordTests extends ActivityTestsBase { } @Test public void testFixedScreenBoundsWhenDisplaySizeChanged() { public void testSizeCompatMode_FixedScreenBoundsWhenDisplaySizeChanged() { when(mActivity.mAppWindowToken.getOrientationIgnoreVisibility()).thenReturn( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); mTask.getWindowConfiguration().setAppBounds(mStack.getDisplay().getBounds()); Loading @@ -446,4 +446,28 @@ public class ActivityRecordTests extends ActivityTestsBase { assertEquals(originalBounds, mActivity.getBounds()); } @Test public void testSizeCompatMode_FixedScreenLayoutSizeBits() { final int fixedScreenLayout = Configuration.SCREENLAYOUT_LONG_NO | Configuration.SCREENLAYOUT_SIZE_NORMAL; mTask.getConfiguration().screenLayout = fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_LTR; mTask.getWindowConfiguration().setAppBounds(mStack.getDisplay().getBounds()); mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_UNRESIZEABLE; mActivity.info.maxAspectRatio = 1.5f; ensureActivityConfiguration(); // The initial configuration should inherit from parent. assertEquals(mTask.getConfiguration().screenLayout, mActivity.getConfiguration().screenLayout); mTask.getConfiguration().screenLayout = Configuration.SCREENLAYOUT_LAYOUTDIR_RTL | Configuration.SCREENLAYOUT_LONG_YES | Configuration.SCREENLAYOUT_SIZE_LARGE; mActivity.onConfigurationChanged(mTask.getConfiguration()); // The size and aspect ratio bits don't change, but the layout direction should be updated. assertEquals(fixedScreenLayout | Configuration.SCREENLAYOUT_LAYOUTDIR_RTL, mActivity.getConfiguration().screenLayout); } }