Disable submit button when PSK pass is invalid

Modified the logic of when to enable the 'connect'/'save'(submit)
button.
PSK is now also recognized as invalid when over 63 characters in length.
Removed the 'isSavedAp' check that only applied the invalid password
check to new networks. Users must now modify networks with a valid psk.

While I was here: Fixed WifiSettingsUiTest from failing due to invalid
WIFI_PREFERENCES string

Bug: 37152520
Bug: 36709852
Test: runtest WifiSettingsUiTest & m RunSettingsRoboTests pass
Change-Id: I273560cbf9124d16034962a2084f36c93973ee83
This commit is contained in:
Glen Kuhne
2017-04-13 15:23:44 -07:00
parent 4bce1569a1
commit 92119d7f55

View File

@@ -403,12 +403,13 @@ public class WifiConfigController implements TextWatcher,
&& ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP
&& mPasswordView.length() == 0) && mPasswordView.length() == 0)
|| (mAccessPointSecurity == AccessPoint.SECURITY_PSK || (mAccessPointSecurity == AccessPoint.SECURITY_PSK
&& mPasswordView.length() < 8))) { && (mPasswordView.length() < 8 || mPasswordView.length() > 63)))) {
passwordInvalid = true; passwordInvalid = true;
} }
if ((mSsidView != null && mSsidView.length() == 0) if ((mSsidView != null && mSsidView.length() == 0)
|| ((mAccessPoint == null || !mAccessPoint.isSaved()) && passwordInvalid)) { || ((mAccessPoint == null || !mAccessPoint.isSaved()) && passwordInvalid
// If AccessPoint is saved (we're modifying it), allow zero length (unchanged) pw
|| mAccessPoint.isSaved() && passwordInvalid && mPasswordView.length() > 0)) {
enabled = false; enabled = false;
} else { } else {
enabled = ipAndProxyFieldsAreValid(); enabled = ipAndProxyFieldsAreValid();