PhoneApp的初步独立分析

来源:互联网 发布:淘宝买家钻号 编辑:程序博客网 时间:2024/05/22 14:08

在phoneapp中,首先初始化了两个东西phonegloabls和telephoneglobals

40            mPhoneGlobals = new PhoneGlobals(this);41            mPhoneGlobals.onCreate();4243            mTelephonyGlobals = new TelephonyGlobals(this);44            mTelephonyGlobals.onCreate();
91 * Global state for the telephony subsystem when running in the primary92 * phone process.

在phonegloabls中,主要创建了phone实体。

   PhoneFactory.makeDefaultPhones(this);

创建了CallManager

   mCM = CallManager.getInstance();
创建了Callcontroller

callController = CallController.init(this, callLogger, callGatewayManager);


PhoneFactory.java

这个是phone的工厂啊,在phonegloabls中使用了makedefaultphone方法,里面干了啥

想想一个手机有什么?

1.手机协议

2.手机卡

里面就搞了这两个东西罗

手机卡

  SubscriptionController.init(context, sCommandsInterfaces);               // Instantiate UiccController so that all other classes can just               // call getInstance()  mUiccController = UiccController.make(context, sCommandsInterfaces);

手机协议
 phone = new GSMPhone(context,sCommandsInterfaces[i], sPhoneNotifier, i);
我们看到一个phone实例的建设是跟一个Ril相关的,Ril就厉害了,属于modem的东西,里面肯定建立了一套通信机制啦
果不其然,Ril中果然建立了一个连接socket,我们可以在Ril的构造函数中看到
916                mReceiver = new RILReceiver();917                mReceiverThread = new Thread(mReceiver, "RILReceiver" + mInstanceId);918                mReceiverThread.start();
这个mreceiver就是一个receiver,一个runner
通过阅读Ril,发现他实现了CommandsInterface这个接口,
注册ICC的抽象函数
269    void registerForIccStatusChanged(Handler h, int what, Object obj);270    void unregisterForIccStatusChanged(Handler h);



0 0