Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 345a3cb6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix null pointer from PowerUsageFeatureProvider"

parents c4ceb8c1 250a7983
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -171,19 +171,21 @@ public class BatteryInfo {
                if (discharging && provider != null
                        && provider.isEnhancedBatteryPredictionEnabled(context)) {
                    Estimate estimate = provider.getEnhancedBatteryPrediction(context);
                    BatteryUtils.logRuntime(LOG_TAG, "time for enhanced BatteryInfo", startTime);
                    if(estimate != null) {
                        BatteryUtils
                                .logRuntime(LOG_TAG, "time for enhanced BatteryInfo", startTime);
                        return BatteryInfo.getBatteryInfo(context, batteryBroadcast, stats,
                                elapsedRealtimeUs, shortString,
                                BatteryUtils.convertMsToUs(estimate.estimateMillis),
                                estimate.isBasedOnUsage);
                } else {
                    }
                }
                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
            protected void onPostExecute(BatteryInfo batteryInfo) {
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ public class DebugEstimatesLoader extends AsyncLoader<List<BatteryInfo>> {
                stats, elapsedRealtimeUs, false);

        Estimate estimate = powerUsageFeatureProvider.getEnhancedBatteryPrediction(context);
        if (estimate == null) {
            estimate = new Estimate(0, false);
        }
        BatteryInfo newInfo = BatteryInfo.getBatteryInfo(getContext(), batteryBroadcast, stats,
                elapsedRealtimeUs, false,
                BatteryUtils.convertMsToUs(estimate.estimateMillis),