当前位置:   article > 正文

Android 12 版本 Data Call 移动数据业务流程分析_android multisimsettingcontroller

android multisimsettingcontroller

目录

前言

基础知识

APN

初始化ApnContext

DataConnection

 开启移动数据业务

总流程图

前言

本文档将基于Android 12  AOSP源码进行流程分析,围绕DcTracker的核心处理机制和关键业务流程,疏通Android手机的移动数据业务基本原理和关键流程,我把流程图放在了最后。

之前我疏忽了,Android12仍然采用的是DcTracker,但从13开始已经默认使用DataNetworkController作为数据栈了,14开始将会彻底删除老版本的数据栈DcTracker,下次会给大家带来最新的DataNetworkController的解析。

基础知识

TeleService系统应用在创建GsmCdmaPhone对象时,在该Phone对象的构造方法内会同时创建DcTracker对象。DcTracker自身继承于Handler,在构造方法中主要实现了以下三个业务:

  • 初始化ApnContext
  • 注册各类监听(广播接收器、Observer, Handler消息注册)
  • 创建DcController对象
  1. /frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
  2. public DcTracker(Phone phone, @TransportType int transportType) {
  3. super();
  4. mPhone = phone;
  5. ......
  6. mResolver = mPhone.getContext().getContentResolver();
  7. ......
  8. IntentFilter filter = new IntentFilter();
  9. filter.addAction(Intent.ACTION_SCREEN_ON);
  10. filter.addAction(Intent.ACTION_SCREEN_OFF);
  11. filter.addAction(INTENT_DATA_STALL_ALARM);
  12. filter.addAction(INTENT_PROVISIONING_APN_ALARM);
  13. filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
  14. filter.addAction(TelephonyManager.ACTION_SIM_CARD_STATE_CHANGED);
  15. filter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED);
  16. mDataEnabledSettings = mPhone.getDataEnabledSettings();
  17. //注意这个把自身作为handler传过去方便之后传递消息,当数据业务开关状态改变时会通过这个通知DCTracker
  18. mDataEnabledSettings.registerForDataEnabledChanged(this, DctConstants.EVENT_DATA_ENABLED_CHANGED, null);
  19. mDataEnabledSettings.registerForDataEnabledOverrideChanged(this, DctConstants.EVENT_DATA_ENABLED_OVERRIDE_RULES_CHANGED);
  20. mPhone.getContext().registerReceiver(mIntentReceiver, filter, null, mPhone);
  21. mHandlerThread = new HandlerThread("DcHandlerThread");
  22. mHandlerThread.start();
  23. Handler dcHandler = new Handler(mHandlerThread.getLooper());
  24. //创建DcController对象
  25. mDcc = DcController.makeDcc(mPhone, this, mDataServiceManager, dcHandler.getLooper(),
  26. tagSuffix);
  27. registerForAllEvents();
  28. mApnObserver = new ApnChangeObserver();
  29. phone.getContext().getContentResolver().registerContentObserver(
  30. Telephony.Carriers.CONTENT_URI, true, mApnObserver);
  31. //初始化各类ApnContext
  32. initApnContexts();
  33. addDefaultApnSettingsAsNeeded();
  34. mSettingsObserver = new SettingsObserver(mPhone.getContext(), this);
  35. registerSettingsObserver();
  36. mThrottleStatusCallback = new ThrottleStatusChangedCallback();
  37. mDataThrottler.registerForThrottleStatusChanges(mThrottleStatusCallback);
  38. }

APN

APN(Access Point Name)是Android手机实现移动数据上网业务必须配置的参数,用来决定手机使用哪一种方式访问网络,其配置信息保存在telephony.db中的名为carriers的表中。关键字段如下:

字段

说明

name

APN配置名称

numeric

运营商编号

apn

APN接入点, 中国移动cmwap和cmnet

proxy

代理服务器地址

port

端口号

mmsproxy

彩信代理服务器地址

mmsport

彩信代理服务器端口号

mmsc

彩信接入服务地址

type

APN接入类型

APN配置信息一旦有问题就会导致无法上网。那如果需要做国内手机的Android定制化开发,或是国外的定制化开发,应该怎么增加APN配置呢?有三个方法:

  • 定制化项目本地xml配置文件
  • 在线更新
  • APN配置管理界面手动增加

