Prevent division-by-zero error when calculating battery capacity. am: 415f8b32e8
am: 63f3dbae3c
Change-Id: I1c97aa2e4c0bbc84c547e4ce3ff98b77c5bba3f4
This commit is contained in:
committed by
android-build-merger
commit
df6a737108
@@ -9612,7 +9612,7 @@ public class BatteryStatsImpl extends BatteryStats {
|
|||||||
}
|
}
|
||||||
doWrite = true;
|
doWrite = true;
|
||||||
resetAllStatsLocked();
|
resetAllStatsLocked();
|
||||||
if (chargeUAh > 0) {
|
if (chargeUAh > 0 && level > 0) {
|
||||||
// Only use the reported coulomb charge value if it is supported and reported.
|
// Only use the reported coulomb charge value if it is supported and reported.
|
||||||
mEstimatedBatteryCapacity = (int) ((chargeUAh / 1000) / (level / 100.0));
|
mEstimatedBatteryCapacity = (int) ((chargeUAh / 1000) / (level / 100.0));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user