Merge change 3017 into donut
* changes: Add the EAP related fields for WiFi configuration.
This commit is contained in:
@ -1060,6 +1060,83 @@ public class WifiService extends IWifiManager.Stub {
|
|||||||
break setVariables;
|
break setVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((config.eap != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.eapVarName,
|
||||||
|
config.eap)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set eap: "+
|
||||||
|
config.eap);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.identity != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.identityVarName,
|
||||||
|
config.identity)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set identity: "+
|
||||||
|
config.identity);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.anonymousIdentity != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.anonymousIdentityVarName,
|
||||||
|
config.anonymousIdentity)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set anonymousIdentity: "+
|
||||||
|
config.anonymousIdentity);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.clientCert != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.clientCertVarName,
|
||||||
|
config.clientCert)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set clientCert: "+
|
||||||
|
config.clientCert);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.caCert != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.caCertVarName,
|
||||||
|
config.caCert)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set caCert: "+
|
||||||
|
config.caCert);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.privateKey != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.privateKeyVarName,
|
||||||
|
config.privateKey)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set privateKey: "+
|
||||||
|
config.privateKey);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.privateKeyPasswd != null) && !WifiNative.setNetworkVariableCommand(
|
||||||
|
netId,
|
||||||
|
WifiConfiguration.privateKeyPasswdVarName,
|
||||||
|
config.privateKeyPasswd)) {
|
||||||
|
if (DBG) {
|
||||||
|
Log.d(TAG, config.SSID + ": failed to set privateKeyPasswd: "+
|
||||||
|
config.privateKeyPasswd);
|
||||||
|
}
|
||||||
|
break setVariables;
|
||||||
|
}
|
||||||
|
|
||||||
return netId;
|
return netId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,13 +42,27 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
public static final String priorityVarName = "priority";
|
public static final String priorityVarName = "priority";
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
public static final String hiddenSSIDVarName = "scan_ssid";
|
public static final String hiddenSSIDVarName = "scan_ssid";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String eapVarName = "eap";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String identityVarName = "identity";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String anonymousIdentityVarName = "anonymous_identity";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String clientCertVarName = "client_cert";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String caCertVarName = "ca_cert";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String privateKeyVarName = "private_key";
|
||||||
|
/** {@hide} */
|
||||||
|
public static final String privateKeyPasswdVarName = "private_key_passwd";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recognized key management schemes.
|
* Recognized key management schemes.
|
||||||
*/
|
*/
|
||||||
public static class KeyMgmt {
|
public static class KeyMgmt {
|
||||||
private KeyMgmt() { }
|
private KeyMgmt() { }
|
||||||
|
|
||||||
/** WPA is not used; plaintext or static WEP could be used. */
|
/** WPA is not used; plaintext or static WEP could be used. */
|
||||||
public static final int NONE = 0;
|
public static final int NONE = 0;
|
||||||
/** WPA pre-shared key (requires {@code preSharedKey} to be specified). */
|
/** WPA pre-shared key (requires {@code preSharedKey} to be specified). */
|
||||||
@ -63,7 +77,7 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
|
|
||||||
public static final String[] strings = { "NONE", "WPA_PSK", "WPA_EAP", "IEEE8021X" };
|
public static final String[] strings = { "NONE", "WPA_PSK", "WPA_EAP", "IEEE8021X" };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recognized security protocols.
|
* Recognized security protocols.
|
||||||
*/
|
*/
|
||||||
@ -112,7 +126,7 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
public static final int CCMP = 2;
|
public static final int CCMP = 2;
|
||||||
|
|
||||||
public static final String varName = "pairwise";
|
public static final String varName = "pairwise";
|
||||||
|
|
||||||
public static final String[] strings = { "NONE", "TKIP", "CCMP" };
|
public static final String[] strings = { "NONE", "TKIP", "CCMP" };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +216,7 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
* string otherwise.
|
* string otherwise.
|
||||||
*/
|
*/
|
||||||
public String[] wepKeys;
|
public String[] wepKeys;
|
||||||
|
|
||||||
/** Default WEP key index, ranging from 0 to 3. */
|
/** Default WEP key index, ranging from 0 to 3. */
|
||||||
public int wepTxKeyIndex;
|
public int wepTxKeyIndex;
|
||||||
|
|
||||||
@ -249,6 +263,38 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public BitSet allowedGroupCiphers;
|
public BitSet allowedGroupCiphers;
|
||||||
|
|
||||||
|
/* The following fields are used for EAP/IEEE8021X authentication */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The eap mode should be PEAP, TLS or TTLS.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String eap;
|
||||||
|
/**
|
||||||
|
* The identity of the user in string,
|
||||||
|
* which is used for the authentication.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String identity;
|
||||||
|
/** {@hide} */
|
||||||
|
public String anonymousIdentity;
|
||||||
|
/** The path of the client certificate file.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String clientCert;
|
||||||
|
/** The path of the CA certificate file.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String caCert;
|
||||||
|
/** The path of the private key file.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String privateKey;
|
||||||
|
/** The password of the private key file if encrypted.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public String privateKeyPasswd;
|
||||||
|
|
||||||
public WifiConfiguration() {
|
public WifiConfiguration() {
|
||||||
networkId = -1;
|
networkId = -1;
|
||||||
SSID = null;
|
SSID = null;
|
||||||
@ -263,6 +309,13 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
wepKeys = new String[4];
|
wepKeys = new String[4];
|
||||||
for (int i = 0; i < wepKeys.length; i++)
|
for (int i = 0; i < wepKeys.length; i++)
|
||||||
wepKeys[i] = null;
|
wepKeys[i] = null;
|
||||||
|
eap = null;
|
||||||
|
identity = null;
|
||||||
|
anonymousIdentity = null;
|
||||||
|
clientCert = null;
|
||||||
|
caCert = null;
|
||||||
|
privateKey = null;
|
||||||
|
privateKeyPasswd = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
@ -333,10 +386,39 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sbuf.append('\n');
|
sbuf.append('\n').append(" PSK: ");
|
||||||
if (this.preSharedKey != null) {
|
if (this.preSharedKey != null) {
|
||||||
sbuf.append(" PSK: ").append('*');
|
sbuf.append('*');
|
||||||
}
|
}
|
||||||
|
sbuf.append('\n').append(" eap: ");
|
||||||
|
if (this.eap != null) {
|
||||||
|
sbuf.append(eap);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" Identity: ");
|
||||||
|
if (this.identity != null) {
|
||||||
|
sbuf.append(identity);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" AnonymousIdentity: ");
|
||||||
|
if (this.anonymousIdentity != null) {
|
||||||
|
sbuf.append(anonymousIdentity);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" ClientCert: ");
|
||||||
|
if (this.clientCert != null) {
|
||||||
|
sbuf.append(clientCert);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" CaCert: ");
|
||||||
|
if (this.caCert != null) {
|
||||||
|
sbuf.append(caCert);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" PrivateKey: ");
|
||||||
|
if (this.privateKey != null) {
|
||||||
|
sbuf.append(privateKey);
|
||||||
|
}
|
||||||
|
sbuf.append('\n').append(" PrivateKeyPasswd: ");
|
||||||
|
if (this.privateKeyPasswd != null) {
|
||||||
|
sbuf.append(privateKeyPasswd);
|
||||||
|
}
|
||||||
|
sbuf.append('\n');
|
||||||
return sbuf.toString();
|
return sbuf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,6 +476,13 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
writeBitSet(dest, allowedAuthAlgorithms);
|
writeBitSet(dest, allowedAuthAlgorithms);
|
||||||
writeBitSet(dest, allowedPairwiseCiphers);
|
writeBitSet(dest, allowedPairwiseCiphers);
|
||||||
writeBitSet(dest, allowedGroupCiphers);
|
writeBitSet(dest, allowedGroupCiphers);
|
||||||
|
dest.writeString(eap);
|
||||||
|
dest.writeString(identity);
|
||||||
|
dest.writeString(anonymousIdentity);
|
||||||
|
dest.writeString(clientCert);
|
||||||
|
dest.writeString(caCert);
|
||||||
|
dest.writeString(privateKey);
|
||||||
|
dest.writeString(privateKeyPasswd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Implement the Parcelable interface {@hide} */
|
/** Implement the Parcelable interface {@hide} */
|
||||||
@ -416,6 +505,13 @@ public class WifiConfiguration implements Parcelable {
|
|||||||
config.allowedAuthAlgorithms = readBitSet(in);
|
config.allowedAuthAlgorithms = readBitSet(in);
|
||||||
config.allowedPairwiseCiphers = readBitSet(in);
|
config.allowedPairwiseCiphers = readBitSet(in);
|
||||||
config.allowedGroupCiphers = readBitSet(in);
|
config.allowedGroupCiphers = readBitSet(in);
|
||||||
|
config.eap = in.readString();
|
||||||
|
config.identity = in.readString();
|
||||||
|
config.anonymousIdentity = in.readString();
|
||||||
|
config.clientCert = in.readString();
|
||||||
|
config.caCert = in.readString();
|
||||||
|
config.privateKey = in.readString();
|
||||||
|
config.privateKeyPasswd = in.readString();
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user