这里厂商常用的是前两个方法,我们不可能要求用户自己手动添加配置,因此厂商在定制开发过程中,会将APN配置信息提前配好,在TelephonyProvider的initDatabase方法里将APN信息插入表中.

比如我手头上的某手机厂商项目中,使用了前两个方法:

  1. private File getApnConfFile() {
  2. //加载本地预置配置文件
  3. File confFile = new File(Environment.getRootDirectory(), PARTNER_APNS_PATH);
  4. File oemConfFile = new File(Environment.getOemDirectory(), OEM_APNS_PATH);
  5. File updatedConfFile = new File(Environment.getDataDirectory(), OTA_UPDATED_APNS_PATH);
  6. File productConfFile = new File(Environment.getProductDirectory(), PARTNER_APNS_PATH);
  7. //厂商的在线更新配置文件,这样更新重启手机后会更新表中的数据
  8. File onlineConfFile = new File(ONLINE_UPDATED_APNS_PATH);
  9. confFile = pickSecondIfExists(confFile, oemConfFile);
  10. confFile = pickSecondIfExists(confFile, productConfFile);
  11. confFile = pickSecondIfExists(confFile, updatedConfFile);
  12. confFile = getNewerFile(confFile, onlineConfFile);
  13. return confFile;
  14. }

本地配置中截取部分APN配置信息如下:

  1. <apn carrier="中国移动 (China Mobile) GPRS"
  2. carrier_id = "1435"
  3. mcc="460"
  4. mnc="00"
  5. apn="cmnet"
  6. type="default,supl"
  7. />
  8. <apn carrier="中国移动 (China Mobile) WAP"
  9. carrier_id = "1435"
  10. mcc="460"
  11. mnc="00"
  12. apn="cmwap"
  13. proxy="10.0.0.172"
  14. port="80"
  15. type="default,supl"
  16. />

初始化ApnContext

在DcTracker构造方法里将调用initApnContexts方法初始化ApnContext,每个ApnContext对象用来保存对应APN网络类型的配置参数、连接状态等等。

  1. private void initApnContexts() {
  2. PersistableBundle carrierConfig;
  3. //查看是否有运营商配置服务
  4. CarrierConfigManager configManager = (CarrierConfigManager) mPhone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
  5. if (configManager != null) {
  6. carrierConfig = configManager.getConfigForSubId(mPhone.getSubId());
  7. } else {
  8. carrierConfig = null;
  9. }
  10. initApnContexts(carrierConfig);
  11. }
  12. private void initApnContexts(PersistableBundle carrierConfig) {
  13. // 从本地资源中加载网络配置
  14. final Collection<ApnConfigType> types =
  15. new ApnConfigTypeRepository(carrierConfig).getTypes();
  16. for (ApnConfigType apnConfigType : types) {
  17. ApnContext apnContext = new ApnContext(mPhone, apnConfigType.getType(), mLogTag, this,
  18. apnConfigType.getPriority());
  19. ......
  20. mPrioritySortedApnContexts.add(apnContext);
  21. ......
  22. }
  23. mPrioritySortedApnContexts.sort((c1, c2) -> c2.getPriority() - c1.getPriority());
  24. }

在初始化ApnContext时,会创建ApnConfigTypeRepository对象,sDefaults对象是里面的一个静态对象,在静态代码块完成初始化,在初始化时就会添加很多默认的配置参数,包括我们关注的网络配置信息:

  1. sDefaults.putStringArray(KEY_APN_PRIORITY_STRING_ARRAY, new String[] {
  2. "enterprise:0", "default:1", "mms:2", "supl:2", "dun:2", "hipri:3", "fota:2",
  3. "ims:2", "cbs:2", "ia:2", "emergency:2", "mcx:3", "xcap:3"
  4. });

从默认配置参数可以得到13个ApnConfigType对象,从而创建出13个ApnContext对象,字符串数组中每个字符串中":'之前代表一种网络配置,":"后面的数字代表着该配置的优先级,所以优先级从高到低依次是

hipri -> mcx -> xcap -> mmx -> supl -> dun -> fota -> ims -> cbs -> ia -> emergency -> default -> enterprise。

手机上网将建立default类型的数据连接,当彩信来时,因为彩信建立的是mms类型,优先级比default高,所以会断开default连接而创建mms连接,因此,在发送和接收彩信的同时不能上网 。

