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

Commit bbc8211a authored by Jackal Guo's avatar Jackal Guo Committed by Automerger Merge Worker
Browse files

Merge "Enforce the owner rights of dumpProfiles" into sc-dev am: ebca03d2 am: f73c1a5d

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

Change-Id: Ie4f1a42edaf1b157ff79f2e9f4ef2341160be08f
parents 1fc759a3 f73c1a5d
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -12987,6 +12987,15 @@ public class PackageManagerService extends IPackageManager.Stub
    @Override
    public void dumpProfiles(String packageName) {
        /* Only the shell, root, or the app user should be able to dump profiles. */
        final int callingUid = Binder.getCallingUid();
        final String[] callerPackageNames = getPackagesForUid(callingUid);
        if (callingUid != Process.SHELL_UID
                && callingUid != Process.ROOT_UID
                && !ArrayUtils.contains(callerPackageNames, packageName)) {
            throw new SecurityException("dumpProfiles");
        }
        AndroidPackage pkg;
        synchronized (mLock) {
            pkg = mPackages.get(packageName);
@@ -12994,13 +13003,6 @@ public class PackageManagerService extends IPackageManager.Stub
                throw new IllegalArgumentException("Unknown package: " + packageName);
            }
        }
        /* Only the shell, root, or the app user should be able to dump profiles. */
        int callingUid = Binder.getCallingUid();
        if (callingUid != Process.SHELL_UID &&
            callingUid != Process.ROOT_UID &&
            callingUid != pkg.getUid()) {
            throw new SecurityException("dumpProfiles");
        }
        synchronized (mInstallLock) {
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dump profiles");