diff options
-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; |