Prevent DivideByZero error in BatteryStatsImpl
am: ba88e68fe4
* commit 'ba88e68fe47b66f1fc5d10c15f04f20fe662399e':
Prevent DivideByZero error in BatteryStatsImpl
This commit is contained in:
@@ -7699,26 +7699,35 @@ public final class BatteryStatsImpl extends BatteryStats {
|
||||
}
|
||||
|
||||
final Uid u = getUidStatsLocked(mapUid(entry.uid));
|
||||
u.noteNetworkActivityLocked(NETWORK_WIFI_RX_DATA, entry.rxBytes,
|
||||
entry.rxPackets);
|
||||
u.noteNetworkActivityLocked(NETWORK_WIFI_TX_DATA, entry.txBytes,
|
||||
entry.txPackets);
|
||||
rxPackets.put(u.getUid(), entry.rxPackets);
|
||||
txPackets.put(u.getUid(), entry.txPackets);
|
||||
if (entry.rxBytes != 0) {
|
||||
u.noteNetworkActivityLocked(NETWORK_WIFI_RX_DATA, entry.rxBytes,
|
||||
entry.rxPackets);
|
||||
mNetworkByteActivityCounters[NETWORK_WIFI_RX_DATA].addCountLocked(
|
||||
entry.rxBytes);
|
||||
mNetworkPacketActivityCounters[NETWORK_WIFI_RX_DATA].addCountLocked(
|
||||
entry.rxPackets);
|
||||
|
||||
// Sum the total number of packets so that the Rx Power and Tx Power can
|
||||
// be evenly distributed amongst the apps.
|
||||
totalRxPackets += entry.rxPackets;
|
||||
totalTxPackets += entry.txPackets;
|
||||
rxPackets.put(u.getUid(), entry.rxPackets);
|
||||
|
||||
mNetworkByteActivityCounters[NETWORK_WIFI_RX_DATA].addCountLocked(
|
||||
entry.rxBytes);
|
||||
mNetworkByteActivityCounters[NETWORK_WIFI_TX_DATA].addCountLocked(
|
||||
entry.txBytes);
|
||||
mNetworkPacketActivityCounters[NETWORK_WIFI_RX_DATA].addCountLocked(
|
||||
entry.rxPackets);
|
||||
mNetworkPacketActivityCounters[NETWORK_WIFI_TX_DATA].addCountLocked(
|
||||
entry.txPackets);
|
||||
// Sum the total number of packets so that the Rx Power can
|
||||
// be evenly distributed amongst the apps.
|
||||
totalRxPackets += entry.rxPackets;
|
||||
}
|
||||
|
||||
if (entry.txBytes != 0) {
|
||||
u.noteNetworkActivityLocked(NETWORK_WIFI_TX_DATA, entry.txBytes,
|
||||
entry.txPackets);
|
||||
mNetworkByteActivityCounters[NETWORK_WIFI_TX_DATA].addCountLocked(
|
||||
entry.txBytes);
|
||||
mNetworkPacketActivityCounters[NETWORK_WIFI_TX_DATA].addCountLocked(
|
||||
entry.txPackets);
|
||||
|
||||
txPackets.put(u.getUid(), entry.txPackets);
|
||||
|
||||
// Sum the total number of packets so that the Tx Power can
|
||||
// be evenly distributed amongst the apps.
|
||||
totalTxPackets += entry.txPackets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user