summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMingguang Xu <mingguangxu@google.com>2019-04-19 12:37:19 -0700
committerMingguang Xu <mingguangxu@google.com>2019-04-22 08:40:38 -0700
commit094ab86334602dd5402f371b0b7e71746df7a476 (patch)
treedb913ebce50c2096d363e75b6e71bf28aa8348b8 /tests
parentedea5f52d7ceb19117d8c5ff2a28d1b0657fdae3 (diff)
Wifi usability: Check screen status before adding bad Wifi usability
stats Message of IP_reachability_lost and wifi_firmware_alert may occur while screen goes off and the Wifi usability stats triggered by them are not useful. Add a check to filter out them. Bug: 129282057 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I8a9f809879ba46732dbf034785a28da0df287de4 Signed-off-by: Mingguang Xu <mingguangxu@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 303f5b36e..d3b6b2ff8 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -3941,4 +3941,32 @@ public class WifiMetricsTest {
}
}
}
+
+ /**
+ * Verify that the LABEL_BAD Wifi usability stats are not saved if screen state is off.
+ * @throws Exception
+ */
+ @Test
+ public void verifyLabelBadStatsAreNotSavedIfScreenIsOff() throws Exception {
+ mWifiMetrics.setScreenState(false);
+ WifiInfo info = mock(WifiInfo.class);
+ when(info.getRssi()).thenReturn(nextRandInt());
+ when(info.getLinkSpeed()).thenReturn(nextRandInt());
+ WifiLinkLayerStats stats1 = nextRandomStats(new WifiLinkLayerStats());
+ mWifiMetrics.updateWifiUsabilityStatsEntries(info, stats1);
+
+ // Add 1 LABEL_GOOD
+ WifiLinkLayerStats statsGood = addGoodWifiUsabilityStats(nextRandomStats(stats1));
+ // IP reachability lost occurs
+ mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
+ WifiUsabilityStats.TYPE_IP_REACHABILITY_LOST, -1);
+ // Wifi data stall occurs
+ mWifiMetrics.addToWifiUsabilityStatsList(WifiUsabilityStats.LABEL_BAD,
+ WifiIsUnusableEvent.TYPE_DATA_STALL_BAD_TX, -1);
+ // Firmware alert occurs
+ mWifiMetrics.logFirmwareAlert(2);
+
+ dumpProtoAndDeserialize();
+ assertEquals(0, mDecodedProto.wifiUsabilityStatsList.length);
+ }
}