summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2020-01-10 20:53:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-01-10 20:53:58 +0000
commit7ea1fd432465d40a7a5d32a817d655a9d118d4d0 (patch)
treef8316dfb9e2e895a57ddcd7812bd9ea85e70c119
parent78d2895d1a4a3eb6c75ca694d288b0d55d3fbbdb (diff)
parent229a8457010009e748408d85773479edae01da9c (diff)
Merge "Metrics: number of IP renewal failures"
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java4
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java11
-rw-r--r--service/proto/src/metrics.proto3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java15
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java5
5 files changed, 38 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 3d6d1b09b..5bf1cc050 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -5159,6 +5159,10 @@ public class ClientModeImpl extends StateMachine {
break;
}
break;
+ case CMD_IP_CONFIGURATION_LOST:
+ mWifiMetrics.incrementIpRenewalFailure();
+ handleStatus = NOT_HANDLED;
+ break;
default:
handleStatus = NOT_HANDLED;
break;
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index c0b47f593..7dd920598 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -2853,6 +2853,8 @@ public class WifiMetrics {
pw.println("mWifiLogProto.rxLinkSpeedCount5gLow=" + mRxLinkSpeedCount5gLow);
pw.println("mWifiLogProto.rxLinkSpeedCount5gMid=" + mRxLinkSpeedCount5gMid);
pw.println("mWifiLogProto.rxLinkSpeedCount5gHigh=" + mRxLinkSpeedCount5gHigh);
+ pw.println("mWifiLogProto.numIpRenewalFailure="
+ + mWifiLogProto.numIpRenewalFailure);
}
}
}
@@ -5111,6 +5113,15 @@ public class WifiMetrics {
}
/**
+ * Increment number of IP renewal failures.
+ */
+ public void incrementIpRenewalFailure() {
+ synchronized (mLock) {
+ mWifiLogProto.numIpRenewalFailure++;
+ }
+ }
+
+ /**
* Sets the duration for evaluating Wifi condition to trigger a data stall
*/
public void setDataStallDurationMs(int duration) {
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index aa0b38e22..60dd432c4 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -573,6 +573,9 @@ message WifiLog {
// Histogram of Rx link speed at 5G high band
repeated Int32Count rx_link_speed_count_5g_high = 156;
+
+ // Count of IP renewal failures.
+ optional int32 num_ip_renewal_failure = 157;
}
// Information that gets logged for every WiFi connection.
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
index f8d99a95d..8690b9e7f 100644
--- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java
@@ -1552,6 +1552,8 @@ public class ClientModeImplTest extends WifiBaseTest {
mLooper.dispatchAll();
assertEquals("DisconnectingState", getCurrentState().getName());
+ // Verify this is not counted as a IP renewal failure
+ verify(mWifiMetrics, never()).incrementIpRenewalFailure();
// Verifies that WifiLastResortWatchdog be notified
// by DHCP failure
verify(mWifiLastResortWatchdog, times(2)).noteConnectionFailureAndTriggerIfNeeded(
@@ -1565,6 +1567,19 @@ public class ClientModeImplTest extends WifiBaseTest {
}
/**
+ * Verify that a IP renewal failure is logged when IP provisioning fail in the
+ * ConnectedState.
+ */
+ @Test
+ public void testDhcpRenewalMetrics() throws Exception {
+ connect();
+ injectDhcpFailure();
+ mLooper.dispatchAll();
+
+ verify(mWifiMetrics).incrementIpRenewalFailure();
+ }
+
+ /**
* Verify that the network selection status will be updated with DISABLED_AUTHENTICATION_FAILURE
* when wrong password authentication failure is detected and the network had been
* connected previously.
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index d63ace814..497e1f59a 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -410,6 +410,7 @@ public class WifiMetricsTest extends WifiBaseTest {
private static final int NUM_ONESHOT_SCAN_REQUESTS_WITH_DFS_CHANNELS = 4;
private static final int NUM_ADD_OR_UPDATE_NETWORK_CALLS = 5;
private static final int NUM_ENABLE_NETWORK_CALLS = 6;
+ private static final long NUM_IP_RENEWAL_FAILURE = 7;
/** Number of notifications per "Connect to Network" notification type. */
private static final int[] NUM_CONNECT_TO_NETWORK_NOTIFICATIONS = {0, 10, 20, 30, 40};
@@ -869,6 +870,9 @@ public class WifiMetricsTest extends WifiBaseTest {
for (int i = 0; i < NUM_ENABLE_NETWORK_CALLS; i++) {
mWifiMetrics.incrementNumEnableNetworkCalls();
}
+ for (int i = 0; i < NUM_IP_RENEWAL_FAILURE; i++) {
+ mWifiMetrics.incrementIpRenewalFailure();
+ }
mWifiMetrics.setWatchdogSuccessTimeDurationMs(NUM_WATCHDOG_SUCCESS_DURATION_MS);
mResources.setBoolean(R.bool.config_wifi_connected_mac_randomization_supported,
@@ -1208,6 +1212,7 @@ public class WifiMetricsTest extends WifiBaseTest {
mDecodedProto.numOneshotHasDfsChannelScans);
assertEquals(NUM_ADD_OR_UPDATE_NETWORK_CALLS, mDecodedProto.numAddOrUpdateNetworkCalls);
assertEquals(NUM_ENABLE_NETWORK_CALLS, mDecodedProto.numEnableNetworkCalls);
+ assertEquals(NUM_IP_RENEWAL_FAILURE, mDecodedProto.numIpRenewalFailure);
}
/**