Fixed double face auth on swipe

Previously, if a face was rejected, and PIN/Pattern/Pass was
presented, and the user swiped on to unlock simultaneously, 2x face
authentications would be observed.

Test: Verified 10/10 times that device no longer performs 2x face
authentications in the scenario described above.
Fixes: 188598635

Change-Id: I24f964981484cfa19f7e1709f95da485204ff7a9
This commit is contained in:
Joshua Mccloskey
2021-07-15 11:43:26 -07:00
parent 4de5e90844
commit 5afa7487df
2 changed files with 19 additions and 4 deletions

View File

@@ -23,5 +23,6 @@ data class KeyguardFaceListenModel(
val isLockIconPressed: Boolean,
val isScanningAllowedByStrongAuth: Boolean,
val isPrimaryUser: Boolean,
val isSecureCameraLaunched: Boolean
val isSecureCameraLaunched: Boolean,
val isFaceAuthenticated: Boolean
)

View File

@@ -1058,9 +1058,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|| isSimPinSecure());
}
private boolean getIsFaceAuthenticated() {
boolean faceAuthenticated = false;
BiometricAuthenticated bioFaceAuthenticated = mUserFaceAuthenticated.get(getCurrentUser());
if (bioFaceAuthenticated != null) {
faceAuthenticated = bioFaceAuthenticated.mAuthenticated;
}
return faceAuthenticated;
}
private void requireStrongAuthIfAllLockedOut() {
final boolean faceLock =
mFaceLockedOutPermanent || !shouldListenForFace();
(mFaceLockedOutPermanent || !shouldListenForFace()) && !getIsFaceAuthenticated();
final boolean fpLock =
mFingerprintLockedOutPermanent || !shouldListenForFingerprint(isUdfpsEnrolled());
@@ -2236,6 +2245,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
strongAuthAllowsScanning = false;
}
// If the face has recently been authenticated do not attempt to authenticate again.
boolean faceAuthenticated = getIsFaceAuthenticated();
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
final boolean shouldListen =
@@ -2244,7 +2256,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
&& !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer
&& !mKeyguardGoingAway && mBiometricEnabledForUser.get(user) && !mLockIconPressed
&& strongAuthAllowsScanning && mIsPrimaryUser
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace);
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace)
&& !faceAuthenticated;
// Aggregate relevant fields for debug logging.
if (DEBUG_FACE || DEBUG_SPEW) {
@@ -2265,7 +2278,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mLockIconPressed,
strongAuthAllowsScanning,
mIsPrimaryUser,
mSecureCameraLaunched);
mSecureCameraLaunched,
faceAuthenticated);
maybeLogFaceListenerModelData(model);
}