Internals of Telephony Subsystem

1.1. Part I, the key items

Assumption: We are in the top level of Android source code repository

  • Files
    frameworks\base\telephony  the core of the telephony subsystem implementation, GSM phone and so on
    packages\apps\Phone        Phone application implementation, UI related stuffs reside
    hardware\ril               Radio reference implementation

  • The big picture

  • The key interfaces and classes

    1. Phone interfaces
      Phone.java:Base abstraction of the phone

      frameworks\base\telephony\java\com\android\internal\telephony\Phone.java

      PhoneBase.java:An abstract class which extends Phone interface and implements the Event registration and notification

      frameworks\base\telephony\java\com\android\internal\telephony\PhoneBase.java

      GSMPhone.java:A concrete phone implementation

      frameworks\base\telephony\java\com\android\internal\telephony\gsm\GSMPhone.java

      CommandsInterface.java:Radio operation abstraction

      frameworks\base\telephony\java\com\android\internal\telephony\gsm\CommandsInterface.java

      BaseCommands.java:Radio event registration and notification

      frameworks\base\telephony\java\com\android\internal\telephony\gsm\BaseCommands.java

      RIL.java: Radio interface library implementation, responsible for sending request to Radio layer and
      distribute the response from Radio layer to request sender
       

      frameworks\base\telephony\java\com\android\internal\telephony\RIL.java

      Native stub for RIL.java: communicates with RIL.java through local socket

      hardware\ril\libril\*

      Reference implementation of Radio library:communicates with Radio hardware through AT command

      hardware\ril\reference-ril\*

      Radio interface lib daemon runs as a stand alone process

      hardware\ril\rild\*

    2. RIL request and response
      1, Solicited and Unsolicited response
      Solicited response response to the upper layer request, this is a kind of passive response,
      for instance, response the request of Singal strength request
      Unsolicited response a response triggered by the underlying hardware, for instance, the state change
      Radio will trigger an RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED response to notify the upper layer

    3. Request sending and handling
      RIL_Sender thread
      gets the reqeust from mRequestsList and send it to Radio reference library through local socket
      RIL Receiver thread
      receives the response from Radio reference library and process it with processUnsolicited()/processSolicited()
      according to response type RESPONSE_UNSOLICITED/RESPONSE_SOLICITED
      processUnsolicited() is responsible for processing active event from Radio layer
      processSolicited() is responsible for processing passive response to upper layer request

    4. Message identity localization and Parcel
      The mechanism used here is localize the identity of message and put it into a Parcel, send it to the target,
      the target receives the Parcel, put the wanted stuffs into Parcel and return back it to the sender, it is
      the sender's responsibility to classify and handle the response corresponds to the specific request.

      We explain this trick by an example, User dialed a number
      *A user's dialing activity runs a long trip to get to the point dial() in RIL.java
      * RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result);
           send(rr);
           put the RIL_REQUEST_DIAL ID into Parcel embedded in rr and send it to the target, the target here is      reference-ril.c
      * refernece-ril.c receives the request and handle it with requestDial()
      * requestDial() completes it work and send response back by RIL_onRequestComplete()
      * The implementation of RIL_onRequestComplete() resides in ril.cpp
           p.writeInt32 (RESPONSE_SOLICITED);
           p.writeInt32 (pRI->token);
           put the response type to RESPONSE_SOLICITED, because the request is initiated by upper level, and it      is a passive response, put the RIL_REQUEST_DIAL into the Parcel (pRI->token == RIL_REQUEST_DIAL) for      upper layer to handle the response to the RIL_REQUEST_DIAL request.
      * thanks to the local socket, the control flow arrived at RIL.java again, this time it hits at
           RIL_Receiver(),for the reason of RIL_Receiver's listing on SOCKET_NAME_RIL socket
           the RIL_Receiver delegates the response to the processSolicited(), it was responsibility of
           processSolicited() to notify the registrarant according the content of the response.

'old > sms&mms' 카테고리의 다른 글

soft keyboard 출력 방법  (0) 2010.07.22
SMS solicite_eclair  (0) 2010.07.22
The Radio Interface Layer (RIL)  (0) 2010.07.09
Android's Radio Interface Layer(RIL)  (0) 2010.07.08
Complete End to End Call Flow of Short Message Service(SMS)  (0) 2010.07.08
Posted by jazzlife
,