Skip to content
Commit 0ed84f12 authored by Hui Yu's avatar Hui Yu
Browse files

Better Handling of Battery Stats History Overflow

Previously battery history is kept in the in-memory mHistoryBuffer
with size of 512KB (96KB on low memory device). When the buffer is
close to full we drop certain types of history. When the buffer is
full the whole buffer is reset and we lost elder history. On a
device with long battery life this problem is more frequent.

This CL changes mHistoryBuffer to 128KB (64KB on low memory device).
When the buffer is full, it is saved to history file on file system.
By default we allow 32 history files (64 history files on low-memory
device) which gives us 4MB history (compare to 512KB today).

The MAX_HISTORY_BUFFER and MAX_HISTORY_FILES can be remote configured
through GServices or P/H.

In case of history exceeding 4MB, the oldest history file is deleted
and new history file is open.

This change increases battery history by using disk file and the
chance of losing history is greatly reduced.

Bug: 67297625
Test: adb shell dumpsys batterystats --history
Change-Id: Id9aafea761649d7323b97d1e44135f7880a95414
parent 458b7f74
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment