Handle provisioning APN by turning off/on data.
This is a start and two tests succeed: Tested expired AT&T SIM and waiting 15min for alarm to fire. Tested a provisioned Verizon SIM and works normally. I've NOT tested AT&T where I've properly completed the provisioning. I've NOT tested T-Mobile SIM either provisioned or not-provisioned. I've NOT tested provisioning over WiFi. I've NOT tested that WiFi <-> Mobile works I've NOT tested voice calls, SMS, MMS ... The current bug is below, but it is poorly named either it should be renamed or a new bug created. Bug: 13190133 Change-Id: I0a09f642614cd27a8655e9dae764b8999ce485b8
This commit is contained in:
committed by
Robert Greenwalt
parent
4df83f5734
commit
98fee2c93b
@@ -3975,6 +3975,14 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
*/
|
*/
|
||||||
private static final int CMP_RESULT_CODE_PROVISIONING_NETWORK = 5;
|
private static final int CMP_RESULT_CODE_PROVISIONING_NETWORK = 5;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mobile network is provisioning
|
||||||
|
*/
|
||||||
|
private static final int CMP_RESULT_CODE_IS_PROVISIONING = 6;
|
||||||
|
|
||||||
|
private AtomicBoolean mIsProvisioningNetwork = new AtomicBoolean(false);
|
||||||
|
private AtomicBoolean mIsStartingProvisioning = new AtomicBoolean(false);
|
||||||
|
|
||||||
private AtomicBoolean mIsCheckingMobileProvisioning = new AtomicBoolean(false);
|
private AtomicBoolean mIsCheckingMobileProvisioning = new AtomicBoolean(false);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -4045,11 +4053,25 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
setProvNotificationVisible(true,
|
setProvNotificationVisible(true,
|
||||||
ConnectivityManager.TYPE_MOBILE_HIPRI, ni.getExtraInfo(),
|
ConnectivityManager.TYPE_MOBILE_HIPRI, ni.getExtraInfo(),
|
||||||
url);
|
url);
|
||||||
|
// Mark that we've got a provisioning network and
|
||||||
|
// Disable Mobile Data until user actually starts provisioning.
|
||||||
|
mIsProvisioningNetwork.set(true);
|
||||||
|
MobileDataStateTracker mdst = (MobileDataStateTracker)
|
||||||
|
mNetTrackers[ConnectivityManager.TYPE_MOBILE];
|
||||||
|
mdst.setInternalDataEnable(false);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("CheckMp.onComplete: warm (no dns/tcp), no url");
|
if (DBG) log("CheckMp.onComplete: warm (no dns/tcp), no url");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMP_RESULT_CODE_IS_PROVISIONING: {
|
||||||
|
// FIXME: Need to know when provisioning is done. Probably we can
|
||||||
|
// check the completion status if successful we're done if we
|
||||||
|
// "timedout" or still connected to provisioning APN turn off data?
|
||||||
|
if (DBG) log("CheckMp.onComplete: provisioning started");
|
||||||
|
mIsStartingProvisioning.set(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
loge("CheckMp.onComplete: ignore unexpected result=" + result);
|
loge("CheckMp.onComplete: ignore unexpected result=" + result);
|
||||||
break;
|
break;
|
||||||
@@ -4199,6 +4221,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mCs.mIsStartingProvisioning.get()) {
|
||||||
|
result = CMP_RESULT_CODE_IS_PROVISIONING;
|
||||||
|
log("isMobileOk: X is provisioning result=" + result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// See if we've already determined we've got a provisioning connection,
|
// See if we've already determined we've got a provisioning connection,
|
||||||
// if so we don't need to do anything active.
|
// if so we don't need to do anything active.
|
||||||
MobileDataStateTracker mdstDefault = (MobileDataStateTracker)
|
MobileDataStateTracker mdstDefault = (MobileDataStateTracker)
|
||||||
@@ -4533,19 +4561,20 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void handleMobileProvisioningAction(String url) {
|
private void handleMobileProvisioningAction(String url) {
|
||||||
// Notication mark notification as not visible
|
// Mark notification as not visible
|
||||||
setProvNotificationVisible(false, ConnectivityManager.TYPE_MOBILE_HIPRI, null, null);
|
setProvNotificationVisible(false, ConnectivityManager.TYPE_MOBILE_HIPRI, null, null);
|
||||||
|
|
||||||
// If provisioning network handle as a special case,
|
// If provisioning network handle as a special case,
|
||||||
// otherwise launch browser with the intent directly.
|
// otherwise launch browser with the intent directly.
|
||||||
NetworkInfo ni = getProvisioningNetworkInfo();
|
if (mIsProvisioningNetwork.get()) {
|
||||||
if ((ni != null) && ni.isConnectedToProvisioningNetwork()) {
|
if (DBG) log("handleMobileProvisioningAction: on prov network enable then launch");
|
||||||
if (DBG) log("handleMobileProvisioningAction: on provisioning network");
|
mIsStartingProvisioning.set(true);
|
||||||
MobileDataStateTracker mdst = (MobileDataStateTracker)
|
MobileDataStateTracker mdst = (MobileDataStateTracker)
|
||||||
mNetTrackers[ConnectivityManager.TYPE_MOBILE];
|
mNetTrackers[ConnectivityManager.TYPE_MOBILE];
|
||||||
|
mdst.setEnableFailFastMobileData(DctConstants.ENABLED);
|
||||||
mdst.enableMobileProvisioning(url);
|
mdst.enableMobileProvisioning(url);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("handleMobileProvisioningAction: on default network");
|
if (DBG) log("handleMobileProvisioningAction: not prov network, launch browser directly");
|
||||||
Intent newIntent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
|
Intent newIntent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN,
|
||||||
Intent.CATEGORY_APP_BROWSER);
|
Intent.CATEGORY_APP_BROWSER);
|
||||||
newIntent.setData(Uri.parse(url));
|
newIntent.setData(Uri.parse(url));
|
||||||
|
|||||||
Reference in New Issue
Block a user