Merge "Do not run face auth if face is locked out and don't transition to bouncer when face is locked out." into tm-qpr-dev am: b3b9a1d091 am: 38504f8539
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19941805 Change-Id: I0919a5ac45bfe6db9b17d81e84180f6c79fe62d5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -55,6 +55,8 @@ data class KeyguardFaceListenModel(
|
||||
val bouncerIsOrWillShow: Boolean,
|
||||
val faceAuthenticated: Boolean,
|
||||
val faceDisabled: Boolean,
|
||||
val faceLockedOut: Boolean,
|
||||
val fpLockedOut: Boolean,
|
||||
val goingToSleep: Boolean,
|
||||
val keyguardAwakeExcludingBouncerShowing: Boolean,
|
||||
val keyguardGoingAway: Boolean,
|
||||
@@ -65,7 +67,7 @@ data class KeyguardFaceListenModel(
|
||||
val scanningAllowedByStrongAuth: Boolean,
|
||||
val secureCameraLaunched: Boolean,
|
||||
val switchingUser: Boolean,
|
||||
val udfpsBouncerShowing: Boolean
|
||||
val udfpsBouncerShowing: Boolean,
|
||||
) : KeyguardListenModel()
|
||||
/**
|
||||
* Verbose debug information associated with [KeyguardUpdateMonitor.shouldTriggerActiveUnlock].
|
||||
|
||||
@@ -2612,6 +2612,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
final boolean biometricEnabledForUser = mBiometricEnabledForUser.get(user);
|
||||
final boolean shouldListenForFaceAssistant = shouldListenForFaceAssistant();
|
||||
final boolean onlyFaceEnrolled = isOnlyFaceEnrolled();
|
||||
final boolean fpOrFaceIsLockedOut = isFaceLockedOut() || fpLockedout;
|
||||
|
||||
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
|
||||
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||
@@ -2628,7 +2629,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
&& strongAuthAllowsScanning && mIsPrimaryUser
|
||||
&& (!mSecureCameraLaunched || mOccludingAppRequestingFace)
|
||||
&& !faceAuthenticated
|
||||
&& !fpLockedout;
|
||||
&& !fpOrFaceIsLockedOut;
|
||||
|
||||
// Aggregate relevant fields for debug logging.
|
||||
maybeLogListenerModelData(
|
||||
@@ -2643,6 +2644,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
mBouncerIsOrWillBeShowing,
|
||||
faceAuthenticated,
|
||||
faceDisabledForUser,
|
||||
isFaceLockedOut(),
|
||||
fpLockedout,
|
||||
mGoingToSleep,
|
||||
awakeKeyguardExcludingBouncerShowing,
|
||||
mKeyguardGoingAway,
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.res.Resources;
|
||||
import android.hardware.biometrics.BiometricFaceConstants;
|
||||
import android.hardware.biometrics.BiometricFingerprintConstants;
|
||||
import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Handler;
|
||||
@@ -654,10 +653,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
final boolean fingerprintLockout = biometricSourceType == BiometricSourceType.FINGERPRINT
|
||||
&& (msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT
|
||||
|| msgId == FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT);
|
||||
final boolean faceLockout = biometricSourceType == BiometricSourceType.FACE
|
||||
&& (msgId == FaceManager.FACE_ERROR_LOCKOUT
|
||||
|| msgId == FaceManager.FACE_ERROR_LOCKOUT_PERMANENT);
|
||||
if (fingerprintLockout || faceLockout) {
|
||||
if (fingerprintLockout) {
|
||||
startWakeAndUnlock(MODE_SHOW_BOUNCER);
|
||||
UI_EVENT_LOGGER.log(BiometricUiEvent.BIOMETRIC_BOUNCER_SHOWN, getSessionId());
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel(
|
||||
onlyFaceEnrolled = false,
|
||||
faceAuthenticated = false,
|
||||
faceDisabled = false,
|
||||
faceLockedOut = false,
|
||||
fpLockedOut = false,
|
||||
goingToSleep = false,
|
||||
keyguardAwakeExcludingBouncerShowing = false,
|
||||
keyguardGoingAway = false,
|
||||
@@ -99,5 +101,5 @@ private fun faceModel(user: Int) = KeyguardFaceListenModel(
|
||||
scanningAllowedByStrongAuth = false,
|
||||
secureCameraLaunched = false,
|
||||
switchingUser = false,
|
||||
udfpsBouncerShowing = false
|
||||
udfpsBouncerShowing = false,
|
||||
)
|
||||
|
||||
@@ -20,6 +20,7 @@ import static android.app.StatusBarManager.SESSION_KEYGUARD;
|
||||
import static android.hardware.biometrics.BiometricAuthenticator.TYPE_FINGERPRINT;
|
||||
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ACQUIRED_START;
|
||||
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_LOCKOUT;
|
||||
import static android.hardware.biometrics.BiometricFingerprintConstants.FINGERPRINT_ERROR_LOCKOUT_PERMANENT;
|
||||
import static android.telephony.SubscriptionManager.DATA_ROAMING_DISABLE;
|
||||
import static android.telephony.SubscriptionManager.NAME_SOURCE_CARRIER_ID;
|
||||
|
||||
@@ -751,8 +752,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
|
||||
mKeyguardUpdateMonitor.mFaceAuthenticationCallback
|
||||
.onAuthenticationError(FaceManager.FACE_ERROR_LOCKOUT_PERMANENT, "");
|
||||
faceAuthLockedOut();
|
||||
|
||||
verify(mLockPatternUtils, never()).requireStrongAuth(anyInt(), anyInt());
|
||||
}
|
||||
@@ -764,7 +764,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
|
||||
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
|
||||
.onAuthenticationError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
|
||||
.onAuthenticationError(FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
|
||||
|
||||
verify(mLockPatternUtils).requireStrongAuth(anyInt(), anyInt());
|
||||
}
|
||||
@@ -775,10 +775,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mTestableLooper.processAllMessages();
|
||||
mKeyguardUpdateMonitor.onKeyguardVisibilityChanged(true);
|
||||
|
||||
mKeyguardUpdateMonitor.mFaceAuthenticationCallback
|
||||
.onAuthenticationError(FaceManager.FACE_ERROR_LOCKOUT_PERMANENT, "");
|
||||
faceAuthLockedOut();
|
||||
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback
|
||||
.onAuthenticationError(FingerprintManager.FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
|
||||
.onAuthenticationError(FINGERPRINT_ERROR_LOCKOUT_PERMANENT, "");
|
||||
|
||||
verify(mLockPatternUtils).requireStrongAuth(anyInt(), anyInt());
|
||||
}
|
||||
@@ -1217,7 +1216,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
public void testShouldListenForFace_whenFpIsLockedOut_returnsFalse() throws RemoteException {
|
||||
// Face auth should run when the following is true.
|
||||
keyguardNotGoingAway();
|
||||
bouncerFullyVisibleAndNotGoingToSleep();
|
||||
occludingAppRequestsFaceAuth();
|
||||
currentUserIsPrimary();
|
||||
strongAuthNotRequired();
|
||||
biometricsEnabledForCurrentUser();
|
||||
@@ -1225,6 +1224,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
biometricsNotDisabledThroughDevicePolicyManager();
|
||||
userNotCurrentlySwitching();
|
||||
mTestableLooper.processAllMessages();
|
||||
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
|
||||
|
||||
// Fingerprint is locked out.
|
||||
fingerprintErrorLockedOut();
|
||||
@@ -1499,6 +1499,27 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldListenForFace_whenFaceIsLockedOut_returnsFalse()
|
||||
throws RemoteException {
|
||||
// Preconditions for face auth to run
|
||||
keyguardNotGoingAway();
|
||||
currentUserIsPrimary();
|
||||
currentUserDoesNotHaveTrust();
|
||||
biometricsNotDisabledThroughDevicePolicyManager();
|
||||
biometricsEnabledForCurrentUser();
|
||||
userNotCurrentlySwitching();
|
||||
mKeyguardUpdateMonitor.setUdfpsBouncerShowing(true);
|
||||
mTestableLooper.processAllMessages();
|
||||
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isTrue();
|
||||
|
||||
// Face is locked out.
|
||||
faceAuthLockedOut();
|
||||
mTestableLooper.processAllMessages();
|
||||
|
||||
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBouncerVisibility_whenBothFingerprintAndFaceIsEnrolled_stopsFaceAuth()
|
||||
throws RemoteException {
|
||||
@@ -1587,6 +1608,11 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
verify(mPowerManager, never()).wakeUp(anyLong(), anyInt(), anyString());
|
||||
}
|
||||
|
||||
private void faceAuthLockedOut() {
|
||||
mKeyguardUpdateMonitor.mFaceAuthenticationCallback
|
||||
.onAuthenticationError(FaceManager.FACE_ERROR_LOCKOUT_PERMANENT, "");
|
||||
}
|
||||
|
||||
private void faceAuthEnabled() {
|
||||
// this ensures KeyguardUpdateMonitor updates the cached mIsFaceEnrolled flag using the
|
||||
// face manager mock wire-up in setup()
|
||||
|
||||
Reference in New Issue
Block a user