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

Commit b98faf16 authored by Rubin Xu's avatar Rubin Xu
Browse files

Fix IndexOutOfBoundsException in SecurityLogMonitor

Bug: 191742062
Test: manual - Set SecurityLogMonitor.DEBUG to true
      execute 'adb shell dpm force-security-logs'
      Retrieve logs
      execute 'adb shell dpm force-security-logs' again
Change-Id: I5006481f71c7dabc8e6cdb100f8f5793b7f0987d
parent 0cc40af3
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -389,9 +389,15 @@ class SecurityLogMonitor implements Runnable {
            mCriticalLevelLogged = false;
            Slog.i(TAG, "Pending logs buffer full. Discarding old logs.");
        }
        if (DEBUG) Slog.d(TAG, mPendingLogs.size() + " pending events in the buffer after merging,"
        if (DEBUG) {
            if (mPendingLogs.size() > 0) {
                Slog.d(TAG, mPendingLogs.size() + " pending events in the buffer after merging,"
                        + " with ids " + mPendingLogs.get(0).getId()
                        + " to " + mPendingLogs.get(mPendingLogs.size() - 1).getId());
            } else {
                Slog.d(TAG, "0 pending events in the buffer after merging");
            }
        }
    }

    @GuardedBy("mLock")