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

Commit 9fa3cd3d authored by Adam Lesinski's avatar Adam Lesinski Committed by Android (Google) Code Review
Browse files

Merge "BatteryStats: Fix DivideByZero error"

parents 1990221c a426817a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -8160,7 +8160,7 @@ public final class BatteryStatsImpl extends BatteryStats {
            final int size = delta.size();
            for (int i = 0; i < size; i++) {
                final NetworkStats.Entry entry = delta.getValues(i, mTmpNetworkStatsEntry);
                if (entry.rxPackets == 0 || entry.txPackets == 0) {
                if (entry.rxPackets == 0 && entry.txPackets == 0) {
                    continue;
                }

@@ -8211,13 +8211,13 @@ public final class BatteryStatsImpl extends BatteryStats {
                    if (activityInfo != null) {
                        ControllerActivityCounterImpl activityCounter =
                                u.getOrCreateModemControllerActivityLocked();
                        if (entry.rxPackets != 0) {
                        if (totalRxPackets > 0 && entry.rxPackets > 0) {
                            final long rxMs = (entry.rxPackets * activityInfo.getRxTimeMillis())
                                    / totalRxPackets;
                            activityCounter.getRxTimeCounter().addCountLocked(rxMs);
                        }

                        if (entry.txPackets != 0) {
                        if (totalTxPackets > 0 && entry.txPackets > 0) {
                            for (int lvl = 0; lvl < ModemActivityInfo.TX_POWER_LEVELS; lvl++) {
                                long txMs = entry.txPackets * activityInfo.getTxTimeMillis()[lvl];
                                txMs /= totalTxPackets;