|RIL| Data Connection Flow

觀念:

  1. 啟動數據服務前,要先設定 APN。APN 在上層有一份,在 modem 也有一份
  2. 是可以只用 modem 裡的那份 APN (嵌入式平台)
  3. Android 是由上層帶 APN 給 modem 的
  4. 上層主要是看 bringUp & RIL 的 setupDataCall

 

以下只講部分關鍵點。

 

# load 上層的 db:TelephonyProvider.java

  loadApns()

# TelephonyManager:使用者點開數據上網的 Icon
  public void setDataEnabled(boolean enable) {
   setDataEnabled(getDefaultDataSubscriptionId(), enable);

# DcAsyncChannel:填入 APN, 準備往下帶
    public void bringUp(ApnContext apnContext, int profileId, int rilRadioTechnology,
                        boolean unmeteredUseOnly, Message onCompletedMsg,
                        int connectionGeneration) {
        mLastConnectionParams = new ConnectionParams(apnContext, profileId, rilRadioTechnology,
                unmeteredUseOnly, onCompletedMsg, connectionGeneration);
        sendMessage(DataConnection.EVENT_CONNECT, mLastConnectionParams);

# DataConnection:StateMachine 收到要建立連線啦!
 public boolean processMessage(Message msg) {
  …
   case EVENT_CONNECT:
    if (DBG) log(“DcInactiveState: mag.what=EVENT_CONNECT”);
     ConnectionParams cp = (ConnectionParams) msg.obj;
     if (initConnection(cp)) {
      onConnect(mConnectionParams);

# RIL:終於送到 RIL了,要往 Modem 前進啦!

 mPhone.mCi.setupDataCall(cp.mRilRat, dp, isModemRoaming, allowRoaming, msg);

 

Ref. https://blog.csdn.net/u012439416/article/details/75263645

Comments are closed.

WordPress.com.

Up ↑