Merge cherrypicks of [3510428, 3510260, 3510652, 3510635, 3510636, 3510429, 3510690, 3510356, 3510357, 3510514] into pi-release

Change-Id: Ibe59f047e5ecefbbb3253ba4c9fa1135d137ac4a
This commit is contained in:
android-build-team Robot
2018-01-25 03:57:15 +00:00
2 changed files with 16 additions and 11 deletions

View File

@@ -171,18 +171,20 @@ public class BatteryInfo {
if (discharging && provider != null if (discharging && provider != null
&& provider.isEnhancedBatteryPredictionEnabled(context)) { && provider.isEnhancedBatteryPredictionEnabled(context)) {
Estimate estimate = provider.getEnhancedBatteryPrediction(context); Estimate estimate = provider.getEnhancedBatteryPrediction(context);
BatteryUtils.logRuntime(LOG_TAG, "time for enhanced BatteryInfo", startTime); if(estimate != null) {
return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats, BatteryUtils
elapsedRealtimeUs, shortString, .logRuntime(LOG_TAG, "time for enhanced BatteryInfo", startTime);
BatteryUtils.convertMsToUs(estimate.estimateMillis), return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats,
estimate.isBasedOnUsage); elapsedRealtimeUs, shortString,
} else { BatteryUtils.convertMsToUs(estimate.estimateMillis),
long prediction = discharging estimate.isBasedOnUsage);
? stats.computeBatteryTimeRemaining(elapsedRealtimeUs) : 0; }
BatteryUtils.logRuntime(LOG_TAG, "time for regular BatteryInfo", startTime);
return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats,
elapsedRealtimeUs, shortString, prediction, false);
} }
long prediction = discharging
? stats.computeBatteryTimeRemaining(elapsedRealtimeUs) : 0;
BatteryUtils.logRuntime(LOG_TAG, "time for regular BatteryInfo", startTime);
return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats,
elapsedRealtimeUs, shortString, prediction, false);
} }
@Override @Override

View File

@@ -55,6 +55,9 @@ public class DebugEstimatesLoader extends AsyncLoader<List<BatteryInfo>> {
stats, elapsedRealtimeUs, false); stats, elapsedRealtimeUs, false);
Estimate estimate = powerUsageFeatureProvider.getEnhancedBatteryPrediction(context); Estimate estimate = powerUsageFeatureProvider.getEnhancedBatteryPrediction(context);
if (estimate == null) {
estimate = new Estimate(0, false);
}
BatteryInfo newInfo = BatteryInfo.getBatteryInfo(getContext(), batteryBroadcast, stats, BatteryInfo newInfo = BatteryInfo.getBatteryInfo(getContext(), batteryBroadcast, stats,
elapsedRealtimeUs, false, elapsedRealtimeUs, false,
BatteryUtils.convertMsToUs(estimate.estimateMillis), BatteryUtils.convertMsToUs(estimate.estimateMillis),