summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2016-12-02 20:14:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-12-02 20:14:12 +0000
commitc05b60f706ef4cbee6d12c01224afe07fad725be (patch)
tree3c62098f70dce51c5a3730f824db97f1c9198904 /service
parenteb77c40b3d17153fe91ca1691aaf2ad16f3f7267 (diff)
parent1200cb27c41ffaa5ff7df61b1758f28be19b01d3 (diff)
Merge "DO NOT MERGE: Upgrade WPA/EAP connections to their fast-transition equivalent" into nyc-mr2-dev
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java8
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStore.java29
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java1
3 files changed, 31 insertions, 7 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 0cc0c9fca..407773ce9 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -243,6 +243,9 @@ public class WifiConfigManager {
public AtomicInteger mCurrentNetworkBoost = new AtomicInteger();
public AtomicInteger mBandAward5Ghz = new AtomicInteger();
+ // Indicates whether the system is capable of 802.11r fast BSS transition.
+ private boolean mSystemSupportsFastBssTransition = false;
+
/**
* Framework keeps a list of ephemeral SSIDs that where deleted by user,
* so as, framework knows not to autojoin again those SSIDs based on scorer input.
@@ -378,6 +381,8 @@ public class WifiConfigManager {
R.integer.config_wifi_framework_current_network_boost));
mNetworkSwitchingBlackListPeriodMs = mContext.getResources().getInteger(
R.integer.config_wifi_network_switching_blacklist_time);
+ mSystemSupportsFastBssTransition = mContext.getResources().getBoolean(
+ R.bool.config_wifi_fast_bss_transition_enabled);
boolean hs2on = mContext.getResources().getBoolean(R.bool.config_wifi_hotspot2_enabled);
Log.d(Utils.hs2LogTag(getClass()), "Passpoint is " + (hs2on ? "enabled" : "disabled"));
@@ -1960,7 +1965,8 @@ public class WifiConfigManager {
// HasEverConnected to be set to false.
WifiConfiguration originalConfig = new WifiConfiguration(currentConfig);
- if (!mWifiConfigStore.addOrUpdateNetwork(config, currentConfig)) {
+ if (!mWifiConfigStore.addOrUpdateNetwork(config, currentConfig,
+ mSystemSupportsFastBssTransition)) {
return new NetworkUpdateResult(INVALID_NETWORK_ID);
}
int netId = config.networkId;
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index b693e2344..cfed460cb 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -601,14 +601,27 @@ public class WifiConfigStore {
return true;
}
+ private BitSet addFastTransitionFlags(BitSet 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.
*
* @param config Config corresponding to the network.
- * @param netId Net Id of the network.
+ * @param netId Net Id of the network.
+ * @param addFastTransitionFlags Add the BSS fast transition(80211r) flags to the network.
* @return true if successful, false otherwise.
*/
- private boolean saveNetwork(WifiConfiguration config, int netId) {
+ private boolean saveNetwork(WifiConfiguration config, int netId,
+ boolean addFastTransitionFlags) {
if (config == null) {
return false;
}
@@ -631,6 +644,10 @@ public class WifiConfigStore {
return false;
}
}
+ BitSet allowedKeyManagement = config.allowedKeyManagement;
+ if (addFastTransitionFlags) {
+ allowedKeyManagement = addFastTransitionFlags(config.allowedKeyManagement);
+ }
String allowedKeyManagementString =
makeString(config.allowedKeyManagement, WifiConfiguration.KeyMgmt.strings);
if (config.allowedKeyManagement.cardinality() != 0 && !mWifiNative.setNetworkVariable(
@@ -788,11 +805,13 @@ public class WifiConfigStore {
/**
* Add or update a network configuration to wpa_supplicant.
*
- * @param config Config corresponding to the network.
+ * @param config Config corresponding to the network.
* @param existingConfig Existing config corresponding to the network saved in our database.
+ * @param addFastTransitionFlags Add the BSS fast transition(80211r) flags to the network.
* @return true if successful, false otherwise.
*/
- public boolean addOrUpdateNetwork(WifiConfiguration config, WifiConfiguration existingConfig) {
+ public boolean addOrUpdateNetwork(WifiConfiguration config, WifiConfiguration existingConfig,
+ boolean addFastTransitionFlags) {
if (config == null) {
return false;
}
@@ -816,7 +835,7 @@ public class WifiConfigStore {
// Save the new network ID to the config
config.networkId = netId;
}
- if (!saveNetwork(config, netId)) {
+ if (!saveNetwork(config, netId, addFastTransitionFlags)) {
if (newNetwork) {
mWifiNative.removeNetwork(netId);
loge("Failed to set a network variable, removed network: " + netId);
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 9d8a66f2d..0c7e987ee 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1026,7 +1026,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
mP2pSupported = mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_WIFI_DIRECT);
-
mWifiConfigManager = mFacade.makeWifiConfigManager(context, mWifiNative, facade,
mWifiInjector.getClock(), userManager, mWifiInjector.getKeyStore());