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

Commit 6d8058c7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Make package handling in openContentUri more robust" into sc-dev am:...

Merge "Make package handling in openContentUri more robust" into sc-dev am: 3ff294cd am: b909171a

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

Change-Id: I122bf4ae9789524efb4a979002a10201117b28ed
parents a80b21f4 b909171a
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -6222,8 +6222,20 @@ public class ActivityManagerService extends IActivityManager.Stub
                // signature we just use the first package in the UID. For shared
                // UIDs we may blame the wrong app but that is Okay as they are
                // in the same security/privacy sandbox.
                final AndroidPackage androidPackage = mPackageManagerInt
                        .getPackage(Binder.getCallingUid());
                final int uid = Binder.getCallingUid();
                // Here we handle some of the special UIDs (mediaserver, systemserver, etc)
                final String packageName = AppOpsManager.resolvePackageName(uid,
                        /*packageName*/ null);
                final AndroidPackage androidPackage;
                if (packageName != null) {
                    androidPackage = mPackageManagerInt.getPackage(packageName);
                } else {
                    androidPackage = mPackageManagerInt.getPackage(uid);
                }
                if (androidPackage == null) {
                    Log.e(TAG, "Cannot find package for uid: " + uid);
                    return null;
                }
                final AttributionSource attributionSource = new AttributionSource(
                        Binder.getCallingUid(), androidPackage.getPackageName(), null);
                pfd = cph.provider.openFile(attributionSource, uri, "r", null);