Add method to calculate last full charge time

Bug: 38481300
Test: RunSettingsRoboTests
Change-Id: Icd551921f263352eb01d0c6ada62d277c8699507
This commit is contained in:
jackqdyulei
2017-05-25 15:26:03 -07:00
parent 141e442e26
commit de3bb7194d
3 changed files with 28 additions and 7 deletions

View File

@@ -261,6 +261,19 @@ public class BatteryUtils {
});
}
/**
* Calculate the time since last full charge, including the device off time
*
* @param batteryStatsHelper utility class that contains the data
* @param currentTimeMs current wall time
* @return time in millis
*/
public long calculateLastFullChargeTime(BatteryStatsHelper batteryStatsHelper,
long currentTimeMs) {
return currentTimeMs - batteryStatsHelper.getStats().getStartClockTime();
}
private long convertUsToMs(long timeUs) {
return timeUs / 1000;
}