Update BatteryInfo to include averageTimeToDischarge

This updates the Estimate data model class as well as the places
it is used to populate the new field when available.

Test: robotests
Bug: 74020365
Change-Id: Ibcecf933819f8b8cd8514205768569e9bd7d1517
(cherry picked from commit 453db0cdbc)
Merged-In: 453db0cdbc
This commit is contained in:
Salvador Martinez
2018-03-02 17:09:48 -08:00
parent fd7b78afb0
commit db1efa3e03
5 changed files with 79 additions and 57 deletions

View File

@@ -438,14 +438,15 @@ public class BatteryUtils {
if (estimate != null) {
batteryInfo = BatteryInfo.getBatteryInfo(mContext, batteryBroadcast, stats,
elapsedRealtimeUs, false /* shortString */,
PowerUtil.convertMsToUs(estimate.estimateMillis),
estimate.isBasedOnUsage);
estimate, elapsedRealtimeUs, false /* shortString */);
} else {
estimate = new Estimate(
PowerUtil.convertUsToMs(stats.computeBatteryTimeRemaining(elapsedRealtimeUs)),
false,
Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN
);
batteryInfo = BatteryInfo.getBatteryInfo(mContext, batteryBroadcast, stats,
elapsedRealtimeUs, false /* shortString */,
discharging ? stats.computeBatteryTimeRemaining(elapsedRealtimeUs) : 0,
false /* basedOnUsage */);
estimate, elapsedRealtimeUs, false /* shortString */);
}
BatteryUtils.logRuntime(tag, "BatteryInfoLoader.loadInBackground", startTime);