diff options
| author | 2023-05-05 00:03:36 +0000 | |
|---|---|---|
| committer | 2023-05-05 00:03:36 +0000 | |
| commit | e070aa49d837e849da3e0380c3dc0ec1e3a32da0 (patch) | |
| tree | b3cc672b349c4af00f86c5c9b3565924c9ef2594 | |
| parent | 8534aec6a970fa04e4f607df39ca632f5bf65e8a (diff) | |
| parent | 214ad884c6240ed7d2147fb2471f09866aeaa977 (diff) | |
Merge changes from topic "presubmit-am-cb3c43babe4c45069e5619a744950e15" into sc-qpr1-dev am: 214ad884c6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22915959
Change-Id: I97c8f7a192e7c6bf75426e459c1eb40c7773370b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 5de1b3e97db4..77a6e9d6b658 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -6313,7 +6313,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(); @@ -6342,6 +6342,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); |