diff options
author | 2024-11-20 19:51:06 -0800 | |
---|---|---|
committer | 2024-11-25 09:26:10 -0800 | |
commit | 05c364cfe06909fd94cd28532b0047a25f7adcb0 (patch) | |
tree | 63e0cd5e3f125a4b45c7c8be5b7539e93fcf3065 | |
parent | b58c958687b464a1468c5c2a52e95afa5752fdb8 (diff) |
Logs IP unreachable events
Adds these events to the capture buffer.
Flag: EXEMPT does not affect functionality.
Bug: 369386989
Test: New tests added.
Change-Id: Iab3f5a9226f89ca7213d68a969787db0135aa6e6
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 5 | ||||
-rw-r--r-- | service/proto/src/metrics.proto | 8 | ||||
-rw-r--r-- | service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 33 |
3 files changed, 45 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 0e26ebc1b1..dd7fca9428 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -6624,6 +6624,8 @@ public class ClientModeImpl extends StateMachine implements ClientMode { WifiDiagnostics.REPORT_REASON_REACHABILITY_LOST); mWifiMetrics.logWifiIsUnusableEvent(mInterfaceName, WifiIsUnusableEvent.TYPE_IP_REACHABILITY_LOST); + mWifiMetrics.logAsynchronousEvent(mInterfaceName, + WifiUsabilityStatsEntry.CAPTURE_EVENT_TYPE_IP_REACHABILITY_LOST, -1); if (mWifiGlobals.getIpReachabilityDisconnectEnabled()) { handleIpReachabilityLost(-1); } else { @@ -6635,6 +6637,9 @@ public class ClientModeImpl extends StateMachine implements ClientMode { if (!isFromCurrentIpClientCallbacks(message)) break; mWifiDiagnostics.triggerBugReportDataCapture( WifiDiagnostics.REPORT_REASON_REACHABILITY_FAILURE); + mWifiMetrics.logAsynchronousEvent(mInterfaceName, + WifiUsabilityStatsEntry.CAPTURE_EVENT_TYPE_IP_REACHABILITY_FAILURE, + ((ReachabilityLossInfoParcelable) message.obj).reason); handleIpReachabilityFailure((ReachabilityLossInfoParcelable) message.obj); break; } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index 21be8a4144..6c76136036 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -2591,8 +2591,14 @@ message WifiUsabilityStatsEntry { // RSSI polling turned off CAPTURE_EVENT_TYPE_RSSI_POLLING_DISABLED = 3; - // Data sample came from CMD_ONESHOT_RSSI_POLL. + // Data sample came from CMD_ONESHOT_RSSI_POLL CAPTURE_EVENT_TYPE_ONESHOT_RSSI_POLL = 4; + + // IP reachability lost + CAPTURE_EVENT_TYPE_IP_REACHABILITY_LOST = 5; + + // IP reachability failure + CAPTURE_EVENT_TYPE_IP_REACHABILITY_FAILURE = 6; } // Absolute milliseconds from device boot when these stats were sampled diff --git a/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 45f084ecb7..8244607539 100644 --- a/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/service/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -4180,6 +4180,39 @@ public class ClientModeImplTest extends WifiBaseTest { } /** + * Verify that IP reachability problems are recorded in the capture buffer. + */ + @Test + public void testCaptureBufferReachabilityLost() throws Exception { + // Log should indicate RSSI polling turned on. + connect(); + verify(mWifiMetrics).logAsynchronousEvent( + eq(WIFI_IFACE_NAME), + eq(WifiUsabilityStatsEntry.CAPTURE_EVENT_TYPE_RSSI_POLLING_ENABLED)); + reset(mWifiMetrics); + + // Simulate an IP_REACHABILITY_LOST event. + mIpClientCallback.onReachabilityLost("CMD_IP_REACHABILITY_LOST"); + mLooper.dispatchAll(); + verify(mWifiMetrics).logAsynchronousEvent( + eq(WIFI_IFACE_NAME), + eq(WifiUsabilityStatsEntry.CAPTURE_EVENT_TYPE_IP_REACHABILITY_LOST), + eq(-1)); + reset(mWifiMetrics); + + // Simulate an IP_REACHABILITY_FAILURE event. + ReachabilityLossInfoParcelable lossInfo = + new ReachabilityLossInfoParcelable("", ReachabilityLossReason.CONFIRM); + mIpClientCallback.onReachabilityFailure(lossInfo); + mLooper.dispatchAll(); + verify(mWifiMetrics).logAsynchronousEvent( + eq(WIFI_IFACE_NAME), + eq(WifiUsabilityStatsEntry.CAPTURE_EVENT_TYPE_IP_REACHABILITY_FAILURE), + eq(ReachabilityLossReason.CONFIRM)); + reset(mWifiMetrics); + } + + /** * Verify link bandwidth update in connected mode */ @Test |