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

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

Change-Id: I79a1fdafb25d2ee18265059f786505e184797256
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Beverly Tai
2022-04-05 14:04:26 +00:00
committed by Automerger Merge Worker
3 changed files with 22 additions and 7 deletions

View File

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

View File

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

View File

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