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

Commit f7e2a4e7 authored by David Sehr's avatar David Sehr Committed by android-build-merger
Browse files

Merge \"Simplify code paths computation, allow adb root to dump\" into nyc-dev

am: 1c4da665

Change-Id: I6c433663b5b3330f34a731ab32f15b5964649098
parents 30b5e95c 1c4da665
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -7526,9 +7526,11 @@ public class PackageManagerService extends IPackageManager.Stub {
                throw new IllegalArgumentException("Unknown package: " + packageName);
            }
        }
        /* Only the shell or the app user should be able to dump profiles. */
        /* Only the shell, root, or the app user should be able to dump profiles. */
        int callingUid = Binder.getCallingUid();
        if (callingUid != Process.SHELL_UID && callingUid != pkg.applicationInfo.uid) {
        if (callingUid != Process.SHELL_UID &&
            callingUid != Process.ROOT_UID &&
            callingUid != pkg.applicationInfo.uid) {
            throw new SecurityException("dumpProfiles");
        }
@@ -7536,16 +7538,7 @@ public class PackageManagerService extends IPackageManager.Stub {
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dump profiles");
            final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid);
            try {
                final File codeFile = new File(pkg.applicationInfo.getCodePath());
                List<String> allCodePaths = Collections.EMPTY_LIST;
                if (codeFile != null && codeFile.exists()) {
                    try {
                        final PackageLite codePkg = PackageParser.parsePackageLite(codeFile, 0);
                        allCodePaths = codePkg.getAllCodePaths();
                    } catch (PackageParserException e) {
                        // Well, we tried.
                    }
                }
                List<String> allCodePaths = pkg.getAllCodePathsExcludingResourceOnly();
                String gid = Integer.toString(sharedGid);
                String codePaths = TextUtils.join(";", allCodePaths);
                mInstaller.dumpProfiles(gid, packageName, codePaths);