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

Commit ad9bbd8c authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Adds caller check to getAllPackages()

This change enforces that only system, root or shell may call
getAllPackages(), a hidden API that shares all package names regardless
of user, instant app or package visibility rules.

Bug: 174661955
Test: 'adb shell pm compile -a -m speed' doesn't fail with
      SecurityException
Change-Id: I86a03c46896f21cdbeeda2af150675fe77d61955
parent a397f028
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8946,6 +8946,7 @@ public class PackageManagerService extends IPackageManager.Stub
    @Override
    public List<String> getAllPackages() {
        enforceSystemOrRootOrShell("getAllPackages is limited to privileged callers");
        final int callingUid = Binder.getCallingUid();
        final int callingUserId = UserHandle.getUserId(callingUid);
        synchronized (mLock) {