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

Commit 2d0ff3d3 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Prevent crash when power profile has incorrect freq counts

Bug: 179750543
Test: build and launch Settings
Change-Id: I9ede5caf0001deff0067eabd9520af9d315ac95f
parent cf2929ff
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -134,7 +134,8 @@ public class SystemServicePowerCalculator extends PowerCalculator {
        // TODO(179210707): additionally account for CPU active and per cluster battery use
        // TODO(179210707): additionally account for CPU active and per cluster battery use


        double powerMah = 0;
        double powerMah = 0;
        for (int i = 0; i < mPowerEstimators.length; i++) {
        final int size = Math.min(mPowerEstimators.length, systemServiceTimeAtCpuSpeeds.length);
        for (int i = 0; i < size; i++) {
            powerMah += mPowerEstimators[i].calculatePower(systemServiceTimeAtCpuSpeeds[i]);
            powerMah += mPowerEstimators[i].calculatePower(systemServiceTimeAtCpuSpeeds[i]);
        }
        }