am 4ef9edeb: Merge "Handle policy change while keyguard disabled" into lmp-mr1-dev
* commit '4ef9edeb67a1aa25b4ec57b9951b8dc4a06c3691': Handle policy change while keyguard disabled
This commit is contained in:
@@ -68,9 +68,18 @@ public class KeyguardDisableHandler extends Handler {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case KEYGUARD_POLICY_CHANGED:
|
case KEYGUARD_POLICY_CHANGED:
|
||||||
mPolicy.enableKeyguard(true);
|
|
||||||
// lazily evaluate this next time we're asked to disable keyguard
|
|
||||||
mAllowDisableKeyguard = ALLOW_DISABLE_UNKNOWN;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,24 +90,28 @@ public class KeyguardDisableHandler extends Handler {
|
|||||||
super(handler, TAG);
|
super(handler, TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void updateAllowState() {
|
||||||
public void acquired() {
|
|
||||||
// We fail safe and prevent disabling keyguard in the unlikely event this gets
|
// We fail safe and prevent disabling keyguard in the unlikely event this gets
|
||||||
// called before DevicePolicyManagerService has started.
|
// called before DevicePolicyManagerService has started.
|
||||||
if (mAllowDisableKeyguard == ALLOW_DISABLE_UNKNOWN) {
|
DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
||||||
DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
Context.DEVICE_POLICY_SERVICE);
|
||||||
Context.DEVICE_POLICY_SERVICE);
|
if (dpm != null) {
|
||||||
if (dpm != null) {
|
try {
|
||||||
try {
|
mAllowDisableKeyguard = dpm.getPasswordQuality(null,
|
||||||
mAllowDisableKeyguard = dpm.getPasswordQuality(null,
|
ActivityManagerNative.getDefault().getCurrentUser().id)
|
||||||
ActivityManagerNative.getDefault().getCurrentUser().id)
|
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED ?
|
||||||
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED ?
|
ALLOW_DISABLE_YES : ALLOW_DISABLE_NO;
|
||||||
ALLOW_DISABLE_YES : ALLOW_DISABLE_NO;
|
} catch (RemoteException re) {
|
||||||
} catch (RemoteException re) {
|
// Nothing much we can do
|
||||||
// Nothing much we can do
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void acquired() {
|
||||||
|
if (mAllowDisableKeyguard == ALLOW_DISABLE_UNKNOWN) {
|
||||||
|
updateAllowState();
|
||||||
|
}
|
||||||
if (mAllowDisableKeyguard == ALLOW_DISABLE_YES) {
|
if (mAllowDisableKeyguard == ALLOW_DISABLE_YES) {
|
||||||
mPolicy.enableKeyguard(false);
|
mPolicy.enableKeyguard(false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user