summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2015-07-14 16:41:57 -0700
committerAdrian Roos <roosa@google.com>2015-07-14 23:44:25 +0000
commit2609883606e384019895e3be071658b342f5f2ca (patch)
treedc24856144b651bc96b5cad76b5ee113ba55b928 /packages/SystemUI/src
parentd4c1861a536d022b00505c75c30529c50688f26a (diff)
downloadframeworks_base-2609883606e384019895e3be071658b342f5f2ca.zip
frameworks_base-2609883606e384019895e3be071658b342f5f2ca.tar.gz
frameworks_base-2609883606e384019895e3be071658b342f5f2ca.tar.bz2
Show correct locked orientation on phones
Bug: 22487750 Change-Id: I1feaaf1e569c576c5212ef396732b2bbb5a0c0fc
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tiles/RotationLockTile.java18
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 6d2c8c0..1a26a4d 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;
}