summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java22
-rw-r--r--service/java/com/android/server/wifi/WificondControl.java15
2 files changed, 29 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index cc0d277a4..abe692346 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -678,16 +678,19 @@ public class WifiNative {
/**
* Add the provided network configuration to wpa_supplicant and initiate connection to it.
* This method does the following:
- * 1. Remove any existing network in wpa_supplicant(This implicitly triggers disconnect).
- * 2. Add a new network to wpa_supplicant.
- * 3. Save the provided configuration to wpa_supplicant.
- * 4. Select the new network in wpa_supplicant.
- * 5. Triggers reconnect command to wpa_supplicant.
+ * 1. Abort any ongoing scan to unblock the connection request.
+ * 2. Remove any existing network in wpa_supplicant(This implicitly triggers disconnect).
+ * 3. Add a new network to wpa_supplicant.
+ * 4. Save the provided configuration to wpa_supplicant.
+ * 5. Select the new network in wpa_supplicant.
+ * 6. Triggers reconnect command to wpa_supplicant.
*
* @param configuration WifiConfiguration parameters for the provided network.
* @return {@code true} if it succeeds, {@code false} otherwise
*/
public boolean connectToNetwork(WifiConfiguration configuration) {
+ // Abort ongoing scan before connect() to unblock connection request.
+ mWificondControl.abortScan();
return mSupplicantStaIfaceHal.connectToNetwork(configuration);
}
@@ -695,15 +698,18 @@ public class WifiNative {
* Initiates roaming to the already configured network in wpa_supplicant. If the network
* configuration provided does not match the already configured network, then this triggers
* a new connection attempt (instead of roam).
- * 1. First check if we're attempting to connect to the same network as we currently have
+ * 1. Abort any ongoing scan to unblock the roam request.
+ * 2. First check if we're attempting to connect to the same network as we currently have
* configured.
- * 2. Set the new bssid for the network in wpa_supplicant.
- * 3. Triggers reassociate command to wpa_supplicant.
+ * 3. Set the new bssid for the network in wpa_supplicant.
+ * 4. Triggers reassociate command to wpa_supplicant.
*
* @param configuration WifiConfiguration parameters for the provided network.
* @return {@code true} if it succeeds, {@code false} otherwise
*/
public boolean roamToNetwork(WifiConfiguration configuration) {
+ // Abort ongoing scan before connect() to unblock roaming request.
+ mWificondControl.abortScan();
return mSupplicantStaIfaceHal.roamToNetwork(configuration);
}
diff --git a/service/java/com/android/server/wifi/WificondControl.java b/service/java/com/android/server/wifi/WificondControl.java
index fdd0faffe..a877c092d 100644
--- a/service/java/com/android/server/wifi/WificondControl.java
+++ b/service/java/com/android/server/wifi/WificondControl.java
@@ -465,4 +465,19 @@ public class WificondControl {
return false;
}
+ /**
+ * Abort ongoing single scan.
+ */
+ public void abortScan() {
+ if (mWificondScanner == null) {
+ Log.e(TAG, "No valid wificond scanner interface handler");
+ return;
+ }
+ try {
+ mWificondScanner.abortScan();
+ } catch (RemoteException e1) {
+ Log.e(TAG, "Failed to request abortScan due to remote exception");
+ }
+ }
+
}