diff options
author | Pierre Vandwalle <vandwalle@google.com> | 2015-06-10 12:28:29 -0700 |
---|---|---|
committer | Vinit Deshpande <vinitd@google.com> | 2015-06-22 16:28:54 -0700 |
commit | d258d7a86e3e2f8e0d2d573c27a2b3c6a7975df1 (patch) | |
tree | 58534e344929a6a451904fb67b7e4cebcbd24757 /wifi/java/android | |
parent | a77ef4b8b4c11a9fdfdca030462b7b055bf533bc (diff) | |
download | frameworks_base-d258d7a86e3e2f8e0d2d573c27a2b3c6a7975df1.zip frameworks_base-d258d7a86e3e2f8e0d2d573c27a2b3c6a7975df1.tar.gz frameworks_base-d258d7a86e3e2f8e0d2d573c27a2b3c6a7975df1.tar.bz2 |
make sure wifi link stats are reset
Change-Id: I8687594eccea1e3d8b99450da5230442cdbd1a86
(cherry picked from commit 5fc9e14077c3bec51d0a93a5edeeade396d77d15)
Diffstat (limited to 'wifi/java/android')
-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; } |