diff options
author | vandwalle <vandwalle@google.com> | 2014-10-13 16:07:48 -0700 |
---|---|---|
committer | vandwalle <vandwalle@google.com> | 2014-10-13 16:07:53 -0700 |
commit | 85f2d77b1b858c063471951f3a5f93c96bd5e72b (patch) | |
tree | 410c0ce30757992352132b5b03be01bf6f0a73a0 | |
parent | a5283c01ac413e378e2261050cac3a6d6e9cf385 (diff) | |
download | wifi-85f2d77b1b858c063471951f3a5f93c96bd5e72b.tar.gz |
In case of driver roaming and auth failure, allow for fast reconnect
Bug:17747008
Change-Id: I87eefc5a0952dd5f7159385aa180c02a38d92432
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index aadfc6740..3e803b2b6 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -310,6 +310,8 @@ public class WifiStateMachine extends StateMachine { // The BSSID we are associated to is found in mWifiInfo private String mTargetRoamBSSID = "any"; + private long mLastDriverRoamAttempt = 0; + private WifiConfiguration targetWificonfiguration = null; // Used as debug to indicate which configuration last was saved @@ -7235,6 +7237,8 @@ public class WifiStateMachine extends StateMachine { // Reenable all networks, allow for hidden networks to be scanned mWifiConfigStore.enableAllNetworks(); + + mLastDriverRoamAttempt = 0; } @Override public boolean processMessage(Message message) { @@ -7265,14 +7269,26 @@ public class WifiStateMachine extends StateMachine { mWifiNative.disconnect(); } break; + case CMD_ASSOCIATED_BSSID: + // ASSOCIATING to a new BSSID while already connected, indicates + // that driver is roaming + mLastDriverRoamAttempt = System.currentTimeMillis(); + return NOT_HANDLED; case WifiMonitor.NETWORK_DISCONNECTION_EVENT: + long lastRoam = 0; + if (mLastDriverRoamAttempt != 0) { + // Calculate time since last driver roam attempt + lastRoam = System.currentTimeMillis() - mLastDriverRoamAttempt; + mLastDriverRoamAttempt = 0; + } config = getCurrentWifiConfiguration(); if (mScreenOn && !linkDebouncing && config != null && config.autoJoinStatus == WifiConfiguration.AUTO_JOIN_ENABLED && !mWifiConfigStore.isLastSelectedConfiguration(config) - && message.arg2 != 3 /* reason cannot be 3, i.e. locally generated */ + && (message.arg2 != 3 /* reason cannot be 3, i.e. locally generated */ + || (lastRoam > 0 && lastRoam < 2000) /* unless driver is roaming */) && ((ScanResult.is24GHz(mWifiInfo.getFrequency()) && mWifiInfo.getRssi() > WifiConfiguration.BAD_RSSI_24) @@ -7314,6 +7330,9 @@ public class WifiStateMachine extends StateMachine { } break; case CMD_AUTO_ROAM: + // Clear the driver roam indication since we are attempting a framerwork roam + mLastDriverRoamAttempt = 0; + /* Connect command coming from auto-join */ ScanResult candidate = (ScanResult)message.obj; String bssid = "any"; @@ -7385,6 +7404,7 @@ public class WifiStateMachine extends StateMachine { public void exit() { loge("WifiStateMachine: Leaving Connected state"); setScanAlarm(false, 0); + mLastDriverRoamAttempt = 0; } } |