Fix bug incrementing log time

Log start time was being incremented by the latest log event (being
added) instead of the first log event (being removed).

Test: manual
Change-Id: I4e15ba775d65d766ef0030d9cdfabe1f020185e6
This commit is contained in:
Soonil Nagarkar
2020-11-30 08:58:52 -08:00
parent 1681b437d2
commit be77616aff

View File

@@ -99,6 +99,7 @@ public abstract class LocalEventLog {
private long mLastLogRealtimeMs;
public LocalEventLog(int size) {
Preconditions.checkArgument(size > 0);
mLog = new Log[size];
mLogSize = 0;
mLogEndIndex = 0;
@@ -163,7 +164,7 @@ public abstract class LocalEventLog {
if (mLogSize == mLog.length) {
// if log is full, size will remain the same, but update the start time
mStartRealtimeMs += event.getTimeDeltaMs();
mStartRealtimeMs += mLog[startIndex()].getTimeDeltaMs();
} else {
// otherwise add an item
mLogSize++;