Merge "Don't overtrigger face auth (ie: goingToSleep, lockdown)" into tm-dev

This commit is contained in:
Beverly Tai
2022-04-05 13:37:34 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 7 deletions

View File

@@ -54,6 +54,7 @@ data class KeyguardFaceListenModel(
val bouncerFullyShown: Boolean,
val faceAuthenticated: Boolean,
val faceDisabled: Boolean,
val goingToSleep: Boolean,
val keyguardAwake: Boolean,
val keyguardGoingAway: Boolean,
val listeningForFaceAssistant: Boolean,

View File

@@ -628,7 +628,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
*/
public void setKeyguardGoingAway(boolean goingAway) {
mKeyguardGoingAway = goingAway;
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE);
// This is set specifically to stop face authentication from running.
updateBiometricListeningState(BIOMETRIC_ACTION_STOP);
}
/**
@@ -1746,7 +1747,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
cb.onFinishedGoingToSleep(arg1);
}
}
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE);
// This is set specifically to stop face authentication from running.
updateBiometricListeningState(BIOMETRIC_ACTION_STOP);
}
private void handleScreenTurnedOff() {
@@ -1764,7 +1766,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
cb.onDreamingStateChanged(mIsDreaming);
}
}
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE);
if (mIsDreaming) {
updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE);
updateFaceListeningState(BIOMETRIC_ACTION_STOP);
} else {
updateBiometricListeningState(BIOMETRIC_ACTION_UPDATE);
}
}
private void handleUserInfoChanged(int userId) {
@@ -2477,9 +2484,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass
&& !mBouncerFullyShown);
// If the device supports face detection (without authentication), allow it to happen
// if the device is in lockdown mode. Otherwise, prevent scanning.
// If the device supports face detection (without authentication) and bypass is enabled,
// allow face scanning to happen if the device is in lockdown mode.
// Otherwise, prevent scanning.
final boolean supportsDetectOnly = !mFaceSensorProperties.isEmpty()
&& canBypass
&& mFaceSensorProperties.get(0).supportsFaceDetection;
if (isLockDown && !supportsDetectOnly) {
strongAuthAllowsScanning = false;
@@ -2494,8 +2503,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// 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 =
(mBouncerFullyShown || mAuthInterruptActive || mOccludingAppRequestingFace
|| awakeKeyguard || shouldListenForFaceAssistant
(mBouncerFullyShown && !mGoingToSleep
|| mAuthInterruptActive
|| mOccludingAppRequestingFace
|| awakeKeyguard
|| shouldListenForFaceAssistant
|| mAuthController.isUdfpsFingerDown())
&& !mSwitchingUser && !faceDisabledForUser && becauseCannotSkipBouncer
&& !mKeyguardGoingAway && biometricEnabledForUser && !mLockIconPressed
@@ -2517,6 +2529,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
mBouncerFullyShown,
faceAuthenticated,
faceDisabledForUser,
mGoingToSleep,
awakeKeyguard,
mKeyguardGoingAway,
shouldListenForFaceAssistant,

View File

@@ -88,6 +88,7 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel(
bouncerFullyShown = false,
faceAuthenticated = false,
faceDisabled = false,
goingToSleep = false,
keyguardAwake = false,
keyguardGoingAway = false,
listeningForFaceAssistant = false,