DataConnection

DataConnection是用来在Telephony业务模型中管理移动数据业务的类,一个DataConnection对象代表手机移动数据业务的一个数据连接。

DataConnection继承与StateMachine类,是一个典型的状态机,内部定义了6个状态类,全部继承与State类,每个状态类内部封装了对应状态下的较复杂的逻辑处理。

State子类

说明

DcDefaultState

默认状态

DcInactiveState

不活动状态

DcActivatingState

正在激活状态

DcActiveState

激活状态

DcDisconnectingState

正在断开中状态

DcDisconnectionErrorCreatingConnection

在创建连接后正处于断开中状态

源自状态机模式带来的优势,DataConnection切换不同连接状态时,不必操心切换状态的复杂逻辑处理,只需要通过使用内部的handler发送消息切到对应状态,之后交给对应状态类内部实现的processMessage方法处理即可。

在DataConnection的构造方法里面通过addState方法添加这6个状态对象,并且给除了DcDefaultState以外的每个状态指定父状态为DcDefaultState,这样就形成了一个树形结构,当一个State对象不能处理一个消息时就会向上交给父节点处理。

 

 开启移动数据业务

手机可以通过以下两个交互界面开启或关闭移动数据业务:

  • 通知栏快捷控制
  • Settings -> Mobile network设置界面

流程分析:

打开或关闭移动数据业务的入口是TelephonyManager.setDataEnabledForReason方法,传入两个参数——切换原因和切换状态。(以前版本用的setDataEnabled方法已过时)

  1. @RequiresPermission(Manifest.permission.MODIFY_PHONE_STATE)
  2. @RequiresFeature(PackageManager.FEATURE_TELEPHONY_DATA)
  3. public void setDataEnabledForReason(@DataEnabledReason int reason, boolean enabled) {
  4. setDataEnabledForReason(getSubId(), reason, enabled);
  5. }

主要有四种理由:

  • DATA_ENABLED_REASON_USER(用户操作控制)
  • DATA_ENABLED_REASON_POLICY(由于policy数据业务被控制,通常是被限制)
  • DATA_ENABLED_REASON_CARRIER(运营商特殊设置控制)
  • DATA_ENABLED_REASON_THERMAL(热服务控制)

TelephonyManager的私有方法通过IBinder远程调用 ITelephony(PhoneInterfaceManager).setDataEnabledForReason 方法,接下来我们重点关注用户操作控制这一条链路:

  1. /packages/services/Telephony/src/com/android/phone/PhoneInterfaceManager.java
  2. @Override
  3. public void setDataEnabledForReason(int subId, @TelephonyManager.DataEnabledReason int reason, boolean enabled, String callingPackage) {
  4. //检查权限
  5. ......
  6. phone.getDataEnabledSettings().setDataEnabled(reason, enabled);
  7. ......
  8. }
  1. /frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataEnabledSettings.java
  2. public synchronized void setDataEnabled(@TelephonyManager.DataEnabledReason int reason, boolean enabled) {
  3. switch (reason) {
  4. case TelephonyManager.DATA_ENABLED_REASON_USER:
  5. setUserDataEnabled(enabled);
  6. break;
  7. //其他理由
  8. ......
  9. }
  10. }
  11. }
  12. private synchronized void setUserDataEnabled(boolean enabled) {
  13. // By default the change should propagate to the group.
  14. setUserDataEnabled(enabled, true);
  15. }
  16. public synchronized void setUserDataEnabled(boolean enabled, boolean notifyMultiSimSettingController) {
  17. ......
  18. //先更新数据库设置
  19. boolean changed = GlobalSettingsHelper.setInt(mPhone.getContext(), Settings.Global.MOBILE_DATA, mPhone.getSubId(), (enabled ? 1 : 0));
  20. if (changed) {
  21. ......
  22. //还记得DcTacker构造方法里面的添加监听方法吗,DcTacker就是在这里面接收到数据业务状态改变的通知
  23. updateDataEnabledAndNotify(REASON_USER_DATA_ENABLED);
  24. ......
  25. }
  26. }

