Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 88f29ab8 authored by Atneya Nair's avatar Atneya Nair
Browse files

[audio] Fix missing package Attrs from mediaserver

To correctly tolerate missing packages in attribution sources from
trusted UIDs (typically mediaserver), when those UIDs are playing audio
on behalf of a client, we should fill the package name based on the UID
in the attribution, not the UID of the caller.

This fixes AppOps failures due to package name mismatch behind the new
permission logic flag, due to incorrectly filling in the package as
"media" with a non mediaserver UID, which result in incorrectly silenced
audio tracks.

Bug: 411348062
Flag: EXEMPT bugfix
Test: manual repro with app using opensles non-pcm
Change-Id: I11eb2054aef135779ddf8f1e18e3bd553321e1e5
parent 51007edf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ validateAttributionFromContextOrTrustedCaller(AttributionSourceState attr,
        // Legacy paths may not properly populate package name, so we attempt to handle.
        if (!attr.packageName.has_value() || attr.packageName.value() == "") {
            ALOGW("Trusted client %d provided attr with missing package name" , callingUid);
            attr.packageName = VALUE_OR_RETURN(provider.getPackagesForUid(callingUid))[0];
            attr.packageName = VALUE_OR_RETURN(provider.getPackagesForUid(attr.uid))[0];
        }
        // Behavior change: In the case of delegation, if pid is invalid,
        // filling it in with the callingPid will cause a mismatch between the