android framework的opt/telephony是啥进程

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android framework的opt/telephony是啥进程相关的知识,希望对你有一定的参考价值。

本文代码以MTK平台android 6.0为分析对象,与Google原生AOSP有些许差异,请读者知悉。
PhoneApp(包名com.android.phone)主要代码位于

packages/services/Telephony/
frameworks/opt/telephony/
frameworks/base/telephony/

com.android.phone进程是persistent的,在开机过程中被ActivityManagerService自动启动,下图为该进程启动将要涉及到的类(以GSMPhone为例),图中类之间的关系表达可能不太准确,仅供参考。
参考技术A rom Keith and Stuart, they declared themselv

kaifyou Android 7.0 UICC 分析

本文讲解SIMRecords

/frameworks/opt/telephony/src/java/com/android/internal/telephony/uicc/SIMRecords.java

构造方法:

    public SIMRecords(UiccCardApplication app, Context c, CommandsInterface ci) {
        super(app, c, ci);
        mAdnCache = new AdnRecordCache(mFh);
        mVmConfig = new VoiceMailConstants();
        mSpnOverride = new SpnOverride();

        mCi.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);//消息注册,当Ci接收到EVENT_SMS_ON_SIM消息通知SIMRecords
        mCi.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);

        // Start off by setting empty state
        resetRecords();
        mParentApp.registerForReady(this, EVENT_APP_READY, null);//当卡准备好,UiccCardApplication会通过notifyReadyRegistrantsifNeeded()通知SIMRecords
        mParentApp.registerForLocked(this, EVENT_APP_LOCKED, null);//EVENT_APP_LOCKED消息同样处理
        if (DBG) log("SIMRecords X ctor this=" + this);

        IntentFilter intentfilter = new IntentFilter();
        intentfilter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        c.registerReceiver(mReceiver, intentfilter); //接收ACTION_CARRIER_CONFIG_CHANGED消息的处理
    }

 

接收UiccCardApplication 的通知,消息EVENT_APP_READY、EVENT_APP_LOCKED 的处理:

        try { switch (msg.what) {
            case EVENT_APP_READY:
                onReady();
                break;

            case EVENT_APP_LOCKED:
                onLocked();
                break;
            }

onReady() 方法,直接调用fetchSimRecords(),到这里开始加载EF文件信息:

具体的读取SIM卡EF文件信息的过程是有IccFileHandler来实现的,根据EF文件的类型,调用不同的方法loadEFTransparent()和loadEFLinearFixed(),最终都会调用RILJ 的iccIOForApp() 方法;

    protected void fetchSimRecords() {
        if (DBG) log("fetchSimRecords " + mRecordsToLoad);

        mCi.getIMSIForApp(mParentApp.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));//获取IMSI信息,返回的数据在该类handleMessage()中处理
        mRecordsToLoad++;  //没读取一项信息,计数值就加1
        mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));//获取ICCID
        mRecordsToLoad++;

        // Same goes for Call Forward Status indicator: fetch both
        // EF[CFIS] and CPHS-EF, with EF[CFIS] preferred.
        loadCallForwardingRecords();
        getSpnFsm(true, null);
        loadEfLiAndEfPl();

        if (CRASH_RIL) {
            String sms = "0107912160130310f20404d0110041007030208054832b0120"
                         + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
                         + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
                         + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
                         + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
                         + "ffffffffffffffffffffffffffffff";
            byte[] ba = IccUtils.hexStringToBytes(sms);
            mFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
                            obtainMessage(EVENT_MARK_SMS_READ_DONE, 1));
        }
        if (DBG) log("fetchSimRecords " + mRecordsToLoad + " requested: " + mRecordsRequested);
    }

 

以上是关于android framework的opt/telephony是啥进程的主要内容,如果未能解决你的问题,请参考以下文章

android的 frameworks文件夹在哪?像frameworks/base/voip/jni/rtp在哪?

Android 修改默认WiFi热点名称

Android5.0框架层短信接收过程分析

linux中 /opt 和 /opt/ 有啥区别?

改动Android启动画面

Android 7.0 UICC 分析