summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/am
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-10-22 18:45:27 -0700
committerDianne Hackborn <hackbod@google.com>2013-10-22 19:15:49 -0700
commit237cefbcee8721e3268ba778297a0ad48e67f079 (patch)
tree2b8bf3429a2504a967773e90edcb622a61590ef9 /services/java/com/android/server/am
parentce39e8ced8bcbc6663d420bea66280f8b438e027 (diff)
downloadframeworks_base-237cefbcee8721e3268ba778297a0ad48e67f079.zip
frameworks_base-237cefbcee8721e3268ba778297a0ad48e67f079.tar.gz
frameworks_base-237cefbcee8721e3268ba778297a0ad48e67f079.tar.bz2
Fix issue #11323037: Android apk incorrectly marked as running in app processes
The android package is now a special case, not being added to the package list when creating a multi-process component. There is no need, since this package is actually the framework itself which must be loaded in every process. Also cleaned up some of the procstats dump output to help see what is going on here. Change-Id: If65d35ecd562f3154bdebfded69c454af6ce8c96
Diffstat (limited to 'services/java/com/android/server/am')
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java11
-rw-r--r--services/java/com/android/server/am/ActivityStackSupervisor.java9
-rw-r--r--services/java/com/android/server/am/ProcessStatsService.java64
3 files changed, 59 insertions, 25 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 3ba9098..8b7fd8e 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -7224,7 +7224,13 @@ public final class ActivityManagerService extends ActivityManagerNative
if (DEBUG_MU)
Slog.v(TAG_MU, "generateApplicationProvidersLocked, cpi.uid = " + cpr.uid);
app.pubProviders.put(cpi.name, cpr);
- app.addPackage(cpi.applicationInfo.packageName, mProcessStats);
+ if (!cpi.multiprocess || !"android".equals(cpi.packageName)) {
+ // Don't add this if it is a platform component that is marked
+ // to run in multiple processes, because this is actually
+ // part of the framework so doesn't make sense to track as a
+ // separate apk in the process.
+ app.addPackage(cpi.applicationInfo.packageName, mProcessStats);
+ }
ensurePackageDexOpt(cpi.applicationInfo.packageName);
}
}
@@ -12777,7 +12783,8 @@ public final class ActivityManagerService extends ActivityManagerNative
+ ") when registering receiver " + receiver);
}
if (callerApp.info.uid != Process.SYSTEM_UID &&
- !callerApp.pkgList.containsKey(callerPackage)) {
+ !callerApp.pkgList.containsKey(callerPackage) &&
+ !"android".equals(callerPackage)) {
throw new SecurityException("Given caller package " + callerPackage
+ " is not running in process " + callerApp);
}
diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java
index 523015d..b68b98b 100644
--- a/services/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1051,7 +1051,14 @@ public final class ActivityStackSupervisor {
if (app != null && app.thread != null) {
try {
- app.addPackage(r.info.packageName, mService.mProcessStats);
+ if ((r.info.flags&ActivityInfo.FLAG_MULTIPROCESS) == 0
+ || !"android".equals(r.info.packageName)) {
+ // Don't add this if it is a platform component that is marked
+ // to run in multiple processes, because this is actually
+ // part of the framework so doesn't make sense to track as a
+ // separate apk in the process.
+ app.addPackage(r.info.packageName, mService.mProcessStats);
+ }
realStartActivityLocked(r, app, andResume, checkConfig);
return;
} catch (RemoteException e) {
diff --git a/services/java/com/android/server/am/ProcessStatsService.java b/services/java/com/android/server/am/ProcessStatsService.java
index 50a7b5c..8d16880 100644
--- a/services/java/com/android/server/am/ProcessStatsService.java
+++ b/services/java/com/android/server/am/ProcessStatsService.java
@@ -529,6 +529,33 @@ public final class ProcessStatsService extends IProcessStats.Stub {
}
}
+ private void dumpAggregatedStats(PrintWriter pw, long aggregateHours, long now,
+ String reqPackage, boolean isCompact, boolean dumpDetails, boolean dumpFullDetails,
+ boolean dumpAll, boolean activeOnly) {
+ ParcelFileDescriptor pfd = getStatsOverTime(aggregateHours*60*60*1000
+ - (ProcessStats.COMMIT_PERIOD/2));
+ if (pfd == null) {
+ pw.println("Unable to build stats!");
+ return;
+ }
+ ProcessStats stats = new ProcessStats(false);
+ InputStream stream = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
+ stats.read(stream);
+ if (stats.mReadError != null) {
+ pw.print("Failure reading: "); pw.println(stats.mReadError);
+ return;
+ }
+ if (isCompact) {
+ stats.dumpCheckinLocked(pw, reqPackage);
+ } else {
+ if (dumpDetails || dumpFullDetails) {
+ stats.dumpLocked(pw, reqPackage, now, !dumpFullDetails, dumpAll, activeOnly);
+ } else {
+ stats.dumpSummaryLocked(pw, reqPackage, now, activeOnly);
+ }
+ }
+ }
+
static private void dumpHelp(PrintWriter pw) {
pw.println("Process stats (procstats) dump options:");
pw.println(" [--checkin|-c|--csv] [--csv-screen] [--csv-proc] [--csv-mem]");
@@ -789,28 +816,8 @@ public final class ProcessStatsService extends IProcessStats.Stub {
}
return;
} else if (aggregateHours != 0) {
- ParcelFileDescriptor pfd = getStatsOverTime(aggregateHours*60*60*1000
- - (ProcessStats.COMMIT_PERIOD/2));
- if (pfd == null) {
- pw.println("Unable to build stats!");
- return;
- }
- ProcessStats stats = new ProcessStats(false);
- InputStream stream = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
- stats.read(stream);
- if (stats.mReadError != null) {
- pw.print("Failure reading: "); pw.println(stats.mReadError);
- return;
- }
- if (isCompact) {
- stats.dumpCheckinLocked(pw, reqPackage);
- } else {
- if (dumpDetails || dumpFullDetails) {
- stats.dumpLocked(pw, reqPackage, now, !dumpFullDetails, dumpAll, activeOnly);
- } else {
- stats.dumpSummaryLocked(pw, reqPackage, now, activeOnly);
- }
- }
+ dumpAggregatedStats(pw, aggregateHours, now, reqPackage, isCompact,
+ dumpDetails, dumpFullDetails, dumpAll, activeOnly);
return;
}
@@ -875,6 +882,19 @@ public final class ProcessStatsService extends IProcessStats.Stub {
}
}
if (!isCheckin) {
+ if (dumpAll) {
+ if (sepNeeded) {
+ pw.println();
+ pw.println("AGGREGATED OVER LAST 24 HOURS:");
+ }
+ dumpAggregatedStats(pw, 24, now, reqPackage, isCompact,
+ dumpDetails, dumpFullDetails, dumpAll, activeOnly);
+ pw.println();
+ pw.println("AGGREGATED OVER LAST 3 HOURS:");
+ dumpAggregatedStats(pw, 3, now, reqPackage, isCompact,
+ dumpDetails, dumpFullDetails, dumpAll, activeOnly);
+ sepNeeded = true;
+ }
synchronized (mAm) {
if (isCompact) {
mProcessStats.dumpCheckinLocked(pw, reqPackage);