summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2016-04-21 15:24:02 -0700
committerRebecca Silberstein <silberst@google.com>2016-04-27 18:57:52 +0000
commit5f001750a0ce82a8b3a47ac566117d4de27f3e23 (patch)
tree440d138531964ef9491a0331fa2f5b38dd7eae6d
parent83f2b8087178705445e4d1618eaac832f9c633f4 (diff)
downloadandroid_frameworks_opt_net_wifi-5f001750a0ce82a8b3a47ac566117d4de27f3e23.tar.gz
android_frameworks_opt_net_wifi-5f001750a0ce82a8b3a47ac566117d4de27f3e23.tar.bz2
android_frameworks_opt_net_wifi-5f001750a0ce82a8b3a47ac566117d4de27f3e23.zip
WifiLastResortWatchdog metrics
Added logging of various metrics to the WifiLastResortWatchdog. These metrics count the number of times the Watchdog triggers, and stats counting the number of networks present at failure time for different failure types. BUG=27856474 Change-Id: If43836b1c33791fefb8000196b231c312161feef
-rw-r--r--service/java/com/android/server/wifi/WifiInjector.java3
-rw-r--r--service/java/com/android/server/wifi/WifiLastResortWatchdog.java34
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java101
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java101
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java56
5 files changed, 274 insertions, 21 deletions
diff --git a/service/java/com/android/server/wifi/WifiInjector.java b/service/java/com/android/server/wifi/WifiInjector.java
index c8f2fa896..cf65668d5 100644
--- a/service/java/com/android/server/wifi/WifiInjector.java
+++ b/service/java/com/android/server/wifi/WifiInjector.java
@@ -31,7 +31,8 @@ public class WifiInjector {
}
private final WifiMetrics mWifiMetrics = new WifiMetrics();
- private final WifiLastResortWatchdog mWifiLastResortWatchdog = new WifiLastResortWatchdog();
+ private final WifiLastResortWatchdog mWifiLastResortWatchdog =
+ new WifiLastResortWatchdog(mWifiMetrics);
private final Clock mClock = new Clock();
public WifiMetrics getWifiMetrics() {
diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
index adb8771ea..a953404c5 100644
--- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
+++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
@@ -78,6 +78,12 @@ public class WifiLastResortWatchdog {
// successfully connecting or a new network (SSID) becomes available to connect to.
private boolean mWatchdogAllowedToTrigger = true;
+ private WifiMetrics mWifiMetrics;
+
+ WifiLastResortWatchdog(WifiMetrics wifiMetrics) {
+ mWifiMetrics = wifiMetrics;
+ }
+
/**
* Refreshes recentAvailableNetworks with the latest available networks
* Adds new networks, removes old ones that have timed out. Should be called after Wifi
@@ -325,11 +331,35 @@ public class WifiLastResortWatchdog {
}
/**
- * Update WifiMetrics with various Watchdog stats (trigger counts, tracked network count)
+ * Update WifiMetrics with various Watchdog stats (trigger counts, failed network counts)
*/
private void incrementWifiMetricsTriggerCounts() {
if (VDBG) Log.v(TAG, "incrementWifiMetricsTriggerCounts.");
- // <TODO>
+ mWifiMetrics.incrementNumLastResortWatchdogTriggers();
+ mWifiMetrics.addCountToNumLastResortWatchdogAvailableNetworksTotal(
+ mSsidFailureCount.size());
+ // Number of networks over each failure type threshold, present at trigger time
+ int badAuth = 0;
+ int badAssoc = 0;
+ int badDhcp = 0;
+ for (Map.Entry<String, Pair<AvailableNetworkFailureCount, Integer>> entry
+ : mSsidFailureCount.entrySet()) {
+ badAuth += (entry.getValue().first.authenticationFailure >= FAILURE_THRESHOLD) ? 1 : 0;
+ badAssoc += (entry.getValue().first.associationRejection >= FAILURE_THRESHOLD) ? 1 : 0;
+ badDhcp += (entry.getValue().first.dhcpFailure >= FAILURE_THRESHOLD) ? 1 : 0;
+ }
+ if (badAuth > 0) {
+ mWifiMetrics.addCountToNumLastResortWatchdogBadAuthenticationNetworksTotal(badAuth);
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAuthentication();
+ }
+ if (badAssoc > 0) {
+ mWifiMetrics.addCountToNumLastResortWatchdogBadAssociationNetworksTotal(badAssoc);
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAssociation();
+ }
+ if (badDhcp > 0) {
+ mWifiMetrics.addCountToNumLastResortWatchdogBadDhcpNetworksTotal(badDhcp);
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadDhcp();
+ }
}
/**
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index ccc58ec96..f3ab02c24 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -671,6 +671,87 @@ public class WifiMetrics {
}
/**
+ * Increment number of times the Watchdog of Last Resort triggered, resetting the wifi stack
+ */
+ public void incrementNumLastResortWatchdogTriggers() {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogTriggers++;
+ }
+ }
+ /**
+ * @param count number of networks over bad association threshold when watchdog triggered
+ */
+ public void addCountToNumLastResortWatchdogBadAssociationNetworksTotal(int count) {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogBadAssociationNetworksTotal += count;
+ }
+ }
+ /**
+ * @param count number of networks over bad authentication threshold when watchdog triggered
+ */
+ public void addCountToNumLastResortWatchdogBadAuthenticationNetworksTotal(int count) {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogBadAuthenticationNetworksTotal += count;
+ }
+ }
+ /**
+ * @param count number of networks over bad dhcp threshold when watchdog triggered
+ */
+ public void addCountToNumLastResortWatchdogBadDhcpNetworksTotal(int count) {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogBadDhcpNetworksTotal += count;
+ }
+ }
+ /**
+ * @param count number of networks over bad other threshold when watchdog triggered
+ */
+ public void addCountToNumLastResortWatchdogBadOtherNetworksTotal(int count) {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogBadOtherNetworksTotal += count;
+ }
+ }
+ /**
+ * @param count number of networks seen when watchdog triggered
+ */
+ public void addCountToNumLastResortWatchdogAvailableNetworksTotal(int count) {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogAvailableNetworksTotal += count;
+ }
+ }
+ /**
+ * Increment count of triggers with atleast one bad association network
+ */
+ public void incrementNumLastResortWatchdogTriggersWithBadAssociation() {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogTriggersWithBadAssociation++;
+ }
+ }
+ /**
+ * Increment count of triggers with atleast one bad authentication network
+ */
+ public void incrementNumLastResortWatchdogTriggersWithBadAuthentication() {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogTriggersWithBadAuthentication++;
+ }
+ }
+ /**
+ * Increment count of triggers with atleast one bad dhcp network
+ */
+ public void incrementNumLastResortWatchdogTriggersWithBadDhcp() {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogTriggersWithBadDhcp++;
+ }
+ }
+ /**
+ * Increment count of triggers with atleast one bad other network
+ */
+ public void incrementNumLastResortWatchdogTriggersWithBadOther() {
+ synchronized (mLock) {
+ mWifiLogProto.numLastResortWatchdogTriggersWithBadOther++;
+ }
+ }
+
+ /**
* Increment number of times connectivity watchdog confirmed pno is working
*/
public void incrementNumConnectivityWatchdogPnoGood() {
@@ -798,6 +879,26 @@ public class WifiMetrics {
+ mWifiLogProto.numConnectivityWatchdogBackgroundGood);
pw.println("mWifiLogProto.numConnectivityWatchdogBackgroundBad="
+ mWifiLogProto.numConnectivityWatchdogBackgroundBad);
+ pw.println("mWifiLogProto.numLastResortWatchdogTriggers="
+ + mWifiLogProto.numLastResortWatchdogTriggers);
+ pw.println("mWifiLogProto.numLastResortWatchdogBadAssociationNetworksTotal="
+ + mWifiLogProto.numLastResortWatchdogBadAssociationNetworksTotal);
+ pw.println("mWifiLogProto.numLastResortWatchdogBadAuthenticationNetworksTotal="
+ + mWifiLogProto.numLastResortWatchdogBadAuthenticationNetworksTotal);
+ pw.println("mWifiLogProto.numLastResortWatchdogBadDhcpNetworksTotal="
+ + mWifiLogProto.numLastResortWatchdogBadDhcpNetworksTotal);
+ pw.println("mWifiLogProto.numLastResortWatchdogBadOtherNetworksTotal="
+ + mWifiLogProto.numLastResortWatchdogBadOtherNetworksTotal);
+ pw.println("mWifiLogProto.numLastResortWatchdogAvailableNetworksTotal="
+ + mWifiLogProto.numLastResortWatchdogAvailableNetworksTotal);
+ pw.println("mWifiLogProto.numLastResortWatchdogTriggersWithBadAssociation="
+ + mWifiLogProto.numLastResortWatchdogTriggersWithBadAssociation);
+ pw.println("mWifiLogProto.numLastResortWatchdogTriggersWithBadAuthentication="
+ + mWifiLogProto.numLastResortWatchdogTriggersWithBadAuthentication);
+ pw.println("mWifiLogProto.numLastResortWatchdogTriggersWithBadDhcp="
+ + mWifiLogProto.numLastResortWatchdogTriggersWithBadDhcp);
+ pw.println("mWifiLogProto.numLastResortWatchdogTriggersWithBadOther="
+ + mWifiLogProto.numLastResortWatchdogTriggersWithBadOther);
}
}
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
index b9ba0d01d..dabe11971 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
@@ -17,8 +17,7 @@
package com.android.server.wifi;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.*;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiSsid;
@@ -38,7 +37,7 @@ import java.util.List;
@SmallTest
public class WifiLastResortWatchdogTest {
WifiLastResortWatchdog mLastResortWatchdog;
-
+ WifiMetrics mWifiMetrics;
private String[] mSsids = {"\"test1\"", "\"test2\"", "\"test3\"", "\"test4\""};
private String[] mBssids = {"6c:f3:7f:ae:8c:f3", "6c:f3:7f:ae:8c:f4", "de:ad:ba:b1:e5:55",
"c0:ff:ee:ee:e3:ee"};
@@ -51,7 +50,8 @@ public class WifiLastResortWatchdogTest {
@Before
public void setUp() throws Exception {
- mLastResortWatchdog = new WifiLastResortWatchdog();
+ mWifiMetrics = mock(WifiMetrics.class);
+ mLastResortWatchdog = new WifiLastResortWatchdog(mWifiMetrics);
}
private List<Pair<ScanDetail, WifiConfiguration>> createFilteredQnsCandidates(String[] ssids,
@@ -988,11 +988,11 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {true, true, true, true};
+ boolean[] hasEverConnected = {true, true, true, true};
// Buffer potential candidates 1,2,3 & 4
List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids,
- mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, mHasEverConnected);
+ mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
// Increment failure count for 3 networks and failure types, asserting each time that it
@@ -1043,11 +1043,11 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {true, true, true, true};
+ boolean[] hasEverConnected = {true, true, true, true};
// Buffer potential candidates 1,2,3 & 4
List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids,
- mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, mHasEverConnected);
+ mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
// Bring 3 of the 4 networks over failure Threshold without triggering watchdog
@@ -1106,11 +1106,11 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {false, true, false, false};
+ boolean[] hasEverConnected = {false, true, false, false};
// Buffer potential candidates 1,2,3 & 4
List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids,
- mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, mHasEverConnected);
+ mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
// Bring 3 of the 4 networks over failure Threshold without triggering watchdog
@@ -1288,11 +1288,11 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {false, true, false, false};
+ boolean[] hasEverConnected = {false, true, false, false};
// Buffer potential candidates 1,2,3 & 4
List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids,
- mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, mHasEverConnected);
+ mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
incrementFailuresUntilTrigger(mSsids, mBssids);
@@ -1317,11 +1317,11 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {false, true, false, false};
+ boolean[] hasEverConnected = {false, true, false, false};
boolean watchdogTriggered;
// Buffer potential candidates 1,2,3 & 4
List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(mSsids,
- mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, mHasEverConnected);
+ mBssids, mFrequencies, mCaps, mLevels, mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
incrementFailuresUntilTrigger(mSsids, mBssids);
@@ -1374,7 +1374,7 @@ public class WifiLastResortWatchdogTest {
int associationRejections = WifiLastResortWatchdog.FAILURE_THRESHOLD;
int authenticationFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 2;
int dhcpFailures = WifiLastResortWatchdog.FAILURE_THRESHOLD + 3;
- boolean[] mHasEverConnected = {false, true, false, false};
+ boolean[] hasEverConnected = {false, true, false, false};
boolean watchdogTriggered;
// Buffer potential candidates 1,2,3
@@ -1384,7 +1384,8 @@ public class WifiLastResortWatchdogTest {
Arrays.copyOfRange(mFrequencies, 0, 3),
Arrays.copyOfRange(mCaps, 0, 3),
Arrays.copyOfRange(mLevels, 0, 3),
- Arrays.copyOfRange(mIsEphemeral, 0, 3));
+ Arrays.copyOfRange(mIsEphemeral, 0, 3),
+ Arrays.copyOfRange(hasEverConnected, 0, 3));
mLastResortWatchdog.updateAvailableNetworks(candidates);
incrementFailuresUntilTrigger(Arrays.copyOfRange(mSsids, 0, 3),
@@ -1399,10 +1400,76 @@ public class WifiLastResortWatchdogTest {
}
candidates = createFilteredQnsCandidates(mSsids, mBssids, mFrequencies, mCaps, mLevels,
- mIsEphemeral, mHasEverConnected);
+ mIsEphemeral, hasEverConnected);
mLastResortWatchdog.updateAvailableNetworks(candidates);
incrementFailuresUntilTrigger(mSsids, mBssids);
}
+
+ /**
+ * Case 26: Test Metrics collection
+ * Setup 5 networks (unique SSIDs). Fail them until watchdog triggers, with 1 network failing
+ * association, 1 failing authentication, 2 failing dhcp and one failing both authentication and
+ * dhcp, (over threshold for all these failures)
+ * Expected behavior: Metrics are updated as follows
+ * Triggers++
+ * # of Networks += 5
+ * Triggers with Bad association++
+ * Triggers with Bad authentication++
+ * Triggers with Bad dhcp++
+ * Number of networks with bad association += 1
+ * Number of networks with bad authentication += 2
+ * Number of networks with bad dhcp += 3
+ */
+ @Test
+ public void testMetricsCollection() {
+ String[] ssids = {"\"test1\"", "\"test2\"", "\"test3\"", "\"test4\"", "\"test5\""};
+ String[] bssids = {"6c:f3:7f:ae:8c:f3", "6c:f3:7f:ae:8c:f4", "de:ad:ba:b1:e5:55",
+ "c0:ff:ee:ee:e3:ee", "6c:f3:7f:ae:3c:f3"};
+ int[] frequencies = {2437, 5180, 5180, 2437, 2437};
+ String[] caps = {"[WPA2-EAP-CCMP][ESS]", "[WPA2-EAP-CCMP][ESS]",
+ "[WPA2-EAP-CCMP][ESS]", "[WPA2-EAP-CCMP][ESS]", "[WPA2-EAP-CCMP][ESS]"};
+ int[] levels = {-60, -86, -50, -62, -60};
+ boolean[] isEphemeral = {false, false, false, false, false};
+ boolean[] hasEverConnected = {true, false, false, false, false};
+ // Buffer potential candidates 1,2,3 & 4
+ List<Pair<ScanDetail, WifiConfiguration>> candidates = createFilteredQnsCandidates(ssids,
+ bssids, frequencies, caps, levels, isEphemeral, hasEverConnected);
+ mLastResortWatchdog.updateAvailableNetworks(candidates);
+
+ // Ensure new networks have zero'ed failure counts
+ for (int i = 0; i < ssids.length; i++) {
+ assertFailureCountEquals(bssids[i], 0, 0, 0);
+ }
+
+ //Increment failure count for the first test network ssid & bssid
+ for (int i = 0; i < WifiLastResortWatchdog.FAILURE_THRESHOLD; i++) {
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[1], bssids[1], WifiLastResortWatchdog.FAILURE_CODE_AUTHENTICATION);
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[2], bssids[2], WifiLastResortWatchdog.FAILURE_CODE_DHCP);
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[3], bssids[3], WifiLastResortWatchdog.FAILURE_CODE_DHCP);
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[4], bssids[4], WifiLastResortWatchdog.FAILURE_CODE_DHCP);
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[4], bssids[4], WifiLastResortWatchdog.FAILURE_CODE_AUTHENTICATION);
+ mLastResortWatchdog.noteConnectionFailureAndTriggerIfNeeded(
+ ssids[0], bssids[0], WifiLastResortWatchdog.FAILURE_CODE_ASSOCIATION);
+ }
+
+ // Verify relevant WifiMetrics calls were made once with appropriate arguments
+ verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggers();
+ verify(mWifiMetrics, times(1)).addCountToNumLastResortWatchdogAvailableNetworksTotal(5);
+ verify(mWifiMetrics, times(1))
+ .addCountToNumLastResortWatchdogBadAuthenticationNetworksTotal(2);
+ verify(mWifiMetrics, times(1))
+ .incrementNumLastResortWatchdogTriggersWithBadAuthentication();
+ verify(mWifiMetrics, times(1))
+ .addCountToNumLastResortWatchdogBadAssociationNetworksTotal(1);
+ verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggersWithBadAssociation();
+ verify(mWifiMetrics, times(1)).addCountToNumLastResortWatchdogBadDhcpNetworksTotal(3);
+ verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogTriggersWithBadDhcp();
+ }
}
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index ad5ba83ca..8db4a8c39 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -145,7 +145,16 @@ public class WifiMetricsTest {
private static final int NUM_CONNECTIVITY_WATCHDOG_PNO_BAD = 12;
private static final int NUM_CONNECTIVITY_WATCHDOG_BACKGROUND_GOOD = 13;
private static final int NUM_CONNECTIVITY_WATCHDOG_BACKGROUND_BAD = 14;
-
+ private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS = 1;
+ private static final int NUM_LAST_RESORT_WATCHDOG_BAD_ASSOCIATION_NETWORKS_TOTAL = 2;
+ private static final int NUM_LAST_RESORT_WATCHDOG_BAD_AUTHENTICATION_NETWORKS_TOTAL = 3;
+ private static final int NUM_LAST_RESORT_WATCHDOG_BAD_DHCP_NETWORKS_TOTAL = 4;
+ private static final int NUM_LAST_RESORT_WATCHDOG_BAD_OTHER_NETWORKS_TOTAL = 5;
+ private static final int NUM_LAST_RESORT_WATCHDOG_AVAILABLE_NETWORKS_TOTAL = 6;
+ private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_ASSOCIATION = 7;
+ private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_AUTHENTICATION = 8;
+ private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_DHCP = 9;
+ private static final int NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_OTHER = 10;
/**
* Set simple metrics, increment others
*/
@@ -203,6 +212,31 @@ public class WifiMetricsTest {
for (int i = 0; i < NUM_CONNECTIVITY_WATCHDOG_BACKGROUND_BAD; i++) {
mWifiMetrics.incrementNumConnectivityWatchdogBackgroundBad();
}
+ for (int i = 0; i < NUM_LAST_RESORT_WATCHDOG_TRIGGERS; i++) {
+ mWifiMetrics.incrementNumLastResortWatchdogTriggers();
+ }
+ mWifiMetrics.addCountToNumLastResortWatchdogBadAssociationNetworksTotal(
+ NUM_LAST_RESORT_WATCHDOG_BAD_ASSOCIATION_NETWORKS_TOTAL);
+ mWifiMetrics.addCountToNumLastResortWatchdogBadAuthenticationNetworksTotal(
+ NUM_LAST_RESORT_WATCHDOG_BAD_AUTHENTICATION_NETWORKS_TOTAL);
+ mWifiMetrics.addCountToNumLastResortWatchdogBadDhcpNetworksTotal(
+ NUM_LAST_RESORT_WATCHDOG_BAD_DHCP_NETWORKS_TOTAL);
+ mWifiMetrics.addCountToNumLastResortWatchdogBadOtherNetworksTotal(
+ NUM_LAST_RESORT_WATCHDOG_BAD_OTHER_NETWORKS_TOTAL);
+ mWifiMetrics.addCountToNumLastResortWatchdogAvailableNetworksTotal(
+ NUM_LAST_RESORT_WATCHDOG_AVAILABLE_NETWORKS_TOTAL);
+ for (int i = 0; i < NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_ASSOCIATION; i++) {
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAssociation();
+ }
+ for (int i = 0; i < NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_AUTHENTICATION; i++) {
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadAuthentication();
+ }
+ for (int i = 0; i < NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_DHCP; i++) {
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadDhcp();
+ }
+ for (int i = 0; i < NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_OTHER; i++) {
+ mWifiMetrics.incrementNumLastResortWatchdogTriggersWithBadOther();
+ }
}
/**
@@ -258,6 +292,26 @@ public class WifiMetricsTest {
NUM_CONNECTIVITY_WATCHDOG_BACKGROUND_GOOD);
assertEquals(mDeserializedWifiMetrics.numConnectivityWatchdogBackgroundBad,
NUM_CONNECTIVITY_WATCHDOG_BACKGROUND_BAD);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_TRIGGERS,
+ mDeserializedWifiMetrics.numLastResortWatchdogTriggers);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_BAD_ASSOCIATION_NETWORKS_TOTAL,
+ mDeserializedWifiMetrics.numLastResortWatchdogBadAssociationNetworksTotal);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_BAD_AUTHENTICATION_NETWORKS_TOTAL,
+ mDeserializedWifiMetrics.numLastResortWatchdogBadAuthenticationNetworksTotal);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_BAD_DHCP_NETWORKS_TOTAL,
+ mDeserializedWifiMetrics.numLastResortWatchdogBadDhcpNetworksTotal);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_BAD_OTHER_NETWORKS_TOTAL,
+ mDeserializedWifiMetrics.numLastResortWatchdogBadOtherNetworksTotal);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_AVAILABLE_NETWORKS_TOTAL,
+ mDeserializedWifiMetrics.numLastResortWatchdogAvailableNetworksTotal);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_ASSOCIATION,
+ mDeserializedWifiMetrics.numLastResortWatchdogTriggersWithBadAssociation);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_AUTHENTICATION,
+ mDeserializedWifiMetrics.numLastResortWatchdogTriggersWithBadAuthentication);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_DHCP,
+ mDeserializedWifiMetrics.numLastResortWatchdogTriggersWithBadDhcp);
+ assertEquals(NUM_LAST_RESORT_WATCHDOG_TRIGGERS_WITH_BAD_OTHER,
+ mDeserializedWifiMetrics.numLastResortWatchdogTriggersWithBadOther);
}
/**