[Wi-Fi] Hide Connect button when passpoint is expired

If the passpoint is connected and expired, we still show
Disconnect button.

Bug: 148317997
Test: manual
      Observe a connected passpoint and see Disconnect button.
      Observe a disconnect passpoint and see no Connect button.
      Should add test case in WifiDetailPreferenceController2Test
      at later CL.

Change-Id: I07f22804eccce80c44ac709412cb594faaf6ccb0
This commit is contained in:
Arc Wang
2020-01-31 15:17:24 +08:00
parent 41ff138c21
commit e16ce3dcea

View File

@@ -596,7 +596,17 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
mButtonsPref.setButton1Visible(canForgetNetwork);
mButtonsPref.setButton2Visible(canSignIntoNetwork);
mButtonsPref.setButton3Visible(mWifiEntry.getLevel() != WifiEntry.WIFI_LEVEL_UNREACHABLE);
// 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));
mButtonsPref.setButton3Enabled(canConnectDisconnectNetwork);
mButtonsPref.setButton3Text(getConnectDisconnectButtonTextResource());
mButtonsPref.setButton3Icon(getConnectDisconnectButtonIconResource());