diff options
Diffstat (limited to 'wifi/java')
| -rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 85b81d9..e73cce1 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -417,6 +417,12 @@ public class WifiConfiguration implements Parcelable { public int autoJoinStatus; /** + * Set if the configuration was self added by the framework + * @hide + */ + public boolean selfAdded; + + /** * @hide * Indicate that a WifiConfiguration is temporary and should not be saved * nor considered by AutoJoin. @@ -498,6 +504,8 @@ public class WifiConfiguration implements Parcelable { proxySettings = ProxySettings.UNASSIGNED; linkProperties = new LinkProperties(); autoJoinStatus = AUTO_JOIN_ENABLED; + selfAdded = false; + ephemeral = false; } /** @@ -794,8 +802,28 @@ public class WifiConfiguration implements Parcelable { return configKey(false); } + /** @hide + * return the config key string based on a scan result + */ + static public String configKey(ScanResult result) { + String key = "\"" + result.SSID + "\""; + + if (result.capabilities.contains("WEP")) { + key = key + "-WEP"; + } - /** Implement the Parcelable interface {@hide} */ + if (result.capabilities.contains("PSK")) { + key = key + "-" + KeyMgmt.strings[KeyMgmt.WPA_PSK]; + } + + if (result.capabilities.contains("EAP")) { + key = key + "-" + KeyMgmt.strings[KeyMgmt.WPA_EAP]; + } + + return key; + } + + /** Implement the Parcelable interface {@hide} */ public int describeContents() { return 0; } @@ -849,6 +877,7 @@ public class WifiConfiguration implements Parcelable { } mCachedConfigKey = null; //force null configKey autoJoinStatus = source.autoJoinStatus; + selfAdded = source.selfAdded; if (source.visibility != null) { visibility = new Visibility(source.visibility); @@ -886,6 +915,7 @@ public class WifiConfiguration implements Parcelable { dest.writeString(dhcpServer); dest.writeString(defaultGwMacAddress); dest.writeInt(autoJoinStatus); + dest.writeInt(selfAdded ? 1 : 0); } /** Implement the Parcelable interface {@hide} */ @@ -920,7 +950,7 @@ public class WifiConfiguration implements Parcelable { config.dhcpServer = in.readString(); config.defaultGwMacAddress = in.readString(); config.autoJoinStatus = in.readInt(); - + config.selfAdded = in.readInt() != 0; return config; } |
