Passpoint API - Take 1
Added some common fields to WifiConfigurations; which should be used with WifiEnterpriseConfig. The network information is saved in a file. Change-Id: Ica2069900dfc373e14792cbe81a185586e2954cc
This commit is contained in:
@@ -17916,6 +17916,8 @@ package android.net.wifi {
|
||||
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 @@ package android.net.wifi {
|
||||
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 @@ package android.net.wifi {
|
||||
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 @@ package android.net.wifi {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -19,22 +19,18 @@ package android.net.wifi;
|
||||
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
|
||||
@@ -253,18 +249,6 @@ public class WifiConfiguration implements Parcelable {
|
||||
*/
|
||||
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/>
|
||||
@@ -347,6 +331,21 @@ public class WifiConfiguration implements Parcelable {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -857,7 +856,7 @@ public class WifiConfiguration implements Parcelable {
|
||||
SSID = null;
|
||||
BSSID = null;
|
||||
FQDN = null;
|
||||
naiRealm = null;
|
||||
roamingConsortiumIds = new HashSet<Long>();
|
||||
priority = 0;
|
||||
hiddenSSID = false;
|
||||
disableReason = DISABLED_UNKNOWN_REASON;
|
||||
@@ -902,6 +901,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
|
||||
return true;
|
||||
}
|
||||
@@ -1037,8 +1047,9 @@ public class WifiConfiguration implements Parcelable {
|
||||
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 @@ public class WifiConfiguration implements Parcelable {
|
||||
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 @@ public class WifiConfiguration implements Parcelable {
|
||||
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 @@ public class WifiConfiguration implements Parcelable {
|
||||
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 @@ public class WifiConfiguration implements Parcelable {
|
||||
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();
|
||||
|
||||
@@ -54,6 +54,8 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
/** @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 class WifiEnterpriseConfig implements Parcelable {
|
||||
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 @@ public class WifiEnterpriseConfig implements Parcelable {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
Reference in New Issue
Block a user