Closed jamiehiggins closed 2 years ago
Sounds like a critical issue. I have a OnePlus 8T device, but with the test app, all works fine, including the case with dialog cancel.
Can you provide more details about this case?
onSucceeded
call after dialog dismiss OR only some of them?BiometricAuthRequest
did you use to start the Biometric auth flow?onSucceeded
is called, it receives the Set<AuthenticationResult>
(the test app shows info in Toast) - can you provide what AuthenticationResult
(s) you got if you dismiss the dialog?I am testing against the latest version 2.1.11, although it also happens on older versions (I first noticed on 2.0.79 and upgraded to latest to test)
The test APK exhibits the same problem when I click any of the buttons and then click to cancel I see a Succeeded popup message.
In my app I am using the following: BiometricAuthRequest(BiometricApi.AUTO, BiometricType.BIOMETRIC_ANY, BiometricConfirmation.ANY)
The toast is shown below:
If I cancel the popup by going back (using back button/swipe gesture) I do see the correct cancel popup as desired.
My device is running Android 12.
On my OnePlus 7 with Android 11 the issue does not happen and everything behaves as it should.
@jamiehiggins okay, I checked the code and behavior on my OnePlus 8T/Android 12. For me both API's (Fingerprint and Biometric) behave in a next way:
Also, I checked more logic that handles errors and success cases - onSucceeded()
will be called if at least one API call the onAuthenticationSucceeded
. From your report - it seems like touching outside leads to onAuthenticationSucceeded
for both - Fingerprint and BiometricPrompt API.
Recently I faced a bug on MS Surface Duo when onAuthenticationError
with 10 "The user canceled the operation."
was called right after onAuthenticationFailed
. It's just an idea, but I have a mind that if you touch outside the dialog, the onAuthenticationSucceeded
called due to some system bug, and then onAuthenticationError
is called, but this call will be ignored.
Is possible to get from your OnePlus 9 device to get logs? You can obtain logs from LogCat OR after bug reproducing - press "Send logs".
Thank you.
@jamiehiggins So, I prepare the APK with possible fix. Testing required
Thanks so much for the super quick response. I will test first thing tomorrow morning and report back ASAP.
The fix has the same result, I'm afraid. Hitting back or touching outside the dialog returns the correct Canceled result, but hitting the cancel button still shows the success popup.
I can't seem to send logs I'm afraid as it loads up gmail and then hangs before crashing.
Here is the logcat output after this issue happens.
Okay, step-by-step we moving.
I pushed some changes to oneplus_9
branch, so fresh test build can be found here
Result is the same. Updated logcat output is attached:
@jamiehiggins
@sergeykomlach I have just emailed logs from the new APK.
The sample app does get an onAuthenticationSucceeded returned when I hit the cancel button, however it then goes on to hit the SignatureException so it doesn't succeed. (All works fine when I authenticate with the fingerprint).
@jamiehiggins thank you for the logs and feedback!
It seems like in case of false onAuthenticationSucceeded
, if used BiometricCryptoObject - Cipher/Signature is not initialized properly and can't be used for crypto functions.
I can try to use this to detect the false onAuthenticationSucceeded
calls. Here the APK with fix.
Hope this will help
@sergeykomlach that APK is working great and I am now getting the cancelled popup when I tap the cancel button. Great work!
Super! I'll close the issue and prepare new version of the library
When testing the library on the One Plus 9 I have noticed that if I cancel the dialog while prompting for a fingerprint, instead of getting an onCanceled callback like I do on other devices I am seeing an onSucceeded callback. This is allowing users to bypass the security lock simply by cancelling the dialog.
There appears to be no difference in the onSucceeded callback on this device if I do actually authenticate with my fingerprint as the return parameter is identical.