Push down the supplicant-specific double-quote handling to framework.
So we are able to connect to AP with ssid containing double-quotes.
This commit is contained in:
@@ -166,12 +166,6 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
|||||||
if (TextUtils.isEmpty(string)) {
|
if (TextUtils.isEmpty(string)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
final int lastPos = string.length() - 1;
|
|
||||||
if (lastPos < 0 || (string.charAt(0) == '"' && string.charAt(lastPos) == '"')) {
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "\"" + string + "\"";
|
return "\"" + string + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +219,7 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
|||||||
|
|
||||||
public void setSsid(String ssid) {
|
public void setSsid(String ssid) {
|
||||||
if (ssid != null) {
|
if (ssid != null) {
|
||||||
this.ssid = convertToQuotedString(ssid);
|
this.ssid = ssid;
|
||||||
requestRefresh();
|
requestRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -478,41 +472,40 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
|||||||
config.BSSID = getWpaSupplicantBssid();
|
config.BSSID = getWpaSupplicantBssid();
|
||||||
config.priority = priority;
|
config.priority = priority;
|
||||||
config.hiddenSSID = hiddenSsid;
|
config.hiddenSSID = hiddenSsid;
|
||||||
config.SSID = convertToQuotedString(ssid);
|
config.SSID = ssid;
|
||||||
config.eap.setValue(mEap);
|
config.eap.setValue(mEap);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(mPhase2)) {
|
if (!TextUtils.isEmpty(mPhase2)) {
|
||||||
config.phase2.setValue(convertToQuotedString("auth=" + mPhase2));
|
config.phase2.setValue("auth=" + mPhase2);
|
||||||
} else {
|
} else {
|
||||||
config.phase2.setValue(null);
|
config.phase2.setValue(null);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(mEnterpriseFields[IDENTITY])) {
|
if (!TextUtils.isEmpty(mEnterpriseFields[IDENTITY])) {
|
||||||
config.identity.setValue(
|
config.identity.setValue(mEnterpriseFields[IDENTITY]);
|
||||||
convertToQuotedString(mEnterpriseFields[IDENTITY]));
|
|
||||||
} else {
|
} else {
|
||||||
config.identity.setValue(null);
|
config.identity.setValue(null);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(mEnterpriseFields[ANONYMOUS_IDENTITY])) {
|
if (!TextUtils.isEmpty(mEnterpriseFields[ANONYMOUS_IDENTITY])) {
|
||||||
config.anonymous_identity.setValue(convertToQuotedString(
|
config.anonymous_identity.setValue(
|
||||||
mEnterpriseFields[ANONYMOUS_IDENTITY]));
|
mEnterpriseFields[ANONYMOUS_IDENTITY]);
|
||||||
} else {
|
} else {
|
||||||
config.anonymous_identity.setValue(null);
|
config.anonymous_identity.setValue(null);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(mEnterpriseFields[CLIENT_CERT])) {
|
if (!TextUtils.isEmpty(mEnterpriseFields[CLIENT_CERT])) {
|
||||||
config.client_cert.setValue(convertToQuotedString(
|
config.client_cert.setValue(
|
||||||
mEnterpriseFields[CLIENT_CERT]));
|
mEnterpriseFields[CLIENT_CERT]);
|
||||||
} else {
|
} else {
|
||||||
config.client_cert.setValue(null);
|
config.client_cert.setValue(null);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(mEnterpriseFields[CA_CERT])) {
|
if (!TextUtils.isEmpty(mEnterpriseFields[CA_CERT])) {
|
||||||
config.ca_cert.setValue(convertToQuotedString(
|
config.ca_cert.setValue(
|
||||||
mEnterpriseFields[CA_CERT]));
|
mEnterpriseFields[CA_CERT]);
|
||||||
} else {
|
} else {
|
||||||
config.ca_cert.setValue(null);
|
config.ca_cert.setValue(null);
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(mEnterpriseFields[PRIVATE_KEY])) {
|
if (!TextUtils.isEmpty(mEnterpriseFields[PRIVATE_KEY])) {
|
||||||
config.private_key.setValue(convertToQuotedString(
|
config.private_key.setValue(
|
||||||
mEnterpriseFields[PRIVATE_KEY]));
|
mEnterpriseFields[PRIVATE_KEY]);
|
||||||
} else {
|
} else {
|
||||||
config.private_key.setValue(null);
|
config.private_key.setValue(null);
|
||||||
}
|
}
|
||||||
@@ -565,7 +558,7 @@ public final class AccessPointState implements Comparable<AccessPointState>, Par
|
|||||||
config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
|
config.allowedKeyManagement.set(KeyMgmt.WPA_EAP);
|
||||||
config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
|
config.allowedKeyManagement.set(KeyMgmt.IEEE8021X);
|
||||||
if (!TextUtils.isEmpty(mPassword)) {
|
if (!TextUtils.isEmpty(mPassword)) {
|
||||||
config.password.setValue(convertToQuotedString(mPassword));
|
config.password.setValue(mPassword);
|
||||||
}
|
}
|
||||||
} else if (security.equals(OPEN)) {
|
} else if (security.equals(OPEN)) {
|
||||||
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
config.allowedKeyManagement.set(KeyMgmt.NONE);
|
||||||
|
@@ -749,7 +749,6 @@ public class WifiLayer {
|
|||||||
// We already know about this one
|
// We already know about this one
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap = new AccessPointState(mContext);
|
ap = new AccessPointState(mContext);
|
||||||
ap.updateFromWifiConfiguration(config);
|
ap.updateFromWifiConfiguration(config);
|
||||||
if (LOGV) Log.v(TAG, "Created " + ap + " in loadConfiguredAccessPoints");
|
if (LOGV) Log.v(TAG, "Created " + ap + " in loadConfiguredAccessPoints");
|
||||||
@@ -1152,7 +1151,7 @@ public class WifiLayer {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String ssid = AccessPointState.convertToQuotedString(scanResult.SSID);
|
final String ssid = scanResult.SSID;
|
||||||
String security = AccessPointState.getScanResultSecurity(scanResult);
|
String security = AccessPointState.getScanResultSecurity(scanResult);
|
||||||
|
|
||||||
// See if this AP is part of a group of APs (e.g., any large
|
// See if this AP is part of a group of APs (e.g., any large
|
||||||
|
Reference in New Issue
Block a user