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

Commit b35914bb authored by Jeff Brown's avatar Jeff Brown Committed by Android (Google) Code Review
Browse files

Merge "Disallow 180 rotation for phones. Bug: 4981385"

parents a829e166 d3187e39
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -32,5 +32,8 @@
    <!-- see comment in values/config.xml -->
    <dimen name="config_prefDialogWidth">580dp</dimen>
    
    <!-- If true, the screen can be rotated via the accelerometer in all 4
         rotations as the default behavior. -->
    <bool name="config_allowAllRotations">true</bool>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -231,7 +231,7 @@

    <!-- If true, the screen can be rotated via the accelerometer in all 4
         rotations as the default behavior. -->
    <bool name="config_allowAllRotations">true</bool>
    <bool name="config_allowAllRotations">false</bool>

    <!-- If true, the direction rotation is applied to get to an application's requested
         orientation is reversed.  Normally, the model is that landscape is
+9 −4
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    int mUserRotationMode = WindowManagerPolicy.USER_ROTATION_FREE;
    int mUserRotation = Surface.ROTATION_0;

    boolean mAllowAllRotations;
    int mAllowAllRotations = -1;
    boolean mCarDockEnablesAccelerometer;
    boolean mDeskDockEnablesAccelerometer;
    int mLidKeyboardAccessibility;
@@ -681,8 +681,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                com.android.internal.R.integer.config_carDockRotation);
        mDeskDockRotation = readRotation(
                com.android.internal.R.integer.config_deskDockRotation);
        mAllowAllRotations = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_allowAllRotations);
        mCarDockEnablesAccelerometer = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_carDockEnablesAccelerometer);
        mDeskDockEnablesAccelerometer = mContext.getResources().getBoolean(
@@ -2921,8 +2919,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    || orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT) {
                // Otherwise, use sensor only if requested by the application or enabled
                // by default for USER or UNSPECIFIED modes.  Does not apply to NOSENSOR.
                if (mAllowAllRotations < 0) {
                    // Can't read this during init() because the context doesn't
                    // have display metrics at that time so we cannot determine
                    // tablet vs. phone then.
                    mAllowAllRotations = mContext.getResources().getBoolean(
                            com.android.internal.R.bool.config_allowAllRotations) ? 1 : 0;
                }
                if (sensorRotation != Surface.ROTATION_180
                        || mAllowAllRotations
                        || mAllowAllRotations == 1
                        || orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR) {
                    preferredRotation = sensorRotation;
                } else {