Merge "Always attempt AU w/ kg dismissal on fp failure" into tm-qpr-dev
This commit is contained in:
@@ -1660,7 +1660,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationFailed() {
|
public void onAuthenticationFailed() {
|
||||||
requestActiveUnlock(
|
requestActiveUnlockDismissKeyguard(
|
||||||
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL,
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL,
|
||||||
"fingerprintFailure");
|
"fingerprintFailure");
|
||||||
handleFingerprintAuthFailed();
|
handleFingerprintAuthFailed();
|
||||||
@@ -2590,6 +2590,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
|| mAuthController.isUdfpsFingerDown());
|
|| mAuthController.isUdfpsFingerDown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to trigger active unlock from trust agent with a request to dismiss the keyguard.
|
||||||
|
*/
|
||||||
|
public void requestActiveUnlockDismissKeyguard(
|
||||||
|
@NonNull ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN requestOrigin,
|
||||||
|
String extraReason
|
||||||
|
) {
|
||||||
|
requestActiveUnlock(
|
||||||
|
requestOrigin,
|
||||||
|
extraReason + "-dismissKeyguard", true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the UDFPS bouncer is showing.
|
* Whether the UDFPS bouncer is showing.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2084,6 +2084,96 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
|
assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fingerprintFailure_requestActiveUnlock_dismissKeyguard()
|
||||||
|
throws RemoteException {
|
||||||
|
// GIVEN shouldTriggerActiveUnlock
|
||||||
|
bouncerFullyVisible();
|
||||||
|
when(mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())).thenReturn(true);
|
||||||
|
|
||||||
|
// GIVEN active unlock triggers on biometric failures
|
||||||
|
when(mActiveUnlockConfig.shouldAllowActiveUnlockFromOrigin(
|
||||||
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN fingerprint fails
|
||||||
|
mKeyguardUpdateMonitor.mFingerprintAuthenticationCallback.onAuthenticationFailed();
|
||||||
|
|
||||||
|
// ALWAYS request unlock with a keyguard dismissal
|
||||||
|
verify(mTrustManager).reportUserRequestedUnlock(eq(KeyguardUpdateMonitor.getCurrentUser()),
|
||||||
|
eq(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void faceNonBypassFailure_requestActiveUnlock_doesNotDismissKeyguard()
|
||||||
|
throws RemoteException {
|
||||||
|
// GIVEN shouldTriggerActiveUnlock
|
||||||
|
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
|
||||||
|
keyguardIsVisible();
|
||||||
|
keyguardNotGoingAway();
|
||||||
|
statusBarShadeIsNotLocked();
|
||||||
|
when(mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())).thenReturn(true);
|
||||||
|
|
||||||
|
// GIVEN active unlock triggers on biometric failures
|
||||||
|
when(mActiveUnlockConfig.shouldAllowActiveUnlockFromOrigin(
|
||||||
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN face fails & bypass is not allowed
|
||||||
|
lockscreenBypassIsNotAllowed();
|
||||||
|
mKeyguardUpdateMonitor.mFaceAuthenticationCallback.onAuthenticationFailed();
|
||||||
|
|
||||||
|
// THEN request unlock with NO keyguard dismissal
|
||||||
|
verify(mTrustManager).reportUserRequestedUnlock(eq(KeyguardUpdateMonitor.getCurrentUser()),
|
||||||
|
eq(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void faceBypassFailure_requestActiveUnlock_dismissKeyguard()
|
||||||
|
throws RemoteException {
|
||||||
|
// GIVEN shouldTriggerActiveUnlock
|
||||||
|
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
|
||||||
|
keyguardIsVisible();
|
||||||
|
keyguardNotGoingAway();
|
||||||
|
statusBarShadeIsNotLocked();
|
||||||
|
when(mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())).thenReturn(true);
|
||||||
|
|
||||||
|
// GIVEN active unlock triggers on biometric failures
|
||||||
|
when(mActiveUnlockConfig.shouldAllowActiveUnlockFromOrigin(
|
||||||
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN face fails & bypass is not allowed
|
||||||
|
lockscreenBypassIsAllowed();
|
||||||
|
mKeyguardUpdateMonitor.mFaceAuthenticationCallback.onAuthenticationFailed();
|
||||||
|
|
||||||
|
// THEN request unlock with a keyguard dismissal
|
||||||
|
verify(mTrustManager).reportUserRequestedUnlock(eq(KeyguardUpdateMonitor.getCurrentUser()),
|
||||||
|
eq(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void faceNonBypassFailure_requestActiveUnlock_dismissKeyguard()
|
||||||
|
throws RemoteException {
|
||||||
|
// GIVEN shouldTriggerActiveUnlock
|
||||||
|
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
|
||||||
|
lockscreenBypassIsNotAllowed();
|
||||||
|
when(mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())).thenReturn(true);
|
||||||
|
|
||||||
|
// GIVEN active unlock triggers on biometric failures
|
||||||
|
when(mActiveUnlockConfig.shouldAllowActiveUnlockFromOrigin(
|
||||||
|
ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL))
|
||||||
|
.thenReturn(true);
|
||||||
|
|
||||||
|
// WHEN face fails & on the bouncer
|
||||||
|
bouncerFullyVisible();
|
||||||
|
mKeyguardUpdateMonitor.mFaceAuthenticationCallback.onAuthenticationFailed();
|
||||||
|
|
||||||
|
// THEN request unlock with a keyguard dismissal
|
||||||
|
verify(mTrustManager).reportUserRequestedUnlock(eq(KeyguardUpdateMonitor.getCurrentUser()),
|
||||||
|
eq(true));
|
||||||
|
}
|
||||||
|
|
||||||
private void userDeviceLockDown() {
|
private void userDeviceLockDown() {
|
||||||
when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false);
|
when(mStrongAuthTracker.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(false);
|
||||||
when(mStrongAuthTracker.getStrongAuthForUser(mCurrentUserId))
|
when(mStrongAuthTracker.getStrongAuthForUser(mCurrentUserId))
|
||||||
@@ -2101,6 +2191,9 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void mockCanBypassLockscreen(boolean canBypass) {
|
private void mockCanBypassLockscreen(boolean canBypass) {
|
||||||
|
// force update the isFaceEnrolled cache:
|
||||||
|
mKeyguardUpdateMonitor.isFaceAuthEnabledForUser(getCurrentUser());
|
||||||
|
|
||||||
mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController);
|
mKeyguardUpdateMonitor.setKeyguardBypassController(mKeyguardBypassController);
|
||||||
when(mKeyguardBypassController.canBypass()).thenReturn(canBypass);
|
when(mKeyguardBypassController.canBypass()).thenReturn(canBypass);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user