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

Commit 13b0aa2a authored by Dmitri Plotnikov's avatar Dmitri Plotnikov Committed by Android (Google) Code Review
Browse files

Merge "Prevent zero-division in the absence of measured system server drain"

parents 4add4fb9 0312c36c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -175,8 +175,11 @@ public class SystemServicePowerCalculator extends PowerCalculator {
        final double systemUidModeledPowerMah = mCpuPowerCalculator.calculateUidModeledPowerMah(
                systemUid, BatteryStats.STATS_SINCE_CHARGED);

        return uCtoMah(consumptionUC) * systemServiceModeledPowerMah
                / systemUidModeledPowerMah;
        if (systemUidModeledPowerMah > 0) {
            return uCtoMah(consumptionUC) * systemServiceModeledPowerMah / systemUidModeledPowerMah;
        } else {
            return 0;
        }
    }

    private double calculatePowerUsingPowerProfile(BatteryStats batteryStats) {