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

Commit de6a6f71 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Prevent crash when history event is written w/o a name" into main

parents 03e93eb5 0b57f310
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1770,6 +1770,10 @@ public class BatteryStatsHistory {


    @GuardedBy("this")
    @GuardedBy("this")
    private void writeHistoryItem(long elapsedRealtimeMs, long uptimeMs, HistoryItem cur) {
    private void writeHistoryItem(long elapsedRealtimeMs, long uptimeMs, HistoryItem cur) {
        if (cur.eventCode != HistoryItem.EVENT_NONE && cur.eventTag.string == null) {
            Slog.wtfStack(TAG, "Event " + Integer.toHexString(cur.eventCode) + " without a name");
        }

        if (mTracer != null && mTracer.tracingEnabled()) {
        if (mTracer != null && mTracer.tracingEnabled()) {
            recordTraceEvents(cur.eventCode, cur.eventTag);
            recordTraceEvents(cur.eventCode, cur.eventTag);
            recordTraceCounters(mTraceLastState, cur.states, STATE1_TRACE_MASK,
            recordTraceCounters(mTraceLastState, cur.states, STATE1_TRACE_MASK,
@@ -2266,6 +2270,7 @@ public class BatteryStatsHistory {
    private int writeHistoryTag(HistoryTag tag) {
    private int writeHistoryTag(HistoryTag tag) {
        if (tag.string == null) {
        if (tag.string == null) {
            Slog.wtfStack(TAG, "writeHistoryTag called with null name");
            Slog.wtfStack(TAG, "writeHistoryTag called with null name");
            tag.string = "";
        }
        }


        final int stringLength = tag.string.length();
        final int stringLength = tag.string.length();