Loading src/com/android/settings/wifi/WifiConfigController2.java +1 −7 Original line number Diff line number Diff line Loading @@ -514,12 +514,6 @@ public class WifiConfigController2 implements TextWatcher, submit.setEnabled(isSubmittable()); } boolean isValidWepPassword(String password) { // Checks for WEP40 and WEP104 password lengths (5 and 13 bytes) int passwordLen = (password != null) ? password.length() : -1; return passwordLen == 5 || passwordLen == 13; } boolean isValidPsk(String password) { if (password.length() == 64 && password.matches("[0-9A-Fa-f]{64}")) { return true; Loading @@ -541,7 +535,7 @@ public class WifiConfigController2 implements TextWatcher, boolean passwordInvalid = false; if (mPasswordView != null && ((mWifiEntrySecurity == WifiEntry.SECURITY_WEP && !isValidWepPassword(mPasswordView.getText().toString())) && mPasswordView.length() == 0) || (mWifiEntrySecurity == WifiEntry.SECURITY_PSK && !isValidPsk(mPasswordView.getText().toString())) || (mWifiEntrySecurity == WifiEntry.SECURITY_SAE Loading tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java +0 −33 Original line number Diff line number Diff line Loading @@ -202,39 +202,6 @@ public class WifiConfigController2Test { assertThat(mController.isSubmittable()).isFalse(); } @Test public void isSubmittable_wepPasswordLength5_returnTrue() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("12345"); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_wepPasswordLength13_returnTrue() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("1234567890123"); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_wepPasswordLength1_returnFalse() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("1"); assertThat(mController.isSubmittable()).isFalse(); } @Test public void isSubmittable_longPsk_shouldReturnFalse() { createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); Loading Loading
src/com/android/settings/wifi/WifiConfigController2.java +1 −7 Original line number Diff line number Diff line Loading @@ -514,12 +514,6 @@ public class WifiConfigController2 implements TextWatcher, submit.setEnabled(isSubmittable()); } boolean isValidWepPassword(String password) { // Checks for WEP40 and WEP104 password lengths (5 and 13 bytes) int passwordLen = (password != null) ? password.length() : -1; return passwordLen == 5 || passwordLen == 13; } boolean isValidPsk(String password) { if (password.length() == 64 && password.matches("[0-9A-Fa-f]{64}")) { return true; Loading @@ -541,7 +535,7 @@ public class WifiConfigController2 implements TextWatcher, boolean passwordInvalid = false; if (mPasswordView != null && ((mWifiEntrySecurity == WifiEntry.SECURITY_WEP && !isValidWepPassword(mPasswordView.getText().toString())) && mPasswordView.length() == 0) || (mWifiEntrySecurity == WifiEntry.SECURITY_PSK && !isValidPsk(mPasswordView.getText().toString())) || (mWifiEntrySecurity == WifiEntry.SECURITY_SAE Loading
tests/robotests/src/com/android/settings/wifi/WifiConfigController2Test.java +0 −33 Original line number Diff line number Diff line Loading @@ -202,39 +202,6 @@ public class WifiConfigController2Test { assertThat(mController.isSubmittable()).isFalse(); } @Test public void isSubmittable_wepPasswordLength5_returnTrue() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("12345"); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_wepPasswordLength13_returnTrue() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("1234567890123"); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_wepPasswordLength1_returnFalse() { when(mWifiEntry.getSecurity()).thenReturn(WifiEntry.SECURITY_WEP); createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); final TextView password = mView.findViewById(R.id.password); assertThat(password).isNotNull(); password.setText("1"); assertThat(mController.isSubmittable()).isFalse(); } @Test public void isSubmittable_longPsk_shouldReturnFalse() { createController(mWifiEntry, WifiConfigUiBase2.MODE_CONNECT, false); Loading