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

Commit 2326e9b2 authored by Samuel Tan's avatar Samuel Tan
Browse files

StateMachine: reset LogRecords.mOldestIndex in LogRecords.setSize

Reset LogRecords.mOldestIndex when we resize LogRecords with
LogRecords.setSize(), so that LogRecords.get() will use the
correct index to fetch log records.

BUG: 28214608
Change-Id: I58d94d9fe61af6a0e9cba224ff98aad36eb3cd1d
parent c180d68a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -593,7 +593,11 @@ public class StateMachine {
         * @param maxSize number of records to maintain at anyone time.
        */
        synchronized void setSize(int maxSize) {
            // TODO: once b/28217358 is fixed, add unit tests  to verify that these variables are
            // cleared after calling this method, and that subsequent calls to get() function as
            // expected.
            mMaxSize = maxSize;
            mOldestIndex = 0;
            mCount = 0;
            mLogRecVector.clear();
        }