diff options
author | Paul Stewart <pstew@google.com> | 2016-11-02 14:48:01 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2016-12-02 15:56:17 -0800 |
commit | f229afcd54fc31eaf0f66cfb9e548cfc49d689e1 (patch) | |
tree | deeddcf9d2a7ee8723bdba1d3c79394880da6b59 | |
parent | d335557ef8c724395a39c8fdda26653c90dcc1c5 (diff) |
Upgrade WPA/EAP connections to their fast-transition equivalent
The developer-visible API and settings should not have to know
whether an AP supports BSS fast transitions, but from a system
point of view it is beneficial (and in some cases necessary)
to take advantage of it where it is possible. From a config
point of view there is no additional information required
except to enable the authentication type. This allows us to
handle the feature addition at the lowest layer possible,
assuming that the underlying hardware supports (and is
validated) the fast transition feature.
This implementation will be replaced with one in wificond
once pushing configuration to wpa_supplicant is moved there.
Bug: 32607043
Change-Id: I89a1e0bea3bba3ec8506fc9b239bea8b51c3d45c
Test: Manual: Create an FT-only AP and attempt connections
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 4 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiSupplicantControl.java | 36 |
2 files changed, 38 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index a6ad779cd..7a8ce9141 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -877,6 +877,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss mWifiConfigManager = mWifiInjector.getWifiConfigManager(); mWifiSupplicantControl = mWifiInjector.getWifiSupplicantControl(); + mWifiSupplicantControl.setSystemSupportsFastBssTransition( + mContext.getResources().getBoolean(R.bool.config_wifi_fast_bss_transition_enabled)); mPasspointManager = mWifiInjector.getPasspointManager(); @@ -2099,6 +2101,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss pw.println("mUserWantsSuspendOpt " + mUserWantsSuspendOpt); pw.println("mSuspendOptNeedsDisabled " + mSuspendOptNeedsDisabled); pw.println("Supplicant status " + mWifiNative.status(true)); + pw.println("mSystemSupportsFastBssTransition " + + mWifiSupplicantControl.getSystemSupportsFastBssTransition()); if (mCountryCode.getCountryCodeSentToDriver() != null) { pw.println("CountryCode sent to driver " + mCountryCode.getCountryCodeSentToDriver()); } else { diff --git a/service/java/com/android/server/wifi/WifiSupplicantControl.java b/service/java/com/android/server/wifi/WifiSupplicantControl.java index 0109e402b..6507beda2 100644 --- a/service/java/com/android/server/wifi/WifiSupplicantControl.java +++ b/service/java/com/android/server/wifi/WifiSupplicantControl.java @@ -41,7 +41,6 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.BitSet; import java.util.HashMap; @@ -79,6 +78,9 @@ public class WifiSupplicantControl { private boolean mVerboseLoggingEnabled = false; + // Indicates whether the system is capable of 802.11r fast BSS transition. + private boolean mSystemSupportsFastBssTransition = false; + WifiSupplicantControl(TelephonyManager telephonyManager, WifiNative wifiNative, LocalLog localLog) { mTelephonyManager = telephonyManager; @@ -409,6 +411,21 @@ public class WifiSupplicantControl { return true; } + private BitSet addFastTransitionFlags(BitSet keyManagementFlags) { + if (!mSystemSupportsFastBssTransition) { + return keyManagementFlags; + } + + BitSet modifiedFlags = keyManagementFlags; + if (keyManagementFlags.get(WifiConfiguration.KeyMgmt.WPA_PSK)) { + modifiedFlags.set(WifiConfiguration.KeyMgmt.FT_PSK); + } + if (keyManagementFlags.get(WifiConfiguration.KeyMgmt.WPA_EAP)) { + modifiedFlags.set(WifiConfiguration.KeyMgmt.FT_EAP); + } + return modifiedFlags; + } + /** * Save an entire network configuration to wpa_supplicant. * @@ -438,8 +455,9 @@ public class WifiSupplicantControl { return false; } } + BitSet allowedKeyManagement = addFastTransitionFlags(config.allowedKeyManagement); String allowedKeyManagementString = - makeString(config.allowedKeyManagement, WifiConfiguration.KeyMgmt.strings); + makeString(allowedKeyManagement, WifiConfiguration.KeyMgmt.strings); if (config.allowedKeyManagement.cardinality() != 0 && !mWifiNative.setNetworkVariable( netId, WifiConfiguration.KeyMgmt.varName, @@ -892,6 +910,20 @@ public class WifiSupplicantControl { mVerboseLoggingEnabled = verbose; } + /** + * Get Fast BSS Transition capability. + */ + public boolean getSystemSupportsFastBssTransition() { + return mSystemSupportsFastBssTransition; + } + + /** + * Set Fast BSS Transition capability. + */ + public void setSystemSupportsFastBssTransition(boolean supported) { + mSystemSupportsFastBssTransition = supported; + } + private class SupplicantSaver implements WifiEnterpriseConfig.SupplicantSaver { private final int mNetId; private final String mSetterSSID; |