Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow performance on Android BiometricPrompt #309

Closed
vascofg opened this issue Mar 6, 2020 · 8 comments
Closed

Very slow performance on Android BiometricPrompt #309

vascofg opened this issue Mar 6, 2020 · 8 comments

Comments

@vascofg
Copy link
Contributor

vascofg commented Mar 6, 2020

There's what I think is a bug on waiting for the Biometric Prompt result, more specifically in this part of the code:

Log.i(KEYCHAIN_MODULE, "blocking thread. waiting for done UI operation.");
try {
synchronized (this) {
wait();
}
} catch (InterruptedException ignored) {
/* shutdown sequence */
}
Log.i(KEYCHAIN_MODULE, "unblocking thread.");

Particularly in the case where there's an error in the flow, it takes several seconds for the thread to unblock.

I'll do some more investigation, but meanwhile you can try to reproduce:

  • Trigger biometric prompt (e.g. via getInternetCredentials)
  • Scan a wrong fingerprint a bunch of times, until you get a lockout
  • Try to trigger biometric prompt again
    • It now takes several seconds to get an exception from the Promise
@enahum
Copy link

enahum commented Mar 9, 2020

Yes, I'm also experiencing about 2 seconds performance degradation when getting credentials stored in Android, I even disabled the need for Biometrics to see if that made any difference and the reality is that it made no difference.

@lloisp
Copy link

lloisp commented Mar 12, 2020

Our Application experienced an ApplicationNotResponding (android.os.BinderProxy in transactNative), quoted on error-tracking as:

Application Not Responding for at least 4000 ms.

So this seems to be more than just a simple delay and more like something that can hinder the user's experience.

@enahum
Copy link

enahum commented Mar 30, 2020

@oblador thoughts about this?

@SMJ93
Copy link

SMJ93 commented Jun 4, 2020

We are experiencing this on some older Android devices:

Device: P2 Lite
Manufacturer: Shenzhen JEKO Communication Co.,Ltd.
OS: Android 7

Fatal Exception: java.util.concurrent.TimeoutException
android.security.keystore.AndroidKeyStoreUnauthenticatedAESCipherSpi$CBC$PKCS7Padding.finalize() timed out after 10 seconds

@emin93
Copy link

emin93 commented Aug 16, 2021

I have the same issue using the latest version (7.0.0) and can reproduce it sometimes when calling getInternetCredentials directly after the app start. "sometimes" meaning I restart the app over and over again and on every 5-7th app start it takes about 3 seconds until the prompt shows up.

Device: Pixel 3a
OS: Android 11

@oblador
Copy link
Owner

oblador commented Oct 2, 2021

Please try out 8.0.0 which has performance improvements

@emin93
Copy link

emin93 commented Oct 11, 2021

@oblador Thank you for the update. Unfortunately I can still reproduce the issue by restarting the app a few times. Every 4-6th app start it takes much longer until the prompt shows up (it's about the same as before with 7.0.0).

Tried it now also on a Huawei P30, where it also happens. It also doesn't matter whether it's a production or debug build. Even if I generate a signed APK and install that one on the device, I can reliably reproduce the issue.

To reproduce the issue, I simply have to call getInternetCredentials or getGenericPassword in an onMount useEffect hook. If it helps, I can create a reproduction repo and attach a video demonstrating the problem on a few devices. Please let me know if I should do so.

The only solution that really helped here was disabling the warmup as described here: #337 (comment)

@DorianMazur
Copy link
Collaborator

This should be fixed with #658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants