summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRandy Pan <zpan@google.com>2016-06-21 13:40:52 -0700
committerRandy Pan <zpan@google.com>2016-06-21 13:40:52 -0700
commitde5fadf2e5c7bb769705c830efb04133b1e0219d (patch)
tree2308c38cff77ab341df3312d6063556709c2208e /service
parent4301f4786e565d9555e5cbf81ef1055f81975385 (diff)
WCM: reset connectivity scan retry counter
Move the scan retry count reset to where scan results are received. This is to deal with the case that WifiScanner reports success when a scan request is queued but later fails to be executed. Add a unit test case to verify the retry behavior. Bug: 29523369 Change-Id: Ibcd7c771a8efa78612a84021a4511db621f4451e Tests: Wifi Framework Unit Tests & manual tests
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConnectivityManager.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index 3d5bae73d..25f41aacb 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -90,7 +90,8 @@ public class WifiConnectivityManager {
private static final int LOW_RSSI_NETWORK_RETRY_START_DELAY_MS = 20 * 1000; // 20 seconds
private static final int LOW_RSSI_NETWORK_RETRY_MAX_DELAY_MS = 80 * 1000; // 80 seconds
// Maximum number of retries when starting a scan failed
- private static final int MAX_SCAN_RESTART_ALLOWED = 5;
+ @VisibleForTesting
+ public static final int MAX_SCAN_RESTART_ALLOWED = 5;
// Number of milli-seconds to delay before retry starting
// a previously failed scan
private static final int RESTART_SCAN_DELAY_MS = 2 * 1000; // 2 seconds
@@ -246,9 +247,6 @@ public class WifiConnectivityManager {
@Override
public void onSuccess() {
localLog("PeriodicScanListener onSuccess");
-
- // reset the count
- mScanRestartCount = 0;
}
@Override
@@ -277,6 +275,7 @@ public class WifiConnectivityManager {
public void onResults(WifiScanner.ScanData[] results) {
handleScanResults(mScanDetails, "PeriodicScanListener");
clearScanDetails();
+ mScanRestartCount = 0;
}
@Override
@@ -313,9 +312,6 @@ public class WifiConnectivityManager {
@Override
public void onSuccess() {
localLog("SingleScanListener onSuccess");
-
- // reset the count
- mSingleScanRestartCount = 0;
}
@Override
@@ -344,6 +340,8 @@ public class WifiConnectivityManager {
public void onResults(WifiScanner.ScanData[] results) {
boolean wasConnectAttempted = handleScanResults(mScanDetails, "SingleScanListener");
clearScanDetails();
+ mSingleScanRestartCount = 0;
+
// update metrics if this was a watchdog triggered single scan
if (mIsWatchdogTriggered) {
if (wasConnectAttempted) {
@@ -402,9 +400,6 @@ public class WifiConnectivityManager {
@Override
public void onSuccess() {
localLog("PnoScanListener onSuccess");
-
- // reset the count
- mScanRestartCount = 0;
}
@Override
@@ -451,6 +446,7 @@ public class WifiConnectivityManager {
boolean wasConnectAttempted;
wasConnectAttempted = handleScanResults(mScanDetails, "PnoScanListener");
clearScanDetails();
+ mScanRestartCount = 0;
if (!wasConnectAttempted) {
// The scan results were rejected by QNS due to low RSSI values