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

Commit 41919763 authored by Jeffrey Huang's avatar Jeffrey Huang
Browse files

Update process_state_changed logging

Log only the parent state to avoid unnecessary process states from being
sent to statsd. This may not work for all cases, but the edge cases can
be revisited later.

Bug: 135965535
Bug: 135375287
Test: manually tested using chrome
Change-Id: I87b79f5d21f186f227a5a50bbe83b56a9105348c
parent 07bed80a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4009,6 +4009,11 @@ public class BatteryStatsImpl extends BatteryStats {
            // Otherwise the parent's process state will get downgraded incorrectly
            return;
        }
        // TODO(b/155216561): It is possible for isolated uids to be in a higher
        // state than its parent uid. We should track the highest state within the union of host
        // and isolated uids rather than only the parent uid.
        FrameworkStatsLog.write(FrameworkStatsLog.UID_PROCESS_STATE_CHANGED, uid,
                ActivityManager.processStateAmToProto(state));
        getUidStatsLocked(uid).updateUidProcessStateLocked(state);
    }
+0 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.server.am;

import android.app.ActivityManager;
import android.bluetooth.BluetoothActivityEnergyInfo;
import android.content.ContentResolver;
import android.content.Context;
@@ -376,9 +375,6 @@ public final class BatteryStatsService extends IBatteryStats.Stub
    /** @param state Process state from ActivityManager.java. */
    void noteUidProcessState(int uid, int state) {
        synchronized (mStats) {
            FrameworkStatsLog.write(FrameworkStatsLog.UID_PROCESS_STATE_CHANGED, uid,
                    ActivityManager.processStateAmToProto(state));

            mStats.noteUidProcessStateLocked(uid, state);
        }
    }