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

Commit ec65308e authored by Jing Ji's avatar Jing Ji
Browse files

Skip STATE_SERVICE_RESTARTING while dumping procstats to statsd

Because it's not a real process state.

Bug: 186438656
Test: atest ProcStatsValidationTests
Test: atest ProcessStatsDumpsysTest
Test: atest CtsIncidentHostTestCases:ProcStatsProtoTest
Test: atest CtsStatsdHostTestCases
Test: atest CtsAppTestCases:ActivityManagerProcessStateTest
Change-Id: I26d170f5acac8434548aa62b439c26141ad99c3e
parent 5f1fac6a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -93,7 +93,6 @@ public final class DumpUtils {
        STATE_LABELS[STATE_BOUND_TOP_OR_FGS]        = "Bnd TopFgs";
        STATE_LABELS[STATE_FGS]                     = "       Fgs";
        STATE_LABELS[STATE_IMPORTANT_FOREGROUND]    = "    Imp Fg";
        STATE_LABELS[STATE_IMPORTANT_FOREGROUND]    = "    Imp Fg";
        STATE_LABELS[STATE_IMPORTANT_BACKGROUND]    = "    Imp Bg";
        STATE_LABELS[STATE_BACKUP]                  = "    Backup";
        STATE_LABELS[STATE_SERVICE]                 = "   Service";
+7 −1
Original line number Diff line number Diff line
@@ -1550,6 +1550,10 @@ public final class ProcessState {
            final int key = mDurations.getKeyAt(i);
            final int type = SparseMappingTable.getIdFromKey(key);
            final int aggregatedType = DumpUtils.aggregateCurrentProcessState(type);
            if ((type % STATE_COUNT) == STATE_SERVICE_RESTARTING) {
                // Skip restarting service state -- that is not actually a running process.
                continue;
            }

            long time = mDurations.getValue(key);
            if (mCurCombinedState == type) {
@@ -1563,7 +1567,9 @@ public final class ProcessState {
                durationByState.put(aggregatedType, time);
            }
        }
        if (!didCurState && mCurCombinedState != STATE_NOTHING) {
        if (!didCurState && mCurCombinedState != STATE_NOTHING
                && (mCurCombinedState % STATE_COUNT) != STATE_SERVICE_RESTARTING) {
            // Skip restarting service state -- that is not actually a running process.
            final int aggregatedType = DumpUtils.aggregateCurrentProcessState(mCurCombinedState);
            int index = durationByState.indexOfKey(aggregatedType);
            if (index >= 0) {