2.2 setInitialAttachApn
setInitialAttachApn方法调用流程图如下,
DcTrackerBase的setInitialAttachApn方法如下,
setInitialAttachApn(mAllApnSettings, mPreferredApn);
一般第一次开机时, mPreferredApn为null。
mAllApnSettings为当前SIM卡的对应的APN。
setInitialAttachApn方法主要逻辑如下,
1,为三个APN变量赋值,
ApnSetting iaApnSetting = null; //可用APN中类型包含APN_TYPE_IA(ia)的APN
ApnSetting defaultApnSetting = null; //可用APN中包含default类型的APN
ApnSetting firstApnSetting = null; //可用APN的第一个APN
•••
firstApnSetting = apnList.get(0);
for (ApnSetting apn : apnList) {
// Can't use apn.canHandleType(), as that returns true for APNs that have no type.
if (ArrayUtils.contains(apn.types, PhoneConstants.APN_TYPE_IA) &&
apn.carrierEnabled) {
// The Initial A