summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-05 21:18:02 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-05 21:18:02 -0700
commit36d3ebb880e922859d4fd83792e13069072c19b2 (patch)
treee1ab6f801597dcf108cc1e9e19ae3f20ae0f6558
parenta31fb7d1d2225bc9965eb431ac6a2bb94af35e1f (diff)
parent19cd309f9eccdf8454dc6e5076013588b7a170a3 (diff)
downloadframeworks_base-36d3ebb880e922859d4fd83792e13069072c19b2.zip
frameworks_base-36d3ebb880e922859d4fd83792e13069072c19b2.tar.gz
frameworks_base-36d3ebb880e922859d4fd83792e13069072c19b2.tar.bz2
am 19cd309f: Merge change 3017 into donut
Merge commit '19cd309f9eccdf8454dc6e5076013588b7a170a3' * commit '19cd309f9eccdf8454dc6e5076013588b7a170a3': Add the EAP related fields for WiFi configuration.
-rw-r--r--services/java/com/android/server/WifiService.java77
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java108
2 files changed, 179 insertions, 6 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 5bded50..969fbfe 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -1060,6 +1060,83 @@ public class WifiService extends IWifiManager.Stub {
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;
}
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index 3bee3b6..1b7c0cd 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -42,13 +42,27 @@ public class WifiConfiguration implements Parcelable {
public static final String priorityVarName = "priority";
/** {@hide} */
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.
*/
public static class KeyMgmt {
private KeyMgmt() { }
-
+
/** WPA is not used; plaintext or static WEP could be used. */
public static final int NONE = 0;
/** 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" };
}
-
+
/**
* Recognized security protocols.
*/
@@ -112,7 +126,7 @@ public class WifiConfiguration implements Parcelable {
public static final int CCMP = 2;
public static final String varName = "pairwise";
-
+
public static final String[] strings = { "NONE", "TKIP", "CCMP" };
}
@@ -202,7 +216,7 @@ public class WifiConfiguration implements Parcelable {
* string otherwise.
*/
public String[] wepKeys;
-
+
/** Default WEP key index, ranging from 0 to 3. */
public int wepTxKeyIndex;
@@ -249,6 +263,38 @@ public class WifiConfiguration implements Parcelable {
*/
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() {
networkId = -1;
SSID = null;
@@ -263,6 +309,13 @@ public class WifiConfiguration implements Parcelable {
wepKeys = new String[4];
for (int i = 0; i < wepKeys.length; i++)
wepKeys[i] = null;
+ eap = null;
+ identity = null;
+ anonymousIdentity = null;
+ clientCert = null;
+ caCert = null;
+ privateKey = null;
+ privateKeyPasswd = null;
}
public String toString() {
@@ -333,10 +386,39 @@ public class WifiConfiguration implements Parcelable {
}
}
}
- sbuf.append('\n');
+ sbuf.append('\n').append(" PSK: ");
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();
}
@@ -394,6 +476,13 @@ public class WifiConfiguration implements Parcelable {
writeBitSet(dest, allowedAuthAlgorithms);
writeBitSet(dest, allowedPairwiseCiphers);
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} */
@@ -416,6 +505,13 @@ public class WifiConfiguration implements Parcelable {
config.allowedAuthAlgorithms = readBitSet(in);
config.allowedPairwiseCiphers = 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;
}