androidx / androidx/media

ANRs with AudioCapabilities.getCapabilitiesInternal

Open
#2,296 4 comments 0 reactions 1 assignee View on GitHub

@tianyif is already working on this.

Since Apr 2, 2025.

bug needs triage
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 1.6.0

More version details

No response

Devices that reproduce the issue

Any

Devices that do not reproduce the issue

None

Reproducible in the demo app?

Not tested

Reproduction steps

This is the usual OS services binding stuff done on main thread.

Expected result

Try to avoid doing binding stuff on main thread. Continuation of Toni's work.

The strange part is that there's a proper handler support in AudioCapabilitiesReceiver to avoid that, but it's probably created as soon as ExoPlayer is created (usually on main thread) even if we pass loopers and everything to have 100% of the rest happening in background.

Would be nice if the receiver creation was delayed to the passed looper during ExoPlayer creation, as currently we can't workaround this.

Actual result
#06 pc 0x168730 libandroid_runtime.so (android_os_BinderProxy_transact(_JNIEnv*, _jobject*, int, _jobject*, _jobject*, int) + 152)
       at android.os.BinderProxy.transactNative(Native method)
       at android.os.BinderProxy.transact(BinderProxy.java:635)
       at android.app.IActivityManager$Stub$Proxy.bindIsolatedService(IActivityManager.java:7041)
       at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:2059)
       at android.app.ContextImpl.bindService(ContextImpl.java:1976)
       at android.content.ContextWrapper.bindService(ContextWrapper.java:829)
       at androidx.mediarouter.media.RegisteredMediaRouteProvider.bind(RegisteredMediaRouteProvider.java:252)
       at androidx.mediarouter.media.RegisteredMediaRouteProviderWatcher.scanPackages(RegisteredMediaRouteProviderWatcher.java:115)
       at androidx.media3.exoplayer.audio.AudioCapabilitiesReceiver$HdmiAudioPlugBroadcastReceiver.onReceive(AudioCapabilitiesReceiver.java)
       at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1805)
       at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(unavailable)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8663)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)

Media

N/A

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.