DataEnabledSettings使用从DcTracker传过来的handler对象(也就是DcTracker本身)发送消息,DcTracker在handleMessage方法里开始处理消息:

  1. /frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DcTracker.java
  2. @Override
  3. public void handleMessage (Message msg) {
  4. ......
  5. switch (msg.what) {
  6. ......
  7. case DctConstants.EVENT_DATA_ENABLED_CHANGED:
  8. ar = (AsyncResult) msg.obj;
  9. if (ar.result instanceof Pair) {
  10. Pair<Boolean, Integer> p = (Pair<Boolean, Integer>) ar.result;
  11. boolean enabled = p.first; //开关状态
  12. int reason = p.second; // 切换理由
  13. onDataEnabledChanged(enabled, reason);
  14. }
  15. break;
  16. ......
  17. }
  18. }
  19. private void onDataEnabledChanged(boolean enable, @DataEnabledChangedReason int enabledChangedReason) {
  20. ......
  21. if (enable) { //开启移动数据业务
  22. reevaluateDataConnections();
  23. setupDataOnAllConnectableApns(Phone.REASON_DATA_ENABLED, RetryFailures.ALWAYS);
  24. } else { //关闭移动数据业务
  25. ......
  26. cleanUpAllConnectionsInternal(true, cleanupReason);
  27. }
  28. }

 onDataEnabledChanged方法内有两个逻辑处理逻辑分支:开启移动数据业务和关闭移动数据业务。我们继续走开启移动数据业务逻辑setupDataOnAllConnectableApns

  1. protected void setupDataOnAllConnectableApns(String reason, RetryFailures retryFailures) {
  2. for (ApnContext apnContext : mPrioritySortedApnContexts) { //按照优先级开始遍历调用
  3. setupDataOnConnectableApn(apnContext, reason, retryFailures);
  4. }
  5. }
  6. protected void setupDataOnConnectableApn(ApnContext apnContext, String reason,
  7. RetryFailures retryFailures) {
  8. ......
  9. if (apnContext.isConnectable()) {//该ApnContext可连接,
  10. apnContext.setReason(reason);
  11. trySetupData(apnContext, REQUEST_TYPE_NORMAL, null);
  12. }
  13. }

 如上代码,DcTracker会按照优先级开始遍历ApnContext,并判断当前ApnContext是否处于可连接状态,ApnContext定义见上面的基础知识。接着我们继续关注 trySetupData方法的内部逻辑:

  1. private void trySetupData(ApnContext apnContext, @RequestNetworkType int requestType, @Nullable Message onHandoverCompleteMsg) {
  2. ......
  3. DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
  4. //判断是否允许传输数据
  5. boolean isDataAllowed = isDataAllowed(apnContext, requestType, dataConnectionReasons);
  6. if (!isDataAllowed) {
  7. ......
  8. return;
  9. }
  10. if (apnContext.getState() == DctConstants.State.FAILED) {
  11. String str = "trySetupData: make a FAILED ApnContext IDLE so its reusable";
  12. ApnContext.requestLog(apnContext, str);
  13. apnContext.setState(DctConstants.State.IDLE);
  14. }
  15. //获取驻网的移动数据业务RadioTechnology
  16. int radioTech = getDataRat();
  17. ......
  18. apnContext.setConcurrentVoiceAndDataAllowed(mPhone.getServiceStateTracker() .isConcurrentVoiceAndDataAllowed());
  19. //判断该apnContext是否处于空闲状态
  20. if (apnContext.getState() == DctConstants.State.IDLE) {
  21. ArrayList<ApnSetting> waitingApns =
  22. buildWaitingApns(apnContext.getApnType(), radioTech);
  23. if (waitingApns.isEmpty()) {
  24. //未找到对应APN配置信息
  25. return;
  26. } else {
  27. apnContext.setWaitingApns(waitingApns);
  28. }
  29. }
  30. if (!setupData(apnContext, radioTech, requestType)
  31. && requestType == REQUEST_TYPE_HANDOVER) {
  32. sendHandoverCompleteMessages(apnContext.getApnTypeBitmask(), false, false);
  33. }
  34. }

