summaryrefslogtreecommitdiffstats
path: root/wifi/java
diff options
context:
space:
mode:
Diffstat (limited to 'wifi/java')
-rw-r--r--wifi/java/android/net/wifi/IWifiManager.aidl8
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java25
-rw-r--r--wifi/java/android/net/wifi/WifiInfo.java7
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java50
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java3
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java106
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java6
-rw-r--r--wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java166
8 files changed, 303 insertions, 68 deletions
diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl
index 00e1cd8..e83eed7 100644
--- a/wifi/java/android/net/wifi/IWifiManager.aidl
+++ b/wifi/java/android/net/wifi/IWifiManager.aidl
@@ -132,5 +132,13 @@ interface IWifiManager
void enableVerboseLogging(int verbose);
int getVerboseLoggingLevel();
+
+ int getAggressiveHandover();
+
+ void enableAggressiveHandover(int enabled);
+
+ int getAllowScansWithTraffic();
+
+ void setAllowScansWithTraffic(int enabled);
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index b64ad60..59b48e4 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -373,19 +373,19 @@ public class WifiConfiguration implements Parcelable {
public static int GOOD_RSSI_24 = -65;
/** @hide **/
- public static int LOW_RSSI_24 = -75;
+ public static int LOW_RSSI_24 = -77;
/** @hide **/
- public static int BAD_RSSI_24 = -85;
+ public static int BAD_RSSI_24 = -87;
/** @hide **/
- public static int GOOD_RSSI_5 = -55;
+ public static int GOOD_RSSI_5 = -60;
/** @hide **/
- public static int LOW_RSSI_5 = -65;
+ public static int LOW_RSSI_5 = -72;
/** @hide **/
- public static int BAD_RSSI_5 = -75;
+ public static int BAD_RSSI_5 = -82;
/** @hide **/
public static int UNWANTED_BLACKLIST_SOFT_BUMP = 4;
@@ -394,7 +394,7 @@ public class WifiConfiguration implements Parcelable {
public static int UNWANTED_BLACKLIST_HARD_BUMP = 8;
/** @hide **/
- public static int UNBLACKLIST_THRESHOLD_24_SOFT = -75;
+ public static int UNBLACKLIST_THRESHOLD_24_SOFT = -77;
/** @hide **/
public static int UNBLACKLIST_THRESHOLD_24_HARD = -68;
@@ -415,6 +415,19 @@ public class WifiConfiguration implements Parcelable {
* 5GHz band is prefered over 2.4 if the 5GHz RSSI is higher than this threshold **/
public static int A_BAND_PREFERENCE_RSSI_THRESHOLD = -65;
+ /** @hide
+ * 5GHz band is penalized if the 5GHz RSSI is lower than this threshold **/
+ public static int G_BAND_PREFERENCE_RSSI_THRESHOLD = -75;
+
+ /** @hide
+ * Boost given to RSSI on a home network for the purpose of calculating the score
+ * This adds stickiness to home networks, as defined by:
+ * - less than 4 known BSSIDs
+ * - PSK only
+ * - TODO: add a test to verify that all BSSIDs are behind same gateway
+ ***/
+ public static int HOME_NETWORK_RSSI_BOOST = 5;
+
/**
* @hide
* A summary of the RSSI and Band status for that configuration
diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java
index 54a7df2..e46f916 100644
--- a/wifi/java/android/net/wifi/WifiInfo.java
+++ b/wifi/java/android/net/wifi/WifiInfo.java
@@ -134,6 +134,11 @@ public class WifiInfo implements Parcelable {
/**
* @hide
*/
+ public int linkStuckCount;
+
+ /**
+ * @hide
+ */
public int lowRssiCount;
/**
@@ -237,6 +242,7 @@ public class WifiInfo implements Parcelable {
txRetriesRate = 0;
lowRssiCount = 0;
badRssiCount = 0;
+ linkStuckCount = 0;
score = 0;
}
@@ -267,6 +273,7 @@ public class WifiInfo implements Parcelable {
score = source.score;
badRssiCount = source.badRssiCount;
lowRssiCount = source.lowRssiCount;
+ linkStuckCount = source.linkStuckCount;
}
}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 141a69e..a30fb79 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -2226,7 +2226,6 @@ public class WifiManager {
}
}
-
/**
* Set wifi verbose log. Called from developer settings.
* @hide
@@ -2251,4 +2250,53 @@ public class WifiManager {
return 0;
}
}
+
+ /**
+ * Set wifi Aggressive Handover. Called from developer settings.
+ * @hide
+ */
+ public void enableAggressiveHandover(int enabled) {
+ try {
+ mService.enableAggressiveHandover(enabled);
+ } catch (RemoteException e) {
+
+ }
+ }
+
+ /**
+ * Get the WiFi Handover aggressiveness.This is used by settings
+ * to decide what to show within the picker.
+ * @hide
+ */
+ public int getAggressiveHandover() {
+ try {
+ return mService.getAggressiveHandover();
+ } catch (RemoteException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Set setting for allowing Scans when traffic is ongoing.
+ * @hide
+ */
+ public void setAllowScansWithTraffic(int enabled) {
+ try {
+ mService.setAllowScansWithTraffic(enabled);
+ } catch (RemoteException e) {
+
+ }
+ }
+
+ /**
+ * Get setting for allowing Scans when traffic is ongoing.
+ * @hide
+ */
+ public int getAllowScansWithTraffic() {
+ try {
+ return mService.getAllowScansWithTraffic();
+ } catch (RemoteException e) {
+ return 0;
+ }
+ }
}
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
index 54ac71e..33ccad5 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointCredential.java
@@ -493,7 +493,8 @@ public class WifiPasspointCredential implements Parcelable {
}
if (this.mType.equals("TLS")) {
result = this.mRealm.equals(other.mRealm) &&
- this.mHomeSpFqdn.equals(other.mHomeSpFqdn);
+ this.mHomeSpFqdn.equals(other.mHomeSpFqdn) &&
+ this.mClientCert.equals(other.mClientCert);
}
if (this.mType.equals("SIM")) {
result = this.mMcc.equals(other.mMcc) &&
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
index aec87976..33db3f5 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointInfo.java
@@ -213,22 +213,22 @@ public class WifiPasspointInfo implements Parcelable {
public String venueName;
/** list of network authentication types */
- public List<NetworkAuthType> networkAuthType;
+ public List<NetworkAuthType> networkAuthTypeList;
/** list of roaming consortium OIs */
- public List<String> roamingConsortium;
+ public List<String> roamingConsortiumList;
/** IP address availability */
public IpAddressType ipAddrTypeAvailability;
- /** NAI realm */
- public List<NaiRealm> naiRealm;
+ /** list of NAI realm */
+ public List<NaiRealm> naiRealmList;
- /** 3GPP cellular network */
- public List<CellularNetwork> cellularNetwork;
+ /** list of 3GPP cellular network */
+ public List<CellularNetwork> cellularNetworkList;
- /** fully qualified domain name (FQDN) */
- public List<String> domainName;
+ /** list of fully qualified domain name (FQDN) */
+ public List<String> domainNameList;
/** HS 2.0 operator friendly name */
public String operatorFriendlyName;
@@ -236,10 +236,10 @@ public class WifiPasspointInfo implements Parcelable {
/** HS 2.0 wan metrics */
public WanMetrics wanMetrics;
- /** HS 2.0 list of IP proto port */
- public List<IpProtoPort> connectionCapability;
+ /** list of HS 2.0 IP proto port */
+ public List<IpProtoPort> connectionCapabilityList;
- /** HS 2.0 list of OSU providers */
+ /** list of HS 2.0 OSU providers */
public List<WifiPasspointOsuProvider> osuProviderList;
/**
@@ -292,15 +292,15 @@ public class WifiPasspointInfo implements Parcelable {
sb.append(" venueName: ").append("(")
.append(venueName.replace("\n", "\\n")).append(")");
- if (networkAuthType != null) {
+ if (networkAuthTypeList != null) {
sb.append(" networkAuthType: ");
- for (NetworkAuthType auth : networkAuthType)
+ for (NetworkAuthType auth : networkAuthTypeList)
sb.append("(").append(auth.toString()).append(")");
}
- if (roamingConsortium != null) {
+ if (roamingConsortiumList != null) {
sb.append(" roamingConsortium: ");
- for (String oi : roamingConsortium)
+ for (String oi : roamingConsortiumList)
sb.append("(").append(oi).append(")");
}
@@ -309,21 +309,21 @@ public class WifiPasspointInfo implements Parcelable {
.append(ipAddrTypeAvailability.toString()).append(")");
}
- if (naiRealm != null) {
+ if (naiRealmList != null) {
sb.append(" naiRealm: ");
- for (NaiRealm realm : naiRealm)
+ for (NaiRealm realm : naiRealmList)
sb.append("(").append(realm.toString()).append(")");
}
- if (cellularNetwork != null) {
+ if (cellularNetworkList != null) {
sb.append(" cellularNetwork: ");
- for (CellularNetwork plmn : cellularNetwork)
+ for (CellularNetwork plmn : cellularNetworkList)
sb.append("(").append(plmn.toString()).append(")");
}
- if (domainName != null) {
+ if (domainNameList != null) {
sb.append(" domainName: ");
- for (String fqdn : domainName)
+ for (String fqdn : domainNameList)
sb.append("(").append(fqdn).append(")");
}
@@ -335,9 +335,9 @@ public class WifiPasspointInfo implements Parcelable {
sb.append(" wanMetrics: ").append("(")
.append(wanMetrics.toString()).append(")");
- if (connectionCapability != null) {
+ if (connectionCapabilityList != null) {
sb.append(" connectionCapability: ");
- for (IpProtoPort ip : connectionCapability)
+ for (IpProtoPort ip : connectionCapabilityList)
sb.append("(").append(ip.toString()).append(")");
}
@@ -356,21 +356,21 @@ public class WifiPasspointInfo implements Parcelable {
out.writeString(bssid);
out.writeString(venueName);
- if (networkAuthType == null) {
+ if (networkAuthTypeList == null) {
out.writeInt(0);
} else {
- out.writeInt(networkAuthType.size());
- for (NetworkAuthType auth : networkAuthType) {
+ out.writeInt(networkAuthTypeList.size());
+ for (NetworkAuthType auth : networkAuthTypeList) {
out.writeInt(auth.type);
out.writeString(auth.redirectUrl);
}
}
- if (roamingConsortium == null) {
+ if (roamingConsortiumList == null) {
out.writeInt(0);
} else {
- out.writeInt(roamingConsortium.size());
- for (String oi : roamingConsortium)
+ out.writeInt(roamingConsortiumList.size());
+ for (String oi : roamingConsortiumList)
out.writeString(oi);
}
@@ -380,32 +380,32 @@ public class WifiPasspointInfo implements Parcelable {
out.writeInt(ipAddrTypeAvailability.availability);
}
- if (naiRealm == null) {
+ if (naiRealmList == null) {
out.writeInt(0);
} else {
- out.writeInt(naiRealm.size());
- for (NaiRealm realm : naiRealm) {
+ out.writeInt(naiRealmList.size());
+ for (NaiRealm realm : naiRealmList) {
out.writeInt(realm.encoding);
out.writeString(realm.realm);
}
}
- if (cellularNetwork == null) {
+ if (cellularNetworkList == null) {
out.writeInt(0);
} else {
- out.writeInt(cellularNetwork.size());
- for (CellularNetwork plmn : cellularNetwork) {
+ out.writeInt(cellularNetworkList.size());
+ for (CellularNetwork plmn : cellularNetworkList) {
out.writeString(plmn.mcc);
out.writeString(plmn.mnc);
}
}
- if (domainName == null) {
+ if (domainNameList == null) {
out.writeInt(0);
} else {
- out.writeInt(domainName.size());
- for (String fqdn : domainName)
+ out.writeInt(domainNameList.size());
+ for (String fqdn : domainNameList)
out.writeString(fqdn);
}
@@ -423,11 +423,11 @@ public class WifiPasspointInfo implements Parcelable {
out.writeInt(wanMetrics.lmd);
}
- if (connectionCapability == null) {
+ if (connectionCapabilityList == null) {
out.writeInt(0);
} else {
- out.writeInt(connectionCapability.size());
- for (IpProtoPort ip : connectionCapability) {
+ out.writeInt(connectionCapabilityList.size());
+ for (IpProtoPort ip : connectionCapabilityList) {
out.writeInt(ip.proto);
out.writeInt(ip.port);
out.writeInt(ip.status);
@@ -462,20 +462,20 @@ public class WifiPasspointInfo implements Parcelable {
n = in.readInt();
if (n > 0) {
- p.networkAuthType = new ArrayList<NetworkAuthType>();
+ p.networkAuthTypeList = new ArrayList<NetworkAuthType>();
for (int i = 0; i < n; i++) {
NetworkAuthType auth = new NetworkAuthType();
auth.type = in.readInt();
auth.redirectUrl = in.readString();
- p.networkAuthType.add(auth);
+ p.networkAuthTypeList.add(auth);
}
}
n = in.readInt();
if (n > 0) {
- p.roamingConsortium = new ArrayList<String>();
+ p.roamingConsortiumList = new ArrayList<String>();
for (int i = 0; i < n; i++)
- p.roamingConsortium.add(in.readString());
+ p.roamingConsortiumList.add(in.readString());
}
n = in.readInt();
@@ -486,31 +486,31 @@ public class WifiPasspointInfo implements Parcelable {
n = in.readInt();
if (n > 0) {
- p.naiRealm = new ArrayList<NaiRealm>();
+ p.naiRealmList = new ArrayList<NaiRealm>();
for (int i = 0; i < n; i++) {
NaiRealm realm = new NaiRealm();
realm.encoding = in.readInt();
realm.realm = in.readString();
- p.naiRealm.add(realm);
+ p.naiRealmList.add(realm);
}
}
n = in.readInt();
if (n > 0) {
- p.cellularNetwork = new ArrayList<CellularNetwork>();
+ p.cellularNetworkList = new ArrayList<CellularNetwork>();
for (int i = 0; i < n; i++) {
CellularNetwork plmn = new CellularNetwork();
plmn.mcc = in.readString();
plmn.mnc = in.readString();
- p.cellularNetwork.add(plmn);
+ p.cellularNetworkList.add(plmn);
}
}
n = in.readInt();
if (n > 0) {
- p.domainName = new ArrayList<String>();
+ p.domainNameList = new ArrayList<String>();
for (int i = 0; i < n; i++)
- p.domainName.add(in.readString());
+ p.domainNameList.add(in.readString());
}
p.operatorFriendlyName = in.readString();
@@ -528,13 +528,13 @@ public class WifiPasspointInfo implements Parcelable {
n = in.readInt();
if (n > 0) {
- p.connectionCapability = new ArrayList<IpProtoPort>();
+ p.connectionCapabilityList = new ArrayList<IpProtoPort>();
for (int i = 0; i < n; i++) {
IpProtoPort ip = new IpProtoPort();
ip.proto = in.readInt();
ip.port = in.readInt();
ip.status = in.readInt();
- p.connectionCapability.add(ip);
+ p.connectionCapabilityList.add(ip);
}
}
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
index 2f158c2..e7e6767 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointManager.java
@@ -325,7 +325,7 @@ public class WifiPasspointManager {
listener = getListener(message.arg2, true);
if (listener != null) {
ParcelableString str = (ParcelableString) message.obj;
- if (str.string == null)
+ if (str == null || str.string == null)
((OsuRemListener) listener).onBrowserDismiss();
else
((OsuRemListener) listener).onBrowserLaunch(str.string);
@@ -485,7 +485,7 @@ public class WifiPasspointManager {
*
* @return The list of credentials
*/
- public List<WifiPasspointCredential> getSavedCredentials() {
+ public List<WifiPasspointCredential> getCredentials() {
return null;
}
@@ -529,7 +529,7 @@ public class WifiPasspointManager {
Log.d(TAG, "startOsu end");
}
- public void startUserRemediation(Channel c, OsuRemListener listener) {
+ public void startRemediation(Channel c, OsuRemListener listener) {
}
public void connect(WifiPasspointPolicy policy) {
diff --git a/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java b/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
index 9fccf0a..f84ac88 100644
--- a/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
+++ b/wifi/java/android/net/wifi/passpoint/WifiPasspointPolicy.java
@@ -16,10 +16,18 @@
package android.net.wifi.passpoint;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.ScanResult;
import android.os.Parcelable;
import android.os.Parcel;
+import android.security.Credentials;
import android.util.Log;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+
+
/** @hide */
public class WifiPasspointPolicy implements Parcelable {
@@ -43,6 +51,20 @@ public class WifiPasspointPolicy implements Parcelable {
private int mRestriction;// Permitted values are "HomeSP", "RoamingPartner", or "Unrestricted"
private boolean mIsHomeSp;
+ private final String INT_PRIVATE_KEY = "private_key";
+ private final String INT_PHASE2 = "phase2";
+ private final String INT_PASSWORD = "password";
+ private final String INT_IDENTITY = "identity";
+ private final String INT_EAP = "eap";
+ private final String INT_CLIENT_CERT = "client_cert";
+ private final String INT_CA_CERT = "ca_cert";
+ private final String INT_ANONYMOUS_IDENTITY = "anonymous_identity";
+ private final String INT_SIM_SLOT = "sim_slot";
+ private final String INT_ENTERPRISEFIELD_NAME ="android.net.wifi.WifiConfiguration$EnterpriseField";
+ private final String ISO8601DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
+ private final String ENTERPRISE_PHASE2_MSCHAPV2 = "auth=MSCHAPV2";
+ private final String ENTERPRISE_PHASE2_MSCHAP = "auth=MSCHAP";
+
/** @hide */
public WifiPasspointPolicy(String name, String ssid,
String bssid, WifiPasspointCredential pc,
@@ -89,7 +111,7 @@ public class WifiPasspointPolicy implements Parcelable {
}
/** @hide */
- public boolean getHomeSp() {
+ public boolean isHomeSp() {
return mIsHomeSp;
}
@@ -121,6 +143,142 @@ public class WifiPasspointPolicy implements Parcelable {
return mRoamingPriority;
}
+ public WifiConfiguration createWifiConfiguration() {
+ WifiConfiguration wfg = new WifiConfiguration();
+ if (mBssid != null) {
+ Log.d(TAG, "create bssid:" + mBssid);
+ wfg.BSSID = mBssid;
+ }
+
+ if (mSsid != null) {
+ Log.d(TAG, "create ssid:" + mSsid);
+ wfg.SSID = mSsid;
+ }
+ //TODO: 1. add pmf configuration
+ // 2. add ocsp configuration
+ // 3. add eap-sim configuration
+ /*Key management*/
+ wfg.status = WifiConfiguration.Status.ENABLED;
+ wfg.allowedKeyManagement.clear();
+ wfg.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
+ wfg.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.IEEE8021X);
+
+ /*Group Ciphers*/
+ wfg.allowedGroupCiphers.clear();
+ wfg.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ wfg.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
+
+ /*Protocols*/
+ wfg.allowedProtocols.clear();
+ wfg.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
+ wfg.allowedProtocols.set(WifiConfiguration.Protocol.WPA);
+
+ Class[] enterpriseFieldArray = WifiConfiguration.class.getClasses();
+ Class<?> enterpriseFieldClass = null;
+
+
+ for(Class<?> myClass : enterpriseFieldArray) {
+ if(myClass.getName().equals(INT_ENTERPRISEFIELD_NAME)) {
+ enterpriseFieldClass = myClass;
+ break;
+ }
+ }
+ Log.d(TAG, "class chosen " + enterpriseFieldClass.getName() );
+
+
+ Field anonymousId = null, caCert = null, clientCert = null,
+ eap = null, identity = null, password = null,
+ phase2 = null, privateKey = null;
+
+ Field[] fields = WifiConfiguration.class.getFields();
+
+
+ for (Field tempField : fields) {
+ if (tempField.getName().trim().equals(INT_ANONYMOUS_IDENTITY)) {
+ anonymousId = tempField;
+ Log.d(TAG, "field " + anonymousId.getName() );
+ } else if (tempField.getName().trim().equals(INT_CA_CERT)) {
+ caCert = tempField;
+ } else if (tempField.getName().trim().equals(INT_CLIENT_CERT)) {
+ clientCert = tempField;
+ Log.d(TAG, "field " + clientCert.getName() );
+ } else if (tempField.getName().trim().equals(INT_EAP)) {
+ eap = tempField;
+ Log.d(TAG, "field " + eap.getName() );
+ } else if (tempField.getName().trim().equals(INT_IDENTITY)) {
+ identity = tempField;
+ Log.d(TAG, "field " + identity.getName() );
+ } else if (tempField.getName().trim().equals(INT_PASSWORD)) {
+ password = tempField;
+ Log.d(TAG, "field " + password.getName() );
+ } else if (tempField.getName().trim().equals(INT_PHASE2)) {
+ phase2 = tempField;
+ Log.d(TAG, "field " + phase2.getName() );
+
+ } else if (tempField.getName().trim().equals(INT_PRIVATE_KEY)) {
+ privateKey = tempField;
+ }
+ }
+
+
+ Method setValue = null;
+
+ for(Method m: enterpriseFieldClass.getMethods()) {
+ if(m.getName().trim().equals("setValue")) {
+ Log.d(TAG, "method " + m.getName() );
+ setValue = m;
+ break;
+ }
+ }
+
+ try {
+ // EAP
+ String eapmethod = mCredential.getType();
+ Log.d(TAG, "eapmethod:" + eapmethod);
+ setValue.invoke(eap.get(wfg), eapmethod);
+
+ // Username, password, EAP Phase 2
+ if ("TTLS".equals(eapmethod)) {
+ setValue.invoke(phase2.get(wfg), ENTERPRISE_PHASE2_MSCHAPV2);
+ setValue.invoke(identity.get(wfg), mCredential.getUserName());
+ setValue.invoke(password.get(wfg), mCredential.getPassword());
+ setValue.invoke(anonymousId.get(wfg), "anonymous@" + mCredential.getRealm());
+ }
+
+ // EAP CA Certificate
+ String cacertificate = null;
+ String rootCA = mCredential.getCaRootCertPath();
+ if (rootCA == null){
+ cacertificate = null;
+ } else {
+ cacertificate = "keystore://" + Credentials.WIFI + "HS20" + Credentials.CA_CERTIFICATE + rootCA;
+ }
+ Log.d(TAG, "cacertificate:" + cacertificate);
+ setValue.invoke(caCert.get(wfg), cacertificate);
+
+ //User certificate
+ if ("TLS".equals(eapmethod)) {
+ String usercertificate = null;
+ String privatekey = null;
+ String clientCertPath = mCredential.getClientCertPath();
+ if (clientCertPath != null){
+ privatekey = "keystore://" + Credentials.WIFI + "HS20" + Credentials.USER_PRIVATE_KEY + clientCertPath;
+ usercertificate = "keystore://" + Credentials.WIFI + "HS20" + Credentials.USER_CERTIFICATE + clientCertPath;
+ }
+ Log.d(TAG, "privatekey:" + privatekey);
+ Log.d(TAG, "usercertificate:" + usercertificate);
+ if (privatekey != null && usercertificate != null) {
+ setValue.invoke(privateKey.get(wfg), privatekey);
+ setValue.invoke(clientCert.get(wfg), usercertificate);
+ }
+ }
+ } catch (Exception e) {
+ Log.d(TAG, "createWifiConfiguration err:" + e);
+ }
+
+ return wfg;
+ }
+
/** {@inheritDoc} @hide */
public int compareTo(WifiPasspointPolicy another) {
Log.d(TAG, "this:" + this);
@@ -128,11 +286,11 @@ public class WifiPasspointPolicy implements Parcelable {
if (another == null) {
return -1;
- } else if (this.mIsHomeSp == true && another.getHomeSp() == false) {
+ } else if (this.mIsHomeSp == true && another.isHomeSp() == false) {
//home sp priority is higher then roaming
Log.d(TAG, "compare HomeSP first, this is HomeSP, another isn't");
return -1;
- } else if ((this.mIsHomeSp == true && another.getHomeSp() == true)) {
+ } else if ((this.mIsHomeSp == true && another.isHomeSp() == true)) {
Log.d(TAG, "both HomeSP");
//if both home sp, compare credential priority
if (this.mCredentialPriority < another.getCredentialPriority()) {
@@ -160,7 +318,7 @@ public class WifiPasspointPolicy implements Parcelable {
} else {
return 1;
}
- } else if ((this.mIsHomeSp == false && another.getHomeSp() == false)) {
+ } else if ((this.mIsHomeSp == false && another.isHomeSp() == false)) {
Log.d(TAG, "both RoamingSp");
//if both roaming sp, compare roaming priority(preferredRoamingPartnerList/<X+>/priority)
if (this.mRoamingPriority < another.getRoamingPriority()) {