androidx / androidx/media

ANR and Crash in the absence of PlaybackResumption support (Android 11 and bellow)

Open
#2,543 4 comments 1 reaction 1 assignee View on GitHub

@marcbaechinger is already working on this.

Since Jun 20, 2025.

wont fix: intended behavior
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 main branch

More version details

1.6.x
1.5.x
etc

Devices that reproduce the issue

Devices with Android 11 and below

Devices that do not reproduce the issue

Devices with Android 12+

Reproducible in the demo app?

Yes

Reproduction steps
  1. Run demo-session project
  2. Play any video
  3. Pause video
  4. Open Settings -> Apps & notifications -> Media3 Session Demo
  5. Click "Force Stop"
  6. Send media session play event (for example, press the play button on the headset or invoke a command via ADB - adb shell input keyevent 85 )
  7. See logcat: Crash And ANR
Expected result

ANR and Crash

FATAL EXCEPTION: main
Process: androidx.media3.demo.session, PID: 16226
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{6363728 u0 androidx.media3.demo.session/.PlaybackService}
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2005)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:223)
       at android.app.ActivityThread.main(ActivityThread.java:7656)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
ANR in androidx.media3.demo.session
PID: 16226
Reason: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{6363728 u0 androidx.media3.demo.session/.PlaybackService}
Actual result

ANR and Сrash are absent.

Media

Any media from the demo-session project

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.