Merge "Allow 64 char HEX string PSKs in WifiSettingsUi" into oc-mr1-dev am: 85f59ff42d

am: 91aeed6f55

Change-Id: I65d9d59816f9a1b248bfa9bcf7e801260f60bc01
This commit is contained in:
Glen Kuhne
2017-10-12 19:14:50 +00:00
committed by android-build-merger
2 changed files with 21 additions and 4 deletions

View File

@@ -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)