Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f543a71e authored by Kenny Root's avatar Kenny Root
Browse files

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
parent e508dc25
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ public class WifiConfigController implements TextWatcher,
        if (config == null) {
            return false;
        }
        if (config.key_id.value() != null) {
        if (!TextUtils.isEmpty(config.key_id.value())) {
            return true;
        }
        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) ?
                        "" : KEYSTORE_SPACE + Credentials.USER_CERTIFICATE +
                        (String) mEapUserCertSpinner.getSelectedItem());
                config.engine.setValue(WifiConfiguration.ENGINE_ENABLE);
                config.engine_id.setValue(WifiConfiguration.KEYSTORE_ENGINE_ID);
                config.key_id.setValue((mEapUserCertSpinner.getSelectedItemPosition() == 0) ?
                        "" : Credentials.USER_PRIVATE_KEY +
                final boolean isEmptyKeyId = (mEapUserCertSpinner.getSelectedItemPosition() == 0);
                config.key_id.setValue(isEmptyKeyId ? "" : Credentials.USER_PRIVATE_KEY +
                        (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) ? "" :
                        mEapIdentityView.getText().toString());
                config.anonymous_identity.setValue((mEapAnonymousView.length() == 0) ? "" :