Open vascofg opened 4 years ago
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.
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.
@oblador thoughts about this?
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
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
Please try out 8.0.0 which has performance improvements
@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: https://github.com/oblador/react-native-keychain/issues/337#issuecomment-734585561
There's what I think is a bug on waiting for the Biometric Prompt result, more specifically in this part of the code: https://github.com/oblador/react-native-keychain/blob/c854720a8945990dc75bbfbd02dc2044bda8aead/android/src/main/java/com/oblador/keychain/KeychainModule.java#L849-L859
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: