From ad4d342474ae1e54e4667d9f6a054d0c764a1c28 Mon Sep 17 00:00:00 2001 From: xshu Date: Tue, 3 Jul 2018 15:12:43 -0700 Subject: Packet fate: create new event for timeout These timeout messages that were added to solve a corner case for LastMileLogger is causing a regression on the packet fate logs. See the bug on why these timeouts are added in the first place. Specifically, every time 60s after CMD_START_CONNECT, a timeout would fire a CONNECTION_EVENT_FAILED in WifiDiagnostics. End result: "Last failed connection fates" is being updated 60s after start connect to whatever the latest packet fate data is. Instead of CONNECTION_EVENT_FAILED another event should be used since these timeouts always trigger and each connection failure is already explicitly dealt with.(association, authentication, ect.) This patch introduces a new event category: CONNECTION_EVENT_TIMEOUT to separate timeouts from actual connection failures. Bug: 111060673 Test: compile, unit tests Manual test: Flash Enter wrong password for authentication failure Run dumpsys wifi to see the "Last failed connection fates" printout Connect to GoogleGuest successfully Run dumpsys wifi to see both "Last failed connection fates" and "latest fates" printouts and note they are different. Wait 2 minutes to make sure the timeout message is processed Run dumpsys wifi and observe the "Last failed connection fates" log is not over written by the latest packet fates data. Change-Id: I83952eb1fbff7ae0911a9ba1bc377332a568d150 --- .../src/com/android/server/wifi/LastMileLoggerTest.java | 8 ++++---- .../src/com/android/server/wifi/WifiDiagnosticsTest.java | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java b/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java index bb26d01f1..769d67e34 100644 --- a/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/LastMileLoggerTest.java @@ -168,24 +168,24 @@ public class LastMileLoggerTest { } @Test - public void connectionEventFailedDoesNotDisableTracingOnFailureOfStaleConnection() + public void connectionEventTimeoutDoesNotDisableTracingOnFailureOfStaleConnection() throws Exception { mLastMileLogger.reportConnectionEvent( FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED); mLastMileLogger.reportConnectionEvent( FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED); mLastMileLogger.reportConnectionEvent( - FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED); + FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_TIMEOUT); assertEquals("1", IoUtils.readFileAsString(mTraceEnableFile.getPath())); } @Test - public void connectionEventFailedDisablesTracingOnFailureOfFutureConnection() + public void connectionEventTimeoutDisablesTracingOnFailureOfFutureConnection() throws Exception { mLastMileLogger.reportConnectionEvent( FAKE_CONNECTION_ID, BaseWifiDiagnostics.CONNECTION_EVENT_STARTED); mLastMileLogger.reportConnectionEvent( - FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_FAILED); + FAKE_CONNECTION_ID + 1, BaseWifiDiagnostics.CONNECTION_EVENT_TIMEOUT); assertEquals("0", IoUtils.readFileAsString(mTraceEnableFile.getPath())); } diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java index 52cf65e93..7d0f2f196 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java @@ -391,6 +391,22 @@ public class WifiDiagnosticsTest { verify(mWifiNative).getRxPktFates(any(), anyObject()); } + /** + * Verifies that we are not fetching packet fates for a CONNECTION_EVENT_TIMEOUT event + * and propagating it to LastMileLogger instead. + */ + @Test + public void loggerSimplyPropagateEventTimeoutToLastMileLogger() { + final boolean verbosityToggle = true; + mWifiDiagnostics.startLogging(verbosityToggle); + mWifiDiagnostics.reportConnectionEvent( + FAKE_CONNECTION_ID, WifiDiagnostics.CONNECTION_EVENT_TIMEOUT); + verify(mLastMileLogger).reportConnectionEvent( + FAKE_CONNECTION_ID, WifiDiagnostics.CONNECTION_EVENT_TIMEOUT); + verify(mWifiNative, never()).getTxPktFates(any(), anyObject()); + verify(mWifiNative, never()).getRxPktFates(any(), anyObject()); + } + /** Verifies that dump() fetches the latest fates. */ @Test public void dumpFetchesFates() { -- cgit v1.2.3