summaryrefslogtreecommitdiffstats
path: root/cmds/am
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-09-16 10:57:39 -0700
committerDianne Hackborn <hackbod@google.com>2013-09-16 14:05:34 -0700
commit35f72be50b8a2d11bce591dcdac5dc3fa336dac0 (patch)
treed6ababee2a2ac0c48a645e923c28e2d5d0842cbd /cmds/am
parentaf672998af7fb0bba90f7d56504584a63ff189fa (diff)
downloadframeworks_base-35f72be50b8a2d11bce591dcdac5dc3fa336dac0.zip
frameworks_base-35f72be50b8a2d11bce591dcdac5dc3fa336dac0.tar.gz
frameworks_base-35f72be50b8a2d11bce591dcdac5dc3fa336dac0.tar.bz2
Implement issue #10691359: Kill long-running processes
We now have the activity manager kill long-running processes during idle maintanence. This involved adding some more information to the activity manager about the current memory state, so that it could know if it really should bother killing anything. While doing this, I also improved how we determine when memory is getting low by better ignoring cases where processes are going away for other reasons (such as now idle maintenance). We now won't raise our memory state if either a process is going away because we wanted it gone for another reason or the total number of processes is not decreasing. The idle maintanence killing also uses new per-process information about whether the process has ever gone into the cached state since the last idle maintenance, and the initial pss and current pss size over its run time. Change-Id: Iceaa7ffb2ad2015c33a64133a72a272b56dbad53
Diffstat (limited to 'cmds/am')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index d78572b..c18f542 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -100,6 +100,7 @@ public class Am extends BaseCommand {
" am monitor [--gdb <port>]\n" +
" am hang [--allow-restart]\n" +
" am restart\n" +
+ " am idle-maintenance\n" +
" am screen-compat [on|off] <PACKAGE>\n" +
" am to-uri [INTENT]\n" +
" am to-intent-uri [INTENT]\n" +
@@ -189,6 +190,8 @@ public class Am extends BaseCommand {
"\n" +
"am restart: restart the user-space system.\n" +
"\n" +
+ "am idle-maintenance: perform idle maintenance now.\n" +
+ "\n" +
"am screen-compat: control screen compatibility mode of <PACKAGE>.\n" +
"\n" +
"am to-uri: print the given Intent specification as a URI.\n" +
@@ -295,6 +298,8 @@ public class Am extends BaseCommand {
runHang();
} else if (op.equals("restart")) {
runRestart();
+ } else if (op.equals("idle-maintenance")) {
+ runIdleMaintenance();
} else if (op.equals("screen-compat")) {
runScreenCompat();
} else if (op.equals("to-uri")) {
@@ -1393,6 +1398,20 @@ public class Am extends BaseCommand {
mAm.restart();
}
+ private void runIdleMaintenance() throws Exception {
+ String opt;
+ while ((opt=nextOption()) != null) {
+ System.err.println("Error: Unknown option: " + opt);
+ return;
+ }
+
+ System.out.println("Performing idle maintenance...");
+ Intent intent = new Intent(
+ "com.android.server.IdleMaintenanceService.action.FORCE_IDLE_MAINTENANCE");
+ mAm.broadcastIntent(null, intent, null, null, 0, null, null, null,
+ android.app.AppOpsManager.OP_NONE, true, false, UserHandle.USER_ALL);
+ }
+
private void runScreenCompat() throws Exception {
String mode = nextArgRequired();
boolean enabled;