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
This commit is contained in:
Quang Luong
2020-04-30 19:52:22 -07:00
parent 6debb6a775
commit 0ddc3675c4

View File

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