Don't display the "no Internet access" prompt on captive portals.
Bug: 20081183 Bug: 21066461 Change-Id: Idc71844a604f9ca655411c6916de256780ea4586
This commit is contained in:
committed by
The Android Automerger
parent
2943803f73
commit
c2faedca3f
@@ -1982,7 +1982,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
if (msg.arg1 == 0) {
|
||||
setProvNotificationVisibleIntent(false, msg.arg2, 0, null, null);
|
||||
} else {
|
||||
NetworkAgentInfo nai = null;
|
||||
final NetworkAgentInfo nai;
|
||||
synchronized (mNetworkForNetId) {
|
||||
nai = mNetworkForNetId.get(msg.arg2);
|
||||
}
|
||||
@@ -1990,6 +1990,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor");
|
||||
break;
|
||||
}
|
||||
nai.captivePortalDetected = true;
|
||||
setProvNotificationVisibleIntent(true, msg.arg2, nai.networkInfo.getType(),
|
||||
nai.networkInfo.getExtraInfo(), (PendingIntent)msg.obj);
|
||||
}
|
||||
@@ -2384,7 +2385,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
|
||||
// Only prompt if the network is unvalidated and was explicitly selected by the user, and if
|
||||
// we haven't already been told to switch to it regardless of whether it validated or not.
|
||||
if (nai == null || nai.everValidated ||
|
||||
// Also don't prompt on captive portals because we're already prompting the user to sign in.
|
||||
if (nai == null || nai.everValidated || nai.captivePortalDetected ||
|
||||
!nai.networkMisc.explicitlySelected || nai.networkMisc.acceptUnvalidated) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -50,12 +50,11 @@ public class NetworkAgentInfo {
|
||||
public final NetworkMisc networkMisc;
|
||||
// Indicates if netd has been told to create this Network. Once created the appropriate routing
|
||||
// rules are setup and routes are added so packets can begin flowing over the Network.
|
||||
// NOTE: This is a sticky bit; once set it is never cleared.
|
||||
// This is a sticky bit; once set it is never cleared.
|
||||
public boolean created;
|
||||
// Set to true if this Network successfully passed validation or if it did not satisfy the
|
||||
// default NetworkRequest in which case validation will not be attempted.
|
||||
// NOTE: This is a sticky bit; once set it is never cleared even if future validation attempts
|
||||
// fail.
|
||||
// This is a sticky bit; once set it is never cleared even if future validation attempts fail.
|
||||
public boolean everValidated;
|
||||
|
||||
// The result of the last validation attempt on this network (true if validated, false if not).
|
||||
@@ -65,6 +64,10 @@ public class NetworkAgentInfo {
|
||||
// TODO: Fix the network scoring code, remove this, and rename everValidated to validated.
|
||||
public boolean lastValidated;
|
||||
|
||||
// Whether a captive portal was ever detected on this network.
|
||||
// This is a sticky bit; once set it is never cleared.
|
||||
public boolean captivePortalDetected;
|
||||
|
||||
// This represents the last score received from the NetworkAgent.
|
||||
private int currentScore;
|
||||
// Penalty applied to scores of Networks that have not been validated.
|
||||
@@ -101,9 +104,6 @@ public class NetworkAgentInfo {
|
||||
currentScore = score;
|
||||
networkMonitor = new NetworkMonitor(context, handler, this, defaultRequest);
|
||||
networkMisc = misc;
|
||||
created = false;
|
||||
everValidated = false;
|
||||
lastValidated = false;
|
||||
}
|
||||
|
||||
public void addRequest(NetworkRequest networkRequest) {
|
||||
@@ -166,6 +166,7 @@ public class NetworkAgentInfo {
|
||||
"created{" + created + "} " +
|
||||
"explicitlySelected{" + networkMisc.explicitlySelected + "} " +
|
||||
"acceptUnvalidated{" + networkMisc.acceptUnvalidated + "} " +
|
||||
"captivePortalDetected{" + captivePortalDetected + "} " +
|
||||
"}";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user