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

Commit 33ea7c9a authored by Graciela Wissen Putri's avatar Graciela Wissen Putri
Browse files

[2/n] Add PackageManager.USER_MIN_ASPECT_RATIO_APP_DEFAULT

Fullscreen per-app override will be applied when user has not set any
aspect ratio for app (USER_MIN_ASPECT_RATIO_UNSET).

New API will behave the same as USER_MIN_ASPECT_RATIO_UNSET except when
fullscreen override has been applied by device manufacturer.

New API will allow user to revert from device manufacturer-applied
fullscreen override (applied by overriding orientation to
SCREEN_ORIENTATION_USER via OVERRIDE_ANY_ORIENTATION_TO_USER).

Bug: 310816437
Test: atest LetterboxUiControllerTest
Change-Id: Ib23d39b9ecb3fc43139ad5f6b530d6ca11881fed
parent 99fa73c0
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2518,6 +2518,7 @@ public abstract class PackageManager {
            USER_MIN_ASPECT_RATIO_16_9,
            USER_MIN_ASPECT_RATIO_3_2,
            USER_MIN_ASPECT_RATIO_FULLSCREEN,
            USER_MIN_ASPECT_RATIO_APP_DEFAULT,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface UserMinAspectRatio {}
@@ -2571,6 +2572,16 @@ public abstract class PackageManager {
     */
    public static final int USER_MIN_ASPECT_RATIO_FULLSCREEN = 6;

    /**
     * Aspect ratio override code: user sets to app's default aspect ratio.
     * This resets both the user-forced aspect ratio, and the device manufacturer
     * per-app override {@link ActivityInfo#OVERRIDE_ANY_ORIENTATION_TO_USER}.
     * It is different from {@link #USER_MIN_ASPECT_RATIO_UNSET} as the latter may
     * apply the device manufacturer per-app orientation override if any,
     * @hide
     */
    public static final int USER_MIN_ASPECT_RATIO_APP_DEFAULT = 7;

    /** @hide */
    @IntDef(flag = true, prefix = { "DELETE_" }, value = {
            DELETE_KEEP_DATA,
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import static android.content.pm.ActivityInfo.screenOrientationToString;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_16_9;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_3_2;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_4_3;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_APP_DEFAULT;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_DISPLAY_SIZE;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_FULLSCREEN;
import static android.content.pm.PackageManager.USER_MIN_ASPECT_RATIO_SPLIT_SCREEN;
@@ -1185,6 +1186,7 @@ final class LetterboxUiController {
        mUserAspectRatio = getUserMinAspectRatioOverrideCode();

        return mUserAspectRatio != USER_MIN_ASPECT_RATIO_UNSET
                && mUserAspectRatio != USER_MIN_ASPECT_RATIO_APP_DEFAULT
                && mUserAspectRatio != USER_MIN_ASPECT_RATIO_FULLSCREEN;
    }