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

Commit c6b5d1bc authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas Committed by Android (Google) Code Review
Browse files

Merge "[2/n] Test parent rotation ignored for SCM activity in desktop mode" into main

parents 664c5081 a6259c0d
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
@@ -4836,6 +4836,29 @@ public class SizeCompatTests extends WindowTestsBase {
        assertTrue(mTask.getTaskInfo().appCompatTaskInfo.isTopActivityInSizeCompat());
        assertTrue(mTask.getTaskInfo().appCompatTaskInfo.isTopActivityInSizeCompat());
    }
    }


    @Test
    public void testParentRotationIgnoredForSCMActivityInDesktopMode() {
        final TaskBuilder taskBuilder =
                new TaskBuilder(mSupervisor).setWindowingMode(WINDOWING_MODE_FREEFORM);
        setUpDisplaySizeWithApp(2500, 1600, taskBuilder);
        prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT);
        assertFitted();

        // Simulate entering desktop mode by changing app to freeform and reducing size.
        mTask.getWindowConfiguration().setWindowingMode(WINDOWING_MODE_FREEFORM);
        mTask.getWindowConfiguration().setAppBounds(new Rect(0, 0, 500, 1250));
        mActivity.onConfigurationChanged(mTask.getConfiguration());
        // Activity should now be in SCM mode.
        assertDownScaled();

        final int originalRotation =
                mActivity.getResolvedOverrideConfiguration().windowConfiguration.getRotation();
        rotateDisplay(mActivity.mDisplayContent, ROTATION_180);
        // Resolved orientation should match original orientation before device was rotated.
        assertEquals(originalRotation,
                mActivity.getResolvedOverrideConfiguration().windowConfiguration.getRotation());
    }

    /**
    /**
     * Tests that all three paths in which aspect ratio logic can be applied yield the same
     * Tests that all three paths in which aspect ratio logic can be applied yield the same
     * result, which is that aspect ratio is respected on app bounds. The three paths are
     * result, which is that aspect ratio is respected on app bounds. The three paths are