summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/WifiConfigStore.java
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-03-21 13:01:59 -0700
committerRoshan Pius <rpius@google.com>2016-03-22 09:12:25 -0700
commit08c939fa7f1fcd666a3076b6921864b4bf70308f (patch)
tree5e416518006ff13479c1516c77a983f821b65b12 /service/java/com/android/server/wifi/WifiConfigStore.java
parent1b662dbe559e74179ddcb86a02baa74a0a85b3ce (diff)
downloadandroid_frameworks_opt_net_wifi-08c939fa7f1fcd666a3076b6921864b4bf70308f.tar.gz
android_frameworks_opt_net_wifi-08c939fa7f1fcd666a3076b6921864b4bf70308f.tar.bz2
android_frameworks_opt_net_wifi-08c939fa7f1fcd666a3076b6921864b4bf70308f.zip
WifiConfigManager: Update network metadata
The configkey saved for new networks may change after we save the network. This is because some of the default values are not specified when saving the network to supplicant, but these values are filled when reading the config back from supplicant. The configKey which depends on the |authAlgorithms| field needs to be updated after all of these default values are read. BUG: 27756946 TEST: Compiles & unit-test passes TEST: Manually executed the failing test in the above bug and verified that it passes now. Change-Id: Ia568a2804f69697a8342e666d2ec3b269dbc9922
Diffstat (limited to 'service/java/com/android/server/wifi/WifiConfigStore.java')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigStore.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index 431ca2ca8..02bade0a7 100644
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -648,6 +648,25 @@ public class WifiConfigStore {
}
/**
+ * Update the network metadata info stored in wpa_supplicant network extra field.
+ * @param config Config corresponding to the network.
+ * @return true if successful, false otherwise.
+ */
+ public boolean saveNetworkMetadata(WifiConfiguration config) {
+ final Map<String, String> metadata = new HashMap<String, String>();
+ if (config.isPasspoint()) {
+ metadata.put(ID_STRING_KEY_FQDN, config.FQDN);
+ }
+ metadata.put(ID_STRING_KEY_CONFIG_KEY, config.configKey());
+ metadata.put(ID_STRING_KEY_CREATOR_UID, Integer.toString(config.creatorUid));
+ if (!mWifiNative.setNetworkExtra(config.networkId, ID_STRING_VAR_NAME, metadata)) {
+ loge("failed to set id_str: " + metadata.toString());
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Save an entire network configuration to wpa_supplicant.
*
* @param config Config corresponding to the network.
@@ -666,14 +685,7 @@ public class WifiConfigStore {
loge("failed to set SSID: " + config.SSID);
return false;
}
- final Map<String, String> metadata = new HashMap<String, String>();
- if (config.isPasspoint()) {
- metadata.put(ID_STRING_KEY_FQDN, config.FQDN);
- }
- metadata.put(ID_STRING_KEY_CONFIG_KEY, config.configKey());
- metadata.put(ID_STRING_KEY_CREATOR_UID, Integer.toString(config.creatorUid));
- if (!mWifiNative.setNetworkExtra(netId, ID_STRING_VAR_NAME, metadata)) {
- loge("failed to set id_str: " + metadata.toString());
+ if (!saveNetworkMetadata(config)) {
return false;
}
//set selected BSSID to supplicant