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

[Fix][Android] Avoid blocking threads to prevent deadlocks #576

Closed
wants to merge 2 commits into from

Conversation

frw
Copy link
Contributor

@frw frw commented Nov 13, 2022

Similar to #547, I've run into issues with main thread deadlocking when using this library to show a BiometricPrompt and have seen an increased rate of ANRs on Crashlytics.
Upon further digging it was due to react-native-reanimated attempting to acquire a lock on the main thread, but since this library waits on the JS thread for the BiometricPrompt to show and finish on the main thread, a deadlock occurs.
This library avoids blocking the JS thread by using a listener to resolve a promise when decryption finishes. Since there are no additional dependencies, this should be compatible up to API level 21.

This PR should fix #525

@androideveloper
Copy link
Collaborator

For reanimated related issues, please refer to this PR and thread software-mansion/react-native-reanimated#3440

@frw
Copy link
Contributor Author

frw commented Nov 24, 2022

Thanks @androideveloper for referring me to that thread! Glad to know something is also being done on the reanimated side to fix it.
However, I think we should still consider fixing this thread-blocking behavior as well since it is not ideal to be blocking a thread while waiting for the biometrics prompt to finish. Would appreciate any comments or feedback on the PR!

@ca057
Copy link

ca057 commented Feb 6, 2023

I experienced the same issue and could resolve by using the version from this PR, all tests so far are successful. Is there anything I can support with to get this change / fix merged into upstream?

@frw
Copy link
Contributor Author

frw commented Feb 15, 2023

@oblador Any chance you could take a look at this, seems like it's still affecting a few folks

@kabirbaidhya
Copy link

Any progress / blockers on this PR? Can we prioritize this?

@androideveloper
Copy link
Collaborator

Hi @frw! I'm going to have a look at your PRs in this repo. Did you already test these changes in a real app?

@NonNull final byte[] username,
@NonNull final byte[] password,
@NonNull final SecurityLevel level)
public void decrypt(@NonNull final DecryptionResultHandler handler,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is handler not used anymore?

@DorianMazur
Copy link
Collaborator

Fixed in 9.0.0

@DorianMazur DorianMazur closed this Oct 3, 2024
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

Successfully merging this pull request may close these issues.

getGenericPassword on Android sometimes fails and crashes app
5 participants