TELEPHONY IN ANDROID ANDROID'S TELEPHONY SYSTEM ARCHITECTURE Applications Framework Libraries PhoneApp Telephony CallTracker manager Data ServiceStateInternal Connection Tracke Telephony Tracker Ril Daemon Package 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 1. Service ril-daemon /system/bin/rild 2. 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 Vendor RIL SOCKET RIL com.android.internal.t elephony.RIL Communication between vendor RIL and baseband is via RPC Baseband 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. logs CALL STATES EXPOSED THROUGH THE PHONESTATELISTENER 1. 2. 3. 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 1. 2. 3. 4. 5. 6. 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_CHA NGED: 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 boolean isRinging() public abstract boolean isIncoming(); ... } 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(); ... } & OPEN TELEPHONY WITH PHONEAPP AND ANY 3RD PARTY APP PhoneFactory PhoneProxy ITelephony TelephonyManag er ITelephonyRegistry TelephonyRegistry GSM/CDMA Phone mC M RIL.java Broadcast 3rd Paty App PhoneInterfaceManager PhoneStateListener PhoneApp Socket Ril-daemon *Internal Telephony Package: com.android.internal.telephony *Open Telephony Package: android.telephony RELATION BETWEEN FEW IMPORTANT CLASSES Phone CommandInterfac e PhoneBase BaseCommands GSMPhone CDMAPhon e RIL PhoneProxy