summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOscar Shu <xshu@google.com>2019-05-28 19:33:52 +0000
committerOscar Shu <xshu@google.com>2019-05-29 17:38:10 +0000
commitd3e3342fb016e6f92202322abc9040eb29e96883 (patch)
tree416816926cc24772a9d26bcc9e010bf75a8602d9
parentc6cb88c37c22daeeac819726cc91b6c452791a46 (diff)
downloadandroid_frameworks_opt_net_wifi-d3e3342fb016e6f92202322abc9040eb29e96883.tar.gz
android_frameworks_opt_net_wifi-d3e3342fb016e6f92202322abc9040eb29e96883.tar.bz2
android_frameworks_opt_net_wifi-d3e3342fb016e6f92202322abc9040eb29e96883.zip
Revert "Trigger bugreport for abnormally long connections"
This reverts commit c6cb88c37c22daeeac819726cc91b6c452791a46. Reason for revert: This change will likely cause a flood of bugreports from beta users. The plan is remove this from Beta5, so reverting now and will submit this CL again after Beta5 snap to only run the experiment on droidfood daily users. Bug: 132648941 Test: Unit tests Change-Id: Ie4a7319c7d4bf6216612d8528c4d78ac4e7b677e
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java3
-rw-r--r--service/java/com/android/server/wifi/WifiLastResortWatchdog.java48
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java39
3 files changed, 0 insertions, 90 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 008135051..4adf27ff0 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -955,8 +955,6 @@ public class ClientModeImpl extends StateMachine {
mWifiMetrics.getHandler());
mWifiMonitor.registerHandler(mInterfaceName, CMD_TARGET_BSSID,
mWifiMetrics.getHandler());
- mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.NETWORK_CONNECTION_EVENT,
- mWifiInjector.getWifiLastResortWatchdog().getHandler());
}
private void setMulticastFilter(boolean enabled) {
@@ -4276,7 +4274,6 @@ public class ClientModeImpl extends StateMachine {
mWifiInfo.setMacAddress(currentMacAddress);
Log.i(TAG, "Connecting with " + currentMacAddress + " as the mac address");
if (mWifiNative.connectToNetwork(mInterfaceName, config)) {
- mWifiInjector.getWifiLastResortWatchdog().noteStartConnectTime();
mWifiMetrics.logStaEvent(StaEvent.TYPE_CMD_START_CONNECT, config);
mLastConnectAttemptTimestamp = mClock.getWallClockMillis();
mTargetWifiConfiguration = config;
diff --git a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
index 286e4ba47..6889b5016 100644
--- a/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
+++ b/service/java/com/android/server/wifi/WifiLastResortWatchdog.java
@@ -20,7 +20,6 @@ import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.os.Handler;
import android.os.Looper;
-import android.os.Message;
import android.text.TextUtils;
import android.util.LocalLog;
import android.util.Log;
@@ -75,8 +74,6 @@ public class WifiLastResortWatchdog {
// Number of milliseconds to wait before re-enable Watchdog triger
@VisibleForTesting
public static final long LAST_TRIGGER_TIMEOUT_MILLIS = 2 * 3600 * 1000; // 2 hours
- @VisibleForTesting
- public static final int ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS = 1000 * 30; // 30 seconds
/**
* Cached WifiConfigurations of available networks seen within MAX_BSSID_AGE scan results
@@ -108,8 +105,6 @@ public class WifiLastResortWatchdog {
// If any connection failure happened after watchdog triggering restart then assume watchdog
// did not fix the problem
private boolean mWatchdogFixedWifi = true;
- private long mLastStartConnectTime = 0;
- private Handler mHandler;
/**
* Local log used for debugging any WifiLastResortWatchdog issues.
@@ -123,49 +118,6 @@ public class WifiLastResortWatchdog {
mWifiMetrics = wifiMetrics;
mClientModeImpl = clientModeImpl;
mClientModeImplLooper = clientModeImplLooper;
- mHandler = new Handler(clientModeImplLooper) {
- public void handleMessage(Message msg) {
- processMessage(msg);
- }
- };
- }
-
- /**
- * Returns handler for L2 events from supplicant.
- * @return Handler
- */
- public Handler getHandler() {
- return mHandler;
- }
-
- /**
- * Refreshes when the last CMD_START_CONNECT is triggered.
- */
- public void noteStartConnectTime() {
- mLastStartConnectTime = mClock.getElapsedSinceBootMillis();
- }
-
- private void processMessage(Message msg) {
- switch (msg.what) {
- case WifiMonitor.NETWORK_CONNECTION_EVENT:
- // Trigger bugreport for successful connections that take abnormally long
- if (mLastStartConnectTime > 0) {
- long durationMs = mClock.getElapsedSinceBootMillis() - mLastStartConnectTime;
- if (durationMs > ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS) {
- final String bugTitle = "Wi-Fi Bugreport: Abnormal connection time";
- final String bugDetail = "Expected connection to take less than "
- + ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS + " milliseconds. "
- + "Actually took " + durationMs + " milliseconds.";
- mWifiInjector.getClientModeImplHandler().post(() -> {
- mClientModeImpl.takeBugReport(bugTitle, bugDetail);
- });
- }
- mLastStartConnectTime = 0;
- }
- break;
- default:
- return;
- }
}
/**
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
index dab283539..9ae382640 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java
@@ -24,7 +24,6 @@ import static org.mockito.MockitoAnnotations.*;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiSsid;
-import android.os.Handler;
import android.os.test.TestLooper;
import android.util.Pair;
@@ -73,7 +72,6 @@ public class WifiLastResortWatchdogTest {
mLastResortWatchdog.setBugReportProbability(1);
when(mClientModeImpl.getWifiInfo()).thenReturn(mWifiInfo);
when(mWifiInfo.getSSID()).thenReturn(TEST_NETWORK_SSID);
- when(mWifiInjector.getClientModeImplHandler()).thenReturn(mLastResortWatchdog.getHandler());
}
private List<Pair<ScanDetail, WifiConfiguration>> createFilteredQnsCandidates(String[] ssids,
@@ -2154,41 +2152,4 @@ public class WifiLastResortWatchdogTest {
verify(mWifiMetrics, times(1)).incrementNumLastResortWatchdogSuccesses();
}
- /**
- * Verifies that when a connection takes too long (time difference between
- * StaEvent.TYPE_CMD_START_CONNECT and StaEvent.TYPE_NETWORK_CONNECTION_EVENT) a bugreport is
- * taken.
- */
- @Test
- public void testAbnormalConnectionTimeTriggersBugreport() throws Exception {
- // first verifies that bugreports are not taken when connection takes less than
- // WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS
- when(mClock.getElapsedSinceBootMillis()).thenReturn(1L);
- mLastResortWatchdog.noteStartConnectTime();
- when(mClock.getElapsedSinceBootMillis()).thenReturn(
- (long) WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS);
- Handler handler = mLastResortWatchdog.getHandler();
- handler.sendMessage(
- handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null));
- mLooper.dispatchAll();
- verify(mClientModeImpl, never()).takeBugReport(anyString(), anyString());
-
- // Now verify that bugreport is taken
- mLastResortWatchdog.noteStartConnectTime();
- when(mClock.getElapsedSinceBootMillis()).thenReturn(
- (long) 2 * WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS + 1);
- handler.sendMessage(
- handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null));
- mLooper.dispatchAll();
- verify(mClientModeImpl).takeBugReport(anyString(), anyString());
-
- // Verify additional connections (without more TYPE_CMD_START_CONNECT) don't trigger more
- // bugreports.
- when(mClock.getElapsedSinceBootMillis()).thenReturn(
- (long) 4 * WifiLastResortWatchdog.ABNORMAL_SUCCESSFUL_CONNECTION_DURATION_MS);
- handler.sendMessage(
- handler.obtainMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, null));
- mLooper.dispatchAll();
- verify(mClientModeImpl).takeBugReport(anyString(), anyString());
- }
}