commit | 46ed260d0ecf58378399f5f2d8a0214b0c4b6d38 | [log] [tgz] |
---|---|---|
author | Salvador Martinez <dehboxturtle@google.com> | Tue Apr 17 16:08:21 2018 -0700 |
committer | android-build-merger <android-build-merger@google.com> | Tue Apr 17 16:08:21 2018 -0700 |
tree | baf1b33ed2900e10fe0640f3217a5b55e7ec9ca4 | |
parent | 7a9b76f8417138b1f9fd667fee7261832be15b4f [diff] | |
parent | 13c45045de6cc33912b1182f40d07018c63c1843 [diff] |
Merge "Update preference to set password field" into pi-dev am: 13c45045de Change-Id: I7c8f10af2c5b8514865eb83a49bede123f3403a3
diff --git a/src/com/android/settings/widget/ValidatedEditTextPreference.java b/src/com/android/settings/widget/ValidatedEditTextPreference.java index a5bab1c..707da00 100644 --- a/src/com/android/settings/widget/ValidatedEditTextPreference.java +++ b/src/com/android/settings/widget/ValidatedEditTextPreference.java
@@ -74,7 +74,7 @@ editText.removeTextChangedListener(mTextWatcher); if (mIsPassword) { editText.setInputType( - InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); + InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); editText.setMaxLines(1); } editText.addTextChangedListener(mTextWatcher);
diff --git a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java index b38558c..5ba0583 100644 --- a/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java +++ b/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceController.java
@@ -55,6 +55,7 @@ mPassword = generateRandomPassword(); } ((ValidatedEditTextPreference) mPreference).setValidator(this); + ((ValidatedEditTextPreference) mPreference).setIsPassword(true); ((ValidatedEditTextPreference) mPreference).setIsSummaryPassword(true); updatePasswordDisplay((EditTextPreference) mPreference); }
diff --git a/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java b/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java index 5ba9f8a..865422c 100644 --- a/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java +++ b/tests/robotests/src/com/android/settings/widget/ValidatedEditTextPreferenceTest.java
@@ -116,7 +116,7 @@ mPreference.onBindDialogView(mView); assertThat(editText.getInputType() - & (InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)) + & (InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_CLASS_TEXT)) .isNotEqualTo(0); }
diff --git a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java index 60faa2e..7e757ad 100644 --- a/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/wifi/tether/WifiTetherPasswordPreferenceControllerTest.java
@@ -145,4 +145,21 @@ assertThat(mController.getSecuritySettingForPassword()) .isEqualTo(WifiConfiguration.KeyMgmt.WPA2_PSK); } + + @Test + public void updateDisplay_shouldSetInputType() { + // Set controller password to anything and verify is set. + mController.displayPreference(mScreen); + mController.onPreferenceChange(mPreference, "1"); + assertThat(mController.getPassword()).isEqualTo("1"); + + // Create a new config using different password + final WifiConfiguration config = new WifiConfiguration(); + config.preSharedKey = "test_1234"; + when(mWifiManager.getWifiApConfiguration()).thenReturn(config); + + // Call updateDisplay and verify it's changed. + mController.updateDisplay(); + assertThat(mPreference.isPassword()).isTrue(); + } }