diff options
author | xshu <xshu@google.com> | 2018-07-10 18:14:03 -0700 |
---|---|---|
committer | xshu <xshu@google.com> | 2018-07-27 14:42:05 -0700 |
commit | f37bc8f53c7294dbed1180865dd6470a559b4f67 (patch) | |
tree | 809983a053a318003389628adf697c4c5f338b8c /service | |
parent | ca80b462be3ddd34c0fa206f9d333c3c533705c0 (diff) |
[LastMileLogger] cleanup obsolete field
connectionId is no longer needed after removing spurious timeouts
Bug: 111060673
Test: compile, unit test
Manual test:
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: I04e7547d87dcf370c6cf2abb1568c2e60adf5178
Diffstat (limited to 'service')
4 files changed, 9 insertions, 28 deletions
diff --git a/service/java/com/android/server/wifi/BaseWifiDiagnostics.java b/service/java/com/android/server/wifi/BaseWifiDiagnostics.java index 22eb2e6d0..f4d8534ca 100644 --- a/service/java/com/android/server/wifi/BaseWifiDiagnostics.java +++ b/service/java/com/android/server/wifi/BaseWifiDiagnostics.java @@ -37,10 +37,9 @@ public class BaseWifiDiagnostics { /** * Inform the diagnostics module of a connection event. - * @param connectionId A strictly increasing, non-negative, connection identifier * @param event The type of connection event (see CONNECTION_EVENT_* constants) */ - public synchronized void reportConnectionEvent(long connectionId, byte event) {} + public synchronized void reportConnectionEvent(byte event) {} public synchronized void captureBugReportData(int reason) { } diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 046c9c893..e1135018f 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -2902,22 +2902,18 @@ public class ClientModeImpl extends StateMachine { @VisibleForTesting public static final long DIAGS_CONNECT_TIMEOUT_MILLIS = 60 * 1000; - private long mDiagsConnectionStartMillis = -1; /** * Inform other components that a new connection attempt is starting. */ private void reportConnectionAttemptStart( WifiConfiguration config, String targetBSSID, int roamType) { mWifiMetrics.startConnectionEvent(config, targetBSSID, roamType); - mDiagsConnectionStartMillis = mClock.getElapsedSinceBootMillis(); - mWifiDiagnostics.reportConnectionEvent( - mDiagsConnectionStartMillis, WifiDiagnostics.CONNECTION_EVENT_STARTED); + mWifiDiagnostics.reportConnectionEvent(WifiDiagnostics.CONNECTION_EVENT_STARTED); mWrongPasswordNotifier.onNewConnectionAttempt(); // TODO(b/35329124): Remove CMD_DIAGS_CONNECT_TIMEOUT, once ClientModeImpl // grows a proper CONNECTING state. removeMessages(CMD_DIAGS_CONNECT_TIMEOUT); - sendMessageDelayed(CMD_DIAGS_CONNECT_TIMEOUT, - mDiagsConnectionStartMillis, DIAGS_CONNECT_TIMEOUT_MILLIS); + sendMessageDelayed(CMD_DIAGS_CONNECT_TIMEOUT, DIAGS_CONNECT_TIMEOUT_MILLIS); } /** @@ -2939,8 +2935,7 @@ public class ClientModeImpl extends StateMachine { // // TODO(b/34181219): Fix the above. removeMessages(CMD_DIAGS_CONNECT_TIMEOUT); - mWifiDiagnostics.reportConnectionEvent( - mDiagsConnectionStartMillis, WifiDiagnostics.CONNECTION_EVENT_SUCCEEDED); + mWifiDiagnostics.reportConnectionEvent(WifiDiagnostics.CONNECTION_EVENT_SUCCEEDED); break; case WifiMetrics.ConnectionEvent.FAILURE_REDUNDANT_CONNECTION_ATTEMPT: case WifiMetrics.ConnectionEvent.FAILURE_CONNECT_NETWORK_FAILED: @@ -2949,10 +2944,8 @@ public class ClientModeImpl extends StateMachine { break; default: removeMessages(CMD_DIAGS_CONNECT_TIMEOUT); - mWifiDiagnostics.reportConnectionEvent( - mDiagsConnectionStartMillis, WifiDiagnostics.CONNECTION_EVENT_FAILED); + mWifiDiagnostics.reportConnectionEvent(WifiDiagnostics.CONNECTION_EVENT_FAILED); } - mDiagsConnectionStartMillis = -1; } private void handleIPv4Success(DhcpResults dhcpResults) { @@ -3592,7 +3585,7 @@ public class ClientModeImpl extends StateMachine { break; case CMD_DIAGS_CONNECT_TIMEOUT: mWifiDiagnostics.reportConnectionEvent( - (Long) message.obj, BaseWifiDiagnostics.CONNECTION_EVENT_TIMEOUT); + BaseWifiDiagnostics.CONNECTION_EVENT_TIMEOUT); break; case CMD_GET_ALL_MATCHING_CONFIGS: replyToMessage(message, message.what, new ArrayList<WifiConfiguration>()); diff --git a/service/java/com/android/server/wifi/LastMileLogger.java b/service/java/com/android/server/wifi/LastMileLogger.java index 12277f412..1269638b3 100644 --- a/service/java/com/android/server/wifi/LastMileLogger.java +++ b/service/java/com/android/server/wifi/LastMileLogger.java @@ -45,31 +45,21 @@ public class LastMileLogger { /** * Informs LastMileLogger that a connection event has occurred. - * @param connectionId A non-negative connection identifier, or -1 to indicate unknown * @param event an event defined in BaseWifiDiagnostics */ - public void reportConnectionEvent(long connectionId, byte event) { - if (connectionId < 0) { - mLog.warn("Ignoring negative connection id: %").c(connectionId).flush(); - return; - } - + public void reportConnectionEvent(byte event) { switch (event) { case BaseWifiDiagnostics.CONNECTION_EVENT_STARTED: - mPendingConnectionId = connectionId; enableTracing(); return; case BaseWifiDiagnostics.CONNECTION_EVENT_SUCCEEDED: - mPendingConnectionId = -1; disableTracing(); return; case BaseWifiDiagnostics.CONNECTION_EVENT_FAILED: - mPendingConnectionId = -1; disableTracing(); mLastMileLogForLastFailure = readTrace(); return; case BaseWifiDiagnostics.CONNECTION_EVENT_TIMEOUT: - mPendingConnectionId = -1; disableTracing(); mLastMileLogForLastFailure = readTrace(); return; @@ -99,7 +89,6 @@ public class LastMileLogger { private WifiLog mLog; private byte[] mLastMileLogForLastFailure; private FileInputStream mLastMileTraceHandle; - private long mPendingConnectionId = -1; private void enableTracing() { if (!ensureFailSafeIsArmed()) { diff --git a/service/java/com/android/server/wifi/WifiDiagnostics.java b/service/java/com/android/server/wifi/WifiDiagnostics.java index 224c7140e..37b02ed79 100644 --- a/service/java/com/android/server/wifi/WifiDiagnostics.java +++ b/service/java/com/android/server/wifi/WifiDiagnostics.java @@ -203,8 +203,8 @@ class WifiDiagnostics extends BaseWifiDiagnostics { } @Override - public synchronized void reportConnectionEvent(long connectionId, byte event) { - mLastMileLogger.reportConnectionEvent(connectionId, event); + public synchronized void reportConnectionEvent(byte event) { + mLastMileLogger.reportConnectionEvent(event); if (event == CONNECTION_EVENT_FAILED || event == CONNECTION_EVENT_TIMEOUT) { mPacketFatesForLastFailure = fetchPacketFates(); } |