summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi Joshi <ravij@codeaurora.org>2014-11-19 12:10:05 -0800
committerRavi Joshi <ravij@codeaurora.org>2014-11-26 11:04:16 -0800
commit737b583ecf7e566ffad3bc77f23b9d45ffa2d909 (patch)
treed10b0782f51aef5f6b716a9f5ae8e3902aaab253
parent70a7f6985c6b12097f3f96fe0274f2c9a04f9e76 (diff)
downloadandroid_frameworks_opt_net_wifi-737b583ecf7e566ffad3bc77f23b9d45ffa2d909.tar.gz
android_frameworks_opt_net_wifi-737b583ecf7e566ffad3bc77f23b9d45ffa2d909.tar.bz2
android_frameworks_opt_net_wifi-737b583ecf7e566ffad3bc77f23b9d45ffa2d909.zip
wifi: Provide fix for no connect status for a network with WPA-PSK followed by WPS
WifiConfigStore maintains the state of each configured Wifi profile. These profiles are maintained to create a one-to-one mapping between the profile and the IP configuration. The same list is also used to display the connected profiles. While creating list of valid network configurations, the profiles with same SSID but different security and authentication credentials are considered duplicate. Thus the profile created due to WPS connection attempt is not added to the list maintained by WifiConfigStore. This results in the framework not displaying the new network as connected, as the supplicant shall give the connect indication on the new network id which shall not get added. Thus, overwrite the previous duplicate-disabled configuration to fix this issue. CRs-Fixed: 760505 Change-Id: Id1dc26733b9b5ead402e3a2ae4aed3313568c727
-rwxr-xr-xservice/java/com/android/server/wifi/WifiConfigStore.java35
1 files changed, 31 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java
index 959c3f8be..76255d46e 100755
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -1410,8 +1410,32 @@ public class WifiConfigStore extends IpConfigStore {
if (mNetworkIds.containsKey(configKey(config))) {
// That SSID is already known, just ignore this duplicate entry
- if (showNetworks) localLog("discarded duplicate network ", config.networkId);
- } else if(config.isValid()){
+ if (showNetworks)
+ localLog("Duplicate network found ", config.networkId);
+
+ Integer n = mNetworkIds.get(configKey(config));
+ WifiConfiguration tempCfg = mConfiguredNetworks.get(n);
+
+ if ( (tempCfg != null &&
+ tempCfg.status != WifiConfiguration.Status.CURRENT) &&
+ config.status == WifiConfiguration.Status.CURRENT) {
+
+ // Clear the existing entry, we don't need it
+ mConfiguredNetworks.remove(tempCfg.networkId);
+ mNetworkIds.remove(configKey(tempCfg));
+
+ // Add current entry to the list
+ mConfiguredNetworks.put(config.networkId, config);
+ mNetworkIds.put(configKey(config), config.networkId);
+
+ // Enable AutoJoin status and indicate the network as
+ // duplicate The duplicateNetwork flag will be used
+ // to decide whether to restore network configurations
+ // in readNetworkHistory() along with IP and proxy settings
+ config.setAutoJoinStatus(WifiConfiguration.AUTO_JOIN_ENABLED);
+ config.duplicateNetwork = true;
+ }
+ } else if (config.isValid()) {
mConfiguredNetworks.put(config.networkId, config);
mNetworkIds.put(configKey(config), config.networkId);
if (showNetworks) localLog("loaded configured network", config.networkId);
@@ -1840,7 +1864,7 @@ public class WifiConfigStore extends IpConfigStore {
rssi = WifiConfiguration.INVALID_RSSI;
caps = null;
- } else if (config != null) {
+ } else if (config != null && config.duplicateNetwork == false) {
if (key.startsWith(SSID_KEY)) {
ssid = key.replace(SSID_KEY, "");
ssid = ssid.replace(SEPARATOR_KEY, "");
@@ -2540,10 +2564,13 @@ public class WifiConfigStore extends IpConfigStore {
int id = networks.keyAt(i);
WifiConfiguration config = mConfiguredNetworks.get(mNetworkIds.get(id));
-
if (config == null || config.autoJoinStatus == WifiConfiguration.AUTO_JOIN_DELETED) {
loge("configuration found for missing network, nid=" + id
+", ignored, networks.size=" + Integer.toString(networks.size()));
+ } else if (config != null && config.duplicateNetwork == true) {
+ if (VDBG)
+ loge("Network configuration is not updated for duplicate network id="
+ + config.networkId + " SSID=" + config.SSID);
} else {
config.setIpConfiguration(networks.valueAt(i));
}