summaryrefslogtreecommitdiffstats
path: root/services/core
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2014-10-09 17:59:38 -0700
committerDianne Hackborn <hackbod@google.com>2014-10-09 18:21:59 -0700
commitab4a81b3c625e33d04ae8070fcce6b6baee6522c (patch)
tree0318213138edcfa4e65cd4e2c640f1a96bdeeb45 /services/core
parentf9df9dd845ba1d1b14b450bd9df654243921381f (diff)
downloadframeworks_base-ab4a81b3c625e33d04ae8070fcce6b6baee6522c.zip
frameworks_base-ab4a81b3c625e33d04ae8070fcce6b6baee6522c.tar.gz
frameworks_base-ab4a81b3c625e33d04ae8070fcce6b6baee6522c.tar.bz2
Improve some docs, fix some debugging.
- Add docs to Binder, Messenger, ResultReceier to explain their relation (or lack there-of) to process lifecycle. - Clarify some aspects of process lifecycle for services. - Fix help text of am command. - Fix per-package dumping of battery stats to not include history. - Fix per-package dumping of proc stats to only include aggregated and current stats and fix some formatting. - Fix per-process dumping of meminfo to have an option to interpret the input as a package, so including all processes that are running code of that package. - Fix top-level per-package debug output to correctly include all of these improvements and give them a little more time (10s) to complete for timing out. Change-Id: I2a04c0f862bd47b08329443d722345a13ad9b6e2
Diffstat (limited to 'services/core')
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java23
-rw-r--r--services/core/java/com/android/server/am/BatteryStatsService.java10
-rw-r--r--services/core/java/com/android/server/am/ProcessStatsService.java2
3 files changed, 27 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index bb4db90..0c8e26e 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -12588,7 +12588,7 @@ public final class ActivityManagerService extends ActivityManagerNative
void dumpRecentsLocked(FileDescriptor fd, PrintWriter pw, String[] args,
int opti, boolean dumpAll, String dumpPackage) {
- pw.println("ACTIVITY MANAGER RECENT ACTIVITIES (dumpsys activity recents)");
+ pw.println("ACTIVITY MANAGER RECENT TASKS (dumpsys activity recents)");
boolean printedAnything = false;
@@ -13686,7 +13686,8 @@ public final class ActivityManagerService extends ActivityManagerNative
return true;
}
- ArrayList<ProcessRecord> collectProcesses(PrintWriter pw, int start, String[] args) {
+ ArrayList<ProcessRecord> collectProcesses(PrintWriter pw, int start, boolean allPkgs,
+ String[] args) {
ArrayList<ProcessRecord> procs;
synchronized (this) {
if (args != null && args.length > start
@@ -13701,6 +13702,9 @@ public final class ActivityManagerService extends ActivityManagerNative
ProcessRecord proc = mLruProcesses.get(i);
if (proc.pid == pid) {
procs.add(proc);
+ } else if (allPkgs && proc.pkgList != null
+ && proc.pkgList.containsKey(args[start])) {
+ procs.add(proc);
} else if (proc.processName.equals(args[start])) {
procs.add(proc);
}
@@ -13717,7 +13721,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final void dumpGraphicsHardwareUsage(FileDescriptor fd,
PrintWriter pw, String[] args) {
- ArrayList<ProcessRecord> procs = collectProcesses(pw, 0, args);
+ ArrayList<ProcessRecord> procs = collectProcesses(pw, 0, false, args);
if (procs == null) {
pw.println("No process found for: " + args[0]);
return;
@@ -13753,7 +13757,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
final void dumpDbInfo(FileDescriptor fd, PrintWriter pw, String[] args) {
- ArrayList<ProcessRecord> procs = collectProcesses(pw, 0, args);
+ ArrayList<ProcessRecord> procs = collectProcesses(pw, 0, false, args);
if (procs == null) {
pw.println("No process found for: " + args[0]);
return;
@@ -13921,6 +13925,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean oomOnly = false;
boolean isCompact = false;
boolean localOnly = false;
+ boolean packages = false;
int opti = 0;
while (opti < args.length) {
@@ -13941,6 +13946,8 @@ public final class ActivityManagerService extends ActivityManagerNative
oomOnly = true;
} else if ("--local".equals(opt)) {
localOnly = true;
+ } else if ("--package".equals(opt)) {
+ packages = true;
} else if ("-h".equals(opt)) {
pw.println("meminfo dump options: [-a] [-d] [-c] [--oom] [process]");
pw.println(" -a: include all available information for each process.");
@@ -13948,6 +13955,8 @@ public final class ActivityManagerService extends ActivityManagerNative
pw.println(" -c: dump in a compact machine-parseable representation.");
pw.println(" --oom: only show processes organized by oom adj.");
pw.println(" --local: only collect details locally, don't call process.");
+ pw.println(" --package: interpret process arg as package, dumping all");
+ pw.println(" processes that have loaded that package.");
pw.println("If [process] is specified it can be the name or ");
pw.println("pid of a specific process to dump.");
return;
@@ -13961,7 +13970,7 @@ public final class ActivityManagerService extends ActivityManagerNative
long realtime = SystemClock.elapsedRealtime();
final long[] tmpLong = new long[1];
- ArrayList<ProcessRecord> procs = collectProcesses(pw, opti, args);
+ ArrayList<ProcessRecord> procs = collectProcesses(pw, opti, packages, args);
if (procs == null) {
// No Java processes. Maybe they want to print a native process.
if (args != null && args.length > opti
@@ -14016,7 +14025,7 @@ public final class ActivityManagerService extends ActivityManagerNative
return;
}
- if (!brief && !oomOnly && (procs.size() == 1 || isCheckinRequest)) {
+ if (!brief && !oomOnly && (procs.size() == 1 || isCheckinRequest || packages)) {
dumpDetails = true;
}
@@ -14132,7 +14141,7 @@ public final class ActivityManagerService extends ActivityManagerNative
long nativeProcTotalPss = 0;
- if (!isCheckinRequest && procs.size() > 1) {
+ if (!isCheckinRequest && procs.size() > 1 && !packages) {
// If we are showing aggregations, also look for native processes to
// include so that our aggregations are more accurate.
updateCpuStatsNow();
diff --git a/services/core/java/com/android/server/am/BatteryStatsService.java b/services/core/java/com/android/server/am/BatteryStatsService.java
index a021919..6983ec4 100644
--- a/services/core/java/com/android/server/am/BatteryStatsService.java
+++ b/services/core/java/com/android/server/am/BatteryStatsService.java
@@ -871,6 +871,16 @@ public final class BatteryStatsService extends IBatteryStats.Stub
if (BatteryStatsHelper.checkWifiOnly(mContext)) {
flags |= BatteryStats.DUMP_DEVICE_WIFI_ONLY;
}
+ if (reqUid >= 0) {
+ // By default, if the caller is only interested in a specific package, then
+ // we only dump the aggregated data since charged.
+ if ((flags&(BatteryStats.DUMP_HISTORY_ONLY|BatteryStats.DUMP_UNPLUGGED_ONLY
+ |BatteryStats.DUMP_CHARGED_ONLY)) == 0) {
+ flags |= BatteryStats.DUMP_CHARGED_ONLY;
+ // Also if they are doing -c, we don't want history.
+ flags &= ~BatteryStats.DUMP_INCLUDE_HISTORY;
+ }
+ }
if (useCheckinFormat) {
List<ApplicationInfo> apps = mContext.getPackageManager().getInstalledApplications(0);
if (isRealCheckin) {
diff --git a/services/core/java/com/android/server/am/ProcessStatsService.java b/services/core/java/com/android/server/am/ProcessStatsService.java
index 28e46a4..bffb541 100644
--- a/services/core/java/com/android/server/am/ProcessStatsService.java
+++ b/services/core/java/com/android/server/am/ProcessStatsService.java
@@ -791,7 +791,7 @@ public final class ProcessStatsService extends IProcessStats.Stub {
reqPackage = arg;
// Include all details, since we know we are only going to
// be dumping a smaller set of data. In fact only the details
- // container per-package data, so that are needed to be able
+ // contain per-package data, so this is needed to be able
// to dump anything at all when filtering by package.
dumpDetails = true;
}