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

Fatal Exception: android.app.RemoteServiceException - Android 11 OEMs #2072

Open
1 task done
declan-bauer opened this issue Jan 23, 2025 · 1 comment
Open
1 task done
Assignees

Comments

@declan-bauer
Copy link

Version

Media3 1.5.1

More version details

No response

Devices that reproduce the issue

Amazon Fire HD 10 (13th Gen) (OS 11)
Alcatel 1 (OS 11)

Devices that do not reproduce the issue

Pixel 6a (OS 15)
Samsung Flip 5 (OS 15)

Reproducible in the demo app?

Yes

Reproduction steps

To reproduce with the demo app requires a small modification.

This would need added to the DemoPlaybackService

@OptIn(UnstableApi::class)
override fun onTaskRemoved(rootIntent: Intent?) {
  super.onTaskRemoved(rootIntent)
  pauseAllPlayersAndStopSelf()
}

Then:

  1. Open app
  2. Play anything
  3. Close app
  4. Resume playback from the notification player
  5. Observe crash in logcat

In my app the notification doesn't usually stick around after close(though sometimes it will on different devices), however the same crash could be triggered by headphone media control & adb keyevent(adb shell input keyevent 85)

Expected result

Media playback and service stops.

Actual result

Media playback stops but service does not or is recreated(?)

Notification player still persists with broken controls, need to launch app and play something to fix.

FATAL EXCEPTION: main
Process: androidx.media3.demo.session, PID: 1795
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{7f58c5c u0 androidx.media3.demo.session/.PlaybackService}
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2020)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7719)
	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)

Media

Any in demo-session

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@tonihei
Copy link
Collaborator

tonihei commented Jan 24, 2025

I assume you can't stop your service because there still is an connected controller bound to your service. @marcbaechinger is probably able to confirm that or provide a better explanation.

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

No branches or pull requests

3 participants