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

Commit 6a665664 authored by Kenny Root's avatar Kenny Root
Browse files

Strip off phase2 prefix when setting spinner

The writing and reading code for phase2 settings were asymmetric so the
phase2 spinner would always be set as "None". This change strips off the
prefix to set the spinner.

Bug: 6482316
Change-Id: Iaaa1088ec22625f1b8e3974c8a9610cccf0dda90
parent e508dc25
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -65,6 +65,8 @@ public class WifiConfigController implements TextWatcher,
        View.OnClickListener, AdapterView.OnItemSelectedListener {
    private static final String KEYSTORE_SPACE = WifiConfiguration.KEYSTORE_URI;

    private static final String PHASE2_PREFIX = "auth=";

    private final WifiConfigUiBase mConfigUi;
    private final View mView;
    private final AccessPoint mAccessPoint;
@@ -357,7 +359,7 @@ public class WifiConfigController implements TextWatcher,
                config.eap.setValue((String) mEapMethodSpinner.getSelectedItem());

                config.phase2.setValue((mPhase2Spinner.getSelectedItemPosition() == 0) ? "" :
                        "auth=" + mPhase2Spinner.getSelectedItem());
                        PHASE2_PREFIX + mPhase2Spinner.getSelectedItem());
                config.ca_cert.setValue((mEapCaCertSpinner.getSelectedItemPosition() == 0) ? "" :
                        KEYSTORE_SPACE + Credentials.CA_CERTIFICATE +
                        (String) mEapCaCertSpinner.getSelectedItem());
@@ -547,7 +549,14 @@ public class WifiConfigController implements TextWatcher,
            if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
                WifiConfiguration config = mAccessPoint.getConfig();
                setSelection(mEapMethodSpinner, config.eap.value());
                setSelection(mPhase2Spinner, config.phase2.value());

                final String phase2Method = config.phase2.value();
                if (phase2Method != null && phase2Method.startsWith(PHASE2_PREFIX)) {
                    setSelection(mPhase2Spinner, phase2Method.substring(PHASE2_PREFIX.length()));
                } else {
                    setSelection(mPhase2Spinner, phase2Method);
                }

                setCertificate(mEapCaCertSpinner, KEYSTORE_SPACE + Credentials.CA_CERTIFICATE,
                        config.ca_cert.value());
                setCertificate(mEapUserCertSpinner, Credentials.USER_PRIVATE_KEY,