Do not change NetworkInfo.DetailedState.

I'd changed DetailedState to force ConnectivityService to treat
provisioning apn's specially. In particular so that they wouldn't
be identified they were fully connected until the provisioning
actually started. The problem is that DetailedState is a public enum
that has a CTS test and just changing the CTS to allow for the new
state (CONNECTED_TO_PROVISIONING_NETWORK) was inappropriate.

Instead I've added a new mIsConnectedToProvisioningNetwork variable
and used the DetailedState.SUSPENDED as the intermediate state.

Bug: 10620248
Change-Id: Id4a842398cad67455541ce629959351c27d83639
This commit is contained in:
Wink Saville
2013-09-05 12:02:25 -07:00
parent 9a1a7ef57c
commit b1a3202e79
2 changed files with 33 additions and 17 deletions

View File

@@ -890,8 +890,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// Find the first Provisioning Network
NetworkInfo provNi = null;
for (NetworkInfo ni : getAllNetworkInfo()) {
if (ni.getDetailedState()
== NetworkInfo.DetailedState.CONNECTED_TO_PROVISIONING_NETWORK) {
if (ni.isConnectedToProvisioningNetwork()) {
provNi = ni;
break;
}
@@ -2805,7 +2804,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
NetworkInfo.State state = info.getState();
if (VDBG || (state == NetworkInfo.State.CONNECTED) ||
(state == NetworkInfo.State.DISCONNECTED)) {
(state == NetworkInfo.State.DISCONNECTED) ||
(state == NetworkInfo.State.SUSPENDED)) {
log("ConnectivityChange for " +
info.getTypeName() + ": " +
state + "/" + info.getDetailedState());
@@ -2820,7 +2820,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
if (ConnectivityManager.isNetworkTypeMobile(info.getType())
&& (0 != Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0))
&& (state == NetworkInfo.State.CONNECTED)) {
&& ((state == NetworkInfo.State.CONNECTED)
|| info.isConnectedToProvisioningNetwork())) {
checkMobileProvisioning(CheckMp.MAX_TIMEOUT_MS);
}
@@ -2833,8 +2834,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
} else if (info.getDetailedState() ==
DetailedState.CAPTIVE_PORTAL_CHECK) {
handleCaptivePortalTrackerCheck(info);
} else if (info.getDetailedState() ==
DetailedState.CONNECTED_TO_PROVISIONING_NETWORK) {
} else if (info.isConnectedToProvisioningNetwork()) {
/**
* TODO: Create ConnectivityManager.TYPE_MOBILE_PROVISIONING
* for now its an in between network, its a network that
@@ -4197,8 +4197,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
// If provisioning network handle as a special case,
// otherwise launch browser with the intent directly.
NetworkInfo ni = getProvisioningNetworkInfo();
if ((ni != null) && ni.getDetailedState() ==
NetworkInfo.DetailedState.CONNECTED_TO_PROVISIONING_NETWORK) {
if ((ni != null) && ni.isConnectedToProvisioningNetwork()) {
if (DBG) log("handleMobileProvisioningAction: on provisioning network");
MobileDataStateTracker mdst = (MobileDataStateTracker)
mNetTrackers[ConnectivityManager.TYPE_MOBILE];