Merge "Lock face when fingerprint is locked." into sc-v2-dev am: c6d86bbccf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16459553

Change-Id: I2fe1a50820da957a7506dad498d7097b4aaec7c7
This commit is contained in:
Joe Bolinger
2021-12-15 01:40:08 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 17 deletions

View File

@@ -830,7 +830,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) { if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT) {
lockedOutStateChanged |= !mFingerprintLockedOutPermanent; lockedOutStateChanged |= !mFingerprintLockedOutPermanent;
mFingerprintLockedOutPermanent = true; mFingerprintLockedOutPermanent = true;
requireStrongAuthIfAllLockedOut(); Log.d(TAG, "Fingerprint locked out - requiring strong auth");
mLockPatternUtils.requireStrongAuth(
STRONG_AUTH_REQUIRED_AFTER_LOCKOUT, getCurrentUser());
} }
if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT if (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
@@ -840,6 +842,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (isUdfpsEnrolled()) { if (isUdfpsEnrolled()) {
updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
} }
stopListeningForFace();
} }
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
@@ -1049,7 +1052,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
if (msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT) { if (msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT) {
lockedOutStateChanged = !mFaceLockedOutPermanent; lockedOutStateChanged = !mFaceLockedOutPermanent;
mFaceLockedOutPermanent = true; mFaceLockedOutPermanent = true;
requireStrongAuthIfAllLockedOut();
} }
if (isHwUnavailable && cameraPrivacyEnabled) { if (isHwUnavailable && cameraPrivacyEnabled) {
@@ -1163,19 +1165,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
return faceAuthenticated; return faceAuthenticated;
} }
private void requireStrongAuthIfAllLockedOut() {
final boolean faceLock =
(mFaceLockedOutPermanent || !shouldListenForFace()) && !getIsFaceAuthenticated();
final boolean fpLock =
mFingerprintLockedOutPermanent || !shouldListenForFingerprint(isUdfpsEnrolled());
if (faceLock && fpLock) {
Log.d(TAG, "All biometrics locked out - requiring strong auth");
mLockPatternUtils.requireStrongAuth(STRONG_AUTH_REQUIRED_AFTER_LOCKOUT,
getCurrentUser());
}
}
public boolean getUserCanSkipBouncer(int userId) { public boolean getUserCanSkipBouncer(int userId) {
return getUserHasTrust(userId) || getUserUnlockedWithBiometric(userId); return getUserHasTrust(userId) || getUserUnlockedWithBiometric(userId);
} }
@@ -2373,6 +2362,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
containsFlag(strongAuth, STRONG_AUTH_REQUIRED_AFTER_BOOT) containsFlag(strongAuth, STRONG_AUTH_REQUIRED_AFTER_BOOT)
|| containsFlag(strongAuth, STRONG_AUTH_REQUIRED_AFTER_TIMEOUT); || containsFlag(strongAuth, STRONG_AUTH_REQUIRED_AFTER_TIMEOUT);
// TODO: always disallow when fp is already locked out?
final boolean fpLockedout = mFingerprintLockedOut || mFingerprintLockedOutPermanent;
final boolean canBypass = mKeyguardBypassController != null final boolean canBypass = mKeyguardBypassController != null
&& mKeyguardBypassController.canBypass(); && mKeyguardBypassController.canBypass();
// There's no reason to ask the HAL for authentication when the user can dismiss the // There's no reason to ask the HAL for authentication when the user can dismiss the
@@ -2407,7 +2399,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
&& !mKeyguardGoingAway && biometricEnabledForUser && !mLockIconPressed && !mKeyguardGoingAway && biometricEnabledForUser && !mLockIconPressed
&& strongAuthAllowsScanning && mIsPrimaryUser && strongAuthAllowsScanning && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace) && (!mSecureCameraLaunched || mOccludingAppRequestingFace)
&& !faceAuthenticated; && !faceAuthenticated
&& !fpLockedout;
// Aggregate relevant fields for debug logging. // Aggregate relevant fields for debug logging.
if (DEBUG_FACE || DEBUG_SPEW) { if (DEBUG_FACE || DEBUG_SPEW) {

View File

@@ -669,7 +669,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
.onAuthenticationError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT, ""); .onAuthenticationError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
verify(mLockPatternUtils, never()).requireStrongAuth(anyInt(), anyInt()); verify(mLockPatternUtils).requireStrongAuth(anyInt(), anyInt());
} }