(M)SIM卡开机流程分析之SPN加载

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

本篇仅以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) {
  
  

                
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值