react-native-callkeep
react-native-callkeep copied to clipboard
Replace android.os.Looper by android.os.HandleThread to prevent blocking main thread
This PR improves the handling of background threads for legacy phone state listening on Android versions below S (API 31). Key changes:
- Replaced the manual Looper management with a dedicated HandlerThread
- Added proper cleanup of the HandlerThread by implementing quitSafely() when stopping the listener
- Moved HandlerThread to a class property to ensure proper lifecycle management and prevent potential memory leaks
- Removed the blocking Looper.loop() call which could cause issues on the calling thread
I applied this fix using patch and fixed my issue with IncomingCall UI not showing but will show if I "restart" my expo server. Kudos!