Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7308d63f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't put layout round and direction in override configuration"

parents d057e233 2560c3b2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
+26 −2
Original line number Diff line number Diff line
@@ -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);
@@ -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());
@@ -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);
    }
}