WiFi: only send engine setting when key_id is set
For EAP methods that don't need a key, don't set the engine settings or else wpa_supplicant will have an error. Instead, look to see whether key_id is set and use that to indicate when the engine should be set. Additionally, don't require keystore when key_id is not null but is still an empty string. Bug: 6480500 Change-Id: I137de47dfcbbd3da24d693701e249e15d7528228
This commit is contained in:
@@ -126,7 +126,7 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
if (config == null) {
|
if (config == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (config.key_id.value() != null) {
|
if (!TextUtils.isEmpty(config.key_id.value())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String values[] = { config.ca_cert.value(), config.client_cert.value() };
|
String values[] = { config.ca_cert.value(), config.client_cert.value() };
|
||||||
@@ -364,11 +364,12 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
config.client_cert.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ?
|
config.client_cert.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ?
|
||||||
"" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE +
|
"" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE +
|
||||||
(String) mEapUserCertSpinner.getSelectedItem());
|
(String) mEapUserCertSpinner.getSelectedItem());
|
||||||
config.engine.setValue(WifiConfiguration.ENGINE_ENABLE);
|
final boolean isEmptyKeyId = (mEapUserCertSpinner.getSelectedItemPosition() == 0);
|
||||||
config.engine_id.setValue(WifiConfiguration.KEYSTORE_ENGINE_ID);
|
config.key_id.setValue(isEmptyKeyId ? "" : Credentials.USER_PRIVATE_KEY +
|
||||||
config.key_id.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ?
|
|
||||||
"" : Credentials.USER_PRIVATE_KEY +
|
|
||||||
(String) mEapUserCertSpinner.getSelectedItem());
|
(String) mEapUserCertSpinner.getSelectedItem());
|
||||||
|
config.engine.setValue(isEmptyKeyId ? WifiConfiguration.ENGINE_DISABLE :
|
||||||
|
WifiConfiguration.ENGINE_ENABLE);
|
||||||
|
config.engine_id.setValue(isEmptyKeyId ? "" : WifiConfiguration.KEYSTORE_ENGINE_ID);
|
||||||
config.identity.setValue((mEapIdentityView.length() == 0) ? "" :
|
config.identity.setValue((mEapIdentityView.length() == 0) ? "" :
|
||||||
mEapIdentityView.getText().toString());
|
mEapIdentityView.getText().toString());
|
||||||
config.anonymous_identity.setValue((mEapAnonymousView.length() == 0) ? "" :
|
config.anonymous_identity.setValue((mEapAnonymousView.length() == 0) ? "" :
|
||||||
|
Reference in New Issue
Block a user