diff options
author | Mingguang Xu <mingguangxu@google.com> | 2019-10-22 17:00:11 -0700 |
---|---|---|
committer | Mingguang Xu <mingguangxu@google.com> | 2019-10-24 17:34:33 +0000 |
commit | 0180596a8409d60ff2c216c94c1deaaa7e7930a0 (patch) | |
tree | 8336b10a58f25593dc1ddbb8f7916d1cc22aa8fd | |
parent | fcf90c3ee9492cd3da770785c3ca58d1da2a6b2c (diff) |
Wifi usability: Clear the ring buffer after adding each usability stats to the upload list.
The LABEL_GOOD and LABEL_BAD data may be mixed if the ring buffer is not cleared after each addition of usability stats the upload list. Currently we rely on data post processing to sort them out. The load on data post processing can be reduced if the ring buffer is cleared.
Bug: 143219266
Test: atest WifiMetricsTest
Change-Id: I24bef0f7d3ce47696e9d84eb5e516c5ee2b7df50
Signed-off-by: Mingguang Xu <mingguangxu@google.com>
(cherry picked from commit 12bcb71c4267d7c380c02594571f4eff99613836)
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 1 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 1b7e8cdb3..27fe140a7 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -4624,6 +4624,7 @@ public class WifiMetrics { } } mWifiUsabilityStatsCounter = 0; + mWifiUsabilityStatsEntriesList.clear(); } } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 7e086d4ce..73ac30f41 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -2999,9 +2999,10 @@ public class WifiMetricsTest { dumpProtoAndDeserialize(); assertEquals(2 * WifiMetrics.MAX_WIFI_USABILITY_STATS_PER_TYPE_TO_UPLOAD, mDecodedProto.wifiUsabilityStatsList.length); - for (int i = 0; i < mDecodedProto.wifiUsabilityStatsList.length; i++) { + for (int i = 0; i < WifiMetrics.MAX_WIFI_USABILITY_STATS_PER_TYPE_TO_UPLOAD; i++) { assertEquals(WifiMetrics.MAX_WIFI_USABILITY_STATS_ENTRIES_LIST_SIZE, - mDecodedProto.wifiUsabilityStatsList[i].stats.length); + mDecodedProto.wifiUsabilityStatsList[2 * i].stats.length); + assertEquals(2, mDecodedProto.wifiUsabilityStatsList[2 * i + 1].stats.length); } } |