350 likes | 1.51k Views
TELEPHONY IN ANDROID. Android's Telephony system architecture. Applications. PhoneApp. Framework. Telephony manager. Internal Telephony Package. CallTracker. ServiceStateTracke. Data Connection Tracker. Libraries. Ril Daemon. Vendor Specific RIL(.so). Linux Kernel.
E N D
Android's Telephony system architecture Applications PhoneApp Framework Telephony manager Internal Telephony Package CallTracker ServiceStateTracke Data Connection Tracker Libraries Ril Daemon Vendor Specific RIL(.so) Linux Kernel Baseband/Cellular protocol
Radio Interface Layer(RIL) • It is the bridge between Android phone framework services and the hardware. • The RIL consists of two primary components: • RIL Daemon: The RIL daemon initializes the Vendor RIL, processes all communication from Android telephony services, and dispatches calls to the Vendor RIL as solicited commands. • Vendor RIL: The radio-specific Vendor RIL that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands. The line 1 is replace with 2 in init.rc to specify the vendor RIL lib that will be loaded in the main method of rild.c Service ril-daemon /system/bin/rild Service ril-daemon /system/bin/rild -l /system/lib/libreference-ril.so
Communication between various telephony components Communication between RIL and rild is via commands (messages) over sockets Rild RIL com.android.internal.telephony.RIL SOCKET Vendor RIL Baseband Communication between vendor RIL and baseband is via RPC
RIL Interaction • There are two forms of communication that the RIL handles: • Solicited commands: Solicited commands originated by RIL lib, such as DIAL and HANGUP. • Unsolicited responses: Unsolicited responses that originate from the baseband, such as CALL_STATE_CHANGED and NEW_SMS.
RIL InteracTIONS MT C ALL logs
CALL states exposed through the PhoneStateListener • IDLE • RINGING • OFFHOOK NOTE: These states can also be viewed as Phone’s current states with respect to Call/Telephony Various CALL states implemented internally • ACTIVE • HOLDING • DIALING • ALERTING • INCOMING • WAITING
TelephonyIntents • It defines intents that the telephony framework can produce, some of them are: • ACTION_SERVICE_STATE_CHANGED: the phone service state has changed. • ACTION_SIGNAL_STRENGTH_CHANGED: the phone's signal strength has changed. • ACTION_ANY_DATA_CONNECTION_STATE_CHANGED: the data connection state has changed for any one of the phone's mobile data connections. • ACTION_DATA_CONNECTION_FAILED: an attempt to establish a data connection has failed. • ACTION_SIM_STATE_CHANGED: the SIM card state has changed.
Some important methods in the Phone & SIM interfaces as well as the Call abstract classes. • The Phone interface has methods that are used to place, accept or reject a call: public interface Phone { Connection dial(String dialString) throws CallStateException; void acceptCall() throws CallStateException; void rejectCall() throws CallStateException; void setMute(boolean muted); void startDtmf(char c); void sendDtmf(char c); void stopDtmf(); ... } • A Call object is created when you answer a call, and the Call class methods implement call-related functionality allowing you to, among other things, hang up: public interface Phone { public abstract class Call { public abstract void hangup() throws CallStateException; public booleanisRinging() public abstract booleanisIncoming(); ... } • Finally, the SimCard interface provides an access to a SIM card via methods that allow users to supply a PIN (Personal Identification Number) and a PUK (Personal Unblocking Key), which is used to unblock the PIN: public interface SimCard { void supplyPin(String pin, Message onComplete); void supplyPuk(String puk, String newPin, Message onComplete); void supplyPin2(String pin2, Message onComplete); void supplyPuk2(String puk2, String newPin2, Message onComplete); State getState(); ... }
Relation between Framework Internal & Open Telephony with PhoneAPP and any 3rd party APP PhoneApp 3rdPaty App PhoneInterfaceManager ITelephony PhoneFactory PhoneStateListener Broadcast PhoneProxy TelephonyManager ITelephonyRegistry TelephonyRegistry GSM/CDMA Phone mCM Socket RIL.java Ril-daemon *Internal Telephony Package: com.android.internal.telephony *Open Telephony Package: android.telephony
Relation between few important classes Phone CommandInterface PhoneBase BaseCommands GSMPhone CDMAPhone RIL PhoneProxy