DcTracker和DefaultPhoneNotifier的联系

来源:互联网 发布:python mkdtemp 编辑:程序博客网 时间:2024/06/06 01:38

一、主要联系

当数据连接变化时数据图标的刷新过程,主要有这几步:

Step 1:DcTracker::notifyDataConnection  遍历各个apn类型,分别发送通知到phone;Step 2:Phonebase::notifyDataConnection  通知到notifier;Step 3:DefaultPhoneNotifier::notifyDataConnection  调用doNotifyDataConnectionSetp 4:DefaultPhoneNotifier::doNotifyDataConnection  调用notifyDataConnectionForSubscriberStep 5:TelephonyRegistry::notifyDataConnectionForSubscriber  调用onDataConnectionStateChanged

二、具体代码调用

2.1 DcTracker:

public class DcTracker extends DcTrackerBaseprotected void notifyDataConnection(String reason) {    if (DBG) log("notifyDataConnection: reason=" + reason);    for (ApnContext apnContext : mApnContexts.values()) {        if ((mAttached.get() || !mOosIsDisconnect) && apnContext.isReady()) {            if (DBG) log("notifyDataConnection: type:" + apnContext.getApnType());            mPhone.notifyDataConnection(reason != null ? reason : apnContext.getReason(),                    apnContext.getApnType());        }    }    notifyOffApnsOfAvailability(reason);}

2.2 DcTrackerBase:

protected PhoneBase mPhone;

2.3 PhoneBase:

public abstract class PhoneBase extends Handler implements Phonepublic void notifyDataConnection(String reason, String apnType,        PhoneConstants.DataState state) {    mNotifier.notifyDataConnection(this, reason, apnType, state);}
protected PhoneNotifier mNotifier;

2.4 DefaultPhoneNotifier:

public class DefaultPhoneNotifier implements PhoneNotifier
public void notifyDataConnection(Phone sender, String reason, String apnType,        PhoneConstants.DataState state) {    doNotifyDataConnection(sender, reason, apnType, state);}

2.4.1 doNotifyDataConnection:

protected ITelephonyRegistry mRegistry;
mRegistry.notifyDataConnectionForSubscriber();

2.5 TelephonyRegistry:

class TelephonyRegistry extends ITelephonyRegistry.Stub
notifyDataConnectionForSubscriber:r.callback.onDataConnectionStateChanged()

至此,不往下分析了.

原创粉丝点击