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

Commit 78747bee authored by Austin Borger's avatar Austin Borger Committed by Presubmit Automerger Backend
Browse files

[automerge] ActivityManagerService: Allow openContentUri from vendor/system/product. 2p: e37820e4

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

Bug: 236688380
Change-Id: If52613c95390c46a724aafae3e6fd7cbaa2df1e1
Merged-In: I0335496d28fa5fc3bfe1fecd4be90040b0b3687f
parents 385e05a7 e37820e4
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -6284,7 +6284,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        mActivityTaskManager.unhandledBack();
    }
    // TODO: Move to ContentProviderHelper?
    // TODO: Replace this method with one that returns a bound IContentProvider.
    public ParcelFileDescriptor openContentUri(String uriString) throws RemoteException {
        enforceNotIsolatedCaller("openContentUri");
        final int userId = UserHandle.getCallingUserId();
@@ -6313,6 +6313,16 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Log.e(TAG, "Cannot find package for uid: " + uid);
                    return null;
                }
                final ApplicationInfo appInfo = mPackageManagerInt.getApplicationInfo(
                        androidPackage.getPackageName(), /*flags*/0, Process.SYSTEM_UID,
                        UserHandle.USER_SYSTEM);
                if (!appInfo.isVendor() && !appInfo.isSystemApp() && !appInfo.isSystemExt()
                        && !appInfo.isProduct()) {
                    Log.e(TAG, "openContentUri may only be used by vendor/system/product.");
                    return null;
                }
                final AttributionSource attributionSource = new AttributionSource(
                        Binder.getCallingUid(), androidPackage.getPackageName(), null);
                pfd = cph.provider.openFile(attributionSource, uri, "r", null);