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

Commit 11100b96 authored by Yao Chen's avatar Yao Chen Committed by android-build-merger
Browse files

Merge "Fix UidMap proto output error. And fix a bug in MaxDurationTracker."...

Merge "Fix UidMap proto output error. And fix a bug in MaxDurationTracker." into pi-dev am: 23ceeb3a
am: 1daf6456

Change-Id: Ic7f84da8df6f41afeec5934d796607a0d3895f3c
parents 6cecf67a 1daf6456
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -205,11 +205,12 @@ bool MaxDurationTracker::flushCurrentBucket(
    bool hasPendingEvent =
    bool hasPendingEvent =
            false;  // has either a kStarted or kPaused event across bucket boundaries
            false;  // has either a kStarted or kPaused event across bucket boundaries
    // meaning we need to carry them over to the new bucket.
    // meaning we need to carry them over to the new bucket.
    for (auto it = mInfos.begin(); it != mInfos.end(); ++it) {
    for (auto it = mInfos.begin(); it != mInfos.end();) {
        if (it->second.state == DurationState::kStopped) {
        if (it->second.state == DurationState::kStopped) {
            // No need to keep buckets for events that were stopped before.
            // No need to keep buckets for events that were stopped before.
            mInfos.erase(it);
            it = mInfos.erase(it);
        } else {
        } else {
            ++it;
            hasPendingEvent = true;
            hasPendingEvent = true;
        }
        }
    }
    }
+2 −1
Original line number Original line Diff line number Diff line
@@ -365,7 +365,8 @@ void UidMap::appendUidMap(const int64_t& timestamp, const ConfigKey& key,
            count++;
            count++;
            proto->write(FIELD_TYPE_INT64 | FIELD_ID_SNAPSHOT_TIMESTAMP,
            proto->write(FIELD_TYPE_INT64 | FIELD_ID_SNAPSHOT_TIMESTAMP,
                         (long long)record.timestampNs);
                         (long long)record.timestampNs);
            proto->write(FIELD_TYPE_MESSAGE | FIELD_ID_SNAPSHOT_PACKAGE_INFO, record.bytes.data());
            proto->write(FIELD_TYPE_MESSAGE | FIELD_ID_SNAPSHOT_PACKAGE_INFO, record.bytes.data(),
                         record.bytes.size());
            proto->end(snapshotsToken);
            proto->end(snapshotsToken);
        }
        }
    }
    }