Merge "Update lockout state during auth session" into udc-dev

This commit is contained in:
Hao Dong
2023-04-19 21:59:27 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 8 deletions

View File

@@ -95,8 +95,10 @@ public class AuthSessionCoordinator implements AuthSessionListener {
}
}
mRingBuffer.addApiCall("internal : onAuthSessionEnded(" + mUserId + ")");
clearSession();
if (mAuthOperations.isEmpty()) {
mRingBuffer.addApiCall("internal : onAuthSessionEnded(" + mUserId + ")");
clearSession();
}
}
private void clearSession() {
@@ -203,7 +205,7 @@ public class AuthSessionCoordinator implements AuthSessionListener {
return;
}
mAuthOperations.remove(sensorId);
if (mIsAuthenticating && mAuthOperations.isEmpty()) {
if (mIsAuthenticating) {
endAuthSession();
}
}

View File

@@ -135,7 +135,7 @@ public class AuthSessionCoordinatorTest {
}
@Test
public void testUserCanAuthDuringLockoutOfSameSession() {
public void testUserLockedDuringLockoutOfSameSession() {
mCoordinator.resetLockoutFor(PRIMARY_USER, BIOMETRIC_STRONG, 0 /* requestId */);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_CONVENIENCE)).isEqualTo(
@@ -151,9 +151,9 @@ public class AuthSessionCoordinatorTest {
0 /* requestId */);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_CONVENIENCE)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);
LockoutTracker.LOCKOUT_PERMANENT);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_WEAK)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);
LockoutTracker.LOCKOUT_PERMANENT);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_STRONG)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);
}
@@ -191,9 +191,9 @@ public class AuthSessionCoordinatorTest {
0 /* requestId */);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_CONVENIENCE)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);
LockoutTracker.LOCKOUT_PERMANENT);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_WEAK)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);
LockoutTracker.LOCKOUT_PERMANENT);
assertThat(mCoordinator.getLockoutStateFor(PRIMARY_USER, BIOMETRIC_STRONG)).isEqualTo(
LockoutTracker.LOCKOUT_NONE);