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

Commit 49858741 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #3194697: default orientation for portrait-mode apps on stingray is backward?"

parents 658ecc18 07f3d664
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -214,6 +214,14 @@
         rotations as the default behavior. -->
    <bool name="config_allowAllRotations">true</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
         clockwise from portrait; thus on a portrait device an app requesting
         landscape will cause a clockwise rotation, and on a landscape device an
         app requesting portrait will cause a counter-clockwise rotation.  Setting
         true here reverses that logic. -->
    <bool name="config_reverseDefaultRotation">false</bool>

    <!-- The number of degrees to rotate the display when the keyboard is open. -->
    <integer name="config_lidOpenRotation">90</integer>

+16 −4
Original line number Diff line number Diff line
@@ -2360,17 +2360,29 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
                    .getDefaultDisplay();
            if (d.getWidth() > d.getHeight()) {
                mPortraitRotation = Surface.ROTATION_90;
                mLandscapeRotation = Surface.ROTATION_0;
                mUpsideDownRotation = Surface.ROTATION_270;
                mSeascapeRotation = Surface.ROTATION_180;
                if (mContext.getResources().getBoolean(
                        com.android.internal.R.bool.config_reverseDefaultRotation)) {
                    mPortraitRotation = Surface.ROTATION_90;
                    mUpsideDownRotation = Surface.ROTATION_270;
                } else {
                    mPortraitRotation = Surface.ROTATION_270;
                    mUpsideDownRotation = Surface.ROTATION_90;
                }
            } else {
                mPortraitRotation = Surface.ROTATION_0;
                mLandscapeRotation = Surface.ROTATION_90;
                mUpsideDownRotation = Surface.ROTATION_180;
                if (mContext.getResources().getBoolean(
                        com.android.internal.R.bool.config_reverseDefaultRotation)) {
                    mLandscapeRotation = Surface.ROTATION_270;
                    mSeascapeRotation = Surface.ROTATION_90;
                } else {
                    mLandscapeRotation = Surface.ROTATION_90;
                    mSeascapeRotation = Surface.ROTATION_270;
                }
            }
        }

        synchronized (mLock) {
            switch (orientation) {