diff options
| author | 2015-07-15 21:56:12 +0000 | |
|---|---|---|
| committer | 2015-07-15 21:56:27 +0000 | |
| commit | 3a931d028a0c43fe276b0adfdc6b87ac48dd5df3 (patch) | |
| tree | cccbca65574623d9504801a2fc3621764bd918f5 | |
| parent | 4155d9f37762a6a91d47c383f9c3a9fd3aa7f884 (diff) | |
| parent | 2609883606e384019895e3be071658b342f5f2ca (diff) | |
Merge "Show correct locked orientation on phones" into mnc-dev
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java index 6d2c8c09dfaf..1a26a4dad39e 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java @@ -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; } |