Fix the missing longwake finish event problem.
When starting a new batteystats history file, before inserting a new CMD_CURRENT_TIME HistoryItem at beginning of the history buffer, make a copy of the current HistoryItem. Otherwise the current HistoryItem could be overriden by the CMD_CURRENT_TIME and we lose a HistoryItem. In b/130083227, the longwake start event happends before opening the new history file, after CMD_CURRENT_TIME event, the longwake finish event is missing. The fix is to make a copy of current HistoryItem before adding CMD_CURRENT_TIME event. Change-Id: I5048f98b6b47f54336fb01e354fb5a6284c84b43 Fix: 130083227 Test: b/130083227 can be reproduced by createFakeHistoryEvents() call, missing longwake finish event can be seen after "TIME:" record. With the fix, no more missing longwake finish event after "TIME:" record. “adb shell dumpsys batterystats --history-create-events 50000” to create enough events to start new history files, “adb shell dumpsys batterystats --history” to observe all history records.
Loading
Please register or sign in to comment