summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index be6ac6473..4b5866b44 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -428,7 +428,12 @@ public class WifiNetworkFactory extends NetworkFactory {
new NetworkFactoryUserSelectionCallback(mActiveSpecificNetworkRequest));
} catch (RemoteException e) {
Log.e(TAG, "Unable to invoke user selection registration callback " + callback, e);
+ return;
}
+
+ // If we are already in the midst of processing a request, send matching callbacks
+ // immediately on registering the callback.
+ sendNetworkRequestMatchCallbacksForActiveRequest(mActiveMatchedScanResults);
}
/**
@@ -981,6 +986,7 @@ public class WifiNetworkFactory extends NetworkFactory {
mConnectedSpecificNetworkRequestSpecifier = mActiveSpecificNetworkRequestSpecifier;
mActiveSpecificNetworkRequest = null;
mActiveSpecificNetworkRequestSpecifier = null;
+ mActiveMatchedScanResults = null;
mPendingConnectionSuccess = false;
// Cancel connection timeout alarm.
cancelConnectionTimeout();
@@ -1127,7 +1133,8 @@ public class WifiNetworkFactory extends NetworkFactory {
}
private void sendNetworkRequestMatchCallbacksForActiveRequest(
- List<ScanResult> matchedScanResults) {
+ @Nullable List<ScanResult> matchedScanResults) {
+ if (matchedScanResults == null || matchedScanResults.isEmpty()) return;
if (mRegisteredCallbacks.getNumCallbacks() == 0) {
Log.e(TAG, "No callback registered for sending network request matches. "
+ "Ignoring...");