diff options
author | Vinit Deshpande <vinitd@google.com> | 2015-06-23 00:21:28 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-23 00:21:34 +0000 |
commit | a2cbb3e632f46dda69fce264b29ed50c4f827ad3 (patch) | |
tree | e940e68a8412c7a06759dfd1ff450fb92b642be1 /wifi/java | |
parent | 484b114846d6ed425f7e938fb97980ee67f43140 (diff) | |
parent | c88e8b230bb3f51107cf0ed5313c5a39115ddf33 (diff) | |
download | frameworks_base-a2cbb3e632f46dda69fce264b29ed50c4f827ad3.zip frameworks_base-a2cbb3e632f46dda69fce264b29ed50c4f827ad3.tar.gz frameworks_base-a2cbb3e632f46dda69fce264b29ed50c4f827ad3.tar.bz2 |
Merge changes from topic 'mwd-merge-wifi-062215' into mnc-dev
* changes:
Added config_wifi_hotspot2_enabled.
make sure wifi link stats are reset
Diffstat (limited to 'wifi/java')
-rw-r--r-- | wifi/java/android/net/wifi/WifiInfo.java | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java index dbfd4ef..2ba38e1 100644 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -167,15 +167,24 @@ public class WifiInfo implements Parcelable { long txbad = stats.lostmpdu_be + stats.lostmpdu_bk + stats.lostmpdu_vi + stats.lostmpdu_vo; - txBadRate = (txBadRate * 0.5) - + ((double) (txbad - txBad) * 0.5); - txSuccessRate = (txSuccessRate * 0.5) - + ((double) (txgood - txSuccess) * 0.5); - rxSuccessRate = (rxSuccessRate * 0.5) - + ((double) (rxgood - rxSuccess) * 0.5); - txRetriesRate = (txRetriesRate * 0.5) - + ((double) (txretries - txRetries) * 0.5); - + if (txBad <= txbad + && txSuccess <= txgood + && rxSuccess <= rxgood + && txRetries <= txretries) { + txBadRate = (txBadRate * 0.5) + + ((double) (txbad - txBad) * 0.5); + txSuccessRate = (txSuccessRate * 0.5) + + ((double) (txgood - txSuccess) * 0.5); + rxSuccessRate = (rxSuccessRate * 0.5) + + ((double) (rxgood - rxSuccess) * 0.5); + txRetriesRate = (txRetriesRate * 0.5) + + ((double) (txretries - txRetries) * 0.5); + } else { + txBadRate = 0; + txSuccessRate = 0; + rxSuccessRate = 0; + txRetriesRate = 0; + } txBad = txbad; txSuccess = txgood; rxSuccess = rxgood; @@ -204,11 +213,15 @@ public class WifiInfo implements Parcelable { txRetries = 0; txBadRate = 0; txRetriesRate = 0; - - txSuccessRate = (txSuccessRate * 0.5) - + ((double) (txPackets - txSuccess) * 0.5); - rxSuccessRate = (rxSuccessRate * 0.5) - + ((double) (rxPackets - rxSuccess) * 0.5); + if (txSuccess <= txPackets && rxSuccess <= rxPackets) { + txSuccessRate = (txSuccessRate * 0.5) + + ((double) (txPackets - txSuccess) * 0.5); + rxSuccessRate = (rxSuccessRate * 0.5) + + ((double) (rxPackets - rxSuccess) * 0.5); + } else { + txBadRate = 0; + txRetriesRate = 0; + } txSuccess = txPackets; rxSuccess = rxPackets; } |