diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java index 4cb24bd..bbb56fe 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowManager.java @@ -24,6 +24,7 @@ import android.graphics.Point; import android.graphics.PixelFormat; import android.os.Handler; import android.os.SystemProperties; +import android.provider.Settings; import android.view.Gravity; import android.view.Display; import android.view.SurfaceSession; @@ -54,7 +55,7 @@ public class StatusBarWindowManager implements KeyguardMonitor.Callback { private WindowManager.LayoutParams mLp; private WindowManager.LayoutParams mLpChanged; private int mBarHeight; - private final boolean mKeyguardScreenRotation; + private boolean mKeyguardScreenRotation; private final float mScreenBrightnessDoze; private boolean mKeyguardBlurEnabled; @@ -86,8 +87,13 @@ public class StatusBarWindowManager implements KeyguardMonitor.Callback { private boolean shouldEnableKeyguardScreenRotation() { Resources res = mContext.getResources(); + boolean enableAccelerometerRotation = Settings.System.getInt(mContext.getContentResolver(), + Settings.System.ACCELEROMETER_ROTATION, 1) != 0; + boolean enableLockScreenRotation = CMSettings.System.getInt(mContext.getContentResolver(), + CMSettings.System.LOCKSCREEN_ROTATION, 0) != 0; return SystemProperties.getBoolean("lockscreen.rot_override", false) - || res.getBoolean(R.bool.config_enableLockScreenRotation); + || (res.getBoolean(R.bool.config_enableLockScreenRotation) + && (enableLockScreenRotation && enableAccelerometerRotation)); } /** @@ -133,10 +139,10 @@ public class StatusBarWindowManager implements KeyguardMonitor.Callback { if (mKeyguardBlur != null) { mKeyguardBlur.setLayer(STATUS_BAR_LAYER - 2); } - - SettingsObserver observer = new SettingsObserver(new Handler()); - observer.observe(mContext); } + + SettingsObserver observer = new SettingsObserver(new Handler()); + observer.observe(mContext); } private void applyKeyguardFlags(State state) { @@ -468,6 +474,14 @@ public class StatusBarWindowManager implements KeyguardMonitor.Callback { CMSettings.Secure.getUriFor(CMSettings.Secure.LOCK_SCREEN_BLUR_ENABLED), false, this); + context.getContentResolver().registerContentObserver( + Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), + false, + this); + context.getContentResolver().registerContentObserver( + CMSettings.System.getUriFor(CMSettings.System.LOCKSCREEN_ROTATION), + false, + this); } public void unobserve(Context context) { @@ -479,6 +493,7 @@ public class StatusBarWindowManager implements KeyguardMonitor.Callback { // default to being enabled since we are here because the blur config was set to true mKeyguardBlurEnabled = CMSettings.Secure.getInt(mContext.getContentResolver(), CMSettings.Secure.LOCK_SCREEN_BLUR_ENABLED, 1) == 1; + mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation(); // update the state apply(mCurrentState); } |