Merge "Disable WiFi autojoin when user decides via "Stay connected?" dialog" into mnc-dev
This commit is contained in:
@@ -148,6 +148,13 @@ public abstract class NetworkAgent extends Handler {
|
|||||||
*/
|
*/
|
||||||
public static final int CMD_REQUEST_BANDWIDTH_UPDATE = BASE + 10;
|
public static final int CMD_REQUEST_BANDWIDTH_UPDATE = BASE + 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 + 11;
|
||||||
|
|
||||||
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni,
|
||||||
NetworkCapabilities nc, LinkProperties lp, int score) {
|
NetworkCapabilities nc, LinkProperties lp, int score) {
|
||||||
this(looper, context, logTag, ni, nc, lp, score, null);
|
this(looper, context, logTag, ni, nc, lp, score, null);
|
||||||
@@ -240,6 +247,11 @@ public abstract class NetworkAgent extends Handler {
|
|||||||
}
|
}
|
||||||
case CMD_SAVE_ACCEPT_UNVALIDATED: {
|
case CMD_SAVE_ACCEPT_UNVALIDATED: {
|
||||||
saveAcceptUnvalidated(msg.arg1 != 0);
|
saveAcceptUnvalidated(msg.arg1 != 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CMD_PREVENT_AUTOMATIC_RECONNECT: {
|
||||||
|
preventAutomaticReconnect();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -365,6 +377,15 @@ public abstract class NetworkAgent extends Handler {
|
|||||||
protected void saveAcceptUnvalidated(boolean accept) {
|
protected void saveAcceptUnvalidated(boolean accept) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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) {
|
protected void log(String s) {
|
||||||
Log.d(LOG_TAG, "NetworkAgent: " + s);
|
Log.d(LOG_TAG, "NetworkAgent: " + s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2378,14 +2378,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!accept) {
|
if (!accept) {
|
||||||
// Tell the NetworkAgent that the network does not have Internet access (because that's
|
// Tell the NetworkAgent to not automatically reconnect to the network.
|
||||||
// what we just told the user). This will hint to Wi-Fi not to autojoin this network in
|
nai.asyncChannel.sendMessage(NetworkAgent.CMD_PREVENT_AUTOMATIC_RECONNECT);
|
||||||
// the future. We do this now because NetworkMonitor might not yet have finished
|
// Teardown the nework.
|
||||||
// validating and thus we might not yet have received an EVENT_NETWORK_TESTED.
|
teardownUnneededNetwork(nai);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user