summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-12-10 21:11:30 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-12-10 21:11:30 +0000
commit65c08ec82a11eeb2ea8b048935ddafc694fc0236 (patch)
tree297a00f5b153e9c38af67bf35482e82ee9ec73d4 /services
parented211b940b24231d02c4e6e2757ee02ff1b9ea79 (diff)
parent4ef9edeb67a1aa25b4ec57b9951b8dc4a06c3691 (diff)
downloadframeworks_base-65c08ec82a11eeb2ea8b048935ddafc694fc0236.zip
frameworks_base-65c08ec82a11eeb2ea8b048935ddafc694fc0236.tar.gz
frameworks_base-65c08ec82a11eeb2ea8b048935ddafc694fc0236.tar.bz2
am 4ef9edeb: Merge "Handle policy change while keyguard disabled" into lmp-mr1-dev
* commit '4ef9edeb67a1aa25b4ec57b9951b8dc4a06c3691': Handle policy change while keyguard disabled
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/wm/KeyguardDisableHandler.java45
1 files changed, 29 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/wm/KeyguardDisableHandler.java b/services/core/java/com/android/server/wm/KeyguardDisableHandler.java
index c1420a8..37d811f 100644
--- a/services/core/java/com/android/server/wm/KeyguardDisableHandler.java
+++ b/services/core/java/com/android/server/wm/KeyguardDisableHandler.java
@@ -68,9 +68,18 @@ 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()) {
+ // If we are currently disabled we need to know if the keyguard
+ // should be re-enabled, so determine the allow state immediately.
+ mKeyguardTokenWatcher.updateAllowState();
+ if (mAllowDisableKeyguard != ALLOW_DISABLE_YES) {
+ mPolicy.enableKeyguard(true);
+ }
+ } else {
+ // lazily evaluate this next time we're asked to disable keyguard
+ mPolicy.enableKeyguard(true);
+ }
break;
}
}
@@ -81,24 +90,28 @@ public class KeyguardDisableHandler extends Handler {
super(handler, TAG);
}
- @Override
- public void acquired() {
+ public void updateAllowState() {
// 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
- }
+ 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
}
}
+ }
+
+ @Override
+ public void acquired() {
+ if (mAllowDisableKeyguard == ALLOW_DISABLE_UNKNOWN) {
+ updateAllowState();
+ }
if (mAllowDisableKeyguard == ALLOW_DISABLE_YES) {
mPolicy.enableKeyguard(false);
} else {