From a442338fbb51bc797ab03eca48d3b0bc0c454e2e Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Fri, 29 May 2020 15:47:43 -0700 Subject: ClientModeImpl: Ignore connect when connecting to network Use internal variables to check whether we're connected or connecting to the network requested in WifiManager.connect(). If there is a credential change, we will forcefully retrigger a new connection request. Bug: 157696785 Test: atest com.android.server.wifi Change-Id: I514b5b3a1ed5205fde98bc6fd2b59285e10913ef Merged-In: I514b5b3a1ed5205fde98bc6fd2b59285e10913ef --- service/java/com/android/server/wifi/ClientModeImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 0f84b3dd9..7769455e8 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -368,7 +368,7 @@ public class ClientModeImpl extends StateMachine { private String mTargetBssid = SUPPLICANT_BSSID_ANY; // This one is used to track the current target network ID. This is used for error // handling during connection setup since many error message from supplicant does not report - // SSID Once connected, it will be set to invalid + // SSID. Once connected, it will be set to invalid private int mTargetNetworkId = WifiConfiguration.INVALID_NETWORK_ID; private long mLastDriverRoamAttempt = 0; private WifiConfiguration mTargetWifiConfiguration = null; @@ -1211,8 +1211,8 @@ public class ClientModeImpl extends StateMachine { private void connectToUserSelectNetwork(int netId, int uid, boolean forceReconnect) { logd("connectToUserSelectNetwork netId " + netId + ", uid " + uid + ", forceReconnect = " + forceReconnect); - if (!forceReconnect && mWifiInfo.getNetworkId() == netId) { - // We're already connected to the user specified network, don't trigger a + if (!forceReconnect && (mLastNetworkId == netId || mTargetNetworkId == netId)) { + // We're already connecting/connected to the user specified network, don't trigger a // reconnection unless it was forced. logi("connectToUserSelectNetwork already connecting/connected=" + netId); } else { -- cgit v1.2.3