Draw timestamp information into BatteryChartView manually (2/2)

screenshot: https://screenshot.googleplex.com/8zJcMJeMDovfhdD

Bug: 183921876
Test: make SettingsRoboTests
Change-Id: I276f70c3cf8ebd2316f987ace0d6537ed2cf8a45
This commit is contained in:
ykhung
2021-04-27 16:16:13 +08:00
committed by YUKAI HUNG
parent e035a81ddc
commit 10000eb254
3 changed files with 82 additions and 4 deletions

View File

@@ -196,6 +196,11 @@ public final class ConvertUtils {
for (int index = 0; index < timeSlotSize; index++) {
final Long currentTimestamp =
Long.valueOf(batteryHistoryKeys[index * timestampStride]);
// Uses empty list if the timestamp is default value.
if (currentTimestamp == 0) {
resultMap.put(Integer.valueOf(index), new ArrayList<BatteryDiffEntry>());
continue;
}
final Long nextTimestamp =
Long.valueOf(batteryHistoryKeys[index * timestampStride + 1]);
final Long nextTwoTimestamp =