When a SIM is changed check mobile provisioning.
A simple mechanism for doing this is to take advantage of the fact that we require the device to reboot after a sim has been changed. Thus when connectivity service is started we wait to get a connection then call checkMobileProvisioning once. We also add a check that the DEVICE_PROVISIONED is true, i.e. SetupWizard has been run. Bug: 9784024 Change-Id: I5c1936744f6fc55a447ae44cd36eec3849d27e21
This commit is contained in:
@ -375,6 +375,9 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
|
||||
TelephonyManager mTelephonyManager;
|
||||
|
||||
// We only want one checkMobileProvisioning after booting.
|
||||
volatile boolean mFirstProvisioningCheckStarted = false;
|
||||
|
||||
public ConnectivityService(Context context, INetworkManagementService netd,
|
||||
INetworkStatsService statsService, INetworkPolicyManager policyManager) {
|
||||
// Currently, omitting a NetworkFactory will create one internally
|
||||
@ -2730,6 +2733,17 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
state + "/" + info.getDetailedState());
|
||||
}
|
||||
|
||||
// After booting we'll check once for mobile provisioning
|
||||
// if we've provisioned by and connected.
|
||||
if (!mFirstProvisioningCheckStarted
|
||||
&& (0 != Settings.Global.getInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVICE_PROVISIONED, 0))
|
||||
&& (state == NetworkInfo.State.CONNECTED)) {
|
||||
log("check provisioning after booting");
|
||||
mFirstProvisioningCheckStarted = true;
|
||||
checkMobileProvisioning(true, CheckMp.MAX_TIMEOUT_MS, null);
|
||||
}
|
||||
|
||||
EventLogTags.writeConnectivityStateChanged(
|
||||
info.getType(), info.getSubtype(), info.getDetailedState().ordinal());
|
||||
|
||||
@ -3548,6 +3562,8 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
+ " resultReceiver=" + resultReceiver);
|
||||
enforceChangePermission();
|
||||
|
||||
mFirstProvisioningCheckStarted = true;
|
||||
|
||||
int timeOutMs = suggestedTimeOutMs;
|
||||
if (suggestedTimeOutMs > CheckMp.MAX_TIMEOUT_MS) {
|
||||
timeOutMs = CheckMp.MAX_TIMEOUT_MS;
|
||||
|
Reference in New Issue
Block a user