⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Replace android.os.Looper by android.os.HandleThread to prevent blocking main thread#825

Open
JoBolNex wants to merge 1 commit intoreact-native-webrtc:masterfrom
JoBolNex:chore/fix-looper-loop-infinite
Open

Replace android.os.Looper by android.os.HandleThread to prevent blocking main thread#825
JoBolNex wants to merge 1 commit intoreact-native-webrtc:masterfrom
JoBolNex:chore/fix-looper-loop-infinite

Conversation

@JoBolNex
Copy link

@JoBolNex JoBolNex commented Jan 17, 2025

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

@jexodusmercado
Copy link

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!

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.

2 participants