Validate Exception Catching in BioPrompt API
After running through the API, the builder for the prompt is confirmed
to throw just an IllegalArgumentException, as does the actual calling of the
API. Thus, we can specify to just IllegalArgumentException, and anything
else will be unexpected and should error-out.
Bug: 334923201
Test: Video and Build test
Change-Id: If2028b6a60bf4c95a7a0c41247dcb4284f585cb1
diff --git a/packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt b/packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt
index 95f49e9..6bf803a 100644
--- a/packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt
+++ b/packages/CredentialManager/src/com/android/credentialmanager/common/BiometricHandler.kt
@@ -235,8 +235,7 @@
} else {
biometricPrompt.authenticate(cancellationSignal, executor, callback)
}
- } catch (e: Exception) {
- // TODO(b/334923201) : Specialize exception catching
+ } catch (e: IllegalArgumentException) {
Log.w(TAG, "Calling the biometric prompt API failed with: /n${e.localizedMessage}\n")
onBiometricFailureFallback(biometricFlowType)
}