Add method to calculate last full charge time
Bug: 38481300 Test: RunSettingsRoboTests Change-Id: Icd551921f263352eb01d0c6ada62d277c8699507
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user