Update lockout state during auth session

Test: atest AuthSessionCoordinatorTest
Bug: 275743371
Change-Id: Icf4ab00f6ace970d97a0de953c6ec9e7fcc0a798
This commit is contained in:
Hao Dong
2023-04-18 21:29:32 +00:00
parent 6a2dd9b9ab
commit 28c1d6be08
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);