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

Some Android 10 devices has ANR #11138

Open
jasoncfpl opened this issue Apr 26, 2023 · 4 comments
Open

Some Android 10 devices has ANR #11138

jasoncfpl opened this issue Apr 26, 2023 · 4 comments
Assignees
Labels

Comments

@jasoncfpl
Copy link

Bug

android.os.BinderProxy.transactNative(Native Method)
android.os.BinderProxy.transact(BinderProxy.java:610)
android.media.IAudioService$Stub$Proxy.getStreamVolume(IAudioService.java:4565)
android.media.AudioManager.getStreamVolume(AudioManager.java:1210)
com.google.android.exoplayer2.StreamVolumeManager.getVolumeFromManager(StreamVolumeManager.java:1)
com.google.android.exoplayer2.StreamVolumeManager.(StreamVolumeManager.java:8)
com.google.android.exoplayer2.SimpleExoPlayer.(SimpleExoPlayer.java:60)
com.google.android.exoplayer2.SimpleExoPlayer$Builder.build(SimpleExoPlayer.java:3)
io.flutter.plugins.videoplayer.VideoPlayer.(VideoPlayer.java:7)
io.flutter.plugins.videoplayer.VideoPlayerPlugin.create(VideoPlayerPlugin.java:16)

@Tolriq
Copy link
Contributor

Tolriq commented Apr 26, 2023

This is unfortunately something to be expect on some devices or devices with high load.

When the build() call is made a StreamVolumeManager will be created that will directly try to read audioManager to get current volume. Since this requires a bind call that is blocking, this can and will ANR sometimes.

See the Play Store explanation for those kind of issues:

image

Since ExoPlayer recommend using main thread this is somewhat expected that most will create the player in main thread too.

You can mitigate this by creating the player in a background thread and use setLooper to set the proper main thread looper.

@rohitjoins
Copy link
Contributor

We're closing this issue because there hasn't been any recent activity.

@Tolriq
Copy link
Contributor

Tolriq commented Jun 13, 2023

@rohitjoins This is certainly to be considered a bug of ExoPlayer....

You are doing an IPC blocking call on init of the StreamVolumeManager this should not be done and is an error that should be addressed. The workaround to init ExoPlayer in the background is a workaround and is not documented anywhere as recommended so people are facing this in prod.

@rohitjoins rohitjoins reopened this Jun 13, 2023
@AntonMalykh
Copy link

Hi!
We are experiencing hundreds of such anrs per month.
Are there any plans on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants