1.10.1 PackageValidator crash with UID -1
Maintainers usually reply within 4 days
@tonihei is already working on this.
Since Jun 19, 2026.
Assessment
This issue has not been assessed yet.
Description
Version
Media3 1.10.1
More version details
No response
Devices that reproduce the issue
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
We don't know how to reproduce it ourselves, but it's likely related to bluetooth devices and tapping play while the app has been killed or garbage collected?
Background context:
We're using our own implementation of the PackageValidator from the UAMP project, with our onGetSession being overridden like this:
override fun onGetSession(controllerInfo: ControllerInfo): MediaLibrarySession? {
return if ("android.media.session.MediaController" == controllerInfo.packageName
|| packageValidator.isKnownCaller(controllerInfo.packageName, controllerInfo.uid)
) {
mediaSession
} else null
}
Expected result
No crash
Actual result
Crash 1:
We're getting the following crashes after updating from 1.9.3 to 1.10.1:
Fatal Exception: java.lang.RuntimeException: Unable to start service com.app.media.AudioService@27c9a28 with Intent { act=android.intent.action.MEDIA_BUTTON dat=androidx://media3.session/... cmp=com.app/.media.AudioService (has extras) }: java.lang.IllegalStateException: Caller's package UID doesn't match caller's actual UID?
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4710)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2182)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:346)
at android.os.Looper.loop(Looper.java:475)
at android.app.ActivityThread.main(ActivityThread.java:7950)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
We haven't changed anything in the PackageValidator or the onGetSession override function in the new release, so that's why I'm suspecting the Media3 update being the culprit.
We added logging, and we can see that in this piece of code:
// Verify that things aren't ... broken. (This test should always pass.)
if (callerPackageInfo.uid != callingUid) {
throw IllegalStateException("Caller's package UID doesn't match caller's actual UID?")
}
the callingUid is now -1 whereas callerPackageInfo.uid is something like 10399 and varies for each crash. I guess this didn't happen before 1.10.
Crash 2:
We then tried to return false in isKnownCaller instead of throwing an exception, but after releasing this, we get a new crash we hadn't gotten before:
Fatal Exception: java.lang.RuntimeException: Unable to start service com.app.media.AudioService@5d09ebb with Intent { act=android.intent.action.MEDIA_BUTTON dat=androidx://media3.session/... xflg=0x4 cmp=com.app/.media.AudioService (has extras) }
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:6469)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:3111)
at android.os.Handler.dispatchMessage(Handler.java:132)
at android.os.Looper.dispatchMessage(Looper.java:358)
at android.os.Looper.loopOnce(Looper.java:288)
at android.os.Looper.loop(Looper.java:392)
at android.app.ActivityThread.main(ActivityThread.java:10346)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:638)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:972)
Caused by android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service com.app/.media.AudioService
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
at android.os.Parcel.readParcelableInternal(Parcel.java:5277)
at android.os.Parcel.readParcelable(Parcel.java:5258)
at android.os.Parcel.createExceptionOrNull(Parcel.java:3383)
at android.os.Parcel.createException(Parcel.java:3372)
at android.os.Parcel.readException(Parcel.java:3355)
at android.os.Parcel.readException(Parcel.java:3297)
at android.app.IActivityManager$Stub$Proxy.setServiceForeground(IActivityManager.java:7682)
at android.app.Service.startForeground(Service.java:862)
at androidx.media3.common.util.Util$Api29.startForeground(Util.java:4408)
at androidx.media3.common.util.Util.setForegroundServiceNotification(Util.java:321)
at androidx.media3.session.MediaSessionService.stopSelfSafely(MediaSessionService.java:589)
at androidx.media3.session.MediaSessionService.onStartCommand(MediaSessionService.java:533)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:6453)
at android.app.ActivityThread.-$$Nest$mhandleServiceArgs()
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:3111)
at android.os.Handler.dispatchMessage(Handler.java:132)
at android.os.Looper.dispatchMessage(Looper.java:358)
at android.os.Looper.loopOnce(Looper.java:288)
at android.os.Looper.loop(Looper.java:392)
at android.app.ActivityThread.main(ActivityThread.java:10346)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:638)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:972)
My question is, is this not the way to go anymore? The UAMP project has been archived, so maybe this approach is deprecated? In Google's own docs they just return the mediaSession every time: https://developer.android.com/media/media3/session/background-playback#service-lifecycle
Or is this all caused by an unintentional change in 1.10?
Thank you in advance, I hope you can help us with how to proceed!
Media
Not applicable
Bug Report
- You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 998
- Avg merge
- 6d 8h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from androidx/media
-
HLS: muxed Dolby TrueHD audio is dropped during chunkless preparation when CODECS lists "mlpa"Possibly taken @marcbaechinger claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
androidx/media#3485 · 1 assignee ·
Maintainers usually reply within 4 days
-
MediaSessionService: the platform session keeps every player command and publishes the whole queue until the session is added, e.g. after a sticky restartPossibly taken @marcbaechinger claimed this 1 day ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
androidx/media#3490 · 3 comments · 1 assignee ·
Maintainers usually reply within 4 days
-
Gapless MP4/AAC from FFmpeg: padding derived as 0 from the edit list, so the rest of the last frame plays at each joinPossibly taken @rohitjoins claimed this 1 day ago. Openbug needs triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
androidx/media#3489 · 1 assignee ·
Maintainers usually reply within 4 days
-
DTS-HD passthrough never retries a failed AudioTrack since the 1-second retry minimum (#3207)Possibly taken @microkatz claimed this 1 day ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 57/100
androidx/media#3487 · 1 assignee ·
Maintainers usually reply within 4 days
-
Dolby Vision Profile 7 is sent to a Profile 5 decoder on DV displays without a Profile 7 decoderPossibly taken @microkatz claimed this 1 day ago. Open
Difficulty 4/5 1-2 days Newbie friendliness 48/100
androidx/media#3486 · 1 assignee ·
Maintainers usually reply within 4 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
strimzi/strimzi-kafka-operator#13328 · 1 comment · 3 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
OpenLiberty/ci.maven#2137 ·
Maintainers usually reply within 1 day
-
Payer adjustment can exceed the balance left after copay and deductible, so claim payments add up to more than the chargePossibly taken @DG47 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
synthetichealth/synthea#1772 ·
Maintainers usually reply within 13 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
geonetwork/core-geonetwork#9592 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
NationalSecurityAgency/ghidra#10040 ·
Maintainers usually reply within 2 days