Version
Media3 1.11.0
More version details
1.11.0
The same callback works with 1.9.0/1.10.1.
Devices that reproduce the issue
- Pixel 9 with android auto simulator
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
On the demo app, return an incomplete ListenableFuture from MediaLibrarySession.Callback.onGetLibraryRoot().
Complete it successfully from a background thread after 100 ms. Example code:
override fun onGetLibraryRoot(
session: MediaLibraryService.MediaLibrarySession,
browser: MediaSession.ControllerInfo,
params: MediaLibraryService.LibraryParams?,
): ListenableFuture<LibraryResult<MediaItem>> {
val future = SettableFuture.create<LibraryResult<MediaItem>>()
Log.i("AsyncRootRepro", "Returning incomplete root future")
executor.schedule(
{
Log.i("AsyncRootRepro", "Completing root future")
future.set(
LibraryResult.ofItem(
MediaItemTree.getRootItem(),
params,
)
)
},
100,
TimeUnit.MILLISECONDS,
)
return future
}
Connect a controller like Android Auto. The background log confirms the future completes, but the browser never connects and the service main thread ANRs.
Returning Futures.immediateFuture with the identical LibraryResult (as in the default demo-session sample) works.
Expected result
MediaLibrarySession.Callback explicitly returns a ListenableFuture, so a non-immediate result should complete without deadlocking legacy browser compatibility.
Actual result
Only an already-completed future works. Asynchronous future deadlocks the service main thread.
Media
see ready example on de demo-sesion at https://github.com/kelmer44/media-interstitials/tree/anr-deadlock
Bug Report
Version
Media3 1.11.0
More version details
1.11.0
The same callback works with 1.9.0/1.10.1.
Devices that reproduce the issue
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
On the demo app, return an incomplete ListenableFuture from MediaLibrarySession.Callback.onGetLibraryRoot().
Complete it successfully from a background thread after 100 ms. Example code:
Connect a controller like Android Auto. The background log confirms the future completes, but the browser never connects and the service main thread ANRs.
Returning Futures.immediateFuture with the identical LibraryResult (as in the default demo-session sample) works.
Expected result
MediaLibrarySession.Callback explicitly returns a ListenableFuture, so a non-immediate result should complete without deadlocking legacy browser compatibility.
Actual result
Only an already-completed future works. Asynchronous future deadlocks the service main thread.
Media
see ready example on de demo-sesion at https://github.com/kelmer44/media-interstitials/tree/anr-deadlock
Bug Report
adb bugreportto android-media-github@google.com after filing this issue.