GSMPhone 1
10 RIL
2
RILSender
9
RILReceiver
3
8 Java API
RILD 4
Android Telephony Stack
Native API 7
libril 6
5
6 Proprietary RIL library
© David Marques
[email protected]
GSMPhone 1
10 RIL
The com.android.internal.telephony.gsm.GSMPhone class implements a GSM phone and exposes all phone capabilities to the other components inside the android framework. This class interfaces with the radio interface layer in order to communicate to the baseband radio modem though the com.android.internal.telephony.RIL class. The topdown communication between these layers is done by asynchronous function calls passing an android.os.Message instance to be used in order to send the response back to the function caller with the function result within the message itself.
RIL
2
RILSender
9
RILReceiver
The com.android.internal.telephony.RIL class has two internal classes responsible for sending the requests and receiving the responses to and from the RIL daemon respectively. Both RILSender and RILReceiver classes run on its own threads interacting with the RIL daemon through a linux socket to send and receive messages to the baseband radio.
RILSender
RILReceiver
3
8 RILD
The RIL daemon (RILD) is a native linux process that communicates with the Java telephony API through a linux socket exposing a radio implementation agnostic protocol.
RILD 4
7 libril 6
5
6 Proprietary RIL library
The RIL daemon (RILD) loads the proprietary RIL library and registers its radio specific functions implementation into the telephony stack. The RILD receives requests through a linux socket and processes the request calling the proprietary library's radio function implementation passing the appropriate parameters. The proprietary library returns a response to the telephony stack through a callback function which marshals the response and sends it back to the Java API though the same socket used to receive the request. The Java layers processes the request on the RILReceiver class and forwards the response to the original request owner.
Solicited command flow: android RIL -> proprietary RIL
R I L
RILD
libril proprietary ril
1. Phone implementation calls RIL class to communicate with the baseband radio; 2. RIL class creates a Parcel and fills its content with the specified parameters; 3. RIL marshals the parcel into raw data and sends through the RILD socket; 4. RILD unmarshals the raw data into a Parcel and extracts the request parameters from the Parcel; 5. RILD calls through libril the proprietary RIL library request handler function passing the extracted parameters;
Solicited command flow: proprietary RIL -> android RIL
R I L
RILD
libril proprietary ril
1. Proprietary RIL library calls the response function on the android libril passing the result; 2. Android libril creates a Parcel, puts the result within it and marshals the Parcel into raw data to be sent through the RILD socket back to the Java layer; 3. At the Java layer the raw data that came from the socket is unmarshaled into a Parcel and the result is extracted and sent to the original request owner; 4. The request owner receives the response on a Message instance passed to the RIL class method called to make the request;
Note: All the information in this document comes from the Android 2.2 release (aka Froyo) of the Android opensource project. Any future updates may invalidate the information contained on this document.