Skip to content

ANR on speficic devices when SurfaceView Visibility is set to GONE since version 2.5.0 #3724

@ba-a

Description

@ba-a

Issue description

We recently updated the ExoPlayer version in our app from 2.4.0 to 2.6.1. After that we got a lot of ANR reports in the developer console, mostly from the Huawei P8 Lite.
This is important, on most devices the error doesn't occur, but on this and a couple others it happens every time you try to set up the player.

When setting up the player, the stream starts running (you can hear the sound) but the video is not being rendered. (The first frame is shown but stuck) As soon as there is an attempt to interact, the ANR is triggered and the app does not respond anymore.

After a lot of time spent investigating the problem (sorry for the whining but it was painful 😄 ) we found out that setting the visibility of the SurfaceView during the loading time of the player is causing the problem. (TextureView is fine, happening only with SurfaceView)
We tracked it down, the ANR happens since ExoPlayer Version 2.5.0 and ever since. Before that (until 2.4.4) it is not a problem.

We set the visibility to show some loading screen stuff as long as the stream needs to load. We can probably work around that but I thought it would be interesting to know what is causing the problem. Especially since it's only happening for special devices.

Reproduction steps

We could reproduce the problem on a slightly modified version of the demo app. Here is a fork of the ExoPlayer project with the necessary changes. We didn't release the player here in onPause because we reuse the instance in our app to show different streams.

https://github.com/ba-a/ExoPlayer

The commit with the changes:
ba-a@56af4de

To reproduce:

  • open the app
  • start any video, f.e. Youtube dash, Google Glass
  • press back
    -> ANR Huawei P8 Lite

Version of ExoPlayer being used

ExoPlayer 2.5.0 or higher also tried out 2.6.0 and 2.6.1

Device(s) and version(s) of Android being used

Huawei P8 Lite
Android 6

A full bug report captured from the device

Here is traces log from the device. The player gets stuck in
ExoPlayerImplInternal.blockingSendMessages
I guess waiting for a message that is never delivered.
ANR Huawei P8 Lite traces.txt

If you need any more input just let me know.
Best regards

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions