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

Commit bd856725 authored by Marzia Favaro's avatar Marzia Favaro Committed by Android (Google) Code Review
Browse files

Merge "App default has aspect ratio override" into main

parents 88a2e670 27b5e5cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3230,8 +3230,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
        }
        // If the user preference respects aspect ratio, then it becomes non-resizable.
        return !mAppCompatController.getAppCompatOverrides().getAppCompatAspectRatioOverrides()
                .shouldApplyUserMinAspectRatioOverride();
        return mAppCompatController.getAppCompatOverrides().getAppCompatAspectRatioOverrides()
                .userPreferenceCompatibleWithNonResizability();
    }

    boolean isResizeable() {
+6 −0
Original line number Diff line number Diff line
@@ -135,6 +135,12 @@ class AppCompatAspectRatioOverrides {
                && aspectRatio != USER_MIN_ASPECT_RATIO_FULLSCREEN;
    }

    boolean userPreferenceCompatibleWithNonResizability() {
        final int aspectRatio = getUserMinAspectRatioOverrideCode();
        return aspectRatio == USER_MIN_ASPECT_RATIO_UNSET
                || aspectRatio == USER_MIN_ASPECT_RATIO_FULLSCREEN;
    }

    boolean shouldApplyUserFullscreenOverride() {
        if (isUserFullscreenOverrideEnabled()) {
            final int aspectRatio = getUserMinAspectRatioOverrideCode();
+2 −1
Original line number Diff line number Diff line
@@ -4917,7 +4917,8 @@ public class SizeCompatTests extends WindowTestsBase {
        assertEquals(minAspect, aspectRatioPolicy.getMinAspectRatio(), 0 /* delta */);

        // User override can still take effect.
        doReturn(true).when(aspectRatioOverrides).shouldApplyUserMinAspectRatioOverride();
        doReturn(USER_MIN_ASPECT_RATIO_3_2).when(aspectRatioOverrides)
                .getUserMinAspectRatioOverrideCode();
        assertFalse(mActivity.isResizeable());
        assertEquals(maxAspect, aspectRatioPolicy.getMaxAspectRatio(), 0 /* delta */);
        assertNotEquals(SCREEN_ORIENTATION_UNSPECIFIED, mActivity.getOverrideOrientation());