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

Commit fd99d08d authored by Peter Collingbourne's avatar Peter Collingbourne Committed by Android (Google) Code Review
Browse files

Merge "Fix division by zero in maybeAdjustDesiredStockLevelLocked()."

parents a5cbb8fa 9bb7cb8a
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -701,6 +701,10 @@ public class InternalResourceService extends SystemService {
            return;
        }
        final long totalDischargeMah = mAnalyst.getBatteryScreenOffDischargeMah();
        if (totalDischargeMah == 0) {
            Slog.i(TAG, "Total discharge was 0");
            return;
        }
        final long batteryCapacityMah = mBatteryManagerInternal.getBatteryFullCharge() / 1000;
        final long estimatedLifeHours = batteryCapacityMah * totalScreenOffDurationMs
                / totalDischargeMah / HOUR_IN_MILLIS;