Merge "Adds caller check to getAllPackages()" into rvc-dev am: 649d086c2c

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I67fbada42a0b710f9180951240b0357ee706b540
This commit is contained in:
Patrick Baumann
2021-03-03 18:47:24 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 0 deletions

View File

@@ -202,6 +202,12 @@ public class Process {
*/
public static final int SE_UID = 1068;
/**
* Defines the UID/GID for the iorapd.
* @hide
*/
public static final int IORAPD_UID = 1071;
/**
* Defines the UID/GID for the NetworkStack app.
* @hide

View File

@@ -6169,6 +6169,10 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public List<String> getAllPackages() {
// Allow iorapd to call this method.
if (Binder.getCallingUid() != Process.IORAPD_UID) {
enforceSystemOrRootOrShell("getAllPackages is limited to privileged callers");
}
final int callingUid = Binder.getCallingUid();
final int callingUserId = UserHandle.getUserId(callingUid);
synchronized (mLock) {