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

Commit 27b5e5cc authored by Marzia Favaro's avatar Marzia Favaro
Browse files

App default has aspect ratio override

Allow user to set the app default aspect ratio. App default was behaving
the same as fullscreen.

Test: manual, default aspect ratio is different from fullscreen as
before universal resizable by default
Test: SizeCompatTests
Flag: com.android.window.flags.universal_resizable_by_default
Bug: 378880473

Change-Id: I78464df5ee2ff4e06beb1a4b3c7ec54d19603dad
parent ed1405fe
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());