Merge changes from topic "presubmit-am-cb3c43babe4c45069e5619a744950e15" into sc-qpr1-dev am: 214ad884c6 am: e070aa49d8 am: 8f3f0202c1 am: 59882f5e70

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

Change-Id: If61b1101444493b7a6ffda23ae3d75be9341d758
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Austin Borger
2023-05-05 02:16:21 +00:00
committed by Automerger Merge Worker

View File

@@ -6792,7 +6792,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();
@@ -6821,6 +6821,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);