am 4f1c9e37: am e0efd004: am 9e2d14be: Merge "Don\'t display the "no Internet access" prompt on captive portals." into mnc-dev
* commit '4f1c9e37a988b026d452580e7e3bdf0ca7f7ee87': Don't display the "no Internet access" prompt on captive portals.
This commit is contained in:
@@ -1982,7 +1982,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
if (msg.arg1 == 0) {
|
if (msg.arg1 == 0) {
|
||||||
setProvNotificationVisibleIntent(false, msg.arg2, 0, null, null);
|
setProvNotificationVisibleIntent(false, msg.arg2, 0, null, null);
|
||||||
} else {
|
} else {
|
||||||
NetworkAgentInfo nai = null;
|
final NetworkAgentInfo nai;
|
||||||
synchronized (mNetworkForNetId) {
|
synchronized (mNetworkForNetId) {
|
||||||
nai = mNetworkForNetId.get(msg.arg2);
|
nai = mNetworkForNetId.get(msg.arg2);
|
||||||
}
|
}
|
||||||
@@ -1990,6 +1990,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor");
|
loge("EVENT_PROVISIONING_NOTIFICATION from unknown NetworkMonitor");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
nai.captivePortalDetected = true;
|
||||||
setProvNotificationVisibleIntent(true, msg.arg2, nai.networkInfo.getType(),
|
setProvNotificationVisibleIntent(true, msg.arg2, nai.networkInfo.getType(),
|
||||||
nai.networkInfo.getExtraInfo(), (PendingIntent)msg.obj);
|
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
|
// 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.
|
// 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) {
|
!nai.networkMisc.explicitlySelected || nai.networkMisc.acceptUnvalidated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,11 @@ public class NetworkAgentInfo {
|
|||||||
public final NetworkMisc networkMisc;
|
public final NetworkMisc networkMisc;
|
||||||
// Indicates if netd has been told to create this Network. Once created the appropriate routing
|
// 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.
|
// 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;
|
public boolean created;
|
||||||
// Set to true if this Network successfully passed validation or if it did not satisfy the
|
// 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.
|
// 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
|
// This is a sticky bit; once set it is never cleared even if future validation attempts fail.
|
||||||
// fail.
|
|
||||||
public boolean everValidated;
|
public boolean everValidated;
|
||||||
|
|
||||||
// The result of the last validation attempt on this network (true if validated, false if not).
|
// 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.
|
// TODO: Fix the network scoring code, remove this, and rename everValidated to validated.
|
||||||
public boolean lastValidated;
|
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.
|
// This represents the last score received from the NetworkAgent.
|
||||||
private int currentScore;
|
private int currentScore;
|
||||||
// Penalty applied to scores of Networks that have not been validated.
|
// Penalty applied to scores of Networks that have not been validated.
|
||||||
@@ -101,9 +104,6 @@ public class NetworkAgentInfo {
|
|||||||
currentScore = score;
|
currentScore = score;
|
||||||
networkMonitor = new NetworkMonitor(context, handler, this, defaultRequest);
|
networkMonitor = new NetworkMonitor(context, handler, this, defaultRequest);
|
||||||
networkMisc = misc;
|
networkMisc = misc;
|
||||||
created = false;
|
|
||||||
everValidated = false;
|
|
||||||
lastValidated = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRequest(NetworkRequest networkRequest) {
|
public void addRequest(NetworkRequest networkRequest) {
|
||||||
@@ -166,6 +166,7 @@ public class NetworkAgentInfo {
|
|||||||
"created{" + created + "} " +
|
"created{" + created + "} " +
|
||||||
"explicitlySelected{" + networkMisc.explicitlySelected + "} " +
|
"explicitlySelected{" + networkMisc.explicitlySelected + "} " +
|
||||||
"acceptUnvalidated{" + networkMisc.acceptUnvalidated + "} " +
|
"acceptUnvalidated{" + networkMisc.acceptUnvalidated + "} " +
|
||||||
|
"captivePortalDetected{" + captivePortalDetected + "} " +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user