Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e16ce3dc authored by Arc Wang's avatar Arc Wang
Browse files

[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
parent 41ff138c
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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());