private static final int MSG_DEVICE_PROVISIONED = 308;
private static final int MSG_DPM_STATE_CHANGED = 309;
private static final int MSG_USER_SWITCHING = 310;
- private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 312;
+ private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 311;
+ private static final int MSG_KEYGUARD_RESET = 312;
private static final int MSG_BOOT_COMPLETED = 313;
private static final int MSG_USER_SWITCH_COMPLETE = 314;
private static final int MSG_USER_INFO_CHANGED = 317;
private boolean mKeyguardIsVisible;
private boolean mBouncer;
private boolean mBootCompleted;
+ private boolean mUserHasAuthenticatedSinceBoot;
// Device provisioning state
private boolean mDeviceProvisioned;
case MSG_KEYGUARD_VISIBILITY_CHANGED:
handleKeyguardVisibilityChanged(msg.arg1);
break;
+ case MSG_KEYGUARD_RESET:
+ handleKeyguardReset();
+ break;
case MSG_KEYGUARD_BOUNCER_CHANGED:
handleKeyguardBouncerChanged(msg.arg1);
break;
}
public boolean getUserCanSkipBouncer(int userId) {
- return getUserHasTrust(userId) || mUserFingerprintAuthenticated.get(userId);
+ return getUserHasTrust(userId) || (mUserFingerprintAuthenticated.get(userId)
+ && isUnlockingWithFingerprintAllowed());
}
public boolean getUserHasTrust(int userId) {
return mUserTrustIsManaged.get(userId) && !isTrustDisabled(userId);
}
+ public boolean isUnlockingWithFingerprintAllowed() {
+ return mUserHasAuthenticatedSinceBoot;
+ }
+
static class DisplayClientState {
public int clientGeneration;
public boolean clearing;
}
private boolean shouldListenForFingerprint() {
- return mKeyguardIsVisible && !mSwitchingUser
- && mTrustManager.hasUserAuthenticatedSinceBoot(ActivityManager.getCurrentUser());
+ return mKeyguardIsVisible && !mSwitchingUser;
}
private void startListeningForFingerprint() {
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
int userId = ActivityManager.getCurrentUser();
if (isUnlockWithFingerPrintPossible(userId)) {
+ mUserHasAuthenticatedSinceBoot = mTrustManager.hasUserAuthenticatedSinceBoot(
+ ActivityManager.getCurrentUser());
if (mFingerprintCancelSignal != null) {
mFingerprintCancelSignal.cancel();
}
}
/**
+ * Handle {@link #MSG_KEYGUARD_RESET}
+ */
+ private void handleKeyguardReset() {
+ if (DEBUG) Log.d(TAG, "handleKeyguardReset");
+ if (!isUnlockingWithFingerprintAllowed()) {
+ updateFingerprintListeningState();
+ }
+ }
+
+ /**
* Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED}
* @see #sendKeyguardBouncerChanged(boolean)
*/
message.sendToTarget();
}
+ public void sendKeyguardReset() {
+ mHandler.obtainMessage(MSG_KEYGUARD_RESET).sendToTarget();
+ }
+
/**
* @see #handleKeyguardBouncerChanged(int)
*/
@Override
public void onFingerprintHelp(int msgId, String helpString) {
+ if (!KeyguardUpdateMonitor.getInstance(mContext).isUnlockingWithFingerprintAllowed()) {
+ return;
+ }
mLockIcon.setTransientFpError(true);
mIndicationController.showTransientIndication(helpString,
getResources().getColor(R.color.system_warning_color, null));
@Override
public void onFingerprintError(int msgId, String errString) {
+ if (!KeyguardUpdateMonitor.getInstance(mContext).isUnlockingWithFingerprintAllowed()) {
+ return;
+ }
// TODO: Go to bouncer if this is "too many attempts" (lockout) error.
mIndicationController.showTransientIndication(errString,
getResources().getColor(R.color.system_warning_color, null));
}
private int getState() {
- boolean fingerprintRunning =
- KeyguardUpdateMonitor.getInstance(mContext).isFingerprintDetectionRunning();
+ KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
+ boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
+ boolean unlockingAllowed = updateMonitor.isUnlockingWithFingerprintAllowed();
if (mUnlockMethodCache.canSkipBouncer()) {
return STATE_LOCK_OPEN;
} else if (mTransientFpError) {
return STATE_FINGERPRINT_ERROR;
- } else if (fingerprintRunning) {
+ } else if (fingerprintRunning && unlockingAllowed) {
return STATE_FINGERPRINT;
} else if (mUnlockMethodCache.isFaceUnlockRunning()) {
return STATE_FACE_UNLOCK;