From 92119d7f55d6eec5e25e62a65c64f2a7c35d13da Mon Sep 17 00:00:00 2001 From: Glen Kuhne Date: Thu, 13 Apr 2017 15:23:44 -0700 Subject: [PATCH] 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 --- src/com/android/settings/wifi/WifiConfigController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index fe2bbb34d6c..5fb650097b6 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -403,12 +403,13 @@ public class WifiConfigController implements TextWatcher, && ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || (mAccessPointSecurity == AccessPoint.SECURITY_PSK - && mPasswordView.length() < 8))) { + && (mPasswordView.length() < 8 || mPasswordView.length() > 63)))) { passwordInvalid = true; } - 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; } else { enabled = ipAndProxyFieldsAreValid();