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

Commit 95231217 authored by Dake Gu's avatar Dake Gu
Browse files

PhoneWindowManager: allow force default rotation for TV

TV's DP is 960x540, it doesn't satisfy the 960x720 minimal
requirement for config_forceDefaultOrientation=true to work.
skip the DP check for TV.

Test: adb shell settings put system user_rotation 1
Bug: 71769797

Change-Id: I07ba068601cef3b6ebb363fe0b0bc7af9f198360
parent f2beec00
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2255,9 +2255,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        // http://developer.android.com/guide/practices/screens_support.html#range
        // For car, ignore the dp limitation. It's physically impossible to rotate the car's screen
        // so if the orientation is forced, we need to respect that no matter what.
        boolean isCar = mContext.getPackageManager().hasSystemFeature(
        final boolean isCar = mContext.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_AUTOMOTIVE);
        mForceDefaultOrientation = ((longSizeDp >= 960 && shortSizeDp >= 720) || isCar) &&
        // For TV, it's usually 960dp x 540dp, ignore the size limitation.
        // so if the orientation is forced, we need to respect that no matter what.
        final boolean isTv = mContext.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_LEANBACK);
        mForceDefaultOrientation = ((longSizeDp >= 960 && shortSizeDp >= 720) || isCar || isTv) &&
                res.getBoolean(com.android.internal.R.bool.config_forceDefaultOrientation) &&
                // For debug purposes the next line turns this feature off with:
                // $ adb shell setprop config.override_forced_orient true