Report High usage even in a short period

In detector, we should also catch the following case:
1. Battery draining more than 25% even though usage time is less than
2 hours.

This cl stores the first time battery level, even though usage time
may be short.

Bug: 73012441
Test: RunSettingsRoboTests
Change-Id: I7106f7203718bfe2afe9cce297ea01b8fcf0be2d
This commit is contained in:
jackqdyulei
2018-02-21 11:23:30 -08:00
parent c07124feeb
commit 5f28beac51
2 changed files with 12 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ public class HighUsageDataParser implements BatteryInfo.BatteryDataParser {
@Override
public void onDataPoint(long time, BatteryStats.HistoryItem record) {
if (record.currentTime <= mEndTimeMs - mTimePeriodMs) {
if (time == 0 || record.currentTime <= mEndTimeMs - mTimePeriodMs) {
// Since onDataPoint is invoked sorted by time, so we could use this way to get the
// closet battery level 'mTimePeriodMs' time ago.
mLastPeriodBatteryLevel = record.batteryLevel;