Merge "Do not provide 5GHz option for softap if there is no country code available" into m-wireless-wifi-dev
diff --git a/api/current.txt b/api/current.txt
index 753c940..e44002e 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17916,6 +17916,8 @@
field public int networkId;
field public java.lang.String preSharedKey;
field public int priority;
+ field public java.lang.String providerFriendlyName;
+ field public java.util.HashSet<java.lang.Long> roamingConsortiumIds;
field public int status;
field public java.lang.String[] wepKeys;
field public int wepTxKeyIndex;
@@ -17973,6 +17975,7 @@
ctor public WifiEnterpriseConfig();
ctor public WifiEnterpriseConfig(android.net.wifi.WifiEnterpriseConfig);
method public int describeContents();
+ method public java.lang.String getAltSubjectMatch();
method public java.lang.String getAnonymousIdentity();
method public java.security.cert.X509Certificate getCaCertificate();
method public java.security.cert.X509Certificate getClientCertificate();
@@ -17980,7 +17983,10 @@
method public java.lang.String getIdentity();
method public java.lang.String getPassword();
method public int getPhase2Method();
- method public java.lang.String getSubjectMatch();
+ method public java.lang.String getPlmn();
+ method public java.lang.String getRealm();
+ method public deprecated java.lang.String getSubjectMatch();
+ method public void setAltSubjectMatch(java.lang.String);
method public void setAnonymousIdentity(java.lang.String);
method public void setCaCertificate(java.security.cert.X509Certificate);
method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate);
@@ -17988,7 +17994,9 @@
method public void setIdentity(java.lang.String);
method public void setPassword(java.lang.String);
method public void setPhase2Method(int);
- method public void setSubjectMatch(java.lang.String);
+ method public void setPlmn(java.lang.String);
+ method public void setRealm(java.lang.String);
+ method public deprecated void setSubjectMatch(java.lang.String);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 22c236e..65346c0 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -19,22 +19,18 @@
import android.annotation.SystemApi;
import android.net.IpConfiguration;
import android.net.IpConfiguration.ProxySettings;
-import android.net.IpConfiguration.IpAssignment;
import android.net.ProxyInfo;
import android.net.StaticIpConfiguration;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
-import android.util.Log;
-import android.annotation.SystemApi;
-import java.util.Random;
-import java.util.Calendar;
import java.util.HashMap;
import java.util.BitSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.HashSet;
/**
* A class representing a configured Wi-Fi network, including the
@@ -254,18 +250,6 @@
public int apChannel = 0;
/**
- * Fully qualified domain name (FQDN) of AAA server or RADIUS server
- * e.g. {@code "mail.example.com"}.
- */
- public String FQDN;
- /**
- * Network access identifier (NAI) realm, for Passpoint credential.
- * e.g. {@code "myhost.example.com"}.
- * @hide
- */
- public String naiRealm;
-
- /**
* Pre-shared key for use with WPA-PSK.
* <p/>
* When the value of this key is read, the actual key is
@@ -348,6 +332,21 @@
public WifiEnterpriseConfig enterpriseConfig;
/**
+ * Fully qualified domain name of a passpoint configuration
+ */
+ public String FQDN;
+
+ /**
+ * Service provider name, for Passpoint credential.
+ */
+ public String providerFriendlyName;
+
+ /**
+ * Roaming Consortium Id, for Passpoint credential.
+ */
+ public HashSet<Long> roamingConsortiumIds;
+
+ /**
* @hide
*/
private IpConfiguration mIpConfiguration;
@@ -857,7 +856,7 @@
SSID = null;
BSSID = null;
FQDN = null;
- naiRealm = null;
+ roamingConsortiumIds = new HashSet<Long>();
priority = 0;
hiddenSSID = false;
disableReason = DISABLED_UNKNOWN_REASON;
@@ -902,6 +901,17 @@
}
}
+ if (FQDN != null) {
+ /* must have a providerFriendlyName */
+ if (providerFriendlyName == null) {
+ return false;
+ }
+ /* this is passpoint configuration; it must have enterprise config */
+ if (enterpriseConfig == null) {
+ return false;
+ }
+ }
+
// TODO: Add more checks
return true;
}
@@ -1037,8 +1047,9 @@
sbuf.append("- DSBLE ");
}
sbuf.append("ID: ").append(this.networkId).append(" SSID: ").append(this.SSID).
+ append(" PROVIDER-NAME: ").append(this.providerFriendlyName).
append(" BSSID: ").append(this.BSSID).append(" FQDN: ").append(this.FQDN).
- append(" REALM: ").append(this.naiRealm).append(" PRIO: ").append(this.priority).
+ append(" PRIO: ").append(this.priority).
append('\n');
if (this.numConnectionFailures > 0) {
sbuf.append(" numConnectFailures ").append(this.numConnectionFailures).append("\n");
@@ -1366,6 +1377,8 @@
String key;
if (allowCached && mCachedConfigKey != null) {
key = mCachedConfigKey;
+ } else if (providerFriendlyName != null) {
+ key = FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP];
} else {
if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) {
key = SSID + KeyMgmt.strings[KeyMgmt.WPA_PSK];
@@ -1481,7 +1494,12 @@
SSID = source.SSID;
BSSID = source.BSSID;
FQDN = source.FQDN;
- naiRealm = source.naiRealm;
+ roamingConsortiumIds = new HashSet<Long>();
+ for (Long roamingConsortiumId : source.roamingConsortiumIds) {
+ roamingConsortiumIds.add(roamingConsortiumId);
+ }
+
+ providerFriendlyName = source.providerFriendlyName;
preSharedKey = source.preSharedKey;
apBand = source.apBand;
@@ -1580,7 +1598,11 @@
dest.writeInt(apChannel);
dest.writeString(autoJoinBSSID);
dest.writeString(FQDN);
- dest.writeString(naiRealm);
+ dest.writeString(providerFriendlyName);
+ dest.writeInt(roamingConsortiumIds.size());
+ for (Long roamingConsortiumId : roamingConsortiumIds) {
+ dest.writeLong(roamingConsortiumId);
+ }
dest.writeString(preSharedKey);
for (String wepKey : wepKeys) {
dest.writeString(wepKey);
@@ -1644,7 +1666,11 @@
config.apChannel = in.readInt();
config.autoJoinBSSID = in.readString();
config.FQDN = in.readString();
- config.naiRealm = in.readString();
+ config.providerFriendlyName = in.readString();
+ int numRoamingConsortiumIds = in.readInt();
+ for (int i = 0; i < numRoamingConsortiumIds; i++) {
+ config.roamingConsortiumIds.add(in.readLong());
+ }
config.preSharedKey = in.readString();
for (int i = 0; i < config.wepKeys.length; i++) {
config.wepKeys[i] = in.readString();
diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
index cf3cba3..36fc96b 100644
--- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
+++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java
@@ -54,6 +54,8 @@
/** @hide */
public static final String SUBJECT_MATCH_KEY = "subject_match";
/** @hide */
+ public static final String ALTSUBJECT_MATCH_KEY = "altsubject_match";
+ /** @hide */
public static final String OPP_KEY_CACHING = "proactive_key_caching";
/**
* String representing the keystore OpenSSL ENGINE's ID.
@@ -93,6 +95,11 @@
public static final String ENGINE_ID_KEY = "engine_id";
/** @hide */
public static final String PRIVATE_KEY_ID_KEY = "key_id";
+ /** @hide */
+ public static final String REALM_KEY = "realm";
+ /** @hide */
+ public static final String PLMN_KEY = "plmn";
+
private HashMap<String, String> mFields = new HashMap<String, String>();
private X509Certificate mCaCert;
@@ -530,22 +537,74 @@
}
/**
- * Set subject match. This is the substring to be matched against the subject of the
- * authentication server certificate.
+ * Set subject match (deprecated). This is the substring to be matched against the subject of
+ * the authentication server certificate.
* @param subjectMatch substring to be matched
+ * @deprecated in favor of altSubjectMatch
*/
public void setSubjectMatch(String subjectMatch) {
setFieldValue(SUBJECT_MATCH_KEY, subjectMatch, "");
}
/**
- * Get subject match
+ * Get subject match (deprecated)
* @return the subject match string
+ * @deprecated in favor of altSubjectMatch
*/
public String getSubjectMatch() {
return getFieldValue(SUBJECT_MATCH_KEY, "");
}
+ /**
+ * Set alternate subject match. This is the substring to be matched against the
+ * alternate subject of the authentication server certificate.
+ * @param altSubjectMatch substring to be matched, for example
+ * DNS:server.example.com;EMAIL:server@example.com
+ */
+ public void setAltSubjectMatch(String altSubjectMatch) {
+ setFieldValue(ALTSUBJECT_MATCH_KEY, altSubjectMatch, "");
+ }
+
+ /**
+ * Get alternate subject match
+ * @return the alternate subject match string
+ */
+ public String getAltSubjectMatch() {
+ return getFieldValue(ALTSUBJECT_MATCH_KEY, "");
+ }
+
+ /**
+ * Set realm for passpoint credential
+ * @param realm the realm
+ */
+ public void setRealm(String realm) {
+ setFieldValue(REALM_KEY, realm, "");
+ }
+
+ /**
+ * Get realm for passpoint credential
+ * @return the realm
+ */
+ public String getRealm() {
+ return getFieldValue(REALM_KEY, "");
+ }
+
+ /**
+ * Set plmn for passpoint credential
+ * @param plmn the plmn value derived from mcc & mnc
+ */
+ public void setPlmn(String plmn) {
+ setFieldValue(PLMN_KEY, plmn, "");
+ }
+
+ /**
+ * Set plmn for passpoint credential
+ * @return the plmn
+ */
+ public String getPlmn() {
+ return getFieldValue(PLMN_KEY, "");
+ }
+
/** See {@link WifiConfiguration#getKeyIdForCredentials} @hide */
String getKeyId(WifiEnterpriseConfig current) {
String eap = mFields.get(EAP_KEY);
diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java
index c7275f8..f3cf28b 100644
--- a/wifi/java/android/net/wifi/WifiScanner.java
+++ b/wifi/java/android/net/wifi/WifiScanner.java
@@ -634,6 +634,10 @@
* @param results list of scan results, one for each access point visible currently
*/
public void onFound(ScanResult[] results);
+ /** indicates that access points were missed by on going scans
+ * @param results list of scan results, for each access point that is not visible anymore
+ */
+ public void onLost(ScanResult[] results);
}
/** @hide */
@@ -985,6 +989,10 @@
((BssidListener) listener).onFound(
((ParcelableScanResults) msg.obj).getResults());
return;
+ case CMD_AP_LOST:
+ ((BssidListener) listener).onLost(
+ ((ParcelableScanResults) msg.obj).getResults());
+ return;
case CMD_WIFI_CHANGE_DETECTED:
((WifiChangeListener) listener).onChanging(
((ParcelableScanResults) msg.obj).getResults());