Update add network dialog to not make networks hidden by default

This CL updates the add network dialog to use the provided value
for the hidden state (from androids perspective) of the network. The
default selected value will always be not hidden and if the user
selects to mark it as hidden a warning will appear to inform the
user of the privacy implications.

Test: Robotests
Bug: 29003359
Change-Id: Ifd4511e4d0af6eb01f4e951c22a91fc560393e8d
This commit is contained in:
Salvador Martinez
2018-03-29 21:29:30 -07:00
parent 49d0205749
commit 8bc3fa0649
5 changed files with 76 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ public class WifiConfigControllerTest {
private AccessPoint mAccessPoint;
@Mock
private KeyStore mKeyStore;
private Spinner mHiddenSettingsSpinner;
public WifiConfigController mController;
private static final String HEX_PSK = "01234567012345670123456701234567012345670123456701234567"
@@ -82,6 +83,7 @@ public class WifiConfigControllerTest {
when(mAccessPoint.getSecurity()).thenReturn(AccessPoint.SECURITY_PSK);
mView = LayoutInflater.from(mContext).inflate(R.layout.wifi_dialog, null);
final Spinner ipSettingsSpinner = mView.findViewById(R.id.ip_settings);
mHiddenSettingsSpinner = mView.findViewById(R.id.hidden_settings);
ipSettingsSpinner.setSelection(DHCP);
mController = new TestWifiConfigController(mConfigUiBase, mView, mAccessPoint,
@@ -246,6 +248,16 @@ public class WifiConfigControllerTest {
assertThat(password.isFocused()).isTrue();
}
@Test
public void hiddenWarning_warningVisibilityProperlyUpdated() {
View warningView = mView.findViewById(R.id.hidden_settings_warning);
mController.onItemSelected(mHiddenSettingsSpinner, null, mController.HIDDEN_NETWORK, 0);
assertThat(warningView.getVisibility()).isEqualTo(View.VISIBLE);
mController.onItemSelected(mHiddenSettingsSpinner, null, mController.NOT_HIDDEN_NETWORK, 0);
assertThat(warningView.getVisibility()).isEqualTo(View.GONE);
}
public class TestWifiConfigController extends WifiConfigController {
private TestWifiConfigController(