summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDavid van Tonder <david.vantonder@gmail.com>2013-07-02 06:27:42 -0700
committerGerrit Code Review <gerrit@cyanogenmod.org>2013-07-02 06:27:42 -0700
commit00cc4708bbd77fd22bab295fddb7ccdb19b3e56d (patch)
tree631ad7a1e698c51ccacc07b1e4ee985b4bf5fbe4 /services
parente79d05a70b3bb878599140ad376abc1095f4d2ba (diff)
parentb0463ae06523f69c26ebd7b2a005ab1fdd95f6e2 (diff)
downloadframeworks_base-00cc4708bbd77fd22bab295fddb7ccdb19b3e56d.zip
frameworks_base-00cc4708bbd77fd22bab295fddb7ccdb19b3e56d.tar.gz
frameworks_base-00cc4708bbd77fd22bab295fddb7ccdb19b3e56d.tar.bz2
Merge "When DPM is updated while lock screen is inhibited, don't unconditionally enable lock screen." into cm-10.1
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wm/KeyguardDisableHandler.java41
1 files changed, 26 insertions, 15 deletions
diff --git a/services/java/com/android/server/wm/KeyguardDisableHandler.java b/services/java/com/android/server/wm/KeyguardDisableHandler.java
index 859df51..eeb832f 100644
--- a/services/java/com/android/server/wm/KeyguardDisableHandler.java
+++ b/services/java/com/android/server/wm/KeyguardDisableHandler.java
@@ -69,13 +69,35 @@ public class KeyguardDisableHandler extends Handler {
break;
case KEYGUARD_POLICY_CHANGED:
- mPolicy.enableKeyguard(true);
- // lazily evaluate this next time we're asked to disable keyguard
- mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN;
+ if (mKeyguardTokenWatcher.isAcquired()) {
+ updateAllowDisableState();
+ } else {
+ // lazily evaluate this next time we're asked to disable keyguard
+ mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN;
+ }
+ if (mAllowDisableKeyguard != ALLOW_DISABLE_YES) {
+ mPolicy.enableKeyguard(true);
+ }
break;
}
}
+ private void updateAllowDisableState() {
+ DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
+ Context.DEVICE_POLICY_SERVICE);
+ if (dpm != null) {
+ try {
+ int userId = ActivityManagerNative.getDefault().getCurrentUser().id;
+ int quality = dpm.getPasswordQuality(null, userId);
+
+ mAllowDisableKeyguard = quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED
+ ? ALLOW_DISABLE_YES : ALLOW_DISABLE_NO;
+ } catch (RemoteException re) {
+ // Nothing much we can do
+ }
+ }
+ }
+
class KeyguardTokenWatcher extends TokenWatcher {
public KeyguardTokenWatcher(final Handler handler) {
@@ -87,18 +109,7 @@ public class KeyguardDisableHandler extends Handler {
// We fail safe and prevent disabling keyguard in the unlikely event this gets
// called before DevicePolicyManagerService has started.
if (mAllowDisableKeyguard == ALLOW_DISABLE_UNKNOWN) {
- DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
- Context.DEVICE_POLICY_SERVICE);
- if (dpm != null) {
- try {
- mAllowDisableKeyguard = dpm.getPasswordQuality(null,
- ActivityManagerNative.getDefault().getCurrentUser().id)
- == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED ?
- ALLOW_DISABLE_YES : ALLOW_DISABLE_NO;
- } catch (RemoteException re) {
- // Nothing much we can do
- }
- }
+ updateAllowDisableState();
}
if (mAllowDisableKeyguard == ALLOW_DISABLE_YES) {
mPolicy.enableKeyguard(false);