Work on issue #2030135: Device sluggish
This adds some new debugging code to make it easier to see why a process is at
a certain oom_adj level -- for example telling you that a certain other process
has a binding to a certain one of its services. This has helped a lot in
identifying cases where processes are holding references to other processes that
they don't need and thus not allowing the system to get memory it needs.
Also fix a few problems with leaking entries on the service restarting and
service stopping lists.
diff --git a/services/java/com/android/server/am/ProcessRecord.java b/services/java/com/android/server/am/ProcessRecord.java
index 3f59710..544d034 100644
--- a/services/java/com/android/server/am/ProcessRecord.java
+++ b/services/java/com/android/server/am/ProcessRecord.java
@@ -58,7 +58,6 @@
int setAdj; // Last set OOM adjustment for this process
int curSchedGroup; // Currently desired scheduling class
int setSchedGroup; // Last set to background scheduling class
- boolean isForeground; // Is this app running the foreground UI?
boolean setIsForeground; // Running foreground UI when last set?
boolean foregroundServices; // Running any services that are foreground?
boolean bad; // True if disabled in the bad process list
@@ -73,6 +72,9 @@
BroadcastRecord curReceiver;// receiver currently running in the app
long lastRequestedGc; // When we last asked the app to do a gc
int lastPss; // Last pss size reported by app.
+ String adjType; // Debugging: primary thing impacting oom_adj.
+ Object adjSource; // Debugging: option dependent object.
+ Object adjTarget; // Debugging: target component impacting oom_adj.
// contains HistoryRecord objects
final ArrayList activities = new ArrayList();
@@ -151,8 +153,7 @@
pw.print(" set="); pw.println(setAdj);
pw.print(prefix); pw.print("curSchedGroup="); pw.print(curSchedGroup);
pw.print(" setSchedGroup="); pw.println(setSchedGroup);
- pw.print(prefix); pw.print("isForeground="); pw.print(isForeground);
- pw.print(" setIsForeground="); pw.print(setIsForeground);
+ pw.print(prefix); pw.print("setIsForeground="); pw.print(setIsForeground);
pw.print(" foregroundServices="); pw.print(foregroundServices);
pw.print(" forcingToForeground="); pw.println(forcingToForeground);
pw.print(prefix); pw.print("persistent="); pw.print(persistent);