继续分析setupData方法:

  1. private boolean setupData(ApnContext apnContext, int radioTech,
  2. @RequestNetworkType int requestType) {
  3. ApnContext.requestLog(apnContext, "setupData. requestType=" + requestTypeToString(requestType));
  4. ApnSetting apnSetting;
  5. DataConnection dataConnection = null;
  6. //从缓存的ApnSettings集合中获取对象,每个ApnSettings保存从我们上面说的apn配置数据表中的一行数据,包含了nmc,mmsc等等
  7. apnSetting = apnContext.getNextApnSetting();
  8. if (dataConnection == null) {
  9. ......
  10. //先查询是否缓存起来且不在使用状态的DataConnection对象,没有则再创建一个
  11. dataConnection = findFreeDataConnection();
  12. if (dataConnection == null) {
  13. dataConnection = createDataConnection();
  14. }
  15. ......
  16. }
  17. final int generation = apnContext.incAndGetConnectionGeneration(); //计数器
  18. apnContext.setDataConnection(dataConnection);
  19. apnContext.setApnSetting(apnSetting); //将apnSetting与该apnContext对象绑定
  20. apnContext.setState(DctConstants.State.CONNECTING); //设置为"连接中"状态
  21. Message msg = obtainMessage();
  22. msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
  23. msg.obj = new Pair<ApnContext, Integer>(apnContext, generation);
  24. ApnSetting preferredApn = getPreferredApn();
  25. boolean isPreferredApn = apnSetting.equals(preferredApn);
  26. dataConnection.bringUp(apnContext, profileId, radioTech, msg, generation, requestType, mPhone.getSubId(), isPreferredApn); //激活移动数据业务
  27. return true;
  28. }

接下来我们重点关注DataConnection,DataConnection的定义见基础知识部分。

createDataConnection方法会调用DataConnection.makeDataConnection静态方法创建DataConnection对象并启动状态机。最后分析bringUp方法:

  1. public void bringUp(ApnContext apnContext, int profileId, int rilRadioTechnology, Message onCompletedMsg, int connectionGeneration,
  2. @RequestNetworkType int requestType, int subId, boolean isApnPreferred) {
  3. if (mApnSetting == null) {
  4. mApnSetting = apnContext.getApnSetting();
  5. }
  6. sendMessage(DataConnection.EVENT_CONNECT,
  7. new ConnectionParams(apnContext, profileId, rilRadioTechnology, onCompletedMsg,
  8. connectionGeneration, requestType, subId, isApnPreferred));
  9. }

根据传入的参数创建ConnectionParams对象,然后通过sendMessage方法发送DataConnection.EVENT_CONNECT类型的消息。根据我们在基础知识部分讲的那样,根据树状结构,是DataConnection.mInactiveState进行处理,处理逻辑如下:

  1. case EVENT_CONNECT:
  2. ConnectionParams cp = (ConnectionParams) msg.obj;
  3. ......
  4. //调用主类的私有方法connect
  5. int cause = connect(cp);
  6. ......
  7. //切换到正在激活状态
  8. transitionTo(mActivatingState);
  9. return HANDLED;

DataConnection对象的connect方法的主要处理逻辑如下。

  1. private @DataFailureCause int connect(ConnectionParams cp) {
  2. ......
  3. mCreateTime = -1;
  4. mLastFailTime = -1;
  5. mLastFailCause = DataFailCause.NONE;
  6. //创建数据连接完成的消息
  7. Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
  8. msg.obj = cp;
  9. DataProfile dp = new DataProfile.Builder()
  10. .setApnSetting(mApnSetting)
  11. .setPreferred(cp.mIsPreferredApn)
  12. .build();
  13. boolean isModemRoaming = mPhone.getServiceState().getDataRoamingFromRegistration();
  14. boolean isUnmeteredApnType = !ApnSettingUtils.isMeteredApnType(
  15. cp.mApnContext.getApnTypeBitmask(), mPhone);
  16. boolean allowRoaming = mPhone.getDataRoamingEnabled()
  17. || (isModemRoaming && (!mPhone.getServiceState().getDataRoaming()
  18. || isUnmeteredApnType));
  19. ......
  20. allocatePduSessionId(psi -> {
  21. this.setPduSessionId(psi);
  22. mDataServiceManager.setupDataCall(
  23. ServiceState.rilRadioTechnologyToAccessNetworkType(cp.mRilRat), dp, isModemRoaming,
  24. allowRoaming, reason, linkProperties, psi, null, td, matchAllRuleAllowed, msg
  25. );
  26. ......
  27. });
  28. return DataFailCause.NONE;
  29. }

