-
Notifications
You must be signed in to change notification settings - Fork 404
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
NetworkTypeObserver makes binding calls on mainthread by default #1550
Comments
Have you seen such ANRs that you can post here? I'm asking because I know of framework code that do binder calls on the main thread. That code was written by people who I'd say understand more than me around this. While I'm not saying you are wrong, I'm suprised to not see this documented in Can you educate me/us before I reassign? :) |
The problem is not the register, the problem is that you call register without passing an handler so the Then in the This is well documented and should be avoided, devices can have too much binding at some point, be slow or on limits for those calls. In this case there's no need to do those calls in mainthread so it's easy to avoid potential issue. (See also for example : google/ExoPlayer#11138 for the same kind of issues, those can be workaround by init ExoPlayer in the background, for this one this is not possible to workaround client side.). You should either call the register in
(Be sure to update Or you can a start background task from inside the ANR trace:
|
Version
Media3 main branch
More version details
No response
Devices that reproduce the issue
NetworkTypeObserver
register it's receiver to getonReceive
calls on mainthread this leads to binding calls to system services on mainthread and can cause ANR and lock main thread.This should be registered in a background handled to avoid this.
There's quite a few other places where this happens,
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
check the receiver calls thread.
Expected result
No binding calls in mainthread.
Actual result
Binding calls in mainthread.
Media
N/A
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: