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

Commit 700f236a authored by Paul Jensen's avatar Paul Jensen
Browse files

Avoid surfacing "Sign in to network" notification if user selects "use as is"

from captive portal app.

Bug:20440795
Change-Id: I2582109008bc8659d64ead316843c15ca573b1ba
parent d0491e9a
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -208,6 +208,8 @@ public class NetworkMonitor extends StateMachine {


    // Set if the user explicitly selected "Do not use this network" in captive portal sign-in app.
    // Set if the user explicitly selected "Do not use this network" in captive portal sign-in app.
    private boolean mUserDoesNotWant = false;
    private boolean mUserDoesNotWant = false;
    // Avoids surfacing "Sign in to network" notification.
    private boolean mDontDisplaySigninNotification = false;


    public boolean systemReady = false;
    public boolean systemReady = false;


@@ -299,11 +301,13 @@ public class NetworkMonitor extends StateMachine {
                            sendMessage(CMD_FORCE_REEVALUATION, 0 /* no UID */, 0);
                            sendMessage(CMD_FORCE_REEVALUATION, 0 /* no UID */, 0);
                            break;
                            break;
                        case ConnectivityManager.CAPTIVE_PORTAL_APP_RETURN_WANTED_AS_IS:
                        case ConnectivityManager.CAPTIVE_PORTAL_APP_RETURN_WANTED_AS_IS:
                            mDontDisplaySigninNotification = true;
                            // TODO: Distinguish this from a network that actually validates.
                            // TODO: Distinguish this from a network that actually validates.
                            // Displaying the "!" on the system UI icon may still be a good idea.
                            // Displaying the "!" on the system UI icon may still be a good idea.
                            transitionTo(mValidatedState);
                            transitionTo(mValidatedState);
                            break;
                            break;
                        case ConnectivityManager.CAPTIVE_PORTAL_APP_RETURN_UNWANTED:
                        case ConnectivityManager.CAPTIVE_PORTAL_APP_RETURN_UNWANTED:
                            mDontDisplaySigninNotification = true;
                            mUserDoesNotWant = true;
                            mUserDoesNotWant = true;
                            mConnectivityServiceHandler.sendMessage(obtainMessage(
                            mConnectivityServiceHandler.sendMessage(obtainMessage(
                                    EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, 0,
                                    EVENT_NETWORK_TESTED, NETWORK_TEST_RESULT_INVALID, 0,
@@ -498,7 +502,7 @@ public class NetworkMonitor extends StateMachine {
            mConnectivityServiceHandler.sendMessage(obtainMessage(EVENT_NETWORK_TESTED,
            mConnectivityServiceHandler.sendMessage(obtainMessage(EVENT_NETWORK_TESTED,
                    NETWORK_TEST_RESULT_INVALID, 0, mNetworkAgentInfo));
                    NETWORK_TEST_RESULT_INVALID, 0, mNetworkAgentInfo));
            // Don't annoy user with sign-in notifications.
            // Don't annoy user with sign-in notifications.
            if (mUserDoesNotWant) return;
            if (mDontDisplaySigninNotification) return;
            // Create a CustomIntentReceiver that sends us a
            // Create a CustomIntentReceiver that sends us a
            // CMD_LAUNCH_CAPTIVE_PORTAL_APP message when the user
            // CMD_LAUNCH_CAPTIVE_PORTAL_APP message when the user
            // touches the notification.
            // touches the notification.