本篇仅以USIM卡为例进行代码分析
从之前对于UiccController.java文件进行分析中,我们知道UiccController中创建了UiccCard,而在UiccCard中创建了一个UiccCardAppliaction对象,而在UiccCardApplication的构造方法中,调用了如下方法:
UiccCardApplication(UiccCard uiccCard,
IccCardApplicationStatus as,
Context c,
CommandsInterface ci) {
......
mIccFh = createIccFileHandler(as.app_type);
mIccRecords = createIccRecords(as.app_type, mContext, mCi);
......
}通过createIccFileHandler和createIccRecords方法,创建了IccFileHandler和IccRecords对象
private IccFileHandler createIccFileHandler(AppType type) {
switch (type) {
case APPTYPE_SIM:
return new SIMFileHandler(this, mAid, mCi);
case APPTYPE_RUIM:
return new RuimFileHandler(this, mAid, mCi);
case APPTYPE_USIM:
return new UsimFileHandler(this, mAid, mCi);
case APPTYPE_CSIM:
return new CsimFileHandler(this, mAid, mCi);
case APPTYPE_ISIM:
return new IsimFileHandler(this, mAid, mCi);
default:
return null;
}
}
private IccRecords createIccRecords(AppType type, Context c, CommandsInterface ci) {
if (type == AppType.APPTYPE_USIM || type == AppType.APPTYPE_SIM) {
return new SIMRecords(this, c, ci);
} else if (type == AppType.APPTYPE_RUIM || type == AppType.APPTYPE_CSIM){
return new RuimRecords(this, c, ci);
} else if (type == AppType.APPTYPE_ISIM) {
return new IsimUiccRecords(this, c, ci);
} else {
// Unknown app type (maybe detection is still in progress)
return null;
}
}由于是USIM卡,因此创建的是SIMRecords和UsimFileHandler对象,接下来我们进入SIMRecords.java的构造方法,传入的参数分别为当前的UiccCardApplication对象,上下文对象,和RIL对象(从之前的分析中我们知道)
public SIMRecords(UiccCardApplication app, Context c, CommandsInterface ci) {

本文详细分析了USIM卡开机时SPN(ServiceProviderName)的加载过程,从UiccController到UiccCardApplication,再到SIMRecords,探讨了如何通过RIL对象获取SIMRecords数据,并最终设置ServiceProviderName。在接收到EVENT_APP_READY消息后,通过getSpnFsm方法处理,经过多次状态转换,确保SPN的正确加载。如果存在自定义SPN,则会覆盖默认的SPN设置。
最低0.47元/天 解锁文章
4487

被折叠的 条评论
为什么被折叠?



