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

Commit ef151a1b authored by Nikhil Nayunigari's avatar Nikhil Nayunigari
Browse files

Add defaults for shared and edit config switches in Add network dialog

This change adds a config to set the default for shared and edit config
switches in the Add network dialog

Bug: 409847602

Flag: com.android.settings.connectivity.wifi_multiuser

Test: Manual testing
Change-Id: I315b02fbc90d74f3f167ceee3f7ec0fbfacb7600
parent 254d2901
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -869,4 +869,10 @@

    <!-- Whether the Gaze is enabled -->
    <bool name="config_gazeEnabled">false</bool>

    <!-- Whether to share the WiFi network by default. -->
    <bool name="config_share_network_by_default">true</bool>

    <!-- Whether to allow other device users to edit network configuration of a shared network by default. -->
    <bool name="config_allow_edit_network_configuration_by_default">true</bool>
</resources>
+12 −1
Original line number Diff line number Diff line
@@ -352,12 +352,23 @@ public class WifiConfigController2 implements TextWatcher,

        if (com.android.settings.connectivity.Flags.wifiMultiuser()) {
            int userCount = mUserManager.getUserCount();
            mSharedSwitch.setOnCheckedChangeListener(this);
            mView.findViewById(R.id.sharing_toggle_fields)
                    .setVisibility(userCount > 1 ? View.VISIBLE : View.GONE);
            mEditConfigurationSwitch.setEnabled(false);
            mView.findViewById(R.id.edit_wifi_network_configuration_fields)
                    .setVisibility(userCount > 1 ? View.VISIBLE : View.GONE);

            boolean sharedDefault =
                    mContext.getResources().getBoolean(R.bool.config_share_network_by_default);
            boolean editConfigDefault =
                    mContext.getResources()
                        .getBoolean(R.bool.config_allow_edit_network_configuration_by_default);

            mSharedSwitch.setChecked(sharedDefault);
            mEditConfigurationSwitch.setEnabled(sharedDefault);
            mEditConfigurationSwitch.setChecked(editConfigDefault);

            mSharedSwitch.setOnCheckedChangeListener(this);
        }

        if (mWifiEntry == null) { // new network
+0 −1
Original line number Diff line number Diff line
@@ -232,7 +232,6 @@ public class WifiConfigController2Test {
        final Switch sharedSwitch = mView.findViewById(R.id.share_wifi_network);
        assertThat(sharedSwitch).isNotNull();
        assertThat(sharedSwitch.getVisibility()).isEqualTo(View.VISIBLE);
        sharedSwitch.setChecked(true);

        WifiConfiguration config = mController.getConfig();