走到了DataServiceManager.setupDataCall方法里,

  1. /frameworks/opt/telephony/src/java/com/android/internal/telephony/dataconnection/DataServiceManager.java
  2. public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming,
  3. boolean allowRoaming, int reason, LinkProperties linkProperties, int pduSessionId,
  4. @Nullable NetworkSliceInfo sliceInfo, @Nullable TrafficDescriptor trafficDescriptor,
  5. boolean matchAllRuleAllowed, Message onCompleteMessage) {
  6. CellularDataServiceCallback callback = new CellularDataServiceCallback("setupDataCall");
  7. if (onCompleteMessage != null) {
  8. mMessageMap.put(callback.asBinder(), onCompleteMessage);
  9. }
  10. ......
  11. mIDataService.setupDataCall(mPhone.getPhoneId(), accessNetworkType, dataProfile,
  12. isRoaming, allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
  13. trafficDescriptor, matchAllRuleAllowed, callback);
  14. ......
  15. }

DataServiceManager在这里通过IBinder方式远程调用phone进程的实现方法,处于DataService的内部类IDataServiceWrapper里面,通过handler发送DATA_SERVICE_REQUEST_SETUP_DATA_CALL消息:

  1. frameworks/base/telephony/java/android/telephony/data/DataService.java
  2. public abstract class DataService extends Service {
  3. private class IDataServiceWrapper extends IDataService.Stub {
  4. @Override
  5. public void setupDataCall(int slotIndex, int accessNetworkType, DataProfile dataProfile,
  6. boolean isRoaming, boolean allowRoaming, int reason,
  7. LinkProperties linkProperties, int pduSessionId, NetworkSliceInfo sliceInfo,
  8. TrafficDescriptor trafficDescriptor, boolean matchAllRuleAllowed,
  9. IDataServiceCallback callback) {
  10. mHandler.obtainMessage(DATA_SERVICE_REQUEST_SETUP_DATA_CALL, slotIndex, 0,
  11. new SetupDataCallRequest(accessNetworkType, dataProfile, isRoaming,
  12. allowRoaming, reason, linkProperties, pduSessionId, sliceInfo,
  13. trafficDescriptor, matchAllRuleAllowed, callback))
  14. .sendToTarget();
  15. }
  16. }
  17. private class DataServiceHandler extends Handler {
  18. @Override
  19. public void handleMessage(Message message) {
  20. ......
  21. case DATA_SERVICE_REQUEST_SETUP_DATA_CALL:
  22. serviceProvider.setupDataCall(......);
  23. break;
  24. }
  25. }
  26. }

这个serviceProvider实际上有两种,分别由DataService的两个继承类CellularDataServiceIwlanDataService实现提供,这两个类分别代表了蜂窝网数据业务和无线网数据业务。我们这里只看蜂窝网:

  1. /frameworks/opt/telephony/src/java/com/android/internal/telephony/data/CellularDataService.java
  2. private class CellularDataServiceProvider extends DataService.DataServiceProvider {
  3. @Override
  4. public void setupDataCall(int accessNetworkType, DataProfile dataProfile,
  5. boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties,
  6. int pduSessionId, NetworkSliceInfo sliceInfo, TrafficDescriptor trafficDescriptor,
  7. boolean matchAllRuleAllowed, DataServiceCallback callback) {
  8. ......
  9. mPhone.mCi.setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming,
  10. reason, linkProperties, pduSessionId, sliceInfo, trafficDescriptor,
  11. matchAllRuleAllowed, message);
  12. }
  13. }

mCi是RILJ对象,最终由RIL完成Data Call移动数据业务的处理。这个RIL(Radio Interface Layer)是指无线通信接口层,主要运行在HAL上,HAL层我们就暂时不做分析了,这个RIL横跨了HAL层和Framework层,是telephony和modem沟通的桥梁。RIL处理成功后,DataConnection的状态mActivatingState将转换为mActiveState。

总流程图

这样framework层的移动数据业务启动流程就分析完毕了。开启业务流程图如下所示。

欢迎大家关注我,我今后会努力给大家带来更多的Android源码的解析和实用组件的。

谢谢大家 -v-

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/386565
推荐阅读
相关标签
  

闽ICP备14008679号