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

Commit e8e63908 authored by Anna Trostanetski's avatar Anna Trostanetski Committed by Gerrit Code Review
Browse files

Merge "Rate limit non statsd logs."

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


    private void debugLog(int uid, long changeId, int state) {
    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,
        String message = String.format("Compat change id reported: %d; UID %d; state: %s", changeId,
                uid, stateToString(state));
                uid, stateToString(state));
        if (mSource == StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER) {
        if (mSource == StatsLog.APP_COMPATIBILITY_CHANGE_REPORTED__SOURCE__SYSTEM_SERVER) {