Whoops, need to acquire lock.
Also increase time between reports to try to reduce the amount
of redundant spam we get.
Change-Id: Iedd7d743826fffa62ee431073cb7dfb49a00cea0
diff --git a/data/etc/platform.xml b/data/etc/platform.xml
index 9fe2dde..6cd07a3 100644
--- a/data/etc/platform.xml
+++ b/data/etc/platform.xml
@@ -137,6 +137,7 @@
<assign-permission name="android.permission.SET_ALWAYS_FINISH" uid="shell" />
<assign-permission name="android.permission.DUMP" uid="shell" />
<assign-permission name="android.permission.SIGNAL_PERSISTENT_PROCESSES" uid="shell" />
+ <assign-permission name="android.permission.KILL_BACKGROUND_PROCESSES" uid="shell" />
<!-- Internal permissions granted to the shell. -->
<assign-permission name="android.permission.FORCE_BACK" uid="shell" />
<assign-permission name="android.permission.BATTERY_STATS" uid="shell" />
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index b6f1184..c0af2f6 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1211,8 +1211,8 @@
}
synchronized (ActivityManagerService.this) {
long now = SystemClock.uptimeMillis();
- if (now < (mLastMemUsageReportTime+10000)) {
- // Don't report more than every 10 seconds to somewhat
+ if (now < (mLastMemUsageReportTime+5*60*1000)) {
+ // Don't report more than every 5 minutes to somewhat
// avoid spamming.
return;
}
@@ -1250,12 +1250,14 @@
PrintWriter catPw = new PrintWriter(catSw);
String[] emptyArgs = new String[] { };
StringBuilder tag = new StringBuilder(128);
- dumpProcessesLocked(null, catPw, emptyArgs, 0, false);
- catPw.println();
- dumpServicesLocked(null, catPw, emptyArgs, 0, false, false);
- catPw.println();
- dumpActivitiesLocked(null, catPw, emptyArgs, 0, false, false);
- catPw.println();
+ synchronized (ActivityManagerService.this) {
+ dumpProcessesLocked(null, catPw, emptyArgs, 0, false);
+ catPw.println();
+ dumpServicesLocked(null, catPw, emptyArgs, 0, false, false);
+ catPw.println();
+ dumpActivitiesLocked(null, catPw, emptyArgs, 0, false, false);
+ catPw.println();
+ }
tag.append("Low on memory -- ");
dumpApplicationMemoryUsage(null, pw, " ", emptyArgs, true, catPw, tag);
String memUsage = sw.toString();