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

Commit 835ab4eb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adds caller check to getAllPackages()" into oc-mr1-dev

parents 119ebe19 cca5bf92
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -6541,6 +6541,11 @@ public class PackageManagerService extends IPackageManager.Stub
    @Override
    public List<String> getAllPackages() {
        final int callingUid = Binder.getCallingUid();
        // enforceSystemOrRootOrShell:
        if (callingUid != Process.SYSTEM_UID && callingUid != Process.ROOT_UID 
                && callingUid != Process.SHELL_UID) {
            throw new SecurityException("getAllPackages is limited to privileged callers");
        }        
        final int callingUserId = UserHandle.getUserId(callingUid);
        synchronized (mPackages) {
            if (canViewInstantApps(callingUid, callingUserId)) {