Loading services/core/java/com/android/server/biometrics/AuthSession.java +7 −1 Original line number Diff line number Diff line Loading @@ -893,7 +893,13 @@ public final class AuthSession implements IBinder.DeathRecipient { break; default: // Check range of fallback option values. if (reason >= BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_BASE && reason < BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_MAX) { mClientReceiver.onDialogDismissed(reason); } else { Slog.w(TAG, "Unhandled reason: " + reason); } break; } } catch (RemoteException e) { Loading services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_ERROR_NEG import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_BIOMETRIC_CONFIRMED; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_BIOMETRIC_CONFIRM_NOT_REQUIRED; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_BASE; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_NEGATIVE; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_USER_CANCEL; Loading Loading @@ -673,6 +674,33 @@ public class AuthSessionTest { eq(0) /* userId */); } @Test public void onDialogDismissed_withFallbackReason_notifiesClientReceiverWithCorrectReason() throws RemoteException { setupFingerprint(0 /* id */, FingerprintSensorProperties.TYPE_REAR); final AuthSession session = createAuthSession( mSensors, false /* checkDevicePolicyManager */, Authenticators.BIOMETRIC_STRONG, TEST_REQUEST_ID, 0 /* operationId */, 0 /* userId */ ); session.onDialogDismissed(DISMISSED_REASON_FALLBACK_OPTION_BASE, null /* credentialAttestation */); verify(mClientReceiver).onDialogDismissed( eq(DISMISSED_REASON_FALLBACK_OPTION_BASE) ); verify(mClientReceiver, never()).onError(anyInt(), anyInt(), anyInt()); verify(mClientReceiver, never()).onAuthenticationSucceeded(anyInt()); verify(mClientReceiver, never()).onAuthenticationFailed(); verify(mClientReceiver, never()).onAcquired(anyInt(), any()); } @Test public void onErrorReceivedAfterOnTryAgainPressedWhenSensorsAuthenticating() throws Exception { setupFingerprint(0 /* id */, FingerprintSensorProperties.TYPE_UDFPS_OPTICAL); Loading Loading
services/core/java/com/android/server/biometrics/AuthSession.java +7 −1 Original line number Diff line number Diff line Loading @@ -893,7 +893,13 @@ public final class AuthSession implements IBinder.DeathRecipient { break; default: // Check range of fallback option values. if (reason >= BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_BASE && reason < BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_MAX) { mClientReceiver.onDialogDismissed(reason); } else { Slog.w(TAG, "Unhandled reason: " + reason); } break; } } catch (RemoteException e) { Loading
services/tests/servicestests/src/com/android/server/biometrics/AuthSessionTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static android.hardware.biometrics.BiometricConstants.BIOMETRIC_ERROR_NEG import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_BIOMETRIC_CONFIRMED; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_BIOMETRIC_CONFIRM_NOT_REQUIRED; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_CONTENT_VIEW_MORE_OPTIONS; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_FALLBACK_OPTION_BASE; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_NEGATIVE; import static android.hardware.biometrics.BiometricPrompt.DISMISSED_REASON_USER_CANCEL; Loading Loading @@ -673,6 +674,33 @@ public class AuthSessionTest { eq(0) /* userId */); } @Test public void onDialogDismissed_withFallbackReason_notifiesClientReceiverWithCorrectReason() throws RemoteException { setupFingerprint(0 /* id */, FingerprintSensorProperties.TYPE_REAR); final AuthSession session = createAuthSession( mSensors, false /* checkDevicePolicyManager */, Authenticators.BIOMETRIC_STRONG, TEST_REQUEST_ID, 0 /* operationId */, 0 /* userId */ ); session.onDialogDismissed(DISMISSED_REASON_FALLBACK_OPTION_BASE, null /* credentialAttestation */); verify(mClientReceiver).onDialogDismissed( eq(DISMISSED_REASON_FALLBACK_OPTION_BASE) ); verify(mClientReceiver, never()).onError(anyInt(), anyInt(), anyInt()); verify(mClientReceiver, never()).onAuthenticationSucceeded(anyInt()); verify(mClientReceiver, never()).onAuthenticationFailed(); verify(mClientReceiver, never()).onAcquired(anyInt(), any()); } @Test public void onErrorReceivedAfterOnTryAgainPressedWhenSensorsAuthenticating() throws Exception { setupFingerprint(0 /* id */, FingerprintSensorProperties.TYPE_UDFPS_OPTICAL); Loading