summaryrefslogtreecommitdiffstats
path: root/core/java/android/net
diff options
context:
space:
mode:
authorPaul Jensen <pauljensen@google.com>2015-07-13 15:19:51 -0400
committerPaul Jensen <pauljensen@google.com>2015-07-16 14:41:18 +0000
commitf95d220308492550b7bd6c019e4c725a810cd050 (patch)
tree715a089acbb3b83e941aae85966521c1967c34bc /core/java/android/net
parent5d1654a9439f0ed81ecccecfacda34872270dfcb (diff)
downloadframeworks_base-f95d220308492550b7bd6c019e4c725a810cd050.zip
frameworks_base-f95d220308492550b7bd6c019e4c725a810cd050.tar.gz
frameworks_base-f95d220308492550b7bd6c019e4c725a810cd050.tar.bz2
Disable WiFi autojoin when user decides via "Stay connected?" dialog
If the user selects "No" in the "Stay connected?" dialog box: 1. Disable autojoining that network in the future, and 2. Disassociate from that network. Bug:22187193 Change-Id: I14dc9236c57e3ab7d3ec95edc906787cbfbf3c9f
Diffstat (limited to 'core/java/android/net')
-rw-r--r--core/java/android/net/NetworkAgent.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index e6fc1ea..808a882 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -148,6 +148,13 @@ public abstract class NetworkAgent extends Handler {
*/
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,
NetworkCapabilities nc, LinkProperties lp, int score) {
this(looper, context, logTag, ni, nc, lp, score, null);
@@ -240,6 +247,11 @@ public abstract class NetworkAgent extends Handler {
}
case CMD_SAVE_ACCEPT_UNVALIDATED: {
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) {
}
+ /**
+ * 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);
}