summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Sehr <sehr@google.com> 2016-06-09 05:20:19 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-06-09 05:20:20 +0000
commit1c4da6654fab74c8f477304c93211f07e432816d (patch)
treedfa3e7eaad0b14f41a45d32fc6ea0e4aa53da074
parent0d25fdd4a8901626d5c0bfe863b8e75fb309b34b (diff)
parentac063d64ea133461338a1bf89f949bc5b3825565 (diff)
Merge "Simplify code paths computation, allow adb root to dump" into nyc-dev
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 27ca62af5955..b9d7991c1112 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -7520,9 +7520,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");
}
@@ -7530,16 +7532,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);