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

Commit 7f097f92 authored by Austin Borger's avatar Austin Borger Committed by Automerger Merge Worker
Browse files

Merge "ActivityManagerService: Allow openContentUri from...

Merge "ActivityManagerService: Allow openContentUri from vendor/system/product." into udc-dev am: 5fe4d83c am: 5f518a2a

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



Change-Id: I2152f85464ec4c50e186a01552401c70da083f38
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 21707503 5f518a2a
Loading
Loading
Loading
Loading
+11 −1
Original line number Original line Diff line number Diff line
@@ -6917,7 +6917,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        mActivityTaskManager.unhandledBack();
        mActivityTaskManager.unhandledBack();
    }
    }
    // TODO: Move to ContentProviderHelper?
    // TODO: Replace this method with one that returns a bound IContentProvider.
    public ParcelFileDescriptor openContentUri(String uriString) throws RemoteException {
    public ParcelFileDescriptor openContentUri(String uriString) throws RemoteException {
        enforceNotIsolatedCaller("openContentUri");
        enforceNotIsolatedCaller("openContentUri");
        final int userId = UserHandle.getCallingUserId();
        final int userId = UserHandle.getCallingUserId();
@@ -6946,6 +6946,16 @@ public class ActivityManagerService extends IActivityManager.Stub
                    Log.e(TAG, "Cannot find package for uid: " + uid);
                    Log.e(TAG, "Cannot find package for uid: " + uid);
                    return null;
                    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(
                final AttributionSource attributionSource = new AttributionSource(
                        Binder.getCallingUid(), androidPackage.getPackageName(), null);
                        Binder.getCallingUid(), androidPackage.getPackageName(), null);
                pfd = cph.provider.openFile(attributionSource, uri, "r", null);
                pfd = cph.provider.openFile(attributionSource, uri, "r", null);