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

Commit 347553f4 authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Fix divide-by-zero in noteModemControllerActivity

Fixes: 267058279
Test: manual (while no radio activity "adb shell dumpsys battery unplug;
adb shell dumpsys batterystats; adb shell dumpsys batterystats;")

Change-Id: I8803aad1f38c2baa50c255d3d315d2c5880c9e33
parent e4241197
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -12076,11 +12076,16 @@ public class BatteryStatsImpl extends BatteryStats {
            final SparseDoubleArray uidEstimatedConsumptionMah;
            final long dataConsumedChargeUC;
            if (consumedChargeUC > 0 && isMobileRadioEnergyConsumerSupportedLocked()) {
                final long phoneConsumedChargeUC;
                if (totalRadioDurationMs == 0) {
                    phoneConsumedChargeUC = 0;
                } else {
                    // Crudely attribute power consumption. Added (totalRadioDurationMs / 2) to the
                    // numerator for long rounding.
                final long phoneConsumedChargeUC =
                    phoneConsumedChargeUC =
                            (consumedChargeUC * phoneOnDurationMs + totalRadioDurationMs / 2)
                                    / totalRadioDurationMs;
                }
                dataConsumedChargeUC = consumedChargeUC - phoneConsumedChargeUC;
                mGlobalEnergyConsumerStats.updateStandardBucket(