Code drop from //branches/cupcake/...@124589

This commit is contained in:
The Android Open Source Project
2008-12-17 18:06:01 -08:00
parent de2d9f5f10
commit abc48f80d8
97 changed files with 11385 additions and 7016 deletions

View File

@@ -538,7 +538,13 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
// If password is empty, it should be left untouched
if (!TextUtils.isEmpty(mPassword)) {
config.preSharedKey = convertToQuotedString(mPassword);
if (mPassword.length() == 64 && isHex(mPassword)) {
// Goes unquoted as hex
config.preSharedKey = mPassword;
} else {
// Goes quoted as ASCII
config.preSharedKey = convertToQuotedString(mPassword);
}
}
} else if (security.equals(OPEN)) {
@@ -554,8 +560,12 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
return false;
}
for (int i = len - 1; i >= 0; i--) {
final char c = wepKey.charAt(i);
return isHex(wepKey);
}
private static boolean isHex(String key) {
for (int i = key.length() - 1; i >= 0; i--) {
final char c = key.charAt(i);
if (!(c >= '0' && c <= '9' || c >= 'A' && c <= 'F' || c >= 'a' && c <= 'f')) {
return false;
}