From 21e644a9a817ec8daf4c118a9890057a30e041da Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Fri, 20 May 2011 16:10:59 -0700 Subject: [PATCH] Fix submit button display for WPS Change Icd3fde90 exposed an existing issue where password validity was being checked for WPS as well. Fix it. Bug: 4391449 Change-Id: I60ca8869eee680f5ec71284a1ac6ba956a992312 --- .../settings/wifi/WifiConfigController.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index b433ed92acf..77aa7c71eda 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -265,10 +265,18 @@ public class WifiConfigController implements TextWatcher, if (submit == null) return; boolean enabled = false; + boolean passwordInvalid = false; + + /* Check password invalidity for manual network set up alone */ + if (chosenNetworkSetupMethod() == MANUAL && + ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || + (mAccessPointSecurity == AccessPoint.SECURITY_PSK && mPasswordView.length() < 8))) { + passwordInvalid = true; + } + if ((mSsidView != null && mSsidView.length() == 0) || ((mAccessPoint == null || mAccessPoint.networkId == INVALID_NETWORK_ID) && - ((mAccessPointSecurity == AccessPoint.SECURITY_WEP && mPasswordView.length() == 0) || - (mAccessPointSecurity == AccessPoint.SECURITY_PSK && mPasswordView.length() < 8)))) { + passwordInvalid)) { enabled = false; } else { if (ipAndProxyFieldsAreValid()) { @@ -729,16 +737,14 @@ public class WifiConfigController implements TextWatcher, if (parent == mSecuritySpinner) { mAccessPointSecurity = position; showSecurityFields(); - enableSubmitIfAppropriate(); } else if (parent == mNetworkSetupSpinner) { showNetworkSetupFields(); } else if (parent == mProxySettingsSpinner) { showProxyFields(); - enableSubmitIfAppropriate(); } else { showIpConfigFields(); - enableSubmitIfAppropriate(); } + enableSubmitIfAppropriate(); } @Override