Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd3caf6a authored by Amith Yamasani's avatar Amith Yamasani
Browse files

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
parent 5898d521
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -3597,7 +3597,12 @@ public class BatteryStatsImpl extends BatteryStats {
    }

    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);
    }