diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 84f1da01c5c1d..f5022ab64add1 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1496,7 +1496,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab @Override public void onDetectionStatusChanged(@NonNull FaceDetectionStatus status) { - handleFaceAuthenticated(status.getUserId(), status.isStrongBiometric()); + handleBiometricDetected(status.getUserId(), FACE, status.isStrongBiometric()); } }; diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt index b6a296aec3617..d1f011ea4f9b3 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepository.kt @@ -545,11 +545,11 @@ constructor( faceAuthLogger.detectionNotSupported(faceManager, faceManager?.sensorPropertiesInternal) return } - if (_isAuthRunning.value || detectCancellationSignal != null) { + if (_isAuthRunning.value) { faceAuthLogger.skippingDetection(_isAuthRunning.value, detectCancellationSignal != null) return } - + detectCancellationSignal?.cancel() detectCancellationSignal = CancellationSignal() withContext(mainDispatcher) { // We always want to invoke face detect in the main thread. diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/FaceAuthenticationModels.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/FaceAuthenticationModels.kt index dcd6ac4919c42..d9792cf704c8a 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/FaceAuthenticationModels.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/FaceAuthenticationModels.kt @@ -23,7 +23,10 @@ import android.os.SystemClock.elapsedRealtime * Authentication status provided by * [com.android.systemui.keyguard.data.repository.DeviceEntryFaceAuthRepository] */ -sealed class FaceAuthenticationStatus +sealed class FaceAuthenticationStatus( + // present to break equality check if the same error occurs repeatedly. + val createdAt: Long = elapsedRealtime() +) /** Success authentication status. */ data class SuccessFaceAuthenticationStatus(val successResult: FaceManager.AuthenticationResult) : @@ -43,8 +46,6 @@ object FailedFaceAuthenticationStatus : FaceAuthenticationStatus() data class ErrorFaceAuthenticationStatus( val msgId: Int, val msg: String? = null, - // present to break equality check if the same error occurs repeatedly. - val createdAt: Long = elapsedRealtime() ) : FaceAuthenticationStatus() { /** * Method that checks if [msgId] is a lockout error. A lockout error means that face @@ -74,4 +75,10 @@ data class ErrorFaceAuthenticationStatus( } /** Face detection success message. */ -data class FaceDetectionStatus(val sensorId: Int, val userId: Int, val isStrongBiometric: Boolean) +data class FaceDetectionStatus( + val sensorId: Int, + val userId: Int, + val isStrongBiometric: Boolean, + // present to break equality check if the same error occurs repeatedly. + val createdAt: Long = elapsedRealtime() +) diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt index a09f7b9e787e6..8127ac6257480 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/data/repository/DeviceEntryFaceAuthRepositoryTest.kt @@ -386,7 +386,10 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() { detectionCallback.value.onFaceDetected(1, 1, true) - assertThat(detectStatus()).isEqualTo(FaceDetectionStatus(1, 1, true)) + val status = detectStatus()!! + assertThat(status.sensorId).isEqualTo(1) + assertThat(status.userId).isEqualTo(1) + assertThat(status.isStrongBiometric).isEqualTo(true) } @Test