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

Commit dede2312 authored by Paul Jensen's avatar Paul Jensen Committed by Android Git Automerger
Browse files

am 06eabfcc: am 4c55639a: am 8c83be09: am bf10991d: resolved conflicts for...

am 06eabfcc: am 4c55639a: am 8c83be09: am bf10991d: resolved conflicts for merge of 30813942 to mnc-dr-dev

* commit '06eabfcc':
  Disable WiFi autojoin when user decides via "Stay connected?" dialog
parents 114fb59f 06eabfcc
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -193,6 +193,13 @@ public abstract class NetworkAgent extends Handler {
     */
    public static final int CMD_SET_SIGNAL_STRENGTH_THRESHOLDS = BASE + 14;

    /**
     * Sent by ConnectivityService to the NeworkAgent to inform the agent to avoid
     * automatically reconnecting to this network (e.g. via autojoin).  Happens
     * when user selects "No" option on the "Stay connected?" dialog box.
     */
    public static final int CMD_PREVENT_AUTOMATIC_RECONNECT = BASE + 15;

    public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
            NetworkCapabilities nc, LinkProperties lp, int score) {
        this(looper, context, logTag, ni, nc, lp, score, null);
@@ -308,6 +315,10 @@ public abstract class NetworkAgent extends Handler {
                setSignalStrengthThresholds(intThresholds);
                break;
            }
            case CMD_PREVENT_AUTOMATIC_RECONNECT: {
                preventAutomaticReconnect();
                break;
            }
        }
    }

@@ -474,6 +485,15 @@ public abstract class NetworkAgent extends Handler {
    protected void setSignalStrengthThresholds(int[] thresholds) {
    }

    /**
     * Called when the user asks to not stay connected to this network because it was found to not
     * provide Internet access.  Usually followed by call to {@code unwanted}.  The transport is
     * responsible for making sure the device does not automatically reconnect to the same network
     * after the {@code unwanted} call.
     */
    protected void preventAutomaticReconnect() {
    }

    protected void log(String s) {
        Log.d(LOG_TAG, "NetworkAgent: " + s);
    }
+4 −8
Original line number Diff line number Diff line
@@ -2419,14 +2419,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
        }

        if (!accept) {
            // Tell the NetworkAgent that the network does not have Internet access (because that's
            // what we just told the user). This will hint to Wi-Fi not to autojoin this network in
            // the future. We do this now because NetworkMonitor might not yet have finished
            // validating and thus we might not yet have received an EVENT_NETWORK_TESTED.
            nai.asyncChannel.sendMessage(NetworkAgent.CMD_REPORT_NETWORK_STATUS,
                    NetworkAgent.INVALID_NETWORK, 0, null);
            // TODO: Tear the network down once we have determined how to tell WifiStateMachine not
            // to reconnect to it immediately. http://b/20739299
            // Tell the NetworkAgent to not automatically reconnect to the network.
            nai.asyncChannel.sendMessage(NetworkAgent.CMD_PREVENT_AUTOMATIC_RECONNECT);
            // Teardown the nework.
            teardownUnneededNetwork(nai);
        }

    }