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

Commit a8f3c484 authored by atrost's avatar atrost Committed by Anna Trostanetski
Browse files

Rate limit non statsd logs.

Limit 1 log per app launch as the statd logs as this is spamming logs.
Consider increasing in the future to once every x minutes/seconds if
needed.

Bug: 138374585
Bug: 141714588
Test: flash device
Change-Id: I3ed696fb557527d807d03aecc64c0207d7b93f08
parent 0e45bfab
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -77,10 +77,10 @@ public final class ChangeReporter {
     * @param state    of the reported change - enabled/disabled/only logged
     */
    public void reportChange(int uid, long changeId, int state) {
        debugLog(uid, changeId, state);
        ChangeReport report = new ChangeReport(uid, changeId, state);
        synchronized (mReportedChanges) {
            if (!mReportedChanges.contains(report)) {
                debugLog(uid, changeId, state);
                StatsLog.write(StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED, uid, changeId,
                        state, mSource);
                mReportedChanges.add(report);
@@ -89,7 +89,6 @@ public final class ChangeReporter {
    }

    private void debugLog(int uid, long changeId, int state) {
        //TODO(b/138374585): Implement rate limiting for the logs.
        String message = String.format("Compat change id reported: %d; UID %d; state: %s", changeId,
                uid, stateToString(state));
        if (mSource == StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER) {