Loading src/com/android/settings/wifi/WifiConfigController.java +10 −2 Original line number Diff line number Diff line Loading @@ -411,15 +411,23 @@ public class WifiConfigController implements TextWatcher, submit.setEnabled(isSubmittable()); } boolean isValidPsk(String password) { if (password.length() == 64 && password.matches("[0-9A-Fa-f]{64}")) { return true; } else if (password.length() >= 8 && password.length() <= 63) { return true; } return false; } boolean isSubmittable() { boolean enabled = false; boolean passwordInvalid = false; if (mPasswordView != null && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || (mAccessPointSecurity == AccessPoint.SECURITY_PSK && (mPasswordView.length() < 8 || mPasswordView.length() > 63)))) { && !isValidPsk(mPasswordView.getText().toString())))) { passwordInvalid = true; } if ((mSsidView != null && mSsidView.length() == 0) Loading tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java +11 −2 Original line number Diff line number Diff line Loading @@ -55,8 +55,9 @@ public class WifiConfigControllerTest { private AccessPoint mAccessPoint; public WifiConfigController mController; // An invalid PSK pass phrase. It is 64 characters long, must not be greater than 63 private static final String HEX_PSK = "01234567012345670123456701234567012345670123456701234567" + "01abcdef"; // An invalid ASCII PSK pass phrase. It is 64 characters long, must not be greater than 63 private static final String LONG_PSK = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl"; // An invalid PSK pass phrase. It is 7 characters long, must be at least 8 Loading Loading @@ -140,6 +141,14 @@ public class WifiConfigControllerTest { } @Test public void isSubmittable_hexPsk_shouldReturnTrue() { final TextView password = mView.findViewById(R.id.password); password.setText(HEX_PSK); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_savedConfigZeroLengthPassword_shouldReturnTrue() { final TextView password = mView.findViewById(R.id.password); Loading Loading
src/com/android/settings/wifi/WifiConfigController.java +10 −2 Original line number Diff line number Diff line Loading @@ -411,15 +411,23 @@ public class WifiConfigController implements TextWatcher, submit.setEnabled(isSubmittable()); } boolean isValidPsk(String password) { if (password.length() == 64 && password.matches("[0-9A-Fa-f]{64}")) { return true; } else if (password.length() >= 8 && password.length() <= 63) { return true; } return false; } boolean isSubmittable() { boolean enabled = false; boolean passwordInvalid = false; if (mPasswordView != null && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || (mAccessPointSecurity == AccessPoint.SECURITY_PSK && (mPasswordView.length() < 8 || mPasswordView.length() > 63)))) { && !isValidPsk(mPasswordView.getText().toString())))) { passwordInvalid = true; } if ((mSsidView != null && mSsidView.length() == 0) Loading
tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java +11 −2 Original line number Diff line number Diff line Loading @@ -55,8 +55,9 @@ public class WifiConfigControllerTest { private AccessPoint mAccessPoint; public WifiConfigController mController; // An invalid PSK pass phrase. It is 64 characters long, must not be greater than 63 private static final String HEX_PSK = "01234567012345670123456701234567012345670123456701234567" + "01abcdef"; // An invalid ASCII PSK pass phrase. It is 64 characters long, must not be greater than 63 private static final String LONG_PSK = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl"; // An invalid PSK pass phrase. It is 7 characters long, must be at least 8 Loading Loading @@ -140,6 +141,14 @@ public class WifiConfigControllerTest { } @Test public void isSubmittable_hexPsk_shouldReturnTrue() { final TextView password = mView.findViewById(R.id.password); password.setText(HEX_PSK); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_savedConfigZeroLengthPassword_shouldReturnTrue() { final TextView password = mView.findViewById(R.id.password); Loading