am "Passpoint API - Take 1"
merged from partner/m-wireless-wifi-dev
b21d248 Passpoint API - Take 1
This commit is contained in:
@@ -17914,6 +17914,8 @@ package android.net.wifi {
|
|||||||
field public int networkId;
|
field public int networkId;
|
||||||
field public java.lang.String preSharedKey;
|
field public java.lang.String preSharedKey;
|
||||||
field public int priority;
|
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 int status;
|
||||||
field public java.lang.String[] wepKeys;
|
field public java.lang.String[] wepKeys;
|
||||||
field public int wepTxKeyIndex;
|
field public int wepTxKeyIndex;
|
||||||
@@ -17971,6 +17973,7 @@ package android.net.wifi {
|
|||||||
ctor public WifiEnterpriseConfig();
|
ctor public WifiEnterpriseConfig();
|
||||||
ctor public WifiEnterpriseConfig(android.net.wifi.WifiEnterpriseConfig);
|
ctor public WifiEnterpriseConfig(android.net.wifi.WifiEnterpriseConfig);
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method public java.lang.String getAltSubjectMatch();
|
||||||
method public java.lang.String getAnonymousIdentity();
|
method public java.lang.String getAnonymousIdentity();
|
||||||
method public java.security.cert.X509Certificate getCaCertificate();
|
method public java.security.cert.X509Certificate getCaCertificate();
|
||||||
method public java.security.cert.X509Certificate getClientCertificate();
|
method public java.security.cert.X509Certificate getClientCertificate();
|
||||||
@@ -17978,7 +17981,10 @@ package android.net.wifi {
|
|||||||
method public java.lang.String getIdentity();
|
method public java.lang.String getIdentity();
|
||||||
method public java.lang.String getPassword();
|
method public java.lang.String getPassword();
|
||||||
method public int getPhase2Method();
|
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 setAnonymousIdentity(java.lang.String);
|
||||||
method public void setCaCertificate(java.security.cert.X509Certificate);
|
method public void setCaCertificate(java.security.cert.X509Certificate);
|
||||||
method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate);
|
method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate);
|
||||||
@@ -17986,7 +17992,9 @@ package android.net.wifi {
|
|||||||
method public void setIdentity(java.lang.String);
|
method public void setIdentity(java.lang.String);
|
||||||
method public void setPassword(java.lang.String);
|
method public void setPassword(java.lang.String);
|
||||||
method public void setPhase2Method(int);
|
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);
|
method public void writeToParcel(android.os.Parcel, int);
|
||||||
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
|
field public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,22 +19,18 @@ package android.net.wifi;
|
|||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.net.IpConfiguration;
|
import android.net.IpConfiguration;
|
||||||
import android.net.IpConfiguration.ProxySettings;
|
import android.net.IpConfiguration.ProxySettings;
|
||||||
import android.net.IpConfiguration.IpAssignment;
|
|
||||||
import android.net.ProxyInfo;
|
import android.net.ProxyInfo;
|
||||||
import android.net.StaticIpConfiguration;
|
import android.net.StaticIpConfiguration;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.text.TextUtils;
|
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.HashMap;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class representing a configured Wi-Fi network, including the
|
* A class representing a configured Wi-Fi network, including the
|
||||||
@@ -253,18 +249,6 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public int apChannel = 0;
|
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.
|
* Pre-shared key for use with WPA-PSK.
|
||||||
* <p/>
|
* <p/>
|
||||||
@@ -347,6 +331,21 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public WifiEnterpriseConfig enterpriseConfig;
|
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
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -882,7 +881,7 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
SSID = null;
|
SSID = null;
|
||||||
BSSID = null;
|
BSSID = null;
|
||||||
FQDN = null;
|
FQDN = null;
|
||||||
naiRealm = null;
|
roamingConsortiumIds = new HashSet<Long>();
|
||||||
priority = 0;
|
priority = 0;
|
||||||
hiddenSSID = false;
|
hiddenSSID = false;
|
||||||
disableReason = DISABLED_UNKNOWN_REASON;
|
disableReason = DISABLED_UNKNOWN_REASON;
|
||||||
@@ -927,6 +926,17 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// TODO: Add more checks
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1062,8 +1072,9 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
sbuf.append("- DSBLE ");
|
sbuf.append("- DSBLE ");
|
||||||
}
|
}
|
||||||
sbuf.append("ID: ").append(this.networkId).append(" SSID: ").append(this.SSID).
|
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(" 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');
|
append('\n');
|
||||||
if (this.numConnectionFailures > 0) {
|
if (this.numConnectionFailures > 0) {
|
||||||
sbuf.append(" numConnectFailures ").append(this.numConnectionFailures).append("\n");
|
sbuf.append(" numConnectFailures ").append(this.numConnectionFailures).append("\n");
|
||||||
@@ -1403,6 +1414,8 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
String key;
|
String key;
|
||||||
if (allowCached && mCachedConfigKey != null) {
|
if (allowCached && mCachedConfigKey != null) {
|
||||||
key = mCachedConfigKey;
|
key = mCachedConfigKey;
|
||||||
|
} else if (providerFriendlyName != null) {
|
||||||
|
key = FQDN + KeyMgmt.strings[KeyMgmt.WPA_EAP];
|
||||||
} else {
|
} else {
|
||||||
if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) {
|
if (allowedKeyManagement.get(KeyMgmt.WPA_PSK)) {
|
||||||
key = SSID + KeyMgmt.strings[KeyMgmt.WPA_PSK];
|
key = SSID + KeyMgmt.strings[KeyMgmt.WPA_PSK];
|
||||||
@@ -1518,7 +1531,12 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
SSID = source.SSID;
|
SSID = source.SSID;
|
||||||
BSSID = source.BSSID;
|
BSSID = source.BSSID;
|
||||||
FQDN = source.FQDN;
|
FQDN = source.FQDN;
|
||||||
naiRealm = source.naiRealm;
|
roamingConsortiumIds = new HashSet<Long>();
|
||||||
|
for (Long roamingConsortiumId : source.roamingConsortiumIds) {
|
||||||
|
roamingConsortiumIds.add(roamingConsortiumId);
|
||||||
|
}
|
||||||
|
|
||||||
|
providerFriendlyName = source.providerFriendlyName;
|
||||||
preSharedKey = source.preSharedKey;
|
preSharedKey = source.preSharedKey;
|
||||||
|
|
||||||
apBand = source.apBand;
|
apBand = source.apBand;
|
||||||
@@ -1620,7 +1638,11 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
dest.writeInt(apChannel);
|
dest.writeInt(apChannel);
|
||||||
dest.writeString(autoJoinBSSID);
|
dest.writeString(autoJoinBSSID);
|
||||||
dest.writeString(FQDN);
|
dest.writeString(FQDN);
|
||||||
dest.writeString(naiRealm);
|
dest.writeString(providerFriendlyName);
|
||||||
|
dest.writeInt(roamingConsortiumIds.size());
|
||||||
|
for (Long roamingConsortiumId : roamingConsortiumIds) {
|
||||||
|
dest.writeLong(roamingConsortiumId);
|
||||||
|
}
|
||||||
dest.writeString(preSharedKey);
|
dest.writeString(preSharedKey);
|
||||||
for (String wepKey : wepKeys) {
|
for (String wepKey : wepKeys) {
|
||||||
dest.writeString(wepKey);
|
dest.writeString(wepKey);
|
||||||
@@ -1687,7 +1709,11 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
config.apChannel = in.readInt();
|
config.apChannel = in.readInt();
|
||||||
config.autoJoinBSSID = in.readString();
|
config.autoJoinBSSID = in.readString();
|
||||||
config.FQDN = 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();
|
config.preSharedKey = in.readString();
|
||||||
for (int i = 0; i < config.wepKeys.length; i++) {
|
for (int i = 0; i < config.wepKeys.length; i++) {
|
||||||
config.wepKeys[i] = in.readString();
|
config.wepKeys[i] = in.readString();
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ public class WifiEnterpriseConfig implements Parcelable {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String SUBJECT_MATCH_KEY = "subject_match";
|
public static final String SUBJECT_MATCH_KEY = "subject_match";
|
||||||
/** @hide */
|
/** @hide */
|
||||||
|
public static final String ALTSUBJECT_MATCH_KEY = "altsubject_match";
|
||||||
|
/** @hide */
|
||||||
public static final String OPP_KEY_CACHING = "proactive_key_caching";
|
public static final String OPP_KEY_CACHING = "proactive_key_caching";
|
||||||
/**
|
/**
|
||||||
* String representing the keystore OpenSSL ENGINE's ID.
|
* String representing the keystore OpenSSL ENGINE's ID.
|
||||||
@@ -93,6 +95,11 @@ public class WifiEnterpriseConfig implements Parcelable {
|
|||||||
public static final String ENGINE_ID_KEY = "engine_id";
|
public static final String ENGINE_ID_KEY = "engine_id";
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final String PRIVATE_KEY_ID_KEY = "key_id";
|
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 HashMap<String, String> mFields = new HashMap<String, String>();
|
||||||
private X509Certificate mCaCert;
|
private X509Certificate mCaCert;
|
||||||
@@ -530,22 +537,74 @@ public class WifiEnterpriseConfig implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set subject match. This is the substring to be matched against the subject of the
|
* Set subject match (deprecated). This is the substring to be matched against the subject of
|
||||||
* authentication server certificate.
|
* the authentication server certificate.
|
||||||
* @param subjectMatch substring to be matched
|
* @param subjectMatch substring to be matched
|
||||||
|
* @deprecated in favor of altSubjectMatch
|
||||||
*/
|
*/
|
||||||
public void setSubjectMatch(String subjectMatch) {
|
public void setSubjectMatch(String subjectMatch) {
|
||||||
setFieldValue(SUBJECT_MATCH_KEY, subjectMatch, "");
|
setFieldValue(SUBJECT_MATCH_KEY, subjectMatch, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get subject match
|
* Get subject match (deprecated)
|
||||||
* @return the subject match string
|
* @return the subject match string
|
||||||
|
* @deprecated in favor of altSubjectMatch
|
||||||
*/
|
*/
|
||||||
public String getSubjectMatch() {
|
public String getSubjectMatch() {
|
||||||
return getFieldValue(SUBJECT_MATCH_KEY, "");
|
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 */
|
/** See {@link WifiConfiguration#getKeyIdForCredentials} @hide */
|
||||||
String getKeyId(WifiEnterpriseConfig current) {
|
String getKeyId(WifiEnterpriseConfig current) {
|
||||||
String eap = mFields.get(EAP_KEY);
|
String eap = mFields.get(EAP_KEY);
|
||||||
|
|||||||
Reference in New Issue
Block a user