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
This commit is contained in:
@@ -12076,11 +12076,16 @@ public class BatteryStatsImpl extends BatteryStats {
|
||||
final SparseDoubleArray uidEstimatedConsumptionMah;
|
||||
final long dataConsumedChargeUC;
|
||||
if (consumedChargeUC > 0 && isMobileRadioEnergyConsumerSupportedLocked()) {
|
||||
// Crudely attribute power consumption. Added (totalRadioDurationMs / 2) to the
|
||||
// numerator for long rounding.
|
||||
final long phoneConsumedChargeUC =
|
||||
(consumedChargeUC * phoneOnDurationMs + totalRadioDurationMs / 2)
|
||||
/ totalRadioDurationMs;
|
||||
final long phoneConsumedChargeUC;
|
||||
if (totalRadioDurationMs == 0) {
|
||||
phoneConsumedChargeUC = 0;
|
||||
} else {
|
||||
// Crudely attribute power consumption. Added (totalRadioDurationMs / 2) to the
|
||||
// numerator for long rounding.
|
||||
phoneConsumedChargeUC =
|
||||
(consumedChargeUC * phoneOnDurationMs + totalRadioDurationMs / 2)
|
||||
/ totalRadioDurationMs;
|
||||
}
|
||||
dataConsumedChargeUC = consumedChargeUC - phoneConsumedChargeUC;
|
||||
|
||||
mGlobalEnergyConsumerStats.updateStandardBucket(
|
||||
|
||||
Reference in New Issue
Block a user