diff options
author | Vinit Deshpande <vinitd@google.com> | 2015-04-07 22:12:40 +0000 |
---|---|---|
committer | Android Partner Code Review <android-gerrit-partner@google.com> | 2015-04-07 22:12:40 +0000 |
commit | 0326f585e15e56fb49c19ebb77e5a0fc8a7c4a62 (patch) | |
tree | 04368f2d3a4adb8f669c0a60484eff944a4d6178 /wifi/java | |
parent | d5351e7b602f8b69de8b89e343aeb71b5b5d879a (diff) | |
parent | e9b056f8860296a08f93f4b7d2a0971c746c227b (diff) | |
download | frameworks_base-0326f585e15e56fb49c19ebb77e5a0fc8a7c4a62.zip frameworks_base-0326f585e15e56fb49c19ebb77e5a0fc8a7c4a62.tar.gz frameworks_base-0326f585e15e56fb49c19ebb77e5a0fc8a7c4a62.tar.bz2 |
Merge "API for config app." into m-wireless-dev
Diffstat (limited to 'wifi/java')
-rw-r--r-- | wifi/java/android/net/wifi/IWifiManager.aidl | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 38 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiManager.java | 14 |
3 files changed, 41 insertions, 13 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 3365be9..6e6d6f6 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -115,6 +115,8 @@ interface IWifiManager WifiConfiguration getWifiApConfiguration(); + WifiConfiguration buildWifiConfig(String uriString, String mimeType, in byte[] data); + void setWifiApConfiguration(in WifiConfiguration wifiConfig); void startWifi(); diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index 5baa3e8..8ee2273 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -24,6 +24,7 @@ import android.net.StaticIpConfiguration; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; +import android.util.Log; import java.util.HashMap; import java.util.BitSet; @@ -863,41 +864,52 @@ public class WifiConfiguration implements Parcelable { * @hide */ public boolean isValid() { + String reason = strIsValid(); + if (reason != null) { + Log.e("WFII", "WiFi Config not valid: " + reason); + return false; + } + else { + return true; + } + } + + private String strIsValid() { if (allowedKeyManagement == null) - return false; + return "allowed kmgmt"; if (allowedKeyManagement.cardinality() > 1) { if (allowedKeyManagement.cardinality() != 2) { - return false; + return "cardinality != 2"; } - if (allowedKeyManagement.get(KeyMgmt.WPA_EAP) == false) { - return false; + if (!allowedKeyManagement.get(KeyMgmt.WPA_EAP)) { + return "not WPA_EAP"; } - if ((allowedKeyManagement.get(KeyMgmt.IEEE8021X) == false) - && (allowedKeyManagement.get(KeyMgmt.WPA_PSK) == false)) { - return false; + if ((!allowedKeyManagement.get(KeyMgmt.IEEE8021X)) + && (!allowedKeyManagement.get(KeyMgmt.WPA_PSK))) { + return "not PSK or 8021X"; } } - if (TextUtils.isEmpty(FQDN) == false) { + if (!TextUtils.isEmpty(FQDN)) { /* this is passpoint configuration; it must not have an SSID */ - if (TextUtils.isEmpty(SSID) == false) { - return false; + if (!TextUtils.isEmpty(SSID)) { + return "no SSID"; } /* this is passpoint configuration; it must have a providerFriendlyName */ if (TextUtils.isEmpty(providerFriendlyName)) { - return false; + return "no provider friendly name"; } /* this is passpoint configuration; it must have enterprise config */ if (enterpriseConfig == null || enterpriseConfig.getEapMethod() == WifiEnterpriseConfig.Eap.NONE ) { - return false; + return "no enterprise config"; } } // TODO: Add more checks - return true; + return null; } /** diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 53550dd..2058645 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1480,6 +1480,20 @@ public class WifiManager { } /** + * Builds a WifiConfiguration from Hotspot 2.0 MIME file. + * @return AP details in WifiConfiguration + * + * @hide Dont open yet + */ + public WifiConfiguration buildWifiConfig(String uriString, String mimeType, byte[] data) { + try { + return mService.buildWifiConfig(uriString, mimeType, data); + } catch (RemoteException e) { + return null; + } + } + + /** * Sets the Wi-Fi AP Configuration. * @return {@code true} if the operation succeeded, {@code false} otherwise * |