From 0ddc3675c4c3e9c0c0633c0c9fec0fe041ce1be4 Mon Sep 17 00:00:00 2001 From: Quang Luong Date: Thu, 30 Apr 2020 19:52:22 -0700 Subject: [PATCH] Remove Connect/Disconnect button dependence on WifiEntry.isExpired() WifiEntry.canConnect() may be true even if isExpired() is true, such as in the case of connecting to renew a subscription. Thus, the connect/disconnect button should only rely on canConnect() and canDisconnect() (as well as the intermediate state of connecting) to determine its visibility. Bug: 150384136 Test: manually install expired passpoint profile and verify if the connect button is visible and working. Change-Id: Ibfdf285f3b97fd0de88804d4658df20bd67bf8e0 --- .../details2/WifiDetailPreferenceController2.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java index 58299c848c2..a8845765075 100644 --- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java +++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java @@ -666,17 +666,10 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle mButtonsPref.setButton1Visible(canForgetNetwork); mButtonsPref.setButton2Visible(showCaptivePortalButton); - // If it's expired and connected, shows Disconnect button for users to disconnect it. - // If it's expired and not connected, hides the button and users are not able to connect it. - // - // expired connected visibility - // false false true show (Connect) button - // false true true show (Disconnect) button - // true false false hide button - // true true true show (Disconnect) button - mButtonsPref.setButton3Visible(mWifiEntry.getLevel() != WifiEntry.WIFI_LEVEL_UNREACHABLE - && (!mWifiEntry.isExpired() - || mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTED)); + // Keep the connect/disconnected button visible if we can connect/disconnect, or if we are + // in the middle of connecting (greyed out). + mButtonsPref.setButton3Visible(canConnectDisconnectNetwork + || mWifiEntry.getConnectedState() == WifiEntry.CONNECTED_STATE_CONNECTING); mButtonsPref.setButton3Enabled(canConnectDisconnectNetwork); mButtonsPref.setButton3Text(getConnectDisconnectButtonTextResource()); mButtonsPref.setButton3Icon(getConnectDisconnectButtonIconResource());