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

Commit f4655586 authored by Graciela Putri's avatar Graciela Putri Committed by Android (Google) Code Review
Browse files

Merge "Don't create compatDisplayInsets if has fullscreen override" into 24D1-dev

parents c3f7329b 94701206
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -237,7 +237,8 @@ class UserAspectRatioSettingsWindowManager extends CompatUIWindowManagerAbstract
        final int letterboxWidth = taskInfo.topActivityLetterboxWidth;
        // App is not visibly letterboxed if it covers status bar/bottom insets or matches the
        // stable bounds, so don't show the button
        if (stableBounds.height() <= letterboxHeight && stableBounds.width() <= letterboxWidth) {
        if (stableBounds.height() <= letterboxHeight && stableBounds.width() <= letterboxWidth
                && !taskInfo.isUserFullscreenOverrideEnabled) {
            return false;
        }

+18 −0
Original line number Diff line number Diff line
@@ -291,6 +291,24 @@ public class UserAspectRatioSettingsWindowManagerTest extends ShellTestCase {
        verify(mWindowManager).inflateLayout();
    }

    @Test
    public void testUserFullscreenOverrideEnabled_buttonAlwaysShown() {
        TaskInfo taskInfo = createTaskInfo(/* eligibleForUserAspectRatioButton= */
                true, /* topActivityBoundsLetterboxed */ true, ACTION_MAIN, CATEGORY_LAUNCHER);

        final Rect stableBounds = mWindowManager.getTaskStableBounds();

        // Letterboxed activity that has user fullscreen override should always show button,
        // layout should be inflated
        taskInfo.appCompatTaskInfo.topActivityLetterboxHeight = stableBounds.height();
        taskInfo.appCompatTaskInfo.topActivityLetterboxWidth = stableBounds.width();
        taskInfo.appCompatTaskInfo.isUserFullscreenOverrideEnabled = true;

        mWindowManager.updateCompatInfo(taskInfo, mTaskListener, /* canShow= */ true);

        verify(mWindowManager).inflateLayout();
    }

    @Test
    public void testUpdateDisplayLayout() {
        final DisplayInfo displayInfo = new DisplayInfo();
+1 −1
Original line number Diff line number Diff line
@@ -8332,7 +8332,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *         aspect ratio.
     */
    boolean shouldCreateCompatDisplayInsets() {
        if (mLetterboxUiController.shouldApplyUserFullscreenOverride()) {
        if (mLetterboxUiController.hasFullscreenOverride()) {
            // If the user has forced the applications aspect ratio to be fullscreen, don't use size
            // compatibility mode in any situation. The user has been warned and therefore accepts
            // the risk of the application misbehaving.
+19 −0
Original line number Diff line number Diff line
@@ -1357,6 +1357,25 @@ public class SizeCompatTests extends WindowTestsBase {
        assertFalse(activity.shouldCreateCompatDisplayInsets());
    }

    @Test
    @EnableCompatChanges({ActivityInfo.OVERRIDE_ANY_ORIENTATION_TO_USER})
    public void testShouldNotCreateCompatDisplays_systemFullscreenOverride() {
        setUpDisplaySizeWithApp(1000, 2500);

        // Make the task root resizable.
        mActivity.info.resizeMode = RESIZE_MODE_RESIZEABLE;

        // Create an activity on the same task.
        final ActivityRecord activity = buildActivityRecord(/* supportsSizeChanges= */false,
                RESIZE_MODE_UNRESIZEABLE, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        // Simulate the user selecting the fullscreen user aspect ratio override
        spyOn(activity.mLetterboxUiController);
        doReturn(true).when(activity.mLetterboxUiController)
                .isSystemOverrideToFullscreenEnabled();
        assertFalse(activity.shouldCreateCompatDisplayInsets());
    }

    @Test
    @EnableCompatChanges({ActivityInfo.NEVER_SANDBOX_DISPLAY_APIS})
    public void testNeverSandboxDisplayApis_configEnabled_sandboxingNotApplied() {