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

Commit 3a931d02 authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Show correct locked orientation on phones" into mnc-dev

parents 4155d9f3 26098836
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -78,8 +78,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
            return;
        }
        state.value = rotationLocked;
        final boolean portrait = mContext.getResources().getConfiguration().orientation
                != Configuration.ORIENTATION_LANDSCAPE;
        final boolean portrait = isCurrentOrientationLockPortrait();
        final AnimationIcon icon;
        if (rotationLocked) {
            final int label = portrait ? R.string.quick_settings_rotation_locked_portrait_label
@@ -98,6 +97,17 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
                R.string.accessibility_rotation_lock_off);
    }

    private boolean isCurrentOrientationLockPortrait() {
        int lockOrientation = mController.getRotationLockOrientation();
        if (lockOrientation == Configuration.ORIENTATION_UNDEFINED) {
            // Freely rotating device; use current rotation
            return mContext.getResources().getConfiguration().orientation
                    != Configuration.ORIENTATION_LANDSCAPE;
        } else {
            return lockOrientation != Configuration.ORIENTATION_LANDSCAPE;
        }
    }

    @Override
    public int getMetricsCategory() {
        return MetricsLogger.QS_ROTATIONLOCK;
@@ -116,9 +126,7 @@ public class RotationLockTile extends QSTile<QSTile.BooleanState> {
            int idWhenOff) {
        int stringID;
        if (locked) {
            final boolean portrait = mContext.getResources().getConfiguration().orientation
                    != Configuration.ORIENTATION_LANDSCAPE;
            stringID = portrait ? idWhenPortrait: idWhenLandscape;
            stringID = isCurrentOrientationLockPortrait() ? idWhenPortrait: idWhenLandscape;
        } else {
            stringID = idWhenOff;
        }