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

Commit 35b76437 authored by Salvador Martinez's avatar Salvador Martinez
Browse files

Disable hidden network spinner on existing networks

We only want this to be modifiable if you are adding a network
manually, so this CL disables it for existing networks. You
can still see what the spinner is set to though.

Test: robotests
Bug: 78436456
Change-Id: If660e432eca2dabf5bd16881368657ee89fe5a57
parent 8a3bcaa3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ public class WifiConfigController implements TextWatcher,
        mMeteredSettingsSpinner = mView.findViewById(R.id.metered_settings);
        mHiddenSettingsSpinner = mView.findViewById(R.id.hidden_settings);
        mHiddenSettingsSpinner.setOnItemSelectedListener(this);
        mHiddenSettingsSpinner.setEnabled(false);
        mHiddenWarningView = mView.findViewById(R.id.hidden_settings_warning);
        mHiddenWarningView.setVisibility(
                mHiddenSettingsSpinner.getSelectedItemPosition() == NOT_HIDDEN_NETWORK
@@ -238,6 +239,8 @@ public class WifiConfigController implements TextWatcher,
            showIpConfigFields();
            showProxyFields();
            mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
            // Hidden option can be changed only when the user adds a network manually.
            mHiddenSettingsSpinner.setEnabled(true);
            ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox))
                    .setOnCheckedChangeListener(this);

+10 −0
Original line number Diff line number Diff line
@@ -258,6 +258,16 @@ public class WifiConfigControllerTest {
        assertThat(warningView.getVisibility()).isEqualTo(View.GONE);
    }

    @Test
    public void hiddenView_isDisabledWhenAppropriate() {
        View hiddenSpinner = mView.findViewById(R.id.hidden_settings);
        assertThat(hiddenSpinner.isEnabled()).isFalse();

        mController = new TestWifiConfigController(mConfigUiBase, mView, null /* accessPoint */,
                WifiConfigUiBase.MODE_CONNECT);
        assertThat(hiddenSpinner.isEnabled()).isTrue();
    }

    public class TestWifiConfigController extends WifiConfigController {

        private TestWifiConfigController(