summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-06-30 14:49:17 +0200
committerDanny Baumann <dannybaumann@web.de>2013-06-30 14:52:08 +0200
commitb0463ae06523f69c26ebd7b2a005ab1fdd95f6e2 (patch)
treeb9b6a2cc80b5cc8781f93adbf370017d61b1628a
parentba7f179c3a747df3d5c439dfcc0fa48d3965048f (diff)
downloadframeworks_base-b0463ae06523f69c26ebd7b2a005ab1fdd95f6e2.zip
frameworks_base-b0463ae06523f69c26ebd7b2a005ab1fdd95f6e2.tar.gz
frameworks_base-b0463ae06523f69c26ebd7b2a005ab1fdd95f6e2.tar.bz2
When DPM is updated while lock screen is inhibited, don't
unconditionally enable lock screen. Change-Id: Iab2af06eb8e41fbcfc6adfbeb5b42a9bbf446fe9
-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);