Ignore isolated uid's process state in BatteryStats tracking
Isolated UIDs keep coming and going, with their process states
being downgraded. But this shouldn't impact the process state
time tracking in battery stats, since the parent UIDs process state
reflects the overall state already.
This fixes incorrect TOP time reporting in Settings for apps like
Chrome.
Change-Id: I0e94b064cd19f1f2d951e1e88aaba06b5c1c26fe
Fixes: 62162308
Test: Use chrome for a while and observe output of dumpsys batterystats
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 2363f68..00df8fb 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -3597,7 +3597,12 @@
}
public void noteUidProcessStateLocked(int uid, int state) {
- uid = mapUid(uid);
+ int parentUid = mapUid(uid);
+ if (uid != parentUid) {
+ // Isolated UIDs process state is already rolled up into parent, so no need to track
+ // Otherwise the parent's process state will get downgraded incorrectly
+ return;
+ }
getUidStatsLocked(uid).updateUidProcessStateLocked(state);
}