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

Commit a565782b authored by Nate(Qiang) Jiang's avatar Nate(Qiang) Jiang Committed by Automerger Merge Worker
Browse files

Merge "Allow system process register AttributionSource for app from other...

Merge "Allow system process register AttributionSource for app from other user" into tm-dev am: 6be9288d am: d7f5f323 am: cf36712c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18702825



Change-Id: Ie3a4a52447e6c9a2720ca8598c00bf04aef32fe6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3349cdcc cf36712c
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -966,8 +966,14 @@ public class PermissionManagerService extends IPermissionManager.Stub {

            final PackageManagerInternal packageManagerInternal = LocalServices.getService(
                    PackageManagerInternal.class);
            if (packageManagerInternal.getPackageUid(source.getPackageName(), 0,
                    UserHandle.getUserId(callingUid)) != source.getUid()) {

            // TODO(b/234653108): Clean up this UID/package & cross-user check.
            // If calling from the system process, allow registering attribution for package from
            // any user
            int userId = UserHandle.getUserId((callingUid == Process.SYSTEM_UID ? source.getUid()
                    : callingUid));
            if (packageManagerInternal.getPackageUid(source.getPackageName(), 0, userId)
                    != source.getUid()) {
                throw new SecurityException("Cannot register attribution source for package:"
                        + source.getPackageName() + " from uid:" + callingUid);
            }