Vous êtes sur la page 1sur 92

EXHIBIT 54

762 Patent 1. An abstraction layer for interfacing a computer to a telephony radio, comprising:

Exemplary Motorola devices To the extent the preamble is construed to be limiting, the Droid 2 includes an abstraction layer for interfacing a computer to a telephony radio. The Droid 2 includes the Android operating system platform (Android). (See, Ex. A, Droid 2 by Motorola Overview, http://www.motorola.com/Consumers/US-EN/Consumer-Productand-Services/Mobile-Phones/Motorola-DROID-2-US-EN) (visited Sept. 9, 2010.) An exemplary accused device is shown in Figure 1-1 below.

Figure 1-1 Figure 1-2 depicts the Motorola telephony system architecture. Motorola devices implement a radio interface abstraction layer shown between the layers labeled as Applications and Baseband in the Figure.

762 Patent

Exemplary Motorola devices

Figure 1-2. Solid elements represent Android blocks and dashed elements represent partner-specific blocks. (See Ex. B, Radio Layer Interface, http://source.android.com/porting/telephony.html (visited Sept. 9, 2010)) (hereinafter RIL Documentation.) Figure 1-3 depicts an exemplary use case of the architecture shown in Figure 1-2.

Figure 1-3. (Id.)

762 Patent

Exemplary Motorola devices According to the RIL Documentation, the Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony) and radio hardware. (Id.) The RIL documentation indicates that the abstraction layer includes 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 of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands. (Id.) The Droid 2 provides a set of application programming interfaces (APIs) for abstracting out multiple radio technologies without knowledge of the telephony radio or cellular network. By way of example, Figure 1-2 depicts telephony-based applications Call Tracker, SMS Dispatch, Service Tracker, and Data Tracker, all of which access functionality from the RIL Daemon via APIs. Figure 1-3 shows an example in which a telephony-based application directs the Dial() function call to the RIL Daemon. Exemplary APIs are provided in the package android.telephony, which [p]rovides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings. (See Ex. C, Android telephony package summary, http://developer.android.com/reference/android/telephony/package -summary.html (visited Sept. 9, 2010.) The RIL Documentation states that The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio. (See Ex. B, RIL Documentation.) In the Droid 2, the set of APIs correspond to call control functions. By way of example, Figure 1-3 shows the call control function Dial() being sent from a telephony-based application through an API and ultimately resulting in a radio Start Dial command. The Droid 2 comprises a proxy layer and a driver layer. By way of example, the Droid 2 proxy layer includes the RIL 3

a set of application programming interfaces (APIs) for abstracting out multiple radio technologies without knowledge of the telephony radio or cellular network,

wherein the set of APIs correspond to call control functions, wherein the abstraction layer comprises a proxy

762 Patent layer and a driver layer,

Exemplary Motorola devices Daemon / Radio Daemon module depicted in Figures 1-2 and 1-3. By way of example, the Motorola driver layer includes the Vendor RIL module depicted in Figures 1-2 and 1-3. In the Droid 2, the proxy layer receives a call at a first interface to one of the set of APIs. By way of example, android.telephony and com.android.internal.telephony (see Ex. D, CommandsInterface.java; Ex. E, RIL.java) provide calls at a first interface to the APIs In Droid 2, the proxy layer transforms the API call to a command understood by the driver layer and sends the command to the driver layer at a second interface. By way of example, Figure 1-2 graphically depicts the RIL Daemon communicating over a second interface to the Vendor RIL. By way of example, Figure 1-3 likewise graphically depicts the RIL Daemon communicating over a second interface to the Vendor RIL. The RIL Documentation describes that the Droid 2 provides a second interface: To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (/include/telephony/ril.h). (Ex. B.) In Droid 2, the driver layer receives the command at the second interface and determines at least one standard telephony radio command corresponding to the called API and sends the telephony radio command to the telephony radio at a third interface. By way of example, Figure 1-2 depicts the Vendor RIL sending telephony radio commands to the baseband physical layer i.e., the radio at a third interface. By way of example, Figure 1-3 likewise depicts the Vendor RIL sending telephony radio commands to the radio at a third interface. The RIL Documentation states: the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. (See Ex. B.) In the Droid 2, the proxy layer is hardware independent and the driver is hardware specific.

wherein when the proxy layer receives a call at a first interface to one of the set of APIs,

the proxy layer transforms the API call to a command understood by the driver layer and sends the command to the driver layer at a second interface, and

wherein the driver layer receives the command at the second interface and determines at least one standard telephony radio command corresponding to the called API and sends the telephony radio command to the telephony radio at a third interface, and

wherein the proxy layer is hardware independent and the driver is hardware

762 Patent specific.

Exemplary Motorola devices By way of example, the RIL Daemon is hardware independent. The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio (See Ex. B.) By way of example, the Vendor RIL is hardware specific. Figure 1-2 depicts a partner-specific Vendor RIL which will vary depending on that vendors particular hardware implementation.

Moreover, with respect to the Vendor RIL, the RIL documentation states: To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. (See Ex. B) (emphasis added.) 7. A radio interface layer of To the extent the preamble is construed to be limiting, the Droid 2 a telephone for facilitating includes a radio interface layer of a telephone for facilitating communications between communications between an application program module and a an application program radio. module and a radio, comprising: The accused Motorola devices include the Android operating system platform (Android). (See, e.g., Ex. A.) Figure 7-1 depicts the Motorola telephony system architecture. Motorola devices implement a radio interface layer that is shown between the layers labeled as Applications and Baseband in the Figure.

762 Patent

Exemplary Motorola devices Figure 7-1. Solid elements represent Android blocks and dashed elements represent partner-specific blocks. (See Ex. B.) Figure 7-2 depicts an exemplary use case of the architecture shown in Figure 7-1.

Figure 7-2. (Id.) According to the RIL Documentation, the Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony) and radio hardware. (Id.) The radio interface layer generally includes 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 of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands. (Id.) The Droid 2 includes a proxy layer for communicating with the application program module at a first interface and a driver layer at a second interface By way of example, the Droid 2 proxy layer includes the RIL Daemon/Radio Daemon module depicted in Figures 7-1 and 7-2. 6

a proxy layer for communicating with the application program module at a first interface and a driver layer at a second interface, wherein

762 Patent

Exemplary Motorola devices By way of example, the Droid 2 driver layer includes the Vendor RIL module depicted in Figures 7-1 and 7-2. By way of example, the first interface is provided by android.telephony and com.android.internal.telephony. (See Ex. C; Ex. D; Ex. E). Figure 7-1 depicts the manner in which the APIs used by telephony-based applications interface with the RIL Daemon. Figure 7-2, by way of example, depicts an interface through which the Dial() command is sent from a telephony-based application via an API to the RIL Daemon. By way of example, the second interface is depicted in Figure 7-1 as the interface through which the RIL Daemon communicates with to the Vendor RIL. Figure 7-2 likewise graphically depicts the RIL Daemon communicating over the second interface to the Vendor RIL. In the Droid 2, the proxy layer provides an API on the first interface for receiving application program calls to perform a particular function. By way of example, the Droid 2 provides an API on the first interface for receiving application program calls. By way of example, Figure 7-1 depicts telephony-based applications Call Tracker, SMS Dispatch, Service Tracker, and Data Tracker, all of which access functionality from the RIL Daemon via application program calls. Figure 7-2, also by way of example, shows a telephony-based application directing the Dial() function call to the RIL Daemon. Specific APIs are provided in the package android.telephony, which [p]rovides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings. (See Ex. C.) In the Droid 2, the proxy layer transforms the API calls to an input/output control (IOCTL) code and sends the IOCTL code to the driver layer at the second interface. By way of example, the RIL Daemon transforms API calls into IOCTL codes and sends the IOCTL codes to the driver layer at the second interface. (See dial() declaration in Ex. D; dial() implementation in Ex. E; Ex. F, RILConstants.java.) In the Droid 2, the driver layer communicates with the proxy layer at the second interface and the radio at a third interface, the driver layer receiving an IOCTL code at the second interface and transforming the IOCTL code into a command understood by the radio to perform the particular function and sending the radio 7

the proxy layer provides an API on the first interface for receiving application program calls to perform a particular function and wherein

the proxy layer transforms the API calls to an input/output control (IOCTL) code and sends the IOCTL code to the driver layer at the second interface; wherein the driver layer communicates with the proxy layer at the second interface and the radio at a third interface, the driver

762 Patent layer receiving an IOCTL code at the second interface and transforming the IOCTL code into a command understood by the radio to perform the particular function and sending the radio command at the third interfaces; and wherein

Exemplary Motorola devices command at the third interfaces. By way of example, the Droid 2 transforms the IOCTL code into radio commands corresponding to the function represented by the IOCTL code. By way of example, Figure 7-1 depicts the Vendor RIL sending telephony radio commands to the baseband physical layer i.e., the radio at a third interface. By way of example, Figure 7-2 likewise depicts the Vendor RIL sending telephony radio commands to the radio at a third interface. The RIL Documentation describes the third interface: the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. (See Ex. B.) In the Droid 2, the proxy layer is hardware independent and the driver layer is hardware specific By way of example, the RIL Daemon is hardware independent. The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio (See Ex. B.)

the proxy layer is hardware independent and the driver layer is hardware specific.

By way of example, the Vendor RIL is hardware specific. Figure 7-1 depicts a partner-specific Vendor RIL which will vary depending on that vendors particular hardware implementation. 9. A method for processing To the extent the preamble is construed to be limiting, the Droid 2 commands in a telephone includes an abstraction layer for interfacing a computer to a comprising a proxy layer, a telephony radio. driver layer, an application and a radio, the method The accused Motorola devices include the Android operating comprising the steps of: system platform (Android). (See, e.g., Ex. A.) Figure 9-1 depicts the Droid 2 telephony system architecture and shows the flow of communication. The Droid 2 implement a method of processing commands from an application, to a proxy layer, to a driver layer, and to a radio.

762 Patent

Exemplary Motorola devices

Figure 9-1. Solid elements represent Android blocks and dashed elements represent partner-specific blocks. (See Ex. B) Figure 9-2 depicts the flow of communication in one exemplary use case of the accused devices implementation of the claimed method.

Figure 9-2. (Id.)

762 Patent

Exemplary Motorola devices According to the RIL Documentation, the Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony) and radio hardware. (Id.) Furthermore, 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 of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands.

causing the application to call a radio interface layer (RIL) API in the proxy layer at a first interface, wherein the RIL API is associated with an action to be performed by the radio;

(Id.) The Droid 2 causes the application to call a radio interface layer (RIL) API in the proxy layer at a first interface, wherein the RIL API is associated with an action to be performed by the radio. By way of example, Figure 9-1 depicts a variety of applications including Call Tracker, SMS Dispatch, Service Tracker, Data Tracker, and Phone. These applications generate API calls to the set of application programming interfaces provided by Motorola devices. By way of example, Figure 9-2 shows an example in which a telephony-based application generates the Dial() function call to the RIL Daemon. Specific APIs are provided in the package android.telephony, which [p]rovides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings. (See Ex. C) Applications send the RIL API calls described above to a proxy layer via a first interface. The proxy layer includes the RIL Daemon / Radio Daemon module depicted in Figures 9-1 and 9-2. Applications send their API calls to the proxy layer through the interface depicted in Figure 9-1 between the applications and the RIL Daemon and depicted in Figure 9-2 between the Phone and the RIL Daemon. By way of example, the first interface is provided by android.telephony and com.android.internal.telephony (see Ex. D; Ex. E). The Droid 2 causes the proxy layer to translate the RIL API into 10

causing the proxy layer to

762 Patent translate the RIL API into IOCTL codes; IOCTL codes.

Exemplary Motorola devices

sending the IOCTL codes to the driver layer at a second interface;

By way of example, the RIL Daemon translates API calls into IOCTL code. (See dial() declaration in Ex. D; dial() implementation in Ex. E; Ex. F). The Droid 2 sends the IOCTL codes to the driver layer at a second interface. By way of example, Figure 9-1 depicts the RIL Daemon communicating over a second interface to the Vendor RIL. By way of example, Figure 9-2 likewise depicts the RIL Daemon communicating over a second interface to the Vendor RIL.

The RIL Documentation describes: To implement a radiospecific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (/include/telephony/ril.h). (Ex. B.) translating the IOCTL The Droid 2 translates the IOCTL codes to a command codes to a command corresponding to the action, wherein the command will be corresponding to the action, understood by the radio wherein the command will By way of example, the Droid 2 translates the IOCTL code into be understood by the radio; radio commands corresponding to the action represented by the IOCTL code. Figure 9-1 depicts the Vendor RIL sending telephony radio commands to the baseband physical layer i.e., the radio. Figure 9-2 likewise depicts the Vendor RIL sending telephony radio commands corresponding to the Dial() command to the radio. The RIL Documentation states: the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. (Ex. B.) The Droid 2 sends commands to the radio at a third interface. By way of example, Figure 9-1 depicts the Vendor RIL transmitting radio commands to the baseband physical layer i.e., the radio at a third interface. By way of example, Figure 9-2 likewise depicts the Vendor RIL transmitting a radio command to the radio at a third interface. The RIL Documentation describes the third interface: the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony 11

sending the command to the radio at a third interface; and wherein

762 Patent the proxy layer is hardware independent and the driver layer is hardware specific.

Exemplary Motorola devices testing and a guide for commercial vendor RILs. (See Ex. B.) In the Droid 2, the proxy layer is hardware independent and the driver layer is hardware specific By way of example, the RIL Daemon is hardware independent. The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio (See Ex. B.) By way of example, the Vendor RIL is hardware specific. Figure 9-1 depicts a partner-specific Vendor RIL which will vary depending on that vendors particular hardware implementation. Motorola is a vendor (see, e.g. Ex. A) and therefore implements its own Vendor RIL for each of its phones in accordance with that phones hardware. To the extent the preamble is construed to be limiting, the Droid 2 provides a method of communicating between a module and a radio. The accused Motorola devices include the Android operating system platform (Android). (See, e.g., Ex. A.) Figure 15-1 depicts the Motorola telephony system architecture and shows the flow of communication that implements the claimed method of communicating between a module and a radio.

15. A method of communicating between a module and a radio comprising:

12

762 Patent

Exemplary Motorola devices Figure 15-1. Solid elements represent Android blocks and dashed elements represent partner-specific blocks. (See Ex. B.) Figure 15-2 depicts the flow of communication in one exemplary use case of the accused devices implementation of the claimed method.

Figure 15-2. (Id.) The accused devices method of communication generally involves a radio abstraction layer that 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 of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands. (Id.) The Droid 2 provides for generating a radio interface layer (RIL) API call at one of a plurality of modules to perform a specific action. By way of example, Figure 15-1 depicts a variety of modules including Call Tracker, SMS Dispatch, Service Tracker, Data Tracker, and Phone. These modules generate API calls to the set of application programming interfaces provided by the 13

(a) generating a radio interface layer (RIL) API call at one of a plurality of modules to perform a specific action;

762 Patent

Exemplary Motorola devices Droid 2 to perform specific actions. By way of example, Figure 15-2 shows an example in which a telephony-based application generates the Dial() function call to the RIL Daemon. Specific APIs are provided in the package android.telephony, which [p]rovides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings. (See Ex. C) The Droid 2 provides for sending the RIL API call to a prxy at a first interface. By way of example, applications send their API calls to the proxy layer through the interface depicted in Figure 15-1 between the applications and the RIL Daemon and depicted in Figure 15-2 between the Phone and the RIL Daemon. The first interface is provided by android.telephony and com.android.internal.telephony (See Ex. D; Ex. E). The Droid 2 provides for converting the RIL API call to a command understood by a radio driver at the proxy. By way of example, the Droid 2 includes a radio driver that includes the Vendor RIL module depicted in Figures 15-1 and 152. By way of example, the RIL Daemon converts API calls into commands understood by the Vendor RIL. (See Ex. B; dial() declaration in Ex. D; dial() implementation in Ex. E; Ex. F.) The Droid 2 provides for transmitting the radio driver command from the proxy to the radio driver at a second interface. By way of example, the RIL Daemon transmits the radio driver commands discussed by way of example above to the Vendor RIL at a second interface. By way of example, Figure 15-1 depicts the RIL Daemon communicating over the second interface to the Vendor RIL. By way of example, Figure 15-2 likewise depicts the RIL Daemon communicating over the second interface to the Vendor RIL. The RIL Documentation describes that Motorola must provide this second interface: To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (/include/telephony/ril.h). (Ex. B.) The Droid 2 provides for transmitting a radio command from the 14

(b) sending the RIL API call to a proxy at a first interface;

(c) at the proxy, converting the RIL API call to a command understood by a radio driver;

(d) transmitting the radio driver command from the proxy to the radio driver at a second interface;

(e) transmitting a radio

762 Patent command from the radio driver to the radio at a third interface;

Exemplary Motorola devices radio driver to the radio at a third interface. By way of example, the Vendor RIL transmits radio commands from the Vendor RIL to the radio at a third interface. By way of example, Figure 15-1 depicts the Vendor RIL transmitting radio commands to the baseband physical layer i.e., the radio at a third interface. By way of example, Figure 15-2 likewise depicts the Vendor RIL transmitting a radio command to the radio at a third interface. The RIL Documentation describes this interface: the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. (See Ex. B.) The Droid 2 provides for performing the specific action at the radio. By way of example, each of the API calls results in the device performing a specific action at the radio. By way of example, the function dial() depicted in Figure 15-2 results in the radio issuing the sequence of baseband radio signals corresponding to the dialed number. The hangupConnection() function results in the radio taking hardware actions associated with hanging up a connection. The function getSignalStrength() results in the radio taking baseband actions to enable measurement of signal strength. (See Ex. D; Ex. E.) In the Droid 2, wherein the proxy is hardware independent and the driver is hardware specific. By way of example, the RIL Daemon is hardware independent. The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio (See Ex. B.) By way of example, the Vendor RIL is hardware specific. Figure 15-1 depicts a partner-specific Vendor RIL which will vary depending on that vendors particular hardware implementation. Moreover, with respect to the Vendor RIL, the RIL documentation states: To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. (See Ex. B) (emphasis added.)

(f) performing the specific action at the radio; and

wherein the proxy is hardware independent and the driver is hardware specific.

15

ATTACHMENT A

MOTOROLA FOR BUSINESS

SIGN UP FOR EMAIL UPDATES

USA (Change Location)

Search

Overview

Features

Tech Specs

Owner Support

|
Like

Share
2,323 people like this.

Multimedia Station for DROID 2 by Motorola


For music, movies and more, this is the accessory you'll want to get. CHECK IT OUT

Car Mount for DROID 2 by Motorola


This dock triggers an app that allows access to music, Google Maps Navigation and more. CHECK IT OUT

Owner Support
Learn how to get help for your Motorola product. FIND IT

Motorola Home > Consumer Product & Services > Mobile Phones > DROID 2 by Motorola

The Office, property of NBC Studios used under license. PrimeTime2Go is a trademark of Quickplay Inc. Google, Google Search, Google Maps, Gmail, Google Latitude, Google Talk, YouTube, Google Quick Search Box, Android, and Android Market are trademarks of Google, Inc. DROID is a trademark of Lucasfilm Ltd. and its related companies. Used under license. Airtime, data charges, and/or additional charges may apply to applications. Certain applications or features may not be available in all areas. Some listed applications may be trial versions. See your service provider for details.

ABOUT MOTOROLA CAREERS DEVELOPERS INVESTORS MEDIA CENTER PRIVACY POLICY TERMS OF USE CONTACT US

SITE FEEDBACK
2010 MOTOROLA,INC.ALL RIGHTS RESERVED

SITE MAP

ATTACHMENT B

Home

Source

Porting

Compatibility

Community

About

Radio Layer Interface


In this document

Android's Radio Interface Layer (RIL) provides an abstraction layer between Android telephony services (android.telephony) and radio hardware. The RIL is radio agnostic, and includes support for Global System for Mobile communication (GSM)-based radios.

RIL Initialization RIL Interaction Implementing the RIL RIL Functions

The diagram below illustrates the RIL in the context of Android's Telephony system architecture.

Solid elements represent Android blocks and dashed elements represent partner-specific blocks. 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 of ril.h that processes all communication with radio hardware and dispatches calls to the RIL Daemon (rild) through unsolicited commands.

RIL Initialization
Android initializes the telephony stack and the Vendor RIL at startup as described in the sequence below: 1. RIL daemon reads rild.lib path and rild.libargs system properties to determine the Vendor RIL library to use and any initialization arguments to provide to the Vendor RIL 2. RIL daemon loads the Vendor RIL library and calls RIL_Init to initialize the RIL and obtain a reference to RIL functions 3. RIL daemon calls RIL_register on the Android telephony stack, providing a reference to the Vendor RIL functions See the RIL Daemon source code at //device/commands/rild/rild.c for details. System Properties The following RIL-related system properties are set by the RIL library:

ro.ril.ecclist: list of valid Emergency Call Codes, for example, 911. Values are read from EF_ECC on the SIM and possibly supplmented by tables based on operator, network, or manufacturing code.

The following RIL_related system properties are available to the RIL library:

ro.ril.hsxpa: inidcates hsxpa support of target network. ro.ril.gprsclass: inidcates GPRS class of target network. ro.ril.enable.3g.prefix=1: adds the 3G prefix to the operator name.

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.

Solicited
The following snippet illustrates the interface for solicited commands: void OnRequest (int request_id, void *data, size_t datalen, RIL_Token t); void OnRequestComplete (RIL_Token t, RIL_Error e, void *response, size_t responselen); There are over sixty solicited commands grouped by the following families:

SIM PIN, IO, and IMSI/IMEI (11) Call status and handling (dial, answer, mute) (16) Network status query (4) Network setting (barring, forwarding, selection) (12) SMS (3) PDP connection (4) Power and reset (2) Supplementary Services (5) Vendor defined and support (4)

The following diagram illustrates a solicited call in Android.

Unsolicited
The following snippet illustrates the interface for unsolicited commands: void OnUnsolicitedResponse (int unsolResponse, void *data, size_t datalen); There are over ten unsolicited commands grouped by the following families:

Network status changed (4) New SMS notify (3) New USSD notify (2) Signal strength or time changed (2)

The following diagram illustrates an unsolicited call in Android.

Implementing the RIL


To implement a radio-specific RIL, create a shared library that implements a set of functions required by Android to process radio requests. The required functions are defined in the RIL header (/include/telephony/ril.h). The Android radio interface is radio-agnostic and the Vendor RIL can use any protocol to communicate with the radio. Android provides a reference Vendor RIL, using the Hayes AT command set, that you can use as a quick start for telephony testing and a guide for commercial vendor RILs. The source code for the reference RIL is found at /commands/reference-ril/. Compile your Vendor RIL as a shared library using the convention libril-<companyname>-<RIL version>.so, for example, libril-acme-124.so, where:

libril: all vendor RIL implementations start with 'libril' <companyname>: a company-specific abbreviation <RIL version>: RIL version number so: file extension

RIL_Init
Your Vendor RIL must define a RIL_Init function that provides a handle to the functions which will process all radio requests. RIL_Init will be called by the Android RIL Daemon at boot time to initialize the RIL. RIL_RadioFunctions *RIL_Init (RIL_Env* env, int argc, char **argv); RIL_Init should return a RIL_RadioFunctions structure containing the handles to the radio functions: type structure { int RIL_version; RIL_RequestFunc onRequest; RIL_RadioStateRequest onStateRequest; RIL_Supports supports; RIL_Cancel onCancel; RIL_GetVersion getVersion; } RIL_RadioFunctions;

RIL Functions
ril.h defines RIL states and variables, such as RIL_UNSOL_STK_CALL_SETUP, RIL_SIM_READY, RIL_SIM_NOT_READY, as well as the functions described in the tables below. Skim the header file (/device/include/telephony/ril.h) for details.

RIL Solicited Command Requests


The vendor RIL must provide the functions described in the table below to handle solicited commands. The RIL solicited command request types are defined in ril.h with the RIL_REQUEST_ prefix. Check the header file for details. Name void (*RIL_RequestFunc) (int request, void *data, size_t datalen, RIL_Token t); Description This is the RIL entry point for solicited commands and must be able to handle the various RIL solicited request types defined in ril.h with the RIL_REQUEST_ prefix.

request is one of RIL_REQUEST_* data is pointer to data defined for that RIL_REQUEST_* t should be used in subsequent call to RIL_onResponse datalen is owned by caller, and should not be modified or freed by callee

Must be completed with a call to RIL_onRequestComplete(). RIL_onRequestComplete() may be called from any thread before or after this function returns. This will always be called from the same thread, so returning here implies that the radio is ready to process another command (whether or not the previous command has completed). RIL_RadioState (*RIL_RadioStateRequest)(); int (*RIL_Supports)(int requestCode); void (*RIL_Cancel)(RIL_Token t); This function should return the current radio state synchronously. This function returns "1" if the specified RIL_REQUEST code is supported and 0 if it is not. This function is used to indicate that a pending request should be canceled. This function is called from a separate thread--not the thread that calls RIL_RequestFunc. On cancel, the callee should do its best to abandon the request and call RIL_onRequestComplete with RIL_Errno CANCELLED at some later point. Subsequent calls to RIL_onRequestComplete for this request with other results will be tolerated but ignored (that is, it is valid to ignore the cancellation request). RIL_Cancel calls should return immediately and not wait for cancellation. const char * (*RIL_GetVersion) (void); Return a version string for your Vendor RIL

The vendor RIL uses the following callback methods to communicate back to the Android RIL daemon. Name void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen); Description

t is parameter passed in on previous call to RIL_Notification routine. If e != SUCCESS, then response can be null and is ignored response is owned by caller, and should not be modified or freed by callee

RIL_onRequestComplete will return as soon as possible

void RIL_requestTimedCallback (RIL_TimedCallback callback, void *param, const struct timeval *relativeTime);

Call user-specified callback function on the same thread that RIL_RequestFunc is called. If relativeTime is specified, then it specifies a relative time value at which the callback is invoked. If relativeTime is NULL or points to a 0-filled structure, the callback will be invoked as soon as possible.

RIL Unsolicited Commands


The functions listed in the table below are call-back functions used by the Vendor RIL to invoke unsolicited commands on the Android platform. See ril.h for details. Name void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen); Description

unsolResponse is one of RIL_UNSOL_RESPONSE_* data is pointer to data defined for that RIL_UNSOL_RESPONSE_* data is owned by caller, and should not be modified or freed by callee Go to top

Site Terms of Service - Privacy Policy

ATTACHMENT C

package

android.telephony
Classes | Description Provides APIs for monitoring the basic phone information, such as the network type and connection state, plus utilities for manipulating phone number strings. more...

Classes
CellLocation NeighboringCellInfo PhoneNumberFormattingTextWatcher PhoneNumberUtils PhoneStateListener Abstract class that represents the location of the device. Represents the neighboring cell information, including Received Signal Strength and Cell ID location. Watches a TextView and if a phone number is entered will format it using formatNumber(Editable, int). Various utilities for dealing with phone number strings. A listener class for monitoring changes in specific telephony states on the device, including service state, signal strength, message waiting indicator (voicemail), and others. Contains phone state and service related information. Contains phone signal strength related information. Manages SMS operations such as sending data, text, and pdu SMS messages. A Short Message Service message.

ServiceState SignalStrength SmsManager SmsMessage SmsMessage.SubmitPdu TelephonyManager

Provides access to information about the telephony services on the device.

Enums
SmsMessage.MessageClass SMS Class enumeration.

Except as noted, this content is licensed under Apache 2.0. For details and restrictions, see the Content License. Android 2.2 r1 - 08 Sep 2010 18:21 Site Terms of Service - Privacy Policy - Brand Guidelines

ATTACHMENT D

/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; import android.os.Message; import android.os.Handler;

/** * {@hide} */ public interface CommandsInterface { enum RadioState { RADIO_OFF, /* Radio explictly powered off (eg CFUN=0) */ RADIO_UNAVAILABLE, /* Radio unavailable (eg, resetting or not booted) */ SIM_NOT_READY, /* Radio is on, but the SIM interface is not ready */ SIM_LOCKED_OR_ABSENT, /* SIM PIN locked, PUK required, network personalization, or SIM absent */ SIM_READY, /* Radio is on and SIM interface is available */ RUIM_NOT_READY, /* Radio is on, but the RUIM interface is not ready */ RUIM_READY, /* Radio is on and the RUIM interface is available */ RUIM_LOCKED_OR_ABSENT, /* RUIM PIN locked, PUK required, network personalization locked, or RUIM absent */ NV_NOT_READY, /* Radio is on, but the NV interface is not available */ NV_READY; /* Radio is on and the NV interface is available */ public boolean isOn() /* and available...*/ { return this == SIM_NOT_READY || this == SIM_LOCKED_OR_ABSENT || this == SIM_READY || this == RUIM_NOT_READY || this == RUIM_READY || this == RUIM_LOCKED_OR_ABSENT || this == NV_NOT_READY || this == NV_READY; } public boolean isAvailable() { return this != RADIO_UNAVAILABLE; } public boolean isSIMReady() { return this == SIM_READY; } public boolean isRUIMReady() { return this == RUIM_READY; } public boolean isNVReady() { return this == NV_READY;

} public boolean isGsm() { return this == SIM_NOT_READY || this == SIM_LOCKED_OR_ABSENT || this == SIM_READY; } public boolean isCdma() { return this == RUIM_NOT_READY || this == RUIM_READY || this == RUIM_LOCKED_OR_ABSENT || this == NV_NOT_READY || this == NV_READY; } } //***** Constants // Used as parameter to dial() and setCLIR() below static final int CLIR_DEFAULT = 0; // "use subscription default value" static final int CLIR_INVOCATION = 1; // (restrict CLI presentation) static final int CLIR_SUPPRESSION = 2; // (allow CLI presentation)

//

// Used as parameters for call forward methods below static final int CF_ACTION_DISABLE = 0; static final int CF_ACTION_ENABLE = 1; static final int CF_ACTION_UNUSED = 2; static final int CF_ACTION_REGISTRATION = 3; static final int CF_ACTION_ERASURE = 4; static static static static static static final final final final final final int int int int int int CF_REASON_UNCONDITIONAL CF_REASON_BUSY CF_REASON_NO_REPLY CF_REASON_NOT_REACHABLE CF_REASON_ALL CF_REASON_ALL_CONDITIONAL = = = = = = 0; 1; 2; 3; 4; 5;

// Used for call barring methods below static final String CB_FACILITY_BAOC static final String CB_FACILITY_BAOIC static final String CB_FACILITY_BAOICxH static final String CB_FACILITY_BAIC static final String CB_FACILITY_BAICr static final String CB_FACILITY_BA_ALL static final String CB_FACILITY_BA_MO static final String CB_FACILITY_BA_MT static final String CB_FACILITY_BA_SIM static final String CB_FACILITY_BA_FD

= = = = = = = = = =

"AO"; "OI"; "OX"; "AI"; "IR"; "AB"; "AG"; "AC"; "SC"; "FD";

// Used for various supp services apis // See 27.007 +CCFC or +CLCK static final int SERVICE_CLASS_NONE = 0; // no user input static final int SERVICE_CLASS_VOICE = (1 << 0); static final int SERVICE_CLASS_DATA = (1 << 1); //synoym for 16+32+64+128 static final int SERVICE_CLASS_FAX = (1 << 2); static final int SERVICE_CLASS_SMS = (1 << 3); static final int SERVICE_CLASS_DATA_SYNC = (1 << 4); static final int SERVICE_CLASS_DATA_ASYNC = (1 << 5); static final int SERVICE_CLASS_PACKET = (1 << 6); static final int SERVICE_CLASS_PAD = (1 << 7); static final int SERVICE_CLASS_MAX = (1 << 7); // Max SERVICE_CLASS value // Numeric representation of string values returned // by messages sent to setOnUSSD handler

static final int USSD_MODE_NOTIFY static final int USSD_MODE_REQUEST // SIM static static static

= 0; = 1;

Refresh results, passed up from RIL. final int SIM_REFRESH_FILE_UPDATED = 0; final int SIM_REFRESH_INIT = 1; final int SIM_REFRESH_RESET = 2;

// Single file updated // SIM initialized; reload all // SIM reset; may be locked

// GSM SMS fail cause for acknowledgeLastIncomingSMS. From TS 23.040, 9.2.3.22. static final int GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED = 0xD3; static final int GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR = 0xFF; // CDMA SMS fail static final int static final int static final int static final int //***** Methods RadioState getRadioState(); /** * Fires on any RadioState transition * Always fires immediately as well * * do not attempt to calculate transitions by storing getRadioState() values * on previous invocations of this notification. Instead, use the other * registration methods */ void registerForRadioStateChanged(Handler h, int what, Object obj); void unregisterForRadioStateChanged(Handler h); /** * Fires on any transition into RadioState.isOn() * Fires immediately if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForOn(Handler h, int what, Object obj); void unregisterForOn(Handler h); /** * Fires on any transition out of RadioState.isAvailable() * Fires immediately if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForAvailable(Handler h, int what, Object obj); void unregisterForAvailable(Handler h); /** * Fires on any transition into !RadioState.isAvailable() * Fires immediately if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForNotAvailable(Handler h, int what, Object obj); void unregisterForNotAvailable(Handler h); /** * Fires on any transition into RADIO_OFF or !RadioState.isAvailable() * Fires immediately if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForOffOrNotAvailable(Handler h, int what, Object obj); cause for acknowledgeLastIncomingCdmaSms. From TS N.S0005, 6.5.2.125. CDMA_SMS_FAIL_CAUSE_INVALID_TELESERVICE_ID = 4; CDMA_SMS_FAIL_CAUSE_RESOURCE_SHORTAGE = 35; CDMA_SMS_FAIL_CAUSE_OTHER_TERMINAL_PROBLEM = 39; CDMA_SMS_FAIL_CAUSE_ENCODING_PROBLEM = 96;

void unregisterForOffOrNotAvailable(Handler h); /** * Fires on any transition into SIM_READY * Fires immediately if if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForSIMReady(Handler h, int what, Object obj); void unregisterForSIMReady(Handler h); /** Any transition into SIM_LOCKED_OR_ABSENT */ void registerForSIMLockedOrAbsent(Handler h, int what, Object obj); void unregisterForSIMLockedOrAbsent(Handler h); void void void void void void void void void void void void registerForCallStateChanged(Handler h, int what, Object obj); unregisterForCallStateChanged(Handler h); registerForNetworkStateChanged(Handler h, int what, Object obj); unregisterForNetworkStateChanged(Handler h); registerForDataStateChanged(Handler h, int what, Object obj); unregisterForDataStateChanged(Handler h); registerForRadioTechnologyChanged(Handler h, int what, Object obj); unregisterForRadioTechnologyChanged(Handler h); registerForNVReady(Handler h, int what, Object obj); unregisterForNVReady(Handler h); registerForRUIMLockedOrAbsent(Handler h, int what, Object obj); unregisterForRUIMLockedOrAbsent(Handler h);

/** InCall voice privacy notifications */ void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj); void unregisterForInCallVoicePrivacyOn(Handler h); void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj); void unregisterForInCallVoicePrivacyOff(Handler h); /** * Fires on any transition into RUIM_READY * Fires immediately if if currently in that state * In general, actions should be idempotent. State may change * before event is received. */ void registerForRUIMReady(Handler h, int what, Object obj); void unregisterForRUIMReady(Handler h); /** * unlike the register* methods, there's only one new SMS handler * if you need to unregister, you should also tell the radio to stop * sending SMS's to you (via AT+CNMI) * * AsyncResult.result is a String containing the SMS PDU */ void setOnNewSMS(Handler h, int what, Object obj); void unSetOnNewSMS(Handler h); /** * Register for NEW_SMS_ON_SIM unsolicited message * * AsyncResult.result is an int array containing the index of new SMS */ void setOnSmsOnSim(Handler h, int what, Object obj); void unSetOnSmsOnSim(Handler h); /** * Register for NEW_SMS_STATUS_REPORT unsolicited message * * AsyncResult.result is a String containing the status report PDU */

void setOnSmsStatus(Handler h, int what, Object obj); void unSetOnSmsStatus(Handler h); /** * unlike the register* methods, there's only one NITZ time handler * * AsyncResult.result is an Object[] * ((Object[])AsyncResult.result)[0] is a String containing the NITZ time string * ((Object[])AsyncResult.result)[1] is a Long containing the milliseconds since boot as * returned by elapsedRealtime() when this NITZ time * was posted. * * Please note that the delivery of this message may be delayed several * seconds on system startup */ void setOnNITZTime(Handler h, int what, Object obj); void unSetOnNITZTime(Handler h); /** * unlike the register* methods, there's only one USSD notify handler * * Represents the arrival of a USSD "notify" message, which may * or may not have been triggered by a previous USSD send * * AsyncResult.result is a String[] * ((String[])(AsyncResult.result))[0] contains status code * "0" USSD-Notify -- text in ((const char **)data)[1] * "1" USSD-Request -- text in ((const char **)data)[1] * "2" Session terminated by network * "3" other local client (eg, SIM Toolkit) has responded * "4" Operation not supported * "5" Network timeout * * ((String[])(AsyncResult.result))[1] contains the USSD message * The numeric representations of these are in USSD_MODE_* */ void setOnUSSD(Handler h, int what, Object obj); void unSetOnUSSD(Handler h); /** * unlike the register* methods, there's only one signal strength handler * AsyncResult.result is an int[2] * response.obj.result[0] is received signal strength (0-31, 99) * response.obj.result[1] is bit error rate (0-7, 99) * as defined in TS 27.007 8.5 */ void setOnSignalStrengthUpdate(Handler h, int what, Object obj); void unSetOnSignalStrengthUpdate(Handler h); /** * Sets the handler for SIM/RUIM SMS storage full unsolicited message. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnIccSmsFull(Handler h, int what, Object obj); void unSetOnIccSmsFull(Handler h); /** * Sets the handler for SIM Refresh notifications. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message.

* @param what User-defined message code. * @param obj User object. */ void setOnIccRefresh(Handler h, int what, Object obj); void unSetOnIccRefresh(Handler h); /** * Sets the handler for RING notifications. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnCallRing(Handler h, int what, Object obj); void unSetOnCallRing(Handler h); /** * Sets the handler for RESTRICTED_STATE changed notification, * eg, for Domain Specific Access Control * unlike the register* methods, there's only one signal strength handler * * AsyncResult.result is an int[1] * response.obj.result[0] is a bitmask of RIL_RESTRICTED_STATE_* values */ void setOnRestrictedStateChanged(Handler h, int what, Object obj); void unSetOnRestrictedStateChanged(Handler h); /** * Sets the handler for Supplementary Service Notifications. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnSuppServiceNotification(Handler h, int what, Object obj); void unSetOnSuppServiceNotification(Handler h); /** * Sets the handler for Session End Notifications for STK. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnStkSessionEnd(Handler h, int what, Object obj); void unSetOnStkSessionEnd(Handler h); /** * Sets the handler for Proactive Commands for STK. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnStkProactiveCmd(Handler h, int what, Object obj); void unSetOnStkProactiveCmd(Handler h); /** * Sets the handler for Event Notifications for STK. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message.

* @param what User-defined message code. * @param obj User object. */ void setOnStkEvent(Handler h, int what, Object obj); void unSetOnStkEvent(Handler h); /** * Sets the handler for Call Set Up Notifications for STK. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void setOnStkCallSetUp(Handler h, int what, Object obj); void unSetOnStkCallSetUp(Handler h); /** * Enables/disbables supplementary service related notifications from * the network. * * @param enable true to enable notifications, false to disable. * @param result Message to be posted when command completes. */ void setSuppServiceNotifications(boolean enable, Message result); //void unSetSuppServiceNotifications(Handler h); /** * Sets the handler for Event Notifications for CDMA Display Info. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForDisplayInfo(Handler h, int what, Object obj); void unregisterForDisplayInfo(Handler h); /** * Sets the handler for Event Notifications for CallWaiting Info. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForCallWaitingInfo(Handler h, int what, Object obj); void unregisterForCallWaitingInfo(Handler h); /** * Sets the handler for Event Notifications for Signal Info. * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForSignalInfo(Handler h, int what, Object obj); void unregisterForSignalInfo(Handler h); /** * Registers the handler for CDMA number information record * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object.

*/ void registerForNumberInfo(Handler h, int what, Object obj); void unregisterForNumberInfo(Handler h); /** * Registers the handler for CDMA redirected number Information record * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForRedirectedNumberInfo(Handler h, int what, Object obj); void unregisterForRedirectedNumberInfo(Handler h); /** * Registers the handler for CDMA line control information record * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForLineControlInfo(Handler h, int what, Object obj); void unregisterForLineControlInfo(Handler h); /** * Registers the handler for CDMA T53 CLIR information record * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerFoT53ClirlInfo(Handler h, int what, Object obj); void unregisterForT53ClirInfo(Handler h); /** * Registers the handler for CDMA T53 audio control information record * Unlike the register* methods, there's only one notification handler * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. */ void registerForT53AudioControlInfo(Handler h, int what, Object obj); void unregisterForT53AudioControlInfo(Handler h); /** * Fires on if Modem enters Emergency Callback mode */ void setEmergencyCallbackMode(Handler h, int what, Object obj); /** * Fires on any CDMA OTA provision status change */ void registerForCdmaOtaProvision(Handler h,int what, Object obj); void unregisterForCdmaOtaProvision(Handler h); /** * Registers the handler when out-band ringback tone is needed.<p> * * Messages received from this: * Message.obj will be an AsyncResult * AsyncResult.userObj = obj * AsyncResult.result = boolean. <p> */

void registerForRingbackTone(Handler h, int what, Object obj); void unregisterForRingbackTone(Handler h); /** * Registers the handler when mute/unmute need to be resent to get * uplink audio during a call.<p> * * @param h Handler for notification message. * @param what User-defined message code. * @param obj User object. * */ void registerForResendIncallMute(Handler h, int what, Object obj); void unregisterForResendIncallMute(Handler h); /** * Supply the ICC PIN to the ICC card * * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * This exception is CommandException with an error of PASSWORD_INCORRECT * if the password is incorrect * * ar.exception and ar.result are null on success */ void supplyIccPin(String pin, Message result); /** * Supply the ICC PUK to the ICC card * * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * This exception is CommandException with an error of PASSWORD_INCORRECT * if the password is incorrect * * ar.exception and ar.result are null on success */ void supplyIccPuk(String puk, String newPin, Message result); /** * Supply the ICC PIN2 to the ICC card * Only called following operation where ICC_PIN2 was * returned as a a failure from a previous operation * * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * This exception is CommandException with an error of PASSWORD_INCORRECT * if the password is incorrect * * ar.exception and ar.result are null on success */ void supplyIccPin2(String pin2, Message result); /** * Supply the SIM PUK2 to the SIM card * Only called following operation where SIM_PUK2 was * returned as a a failure from a previous operation * * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure

* This exception is CommandException with an error of PASSWORD_INCORRECT * if the password is incorrect * * ar.exception and ar.result are null on success */ void supplyIccPuk2(String puk2, String newPin2, Message result); void changeIccPin(String oldPin, String newPin, Message result); void changeIccPin2(String oldPin2, String newPin2, Message result); void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result); void supplyNetworkDepersonalization(String netpin, Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result contains a List of DriverCall * The ar.result List is sorted by DriverCall.index */ void getCurrentCalls (Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result contains a List of DataCallState * @deprecated Do not use. */ @Deprecated void getPDPContextList(Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result contains a List of DataCallState */ void getDataCallList(Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure * * CLIR_DEFAULT == on "use subscription default value" * CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation) * CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation) */ void dial (String address, int clirMode, Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is String containing IMSI on success */ void getIMSI(Message result);

/** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is String containing IMEI on success */ void getIMEI(Message result); /** * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is String containing IMEISV on success */ void getIMEISV(Message result); /** * Hang up one individual connection. * returned message * retMsg.obj = AsyncResult ar * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure * * 3GPP 22.030 6.5.5 * "Releases a specific active call X" */ void hangupConnection (int gsmIndex, Message result); /** * 3GPP 22.030 6.5.5 * "Releases all held calls or sets User Determined User Busy (UDUB) * for a waiting call." * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void hangupWaitingOrBackground (Message result); /** * 3GPP 22.030 6.5.5 * "Releases all active calls (if any exist) and accepts * the other (held or waiting) call." * * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void hangupForegroundResumeBackground (Message result); /** * 3GPP 22.030 6.5.5 * "Places all active calls (if any exist) on hold and accepts * the other (held or waiting) call." * * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void switchWaitingOrHoldingAndActive (Message result); /** * 3GPP 22.030 6.5.5 * "Adds a held call to the conversation" *

* ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void conference (Message result); /** * Set preferred Voice Privacy (VP). * * @param enable true is enhanced and false is normal VP * @param result is a callback message */ void setPreferredVoicePrivacy(boolean enable, Message result); /** * Get currently set preferred Voice Privacy (VP) mode. * * @param result is a callback message */ void getPreferredVoicePrivacy(Message result); /** * 3GPP 22.030 6.5.5 * "Places all active calls on hold except call X with which * communication shall be supported." */ void separateConnection (int gsmIndex, Message result); /** * * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void acceptCall (Message result); /** * also known as UDUB * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void rejectCall (Message result); /** * 3GPP 22.030 6.5.5 * "Connects the two calls and disconnects the subscriber from both calls" * * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void explicitCallTransfer (Message result); /** * cause code returned as int[0] in Message.obj.response * Returns integer cause code defined in TS 24.008 * Annex H or closest approximation. * Most significant codes: * - Any defined in 22.001 F.4 (for generating busy/congestion) * - Cause 68: ACM >= ACMMax */ void getLastCallFailCause (Message result);

/** * Reason for last PDP context deactivate or failure to activate

* cause code returned as int[0] in Message.obj.response * returns an integer cause code defined in TS 24.008 * section 6.1.3.1.3 or close approximation * @deprecated Do not use. */ @Deprecated void getLastPdpFailCause (Message result); /** * The preferred new alternative to getLastPdpFailCause * that is also CDMA-compatible. */ void getLastDataCallFailCause (Message result); void setMute (boolean enableMute, Message response); void getMute (Message response); /** * response.obj is an AsyncResult * response.obj.result is an int[2] * response.obj.result[0] is received signal strength (0-31, 99) * response.obj.result[1] is bit error rate (0-7, 99) * as defined in TS 27.007 8.5 */ void getSignalStrength (Message response);

/** * response.obj.result is an int[3] * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2 * response.obj.result[1] is LAC if registered or -1 if not * response.obj.result[2] is CID if registered or -1 if not * valid LAC and CIDs are 0x0000 - 0xffff * * Please note that registration state 4 ("unknown") is treated * as "out of service" above */ void getRegistrationState (Message response); /** * response.obj.result is an int[3] * response.obj.result[0] is registration state 0-5 from TS 27.007 7.2 * response.obj.result[1] is LAC if registered or -1 if not * response.obj.result[2] is CID if registered or -1 if not * valid LAC and CIDs are 0x0000 - 0xffff * * Please note that registration state 4 ("unknown") is treated * as "out of service" above */ void getGPRSRegistrationState (Message response); /** * response.obj.result is a String[3] * response.obj.result[0] is long alpha or null if unregistered * response.obj.result[1] is short alpha or null if unregistered * response.obj.result[2] is numeric or null if unregistered */ void getOperator(Message response); /** * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void sendDtmf(char c, Message result);

/** * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void startDtmf(char c, Message result); /** * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void stopDtmf(Message result); /** * ar.exception carries exception on failure * ar.userObject contains the orignal value of result.obj * ar.result is null on success and failure */ void sendBurstDtmf(String dtmfString, int on, int off, Message result); /** * smscPDU is smsc address in PDU form GSM BCD format prefixed * by a length byte (as expected by TS 27.005) or NULL for default SMSC * pdu is SMS in PDU format as an ASCII hex string * less the SMSC address */ void sendSMS (String smscPDU, String pdu, Message response); /** * @param pdu is CDMA-SMS in internal pseudo-PDU format * @param response sent when operation completes */ void sendCdmaSms(byte[] pdu, Message response); /** * Deletes the specified SMS record from SIM memory (EF_SMS). * * @param index index of the SMS record to delete * @param response sent when operation completes */ void deleteSmsOnSim(int index, Message response); /** * Deletes the specified SMS record from RUIM memory (EF_SMS in DF_CDMA). * * @param index index of the SMS record to delete * @param response sent when operation completes */ void deleteSmsOnRuim(int index, Message response); /** * Writes an SMS message to SIM memory (EF_SMS). * * @param status status of message on SIM. One of: * SmsManger.STATUS_ON_ICC_READ * SmsManger.STATUS_ON_ICC_UNREAD * SmsManger.STATUS_ON_ICC_SENT * SmsManger.STATUS_ON_ICC_UNSENT * @param pdu message PDU, as hex string * @param response sent when operation completes. * response.obj will be an AsyncResult, and will indicate * any error that may have occurred (eg, out of memory). */ void writeSmsToSim(int status, String smsc, String pdu, Message response);

void writeSmsToRuim(int status, String pdu, Message response); /** * @deprecated * @param apn * @param user * @param password * @param response */ void setupDefaultPDP(String apn, String user, String password, Message response); /** * @deprecated * @param cid * @param response */ void deactivateDefaultPDP(int cid, Message response); void setRadioPower(boolean on, Message response); void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message response); void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message response); /** * parameters equivilient to 27.007 AT+CRSM command * response.obj will be an AsyncResult * response.obj.userObj will be a IccIoResult on success */ void iccIO (int command, int fileid, String path, int p1, int p2, int p3, String data, String pin2, Message response); /** * (AsyncResult)response.obj).result is an int[] with element [0] set to * 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned". * * @param response is callback message */ void queryCLIP(Message response); /** * response.obj will be a an int[2] * * response.obj[0] will be TS 27.007 +CLIR parameter 'n' * 0 presentation indicator is used according to the subscription of the CLIR service * 1 CLIR invocation * 2 CLIR suppression * * response.obj[1] will be TS 27.007 +CLIR parameter 'm' * 0 CLIR not provisioned * 1 CLIR provisioned in permanent mode * 2 unknown (e.g. no network, etc.) * 3 CLIR temporary mode presentation restricted * 4 CLIR temporary mode presentation allowed */ void getCLIR(Message response); /** * clirMode is one of the CLIR_* constants above * * response.obj is null */ void setCLIR(int clirMode, Message response);

/** * (AsyncResult)response.obj).result is an int[] with element [0] set to * 0 for disabled, 1 for enabled. * * @param serviceClass is a sum of SERVICE_CLASS_* * @param response is callback message */ void queryCallWaiting(int serviceClass, Message response); /** * @param enable is true to enable, false to disable * @param serviceClass is a sum of SERVICE_CLASS_* * @param response is callback message */ void setCallWaiting(boolean enable, int serviceClass, Message response); /** * @param action is one of CF_ACTION_* * @param cfReason is one of CF_REASON_* * @param serviceClass is a sum of SERVICE_CLASSS_* */ void setCallForward(int action, int cfReason, int serviceClass, String number, int timeSeconds, Message response); /** * cfReason is one of CF_REASON_* * * ((AsyncResult)response.obj).result will be an array of * CallForwardInfo's * * An array of length 0 means "disabled for all codes" */ void queryCallForwardStatus(int cfReason, int serviceClass, String number, Message response); void setNetworkSelectionModeAutomatic(Message response); void setNetworkSelectionModeManual(String operatorNumeric, Message response); /** * Queries whether the current network selection mode is automatic * or manual * * ((AsyncResult)response.obj).result is an int[] with element [0] being * a 0 for automatic selection and a 1 for manual selection */ void getNetworkSelectionMode(Message response); /** * Queries the currently available networks * * ((AsyncResult)response.obj).result is a List of NetworkInfo objects */ void getAvailableNetworks(Message response); void getBasebandVersion (Message response);

/** * (AsyncResult)response.obj).result will be an Integer representing * the sum of enabled serivice classes (sum of SERVICE_CLASS_*) * * @param facility one of CB_FACILTY_* * @param password password or "" if not required

* @param serviceClass is a sum of SERVICE_CLASS_* * @param response is callback message */ void queryFacilityLock (String facility, String password, int serviceClass, Message response); /** * @param facility one of CB_FACILTY_* * @param lockState true means lock, false means unlock * @param password password or "" if not required * @param serviceClass is a sum of SERVICE_CLASS_* * @param response is callback message */ void setFacilityLock (String facility, boolean lockState, String password, int serviceClass, Message response);

void sendUSSD (String ussdString, Message response); /** * Cancels a pending USSD session if one exists. * @param response callback message */ void cancelPendingUssd (Message response); void resetRadio(Message result); /** * Assign a specified band for RF configuration. * * @param bandMode one of BM_*_BAND * @param response is callback message */ void setBandMode (int bandMode, Message response); /** * Query the list of band mode supported by RF. * * @param response is callback message * ((AsyncResult)response.obj).result is an int[] with every * element representing one avialable BM_*_BAND */ void queryAvailableBandMode (Message response); /** * Requests to set the preferred network type for searching and registering * (CS/PS domain, RAT, and operation mode) * @param networkType one of NT_*_TYPE * @param response is callback message */ void setPreferredNetworkType(int networkType , Message response); /** * Query the preferred network type setting * * @param response is callback message to report one of */ void getPreferredNetworkType(Message response); /** * Query neighboring cell ids * * @param response s callback message to cell ids */ void getNeighboringCids(Message response);

NT_*_TYPE

/** * Request to enable/disable network state change notifications when * location informateion (lac and/or cid) has changed. * * @param enable true to enable, false to disable * @param response callback message */ void setLocationUpdates(boolean enable, Message response); /** * Gets the default SMSC address. * * @param result Callback message contains the SMSC address. */ void getSmscAddress(Message result); /** * Sets the default SMSC address. * * @param address new SMSC address * @param result Callback message is empty on completion */ void setSmscAddress(String address, Message result); /** * Indicates whether there is storage available for new SMS messages. * @param available true if storage is available * @param result callback message */ void reportSmsMemoryStatus(boolean available, Message result); /** * Indicates to the vendor ril that StkService is running * rand is eady to receive RIL_UNSOL_STK_XXXX commands. * * @param result callback message */ void reportStkServiceIsRunning(Message result); void invokeOemRilRequestRaw(byte[] data, Message response); void invokeOemRilRequestStrings(String[] strings, Message response);

/** * Send TERMINAL RESPONSE to the SIM, after processing a proactive command * sent by the SIM. * * @param contents String containing SAT/USAT response in hexadecimal * format starting with first byte of response data. See * TS 102 223 for details. * @param response Callback message */ public void sendTerminalResponse(String contents, Message response); /** * Send ENVELOPE to the SIM, after processing a proactive command sent by * the SIM. * * @param contents String containing SAT/USAT response in hexadecimal * format starting with command tag. See TS 102 223 for * details. * @param response Callback message */ public void sendEnvelope(String contents, Message response); /**

* Accept or reject the call setup request from SIM. * * @param accept true if the call is to be accepted, false otherwise. * @param response Callback message */ public void handleCallSetupRequestFromSim(boolean accept, Message response); /** * Activate or deactivate cell broadcast SMS for GSM. * * @param activate * true = activate, false = deactivate * @param result Callback message is empty on completion */ public void setGsmBroadcastActivation(boolean activate, Message result); /** * Configure cell broadcast SMS for GSM. * * @param response Callback message is empty on completion */ public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response); /** * Query the current configuration of cell broadcast SMS of GSM. * * @param response * Callback message contains the configuration from the modem * on completion */ public void getGsmBroadcastConfig(Message response); //***** new Methods for CDMA support /** * Request the device ESN / MEID / IMEI / IMEISV. * "response" is const char ** * [0] is IMEI if GSM subscription is available * [1] is IMEISV if GSM subscription is available * [2] is ESN if CDMA subscription is available * [3] is MEID if CDMA subscription is available */ public void getDeviceIdentity(Message response); /** * Request the device MDN / H_SID / H_NID / MIN. * "response" is const char ** * [0] is MDN if CDMA subscription is available * [1] is a comma separated list of H_SID (Home SID) in decimal format * if CDMA subscription is available * [2] is a comma separated list of H_NID (Home NID) in decimal format * if CDMA subscription is available * [3] is MIN (10 digits, MIN2+MIN1) if CDMA subscription is available */ public void getCDMASubscription(Message response); /** * Send Flash Code. * "response" is is NULL * [0] is a FLASH string */ public void sendCDMAFeatureCode(String FeatureCode, Message response); /** Set the Phone type created */ void setPhoneType(int phoneType); /**

* Query the CDMA roaming preference setting * * @param response is callback message to report one of */ void queryCdmaRoamingPreference(Message response);

CDMA_RM_*

/** * Requests to set the CDMA roaming preference * @param cdmaRoamingType one of CDMA_RM_* * @param response is callback message */ void setCdmaRoamingPreference(int cdmaRoamingType, Message response); /** * Requests to set the CDMA subscription mode * @param cdmaSubscriptionType one of CDMA_SUBSCRIPTION_* * @param response is callback message */ void setCdmaSubscription(int cdmaSubscriptionType, Message response); /** * Set the TTY mode for the CDMA phone * * @param enable is true to enable, false to disable * @param response is callback message */ void setTTYMode(int ttyMode, Message response); /** * Query the TTY mode for the CDMA phone * (AsyncResult)response.obj).result is an int[] with element [0] set to * 0 for disabled, 1 for enabled. * * @param response is callback message */ void queryTTYMode(Message response); /** * Setup a packet data connection On successful completion, the result * message will return the following: [0] indicating PDP CID, which is * generated by RIL. This Connection ID is used in both GSM/UMTS and CDMA * modes [1] indicating the network interface name for GSM/UMTS or CDMA [2] * indicating the IP address for this interface for GSM/UMTS and NULL in the * case of CDMA * * @param radioTechnology * indicates whether to setup connection on radio technology CDMA * (0) or GSM/UMTS (1) * @param profile * Profile Number or NULL to indicate default profile * @param apn * the APN to connect to if radio technology is GSM/UMTS. * Otherwise null for CDMA. * @param user * the username for APN, or NULL * @param password * the password for APN, or NULL * @param authType * the PAP / CHAP auth type. Values is one of SETUP_DATA_AUTH_* * @param result * Callback message */ public void setupDataCall(String radioTechnology, String profile, String apn, String user, String password, String authType, Message result); /** * Deactivate packet data connection

* * @param cid * The connection ID * @param result * Callback message is empty on completion */ public void deactivateDataCall(int cid, Message result); /** * Activate or deactivate cell broadcast SMS for CDMA. * * @param activate * true = activate, false = deactivate * @param result * Callback message is empty on completion */ public void setCdmaBroadcastActivation(boolean activate, Message result); /** * Configure cdma cell broadcast SMS. * * @param result * Callback message is empty on completion */ // TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig public void setCdmaBroadcastConfig(int[] configValuesArray, Message result); /** * Query the current configuration of cdma cell broadcast SMS. * * @param result * Callback message contains the configuration from the modem on completion */ public void getCdmaBroadcastConfig(Message result); /** * Requests the radio's system selection module to exit emergency callback mode. * This function should only be called from CDMAPHone.java. * * @param response callback message */ public void exitEmergencyCallbackMode(Message response); /** * Request the status of the ICC and UICC cards. * * @param response * Callback message containing {@link IccCardStatus} structure for the card. */ public void getIccCardStatus(Message result); }

ATTACHMENT E

/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import import static static static static static static static static com.android.internal.telephony.RILConstants.*; android.telephony.TelephonyManager.NETWORK_TYPE_UNKNOWN; android.telephony.TelephonyManager.NETWORK_TYPE_EDGE; android.telephony.TelephonyManager.NETWORK_TYPE_GPRS; android.telephony.TelephonyManager.NETWORK_TYPE_UMTS; android.telephony.TelephonyManager.NETWORK_TYPE_HSDPA; android.telephony.TelephonyManager.NETWORK_TYPE_HSUPA; android.telephony.TelephonyManager.NETWORK_TYPE_HSPA;

android.content.BroadcastReceiver; android.content.Context; android.content.Intent; android.content.IntentFilter; android.net.LocalSocket; android.net.LocalSocketAddress; android.os.AsyncResult; android.os.Handler; android.os.HandlerThread; android.os.Looper; android.os.Message; android.os.Parcel; android.os.PowerManager; android.os.SystemProperties; android.os.PowerManager.WakeLock; android.telephony.NeighboringCellInfo; android.telephony.PhoneNumberUtils; android.telephony.SmsManager; android.telephony.SmsMessage; android.util.Config; android.util.Log; com.android.internal.telephony.CallForwardInfo; com.android.internal.telephony.CommandException; com.android.internal.telephony.DataCallState; com.android.internal.telephony.gsm.NetworkInfo; com.android.internal.telephony.gsm.SmsBroadcastConfigInfo; com.android.internal.telephony.gsm.SuppServiceNotification; com.android.internal.telephony.IccCardApplication; com.android.internal.telephony.IccCardStatus; com.android.internal.telephony.IccUtils; com.android.internal.telephony.RILConstants; com.android.internal.telephony.SmsResponse; com.android.internal.telephony.cdma.CdmaCallWaitingNotification; com.android.internal.telephony.cdma.CdmaInformationRecords; java.io.ByteArrayInputStream; java.io.DataInputStream; java.io.IOException; java.io.InputStream; java.util.ArrayList; java.util.Collections;

/** * {@hide} */ class RILRequest { static final String LOG_TAG = "RILJ"; //***** Class Variables static int sNextSerial = 0; static Object sSerialMonitor = new Object(); private static Object sPoolSync = new Object(); private static RILRequest sPool = null; private static int sPoolSize = 0; private static final int MAX_POOL_SIZE = 4; //***** Instance Variables int mSerial; int mRequest; Message mResult; Parcel mp; RILRequest mNext; /** * Retrieves a new RILRequest instance from the pool. *

* @param request RIL_REQUEST_* * @param result sent when operation completes * @return a RILRequest instance from the pool. */ static RILRequest obtain(int request, Message result) { RILRequest rr = null; synchronized(sPoolSync) { if (sPool != null) { rr = sPool; sPool = rr.mNext; rr.mNext = null; sPoolSize--; } } if (rr == null) { rr = new RILRequest(); } synchronized(sSerialMonitor) { rr.mSerial = sNextSerial++; } rr.mRequest = request; rr.mResult = result; rr.mp = Parcel.obtain(); if (result != null && result.getTarget() == null) { throw new NullPointerException("Message target must not be null"); } // first elements in any RIL Parcel rr.mp.writeInt(request); rr.mp.writeInt(rr.mSerial); return rr; } /** * Returns a RILRequest instance to the pool. * * Note: This should only be called once per use. */ void release() { synchronized (sPoolSync) { if (sPoolSize < MAX_POOL_SIZE) { this.mNext = sPool; sPool = this; sPoolSize++; } } } private RILRequest() { } static void resetSerial() { synchronized(sSerialMonitor) { sNextSerial = 0; } } String serialString() { //Cheesy way to do %04d StringBuilder sb = new StringBuilder(8); String sn; sn = Integer.toString(mSerial); //sb.append("J["); sb.append('['); for (int i = 0, s = sn.length() ; i < 4 - s; i++) { sb.append('0'); } sb.append(sn); sb.append(']'); return sb.toString(); } void onError(int error, Object ret) { CommandException ex; ex = CommandException.fromRilErrno(error); if (RIL.RILJ_LOGD) Log.d(LOG_TAG, serialString() + "< " + RIL.requestToString(mRequest) + " error: " + ex); if (mResult != null) { AsyncResult.forMessage(mResult, ret, ex);

mResult.sendToTarget(); } if (mp != null) { mp.recycle(); mp = null; } } }

/** * RIL implementation of the CommandsInterface. * FIXME public only for testing * * {@hide} */ public final class RIL extends BaseCommands implements CommandsInterface { static final String LOG_TAG = "RILJ"; private static final boolean DBG = false; static final boolean RILJ_LOGD = Config.LOGD; static final boolean RILJ_LOGV = DBG ? Config.LOGD : Config.LOGV; /** * Wake lock timeout should be longer than the longest timeout in * the vendor ril. */ private static final int DEFAULT_WAKE_LOCK_TIMEOUT = 30000; //***** Instance Variables LocalSocket mSocket; HandlerThread mSenderThread; RILSender mSender; Thread mReceiverThread; RILReceiver mReceiver; private Context mContext; WakeLock mWakeLock; int mWakeLockTimeout; int mRequestMessagesPending; // Is this the first radio state change? private boolean mInitialRadioStateChange = true; //I'd rather this be LinkedList or something ArrayList<RILRequest> mRequestsList = new ArrayList<RILRequest>(); Object mLastNITZTimeInfo;

//***** Events static final int EVENT_SEND static final int EVENT_WAKE_LOCK_TIMEOUT //***** Constants // match with constant in ril.cpp static final int RIL_MAX_COMMAND_BYTES = (8 * 1024); static final int RESPONSE_SOLICITED = 0; static final int RESPONSE_UNSOLICITED = 1; static final String SOCKET_NAME_RIL = "rild"; static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000; // The number of the required config values for broadcast SMS stored in the C struct // RIL_CDMA_BroadcastServiceInfo private static final int CDMA_BSI_NO_OF_INTS_STRUCT = 3; private static final int CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES = 31; BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { sendScreenState(true); } else if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { sendScreenState(false); } else { Log.w(LOG_TAG, "RIL received unexpected Intent: " + intent.getAction()); } } }; class RILSender extends Handler implements Runnable { public RILSender(Looper looper) { super(looper); } // Only allocated once byte[] dataLength = new byte[4]; //***** Runnable implementation public void = 1; = 2;

run() { //setup if needed }

//***** Handler implemementation public void handleMessage(Message msg) { RILRequest rr = (RILRequest)(msg.obj); RILRequest req = null; switch (msg.what) { case EVENT_SEND: /** * mRequestMessagePending++ * EVENT_SEND, thus we must * mRequestMessagePending-*/ boolean alreadySubtracted = try { LocalSocket s; s = mSocket; if (s == null) { rr.onError(RADIO_NOT_AVAILABLE, null); rr.release(); mRequestMessagesPending--; alreadySubtracted = true; return; } synchronized (mRequestsList) { mRequestsList.add(rr); } mRequestMessagesPending--; alreadySubtracted = true; byte[] data; data = rr.mp.marshall(); rr.mp.recycle(); rr.mp = null; if (data.length > RIL_MAX_COMMAND_BYTES) { throw new RuntimeException( "Parcel larger than max bytes allowed! " + data.length); } // parcel length in big endian dataLength[0] = dataLength[1] = 0; dataLength[2] = (byte)((data.length >> 8) & 0xff); dataLength[3] = (byte)((data.length) & 0xff); //Log.v(LOG_TAG, "writing packet: " + data.length + " bytes"); s.getOutputStream().write(dataLength); s.getOutputStream().write(data); } catch (IOException ex) { Log.e(LOG_TAG, "IOException", ex); req = findAndRemoveRequestFromList(rr.mSerial); // make sure this request has not already been handled, // eg, if RILReceiver cleared the list. if (req != null || !alreadySubtracted) { rr.onError(RADIO_NOT_AVAILABLE, null); rr.release(); } } catch (RuntimeException exc) { Log.e(LOG_TAG, "Uncaught exception ", exc); req = findAndRemoveRequestFromList(rr.mSerial); // make sure this request has not already been handled, // eg, if RILReceiver cleared the list. if (req != null || !alreadySubtracted) { rr.onError(GENERIC_FAILURE, null); rr.release(); } } if (!alreadySubtracted) { mRequestMessagesPending--; } break; case EVENT_WAKE_LOCK_TIMEOUT: // Haven't heard back from the last request. Assume we're // not getting a response and release the wake lock. // TODO should we clean up mRequestList and mRequestPending synchronized (mWakeLock) { if (mWakeLock.isHeld()) { if (RILJ_LOGD) {

already happened for every make sure happens once and only once false;

synchronized (mRequestsList) { int count = mRequestsList.size(); Log.d(LOG_TAG, "WAKE_LOCK_TIMEOUT " + " mReqPending=" + mRequestMessagesPending + " mRequestList=" + count); for (int i = 0; i < count; i++) { rr = mRequestsList.get(i); Log.d(LOG_TAG, i + ": [" + rr.mSerial + "] " + requestToString(rr.mRequest)); } } } mWakeLock.release(); } } break; } } } /** * Reads in a single RIL message off the wire. A RIL message consists * of a 4-byte little-endian length and a subsequent series of bytes. * The final message (length header omitted) is read into * <code>buffer</code> and the length of the final message (less header) * is returned. A return value of -1 indicates end-of-stream. * * @param is non-null; Stream to read from * @param buffer Buffer to fill in. Must be as large as maximum * message size, or an ArrayOutOfBounds exception will be thrown. * @return Length of message less header, or -1 on end of stream. * @throws IOException */ private static int readRilMessage(InputStream is, byte[] buffer) throws IOException { int countRead; int offset; int remaining; int messageLength; // First, read in the length of the message offset = 0; remaining = 4; do { countRead = is.read(buffer, offset, remaining); if (countRead < 0 ) { Log.e(LOG_TAG, "Hit EOS reading message length"); return -1; } offset += countRead; remaining -= countRead; } while (remaining > 0); messageLength = ((buffer[0] & 0xff) << 24) | ((buffer[1] & 0xff) << 16) | ((buffer[2] & 0xff) << 8) | (buffer[3] & 0xff); // Then, re-use the buffer and read in the message itself offset = 0; remaining = messageLength; do { countRead = is.read(buffer, offset, remaining); if (countRead < 0 ) { Log.e(LOG_TAG, "Hit EOS reading message. + " remaining=" + remaining); return -1; } offset += countRead; remaining -= countRead; } while (remaining > 0); return messageLength; } class RILReceiver implements Runnable { byte[] buffer; RILReceiver() { buffer = new byte[RIL_MAX_COMMAND_BYTES]; } public void run() { int retryCount = 0; try {for (;;) {

messageLength=" + messageLength

LocalSocket s = null; LocalSocketAddress l; try { s = new LocalSocket(); l = new LocalSocketAddress(SOCKET_NAME_RIL, LocalSocketAddress.Namespace.RESERVED); s.connect(l); } catch (IOException ex){ try { if (s != null) { s.close(); } } catch (IOException ex2) { //ignore failure to close after failure to connect } // don't print an error message after the the first time // or after the 8th time if (retryCount == 8) { Log.e (LOG_TAG, "Couldn't find '" + SOCKET_NAME_RIL + "' socket after " + retryCount + " times, continuing to retry silently"); } else if (retryCount > 0 && retryCount < 8) { Log.i (LOG_TAG, "Couldn't find '" + SOCKET_NAME_RIL + "' socket; retrying after timeout"); } try { Thread.sleep(SOCKET_OPEN_RETRY_MILLIS); } catch (InterruptedException er) { } retryCount++; continue; } retryCount = 0; mSocket = s; Log.i(LOG_TAG, "Connected to '" + SOCKET_NAME_RIL + "' socket"); int length = 0; try { InputStream is = mSocket.getInputStream(); for (;;) { Parcel p; length = readRilMessage(is, buffer); if (length < 0) { // End-of-stream reached break; } p = Parcel.obtain(); p.unmarshall(buffer, 0, length); p.setDataPosition(0); //Log.v(LOG_TAG, "Read packet: " + length + " bytes"); processResponse(p); p.recycle(); } } catch (java.io.IOException ex) { Log.i(LOG_TAG, "'" + SOCKET_NAME_RIL + "' socket closed", ex); } catch (Throwable tr) { Log.e(LOG_TAG, "Uncaught exception read length=" + length + "Exception:" + tr.toString()); } Log.i(LOG_TAG, "Disconnected from '" + SOCKET_NAME_RIL + "' socket"); setRadioState (RadioState.RADIO_UNAVAILABLE); try { mSocket.close(); } catch (IOException ex) { } mSocket = null; RILRequest.resetSerial(); // Clear request list on close synchronized (mRequestsList) { for (int i = 0, sz = mRequestsList.size() ; i < sz ; i++) { RILRequest rr = mRequestsList.get(i); rr.onError(RADIO_NOT_AVAILABLE, null);

rr.release(); } mRequestsList.clear(); } }} catch (Throwable tr) { Log.e(LOG_TAG,"Uncaught exception", tr); } } }

//***** Constructors public RIL(Context context) { this(context, RILConstants.PREFERRED_NETWORK_MODE, RILConstants.PREFERRED_CDMA_SUBSCRIPTION); } public RIL(Context context, int networkMode, int cdmaSubscription) { super(context); mCdmaSubscription = cdmaSubscription; mNetworkMode = networkMode; //At startup mPhoneType is first set from networkMode switch(networkMode) { case RILConstants.NETWORK_MODE_WCDMA_PREF: case RILConstants.NETWORK_MODE_GSM_ONLY: case RILConstants.NETWORK_MODE_WCDMA_ONLY: case RILConstants.NETWORK_MODE_GSM_UMTS: mPhoneType = RILConstants.GSM_PHONE; break; case RILConstants.NETWORK_MODE_CDMA: case RILConstants.NETWORK_MODE_CDMA_NO_EVDO: case RILConstants.NETWORK_MODE_EVDO_NO_CDMA: mPhoneType = RILConstants.CDMA_PHONE; break; case RILConstants.NETWORK_MODE_GLOBAL: mPhoneType = RILConstants.CDMA_PHONE; break; default: mPhoneType = RILConstants.CDMA_PHONE; } PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE); mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, LOG_TAG); mWakeLock.setReferenceCounted(false); mWakeLockTimeout = SystemProperties.getInt(TelephonyProperties.PROPERTY_WAKE_LOCK_TIMEOUT, DEFAULT_WAKE_LOCK_TIMEOUT); mRequestMessagesPending = 0; mContext = context; mSenderThread = new HandlerThread("RILSender"); mSenderThread.start(); Looper looper = mSenderThread.getLooper(); mSender = new RILSender(looper); mReceiver = new RILReceiver(); mReceiverThread = new Thread(mReceiver, "RILReceiver"); mReceiverThread.start(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); context.registerReceiver(mIntentReceiver, filter); } //***** CommandsInterface implementation @Override public void setOnNITZTime(Handler h, int what, Object obj) { super.setOnNITZTime(h, what, obj); // Send the last NITZ time if we have it if (mLastNITZTimeInfo != null) { mNITZTimeRegistrant .notifyRegistrant( new AsyncResult (null, mLastNITZTimeInfo, null)); mLastNITZTimeInfo = null; } } public void getIccCardStatus(Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_SIM_STATUS, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); }

public void supplyIccPin(String pin, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PIN, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(1); rr.mp.writeString(pin); send(rr); } public void supplyIccPuk(String puk, String newPin, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PUK, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(2); rr.mp.writeString(puk); rr.mp.writeString(newPin); send(rr); } public void supplyIccPin2(String pin, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PIN2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(1); rr.mp.writeString(pin); send(rr); } public void supplyIccPuk2(String puk, String newPin2, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_SIM_PUK2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(2); rr.mp.writeString(puk); rr.mp.writeString(newPin2); send(rr); } public void changeIccPin(String oldPin, String newPin, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_SIM_PIN, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(2); rr.mp.writeString(oldPin); rr.mp.writeString(newPin); send(rr); } public void changeIccPin2(String oldPin2, String newPin2, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_SIM_PIN2, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(2); rr.mp.writeString(oldPin2); rr.mp.writeString(newPin2); send(rr); } public void changeBarringPassword(String facility, String oldPwd, String newPwd, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CHANGE_BARRING_PASSWORD, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

rr.mp.writeInt(3); rr.mp.writeString(facility); rr.mp.writeString(oldPwd); rr.mp.writeString(newPwd); send(rr); } public void supplyNetworkDepersonalization(String netpin, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeInt(1); rr.mp.writeString(netpin); send(rr); } public void getCurrentCalls (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_CURRENT_CALLS, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getPDPContextList(Message result) { getDataCallList(result); } public void getDataCallList(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DATA_CALL_LIST, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void dial (String address, int clirMode, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); rr.mp.writeString(address); rr.mp.writeInt(clirMode); rr.mp.writeInt(0); // UUS information is absent if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getIMSI(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMSI, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> getIMSI:RIL_REQUEST_GET_IMSI " + RIL_REQUEST_GET_IMSI + " " + requestToString(rr.mRequest)); send(rr); } public void getIMEI(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMEI, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getIMEISV(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_IMEISV, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); }

public void hangupConnection (int gsmIndex, Message result) { if (RILJ_LOGD) riljLog("hangupConnection: gsmIndex=" + gsmIndex); RILRequest rr = RILRequest.obtain(RIL_REQUEST_HANGUP, result);

if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + gsmIndex); rr.mp.writeInt(1); rr.mp.writeInt(gsmIndex); send(rr); } public void hangupWaitingOrBackground (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void hangupForegroundResumeBackground (Message result) { RILRequest rr = RILRequest.obtain( RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void switchWaitingOrHoldingAndActive (Message result) { RILRequest rr = RILRequest.obtain( RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void conference (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CONFERENCE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); }

public void setPreferredVoicePrivacy(boolean enable, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, result); rr.mp.writeInt(1); rr.mp.writeInt(enable ? 1:0); send(rr); } public void getPreferredVoicePrivacy(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, result); send(rr); } public void separateConnection (int gsmIndex, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SEPARATE_CONNECTION, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + gsmIndex); rr.mp.writeInt(1); rr.mp.writeInt(gsmIndex); send(rr); } public void acceptCall (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_ANSWER, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void rejectCall (Message result) {

RILRequest rr = RILRequest.obtain(RIL_REQUEST_UDUB, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void explicitCallTransfer (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_EXPLICIT_CALL_TRANSFER, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getLastCallFailCause (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_LAST_CALL_FAIL_CAUSE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * @deprecated */ public void getLastPdpFailCause (Message result) { getLastDataCallFailCause (result); } /** * The preferred new alternative to getLastPdpFailCause */ public void getLastDataCallFailCause (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setMute (boolean enableMute, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_MUTE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + enableMute); rr.mp.writeInt(1); rr.mp.writeInt(enableMute ? 1 : 0); send(rr); } public void getMute (Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_MUTE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getSignalStrength (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SIGNAL_STRENGTH, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getRegistrationState (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_REGISTRATION_STATE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void

getGPRSRegistrationState (Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GPRS_REGISTRATION_STATE, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getOperator(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_OPERATOR, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void sendDtmf(char c, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DTMF, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeString(Character.toString(c)); send(rr); } public void startDtmf(char c, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DTMF_START, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeString(Character.toString(c)); send(rr); } public void stopDtmf(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DTMF_STOP, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void sendBurstDtmf(String dtmfString, int on, int off, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BURST_DTMF, result); rr.mp.writeInt(3); rr.mp.writeString(dtmfString); rr.mp.writeString(Integer.toString(on)); rr.mp.writeString(Integer.toString(off)); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + dtmfString); send(rr); } public void sendSMS (String smscPDU, String pdu, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result); rr.mp.writeInt(2); rr.mp.writeString(smscPDU); rr.mp.writeString(pdu); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void sendCdmaSms(byte[] pdu, Message result) { int address_nbr_of_digits; int subaddr_nbr_of_digits; int bearerDataLength; ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(bais); RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SEND_SMS, result); try {

rr.mp.writeInt(dis.readInt()); //teleServiceId rr.mp.writeByte((byte) dis.readInt()); //servicePresent rr.mp.writeInt(dis.readInt()); //serviceCategory rr.mp.writeInt(dis.read()); //address_digit_mode rr.mp.writeInt(dis.read()); //address_nbr_mode rr.mp.writeInt(dis.read()); //address_ton rr.mp.writeInt(dis.read()); //address_nbr_plan address_nbr_of_digits = (byte) dis.read(); rr.mp.writeByte((byte) address_nbr_of_digits); for(int i=0; i < address_nbr_of_digits; i++){ rr.mp.writeByte(dis.readByte()); // address_orig_bytes[i] } rr.mp.writeInt(dis.read()); //subaddressType rr.mp.writeByte((byte) dis.read()); //subaddr_odd subaddr_nbr_of_digits = (byte) dis.read(); rr.mp.writeByte((byte) subaddr_nbr_of_digits); for(int i=0; i < subaddr_nbr_of_digits; i++){ rr.mp.writeByte(dis.readByte()); //subaddr_orig_bytes[i] } bearerDataLength = dis.read(); rr.mp.writeInt(bearerDataLength); for(int i=0; i < bearerDataLength; i++){ rr.mp.writeByte(dis.readByte()); //bearerData[i] } }catch (IOException ex){ if (RILJ_LOGD) riljLog("sendSmsCdma: conversion from input stream to object failed: " + ex); } if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void deleteSmsOnSim(int index, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DELETE_SMS_ON_SIM, response); rr.mp.writeInt(1); rr.mp.writeInt(index); if (Config.LOGD) { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + index); } send(rr); } public void deleteSmsOnRuim(int index, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, response); rr.mp.writeInt(1); rr.mp.writeInt(index); if (Config.LOGD) { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + index); } send(rr); } public void writeSmsToSim(int status, String smsc, String pdu, Message response) { status = translateStatus(status); RILRequest rr = RILRequest.obtain(RIL_REQUEST_WRITE_SMS_TO_SIM, response); rr.mp.writeInt(status); rr.mp.writeString(pdu); rr.mp.writeString(smsc); if (Config.LOGD) { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + status); } send(rr); } public void writeSmsToRuim(int status, String pdu, Message response) { status = translateStatus(status); RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, response); rr.mp.writeInt(status); rr.mp.writeString(pdu);

if (Config.LOGD) { if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + status); } send(rr); } /** * Translates EF_SMS status bits to a status value compatible with * SMS AT commands. See TS 27.005 3.1. */ private int translateStatus(int status) { switch(status & 0x7) { case SmsManager.STATUS_ON_ICC_READ: return 1; case SmsManager.STATUS_ON_ICC_UNREAD: return 0; case SmsManager.STATUS_ON_ICC_SENT: return 3; case SmsManager.STATUS_ON_ICC_UNSENT: return 2; } // Default to READ. return 1; } /** * @deprecated */ public void setupDefaultPDP(String apn, String user, String password, Message result) { int radioTechnology; int authType; String profile = ""; //profile number, NULL for GSM/UMTS radioTechnology = RILConstants.SETUP_DATA_TECH_GSM; //TODO(): Add to the APN database, AuthType is set to CHAP/PAP authType = (user != null) ? RILConstants.SETUP_DATA_AUTH_PAP_CHAP : RILConstants.SETUP_DATA_AUTH_NONE; setupDataCall(Integer.toString(radioTechnology), profile, apn, user, password, Integer.toString(authType), result); } /** * @deprecated */ public void deactivateDefaultPDP(int cid, Message result) { deactivateDataCall(cid, result); } /** * The preferred new alternative to setupDefaultPDP that is * CDMA-compatible. * */ public void setupDataCall(String radioTechnology, String profile, String apn, String user, String password, String authType, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SETUP_DATA_CALL, result); rr.mp.writeInt(6); rr.mp.writeString(radioTechnology); rr.mp.writeString(profile); rr.mp.writeString(apn); rr.mp.writeString(user); rr.mp.writeString(password); rr.mp.writeString(authType); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + radioTechnology + " " + profile + " " + apn + " " + user + " " + password + " " + authType); send(rr); } public void deactivateDataCall(int cid, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DEACTIVATE_DATA_CALL, result); rr.mp.writeInt(1); rr.mp.writeString(Integer.toString(cid)); if (RILJ_LOGD) riljLog(rr.serialString() + "> " +

requestToString(rr.mRequest) + " " + cid); send(rr); } public void setRadioPower(boolean on, Message result) { //if radio is OFF set preferred NW type and cmda subscription if(mInitialRadioStateChange) { synchronized (mStateMonitor) { if (!mState.isOn()) { RILRequest rrPnt = RILRequest.obtain( RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, null); rrPnt.mp.writeInt(1); rrPnt.mp.writeInt(mNetworkMode); if (RILJ_LOGD) riljLog(rrPnt.serialString() + "> " + requestToString(rrPnt.mRequest) + " : " + mNetworkMode); send(rrPnt); RILRequest rrCs = RILRequest.obtain( RIL_REQUEST_CDMA_SET_SUBSCRIPTION, null); rrCs.mp.writeInt(1); rrCs.mp.writeInt(mCdmaSubscription); if (RILJ_LOGD) riljLog(rrCs.serialString() + "> " + requestToString(rrCs.mRequest) + " : " + mCdmaSubscription); send(rrCs); } } } RILRequest rr = RILRequest.obtain(RIL_REQUEST_RADIO_POWER, result); rr.mp.writeInt(1); rr.mp.writeInt(on ? 1 : 0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setSuppServiceNotifications(boolean enable, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, result); rr.mp.writeInt(1); rr.mp.writeInt(enable ? 1 : 0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void acknowledgeLastIncomingGsmSms(boolean success, int cause, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SMS_ACKNOWLEDGE, result); rr.mp.writeInt(2); rr.mp.writeInt(success ? 1 : 0); rr.mp.writeInt(cause); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + success + " " + cause); send(rr); } public void acknowledgeLastIncomingCdmaSms(boolean success, int cause, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, result); rr.mp.writeInt(success ? 0 : 1); //RIL_CDMA_SMS_ErrorClass // cause code according to X.S004-550E rr.mp.writeInt(cause); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + success + " " + cause); send(rr); }

public void iccIO (int command, int fileid, String path, int p1, int p2, int p3, String data, String pin2, Message result) { //Note: This RIL request has not been renamed to ICC, // but this request is also valid for SIM and RUIM RILRequest rr = RILRequest.obtain(RIL_REQUEST_SIM_IO, result);

rr.mp.writeInt(command); rr.mp.writeInt(fileid); rr.mp.writeString(path); rr.mp.writeInt(p1); rr.mp.writeInt(p2); rr.mp.writeInt(p3); rr.mp.writeString(data); rr.mp.writeString(pin2); if (RILJ_LOGD) riljLog(rr.serialString() + "> iccIO: " + requestToString(rr.mRequest) + " 0x" + Integer.toHexString(command) + " 0x" + Integer.toHexString(fileid) + " " + " path: " + path + "," + p1 + "," + p2 + "," + p3); send(rr); } public void getCLIR(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_CLIR, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setCLIR(int clirMode, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_CLIR, result); // count ints rr.mp.writeInt(1); rr.mp.writeInt(clirMode); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + clirMode); send(rr); } public void queryCallWaiting(int serviceClass, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_CALL_WAITING, response); rr.mp.writeInt(1); rr.mp.writeInt(serviceClass); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + serviceClass); send(rr); } public void setCallWaiting(boolean enable, int serviceClass, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_CALL_WAITING, response); rr.mp.writeInt(2); rr.mp.writeInt(enable ? 1 : 0); rr.mp.writeInt(serviceClass); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + enable + ", " + serviceClass); send(rr); } public void setNetworkSelectionModeAutomatic(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setNetworkSelectionModeManual(String operatorNumeric, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + operatorNumeric);

rr.mp.writeString(operatorNumeric); send(rr); } public void getNetworkSelectionMode(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getAvailableNetworks(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setCallForward(int action, int cfReason, int serviceClass, String number, int timeSeconds, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_CALL_FORWARD, response); rr.mp.writeInt(action); rr.mp.writeInt(cfReason); rr.mp.writeInt(serviceClass); rr.mp.writeInt(PhoneNumberUtils.toaFromString(number)); rr.mp.writeString(number); rr.mp.writeInt (timeSeconds); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + action + " " + cfReason + " " + serviceClass + timeSeconds); send(rr); } public void queryCallForwardStatus(int cfReason, int serviceClass, String number, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, response); rr.mp.writeInt(2); // 2 is for query action, not in used anyway rr.mp.writeInt(cfReason); rr.mp.writeInt(serviceClass); rr.mp.writeInt(PhoneNumberUtils.toaFromString(number)); rr.mp.writeString(number); rr.mp.writeInt (0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + cfReason + " " + serviceClass); send(rr); } public void queryCLIP(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_CLIP, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); }

public void getBasebandVersion (Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_BASEBAND_VERSION, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void queryFacilityLock (String facility, String password, int serviceClass, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_FACILITY_LOCK, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

// count strings rr.mp.writeInt(3); rr.mp.writeString(facility); rr.mp.writeString(password); rr.mp.writeString(Integer.toString(serviceClass)); send(rr); } public void setFacilityLock (String facility, boolean lockState, String password, int serviceClass, Message response) { String lockString; RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_FACILITY_LOCK, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); // count strings rr.mp.writeInt(4); rr.mp.writeString(facility); lockString = (lockState)?"1":"0"; rr.mp.writeString(lockString); rr.mp.writeString(password); rr.mp.writeString(Integer.toString(serviceClass)); send(rr); } public void sendUSSD (String ussdString, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SEND_USSD, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + ussdString); rr.mp.writeString(ussdString); send(rr); } // inherited javadoc suffices public void cancelPendingUssd (Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CANCEL_USSD, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); }

public void resetRadio(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_RESET_RADIO, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void invokeOemRilRequestRaw(byte[] data, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_OEM_HOOK_RAW, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + "[" + IccUtils.bytesToHexString(data) + "]"); rr.mp.writeByteArray(data); send(rr); } public void invokeOemRilRequestStrings(String[] strings, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_OEM_HOOK_STRINGS, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeStringArray(strings); send(rr); } /** * Assign a specified band for RF configuration. *

* @param bandMode one of BM_*_BAND * @param response is callback message */ public void setBandMode (int bandMode, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_BAND_MODE, response); rr.mp.writeInt(1); rr.mp.writeInt(bandMode); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + bandMode); send(rr); } /** * Query the list of band mode supported by RF. * * @param response is callback message * ((AsyncResult)response.obj).result is an int[] with every * element representing one avialable BM_*_BAND */ public void queryAvailableBandMode (Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void sendTerminalResponse(String contents, Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeString(contents); send(rr); } /** * {@inheritDoc} */ public void sendEnvelope(String contents, Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); rr.mp.writeString(contents); send(rr); } /** * {@inheritDoc} */ public void handleCallSetupRequestFromSim( boolean accept, Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); int[] param = new int[1]; param[0] = accept ? 1 : 0; rr.mp.writeIntArray(param); send(rr); } /** * {@inheritDoc} */ public void setPreferredNetworkType(int networkType , Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, response); rr.mp.writeInt(1); rr.mp.writeInt(networkType); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + networkType); send(rr); } /**

* {@inheritDoc} */ public void getPreferredNetworkType(Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void getNeighboringCids(Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void setLocationUpdates(boolean enable, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_LOCATION_UPDATES, response); rr.mp.writeInt(1); rr.mp.writeInt(enable ? 1 : 0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ": " + enable); send(rr); } /** * {@inheritDoc} */ public void getSmscAddress(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_SMSC_ADDRESS, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void setSmscAddress(String address, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_SMSC_ADDRESS, result); rr.mp.writeString(address); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + address); send(rr); } /** * {@inheritDoc} */ public void reportSmsMemoryStatus(boolean available, Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, result); rr.mp.writeInt(1); rr.mp.writeInt(available ? 1 : 0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ": " + available); send(rr); } /** * {@inheritDoc} */ public void reportStkServiceIsRunning(Message result) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, result); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void getGsmBroadcastConfig(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_GET_BROADCAST_CONFIG, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

send(rr); } /** * {@inheritDoc} */ public void setGsmBroadcastConfig(SmsBroadcastConfigInfo[] config, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_SET_BROADCAST_CONFIG, response); int numOfConfig = config.length; rr.mp.writeInt(numOfConfig); for(int i = 0; i < numOfConfig; i++) { rr.mp.writeInt(config[i].getFromServiceId()); rr.mp.writeInt(config[i].getToServiceId()); rr.mp.writeInt(config[i].getFromCodeScheme()); rr.mp.writeInt(config[i].getToCodeScheme()); rr.mp.writeInt(config[i].isSelected() ? 1 : 0); } if (RILJ_LOGD) { riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " with " + numOfConfig + "configs : "); for (int i = 0; i < numOfConfig; i++) { riljLog(config[i].toString()); } } send(rr); } /** * {@inheritDoc} */ public void setGsmBroadcastActivation(boolean activate, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_GSM_BROADCAST_ACTIVATION, response); rr.mp.writeInt(1); rr.mp.writeInt(activate ? 0 : 1); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } //***** Private Methods private void sendScreenState(boolean on) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_SCREEN_STATE, null); rr.mp.writeInt(1); rr.mp.writeInt(on ? 1 : 0); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + ": " + on); send(rr); } protected void onRadioAvailable() { // In case screen state was lost (due to process crash), // this ensures that the RIL knows the correct screen state. // TODO: Should query Power Manager and send the actual // screen state. Just send true for now. sendScreenState(true); } private void setRadioStateFromRILInt(int state) { RadioState newState; /* RIL_RadioState ril.h */ switch(state) { case 0: newState = RadioState.RADIO_OFF; break; case 1: newState = RadioState.RADIO_UNAVAILABLE; break; case 2: newState = RadioState.SIM_NOT_READY; break; case 3: newState = RadioState.SIM_LOCKED_OR_ABSENT; break; case 4: newState = RadioState.SIM_READY; break; case 5: newState = RadioState.RUIM_NOT_READY; break; case 6: newState = RadioState.RUIM_READY; break; case 7: newState = RadioState.RUIM_LOCKED_OR_ABSENT; break; case 8: newState = RadioState.NV_NOT_READY; break; case 9: newState = RadioState.NV_READY; break; default: throw new RuntimeException( "Unrecognized RIL_RadioState: " +state); } if (mInitialRadioStateChange) { if (newState.isOn()) { /* If this is our first notification, make sure the radio * is powered off. This gets the radio into a known state,

* since it's possible for the phone proc to have restarted * (eg, if it or the runtime crashed) without the RIL * and/or radio knowing. */ if (RILJ_LOGD) Log.d(LOG_TAG, "Radio ON @ init; reset to OFF"); setRadioPower(false, null); } else { if (DBG) Log.d(LOG_TAG, "Radio OFF @ init"); setRadioState(newState); } mInitialRadioStateChange = false; } else { setRadioState(newState); } } /** * Holds a PARTIAL_WAKE_LOCK whenever * a) There is outstanding RIL request sent to RIL deamon and no replied * b) There is a request waiting to be sent out. * * There is a WAKE_LOCK_TIMEOUT to release the lock, though it shouldn't * happen often. */ private void acquireWakeLock() { synchronized (mWakeLock) { mWakeLock.acquire(); mRequestMessagesPending++; mSender.removeMessages(EVENT_WAKE_LOCK_TIMEOUT); Message msg = mSender.obtainMessage(EVENT_WAKE_LOCK_TIMEOUT); mSender.sendMessageDelayed(msg, mWakeLockTimeout); } } private void releaseWakeLockIfDone() { synchronized (mWakeLock) { if (mWakeLock.isHeld() && (mRequestMessagesPending == 0) && (mRequestsList.size() == 0)) { mSender.removeMessages(EVENT_WAKE_LOCK_TIMEOUT); mWakeLock.release(); } } } private void send(RILRequest rr) { Message msg; msg = mSender.obtainMessage(EVENT_SEND, rr); acquireWakeLock(); msg.sendToTarget(); } private void processResponse (Parcel p) { int type; type = p.readInt(); if (type == RESPONSE_UNSOLICITED) { processUnsolicited (p); } else if (type == RESPONSE_SOLICITED) { processSolicited (p); } releaseWakeLockIfDone(); } private RILRequest findAndRemoveRequestFromList(int serial) { synchronized (mRequestsList) { for (int i = 0, s = mRequestsList.size() ; i < s ; i++) { RILRequest rr = mRequestsList.get(i); if (rr.mSerial == serial) { mRequestsList.remove(i); return rr; } } } return null; } private void processSolicited (Parcel p) { int serial, error; boolean found = false;

serial = p.readInt(); error = p.readInt(); RILRequest rr; rr = findAndRemoveRequestFromList(serial); if (rr == null) { Log.w(LOG_TAG, "Unexpected solicited response! sn: " + serial + " error: " + error); return; } Object ret = null; if (error == 0 || p.dataAvail() > 0) { // either command succeeds or command fails but with data payload try {switch (rr.mRequest) { /* cat libs/telephony/ril_commands.h \ | egrep "^ *{RIL_" \ | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/' */ case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break; case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break; case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break; case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break; case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break; case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break; case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break; case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break; case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break; case RIL_REQUEST_DIAL: ret = responseVoid(p); break; case RIL_REQUEST_GET_IMSI: ret = responseString(p); break; case RIL_REQUEST_HANGUP: ret = responseVoid(p); break; case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break; case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: ret = responseVoid(p); break; case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_UDUB: ret = responseVoid(p); break; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseInts(p); break; case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; case RIL_REQUEST_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_GPRS_REGISTRATION_STATE: ret = responseStrings(p); break; case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; case RIL_REQUEST_DTMF: ret = responseVoid(p); break; case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break; case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break; case RIL_REQUEST_SETUP_DATA_CALL: ret = responseStrings(p); break; case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break; case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break; case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break; case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break; case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break; case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break; case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break; case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; case RIL_REQUEST_GET_IMEI: ret = responseString(p); break; case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break; case RIL_REQUEST_ANSWER: ret = responseVoid(p); break; case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break; case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break; case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break; case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break; case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseNetworkInfos(p); break; case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break; case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break; case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break; case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break; case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break; case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break; case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break; case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break; case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break; case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break; case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break; case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break; case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break; case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break; case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break; case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break; case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break; case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break; case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break; case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break; case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break;

case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break; case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break; case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break; case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseInts(p); break; case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break; case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_SET_SUBSCRIPTION: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break; case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break; case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break; case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break; case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break; case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break; case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break; case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break; case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break; case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break; case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break; case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break; case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break; case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break; case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break; default: throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); //break; }} catch (Throwable tr) { // Exceptions here usually mean invalid RIL responses Log.w(LOG_TAG, rr.serialString() + "< " + requestToString(rr.mRequest) + " exception, possible invalid RIL response", tr); if (rr.mResult != null) { AsyncResult.forMessage(rr.mResult, null, tr); rr.mResult.sendToTarget(); } rr.release(); return; } } if (error != 0) { rr.onError(error, ret); rr.release(); return; } if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) + " " + retToString(rr.mRequest, ret)); if (rr.mResult != null) { AsyncResult.forMessage(rr.mResult, ret, null); rr.mResult.sendToTarget(); } rr.release(); } private String retToString(int req, Object ret) { if (ret == null) return ""; switch (req) { // Don't log these return values, for privacy's sake. case RIL_REQUEST_GET_IMSI: case RIL_REQUEST_GET_IMEI: case RIL_REQUEST_GET_IMEISV: return ""; } StringBuilder sb; String s; int length; if (ret instanceof int[]){ int[] intArray = (int[]) ret; length = intArray.length; sb = new StringBuilder("{"); if (length > 0) { int i = 0; sb.append(intArray[i++]); while ( i < length) { sb.append(", ").append(intArray[i++]); } }

sb.append("}"); s = sb.toString(); } else if (ret instanceof String[]) { String[] strings = (String[]) ret; length = strings.length; sb = new StringBuilder("{"); if (length > 0) { int i = 0; sb.append(strings[i++]); while ( i < length) { sb.append(", ").append(strings[i++]); } } sb.append("}"); s = sb.toString(); }else if (req == RIL_REQUEST_GET_CURRENT_CALLS) { ArrayList<DriverCall> calls = (ArrayList<DriverCall>) ret; sb = new StringBuilder(" "); for (DriverCall dc : calls) { sb.append("[").append(dc).append("] "); } s = sb.toString(); } else if (req == RIL_REQUEST_GET_NEIGHBORING_CELL_IDS) { ArrayList<NeighboringCellInfo> cells; cells = (ArrayList<NeighboringCellInfo>) ret; sb = new StringBuilder(" "); for (NeighboringCellInfo cell : cells) { sb.append(cell).append(" "); } s = sb.toString(); } else { s = ret.toString(); } return s; } private void processUnsolicited (Parcel p) { int response; Object ret; response = p.readInt(); try {switch(response) { /* cat libs/telephony/ril_unsol_commands.h \ | egrep "^ *{RIL_" \ | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: \2(rr, p); break;/' */ case case case case case case case case case case case case case case case case case case case case case case case case case case case case case case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: ret = responseVoid(p); break; RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: ret = responseVoid(p); break; RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: ret = responseVoid(p); break; RIL_UNSOL_RESPONSE_NEW_SMS: ret = responseString(p); break; RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: ret = responseString(p); break; RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: ret = responseInts(p); break; RIL_UNSOL_ON_USSD: ret = responseStrings(p); break; RIL_UNSOL_NITZ_TIME_RECEIVED: ret = responseString(p); break; RIL_UNSOL_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; RIL_UNSOL_DATA_CALL_LIST_CHANGED: ret = responseDataCallList(p);break; RIL_UNSOL_SUPP_SVC_NOTIFICATION: ret = responseSuppServiceNotification(p); break; RIL_UNSOL_STK_SESSION_END: ret = responseVoid(p); break; RIL_UNSOL_STK_PROACTIVE_COMMAND: ret = responseString(p); break; RIL_UNSOL_STK_EVENT_NOTIFY: ret = responseString(p); break; RIL_UNSOL_STK_CALL_SETUP: ret = responseInts(p); break; RIL_UNSOL_SIM_SMS_STORAGE_FULL: ret = responseVoid(p); break; RIL_UNSOL_SIM_REFRESH: ret = responseInts(p); break; RIL_UNSOL_CALL_RING: ret = responseCallRing(p); break; RIL_UNSOL_RESTRICTED_STATE_CHANGED: ret = responseInts(p); break; RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: ret = responseVoid(p); break; RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: ret = responseCdmaSms(p); break; RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: ret = responseString(p); break; RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: ret = responseVoid(p); break; RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; RIL_UNSOL_CDMA_CALL_WAITING: ret = responseCdmaCallWaiting(p); break; RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: ret = responseInts(p); break; RIL_UNSOL_CDMA_INFO_REC: ret = responseCdmaInformationRecord(p); break; RIL_UNSOL_OEM_HOOK_RAW: ret = responseRaw(p); break; RIL_UNSOL_RINGBACK_TONE: ret = responseInts(p); break; RIL_UNSOL_RESEND_INCALL_MUTE: ret = responseVoid(p); break;

default: throw new RuntimeException("Unrecognized unsol response: " + response); //break; (implied) }} catch (Throwable tr) { Log.e(LOG_TAG, "Exception processing unsol response: " + response + "Exception:" + tr.toString()); return; } switch(response) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: /* has bonus radio state int */ setRadioStateFromRILInt(p.readInt());

if (RILJ_LOGD) unsljLogMore(response, mState.toString()); break; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: if (RILJ_LOGD) unsljLog(response); mCallStateRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); break; case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: if (RILJ_LOGD) unsljLog(response); mNetworkStateRegistrants .notifyRegistrants(new AsyncResult(null, null, null)); break; case RIL_UNSOL_RESPONSE_NEW_SMS: { if (RILJ_LOGD) unsljLog(response); // FIXME this should move up a layer String a[] = new String[2]; a[1] = (String)ret; SmsMessage sms; sms = SmsMessage.newFromCMT(a); if (mSMSRegistrant != null) { mSMSRegistrant .notifyRegistrant(new AsyncResult(null, sms, null)); } break; } case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: if (RILJ_LOGD) unsljLogRet(response, ret); if (mSmsStatusRegistrant != null) { mSmsStatusRegistrant.notifyRegistrant( new AsyncResult(null, ret, null)); } break; case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: if (RILJ_LOGD) unsljLogRet(response, ret); int[] smsIndex = (int[])ret; if(smsIndex.length == 1) { if (mSmsOnSimRegistrant != null) { mSmsOnSimRegistrant. notifyRegistrant(new AsyncResult(null, smsIndex, null)); } } else { if (RILJ_LOGD) riljLog(" NEW_SMS_ON_SIM ERROR with wrong length " + smsIndex.length); } break; case RIL_UNSOL_ON_USSD: String[] resp = (String[])ret; if (resp.length < 2) { resp = new String[2]; resp[0] = ((String[])ret)[0]; resp[1] = null; } if (RILJ_LOGD) unsljLogMore(response, resp[0]); if (mUSSDRegistrant != null) { mUSSDRegistrant.notifyRegistrant( new AsyncResult (null, resp, null)); } break; case RIL_UNSOL_NITZ_TIME_RECEIVED: if (RILJ_LOGD) unsljLogRet(response, ret); // has bonus long containing milliseconds since boot that the NITZ // time was received long nitzReceiveTime = p.readLong(); Object[] result = new Object[2]; result[0] = ret; result[1] = Long.valueOf(nitzReceiveTime); if (mNITZTimeRegistrant != null) { mNITZTimeRegistrant .notifyRegistrant(new AsyncResult (null, result, null)); } else { // in case NITZ time registrant isnt registered yet mLastNITZTimeInfo = result; } break; case RIL_UNSOL_SIGNAL_STRENGTH: // Note this is set to "verbose" because it happens // frequently

if (RILJ_LOGV) unsljLogvRet(response, ret); if (mSignalStrengthRegistrant != null) { mSignalStrengthRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_DATA_CALL_LIST_CHANGED: if (RILJ_LOGD) unsljLogRet(response, ret); mDataConnectionRegistrants.notifyRegistrants(new AsyncResult(null, ret, null)); break; case RIL_UNSOL_SUPP_SVC_NOTIFICATION: if (RILJ_LOGD) unsljLogRet(response, ret); if (mSsnRegistrant != null) { mSsnRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_SESSION_END: if (RILJ_LOGD) unsljLog(response); if (mStkSessionEndRegistrant != null) { mStkSessionEndRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_PROACTIVE_COMMAND: if (RILJ_LOGD) unsljLogRet(response, ret); if (mStkProCmdRegistrant != null) { mStkProCmdRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_EVENT_NOTIFY: if (RILJ_LOGD) unsljLogRet(response, ret); if (mStkEventRegistrant != null) { mStkEventRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_STK_CALL_SETUP: if (RILJ_LOGD) unsljLogRet(response, ret); if (mStkCallSetUpRegistrant != null) { mStkCallSetUpRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_SIM_SMS_STORAGE_FULL: if (RILJ_LOGD) unsljLog(response); if (mIccSmsFullRegistrant != null) { mIccSmsFullRegistrant.notifyRegistrant(); } break; case RIL_UNSOL_SIM_REFRESH: if (RILJ_LOGD) unsljLogRet(response, ret); if (mIccRefreshRegistrant != null) { mIccRefreshRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_CALL_RING: if (RILJ_LOGD) unsljLogRet(response, ret); if (mRingRegistrant != null) { mRingRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_RESTRICTED_STATE_CHANGED: if (RILJ_LOGD) unsljLogvRet(response, ret); if (mRestrictedStateRegistrant != null) { mRestrictedStateRegistrant.notifyRegistrant( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: if (RILJ_LOGD) unsljLog(response);

if (mIccStatusChangedRegistrants != null) { mIccStatusChangedRegistrants.notifyRegistrants(); } break; case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: if (RILJ_LOGD) unsljLog(response); SmsMessage sms = (SmsMessage) ret; if (mSMSRegistrant != null) { mSMSRegistrant .notifyRegistrant(new AsyncResult(null, sms, null)); } break; case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: if (RILJ_LOGD) unsljLog(response); if (mGsmBroadcastSmsRegistrant != null) { mGsmBroadcastSmsRegistrant .notifyRegistrant(new AsyncResult(null, ret, null)); } break; case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: if (RILJ_LOGD) unsljLog(response); if (mIccSmsFullRegistrant != null) { mIccSmsFullRegistrant.notifyRegistrant(); } break; case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: if (RILJ_LOGD) unsljLog(response); if (mEmergencyCallbackModeRegistrant != null) { mEmergencyCallbackModeRegistrant.notifyRegistrant(); } break; case RIL_UNSOL_CDMA_CALL_WAITING: if (RILJ_LOGD) unsljLogRet(response, ret); if (mCallWaitingInfoRegistrants != null) { mCallWaitingInfoRegistrants.notifyRegistrants( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: if (RILJ_LOGD) unsljLogRet(response, ret); if (mOtaProvisionRegistrants != null) { mOtaProvisionRegistrants.notifyRegistrants( new AsyncResult (null, ret, null)); } break; case RIL_UNSOL_CDMA_INFO_REC: ArrayList<CdmaInformationRecords> listInfoRecs; try { listInfoRecs = (ArrayList<CdmaInformationRecords>)ret; } catch (ClassCastException e) { Log.e(LOG_TAG, "Unexpected exception casting to listInfoRecs", e); break; } for (CdmaInformationRecords rec : listInfoRecs) { if (RILJ_LOGD) unsljLogRet(response, rec); notifyRegistrantsCdmaInfoRec(rec); } break; case RIL_UNSOL_OEM_HOOK_RAW: if (RILJ_LOGD) unsljLogvRet(response, IccUtils.bytesToHexString((byte[])ret)); if (mUnsolOemHookRawRegistrant != null) { mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, ret, null)); } break; case RIL_UNSOL_RINGBACK_TONE: if (RILJ_LOGD) unsljLogvRet(response, ret); if (mRingbackToneRegistrants != null) { boolean playtone = (((int[])ret)[0] == 1); mRingbackToneRegistrants.notifyRegistrants( new AsyncResult (null, playtone, null)); } break; case RIL_UNSOL_RESEND_INCALL_MUTE: if (RILJ_LOGD) unsljLogRet(response, ret);

if (mResendIncallMuteRegistrants != null) { mResendIncallMuteRegistrants.notifyRegistrants( new AsyncResult (null, ret, null)); } } } private Object responseInts(Parcel p) { int numInts; int response[]; numInts = p.readInt(); response = new int[numInts]; for (int i = 0 ; i < numInts ; i++) { response[i] = p.readInt(); } return response; }

private Object responseVoid(Parcel p) { return null; } private Object responseCallForward(Parcel p) { int numInfos; CallForwardInfo infos[]; numInfos = p.readInt(); infos = new CallForwardInfo[numInfos]; for (int i = 0 ; i < numInfos ; i++) { infos[i] = new CallForwardInfo(); infos[i].status = p.readInt(); infos[i].reason = p.readInt(); infos[i].serviceClass = p.readInt(); infos[i].toa = p.readInt(); infos[i].number = p.readString(); infos[i].timeSeconds = p.readInt(); } return infos; } private Object responseSuppServiceNotification(Parcel p) { SuppServiceNotification notification = new SuppServiceNotification(); notification.notificationType = p.readInt(); notification.code = p.readInt(); notification.index = p.readInt(); notification.type = p.readInt(); notification.number = p.readString(); return notification; } private Object responseCdmaSms(Parcel p) { SmsMessage sms; sms = SmsMessage.newFromParcel(p); return sms; } private Object responseString(Parcel p) { String response; response = p.readString(); return response; } private Object responseStrings(Parcel p) { int num; String response[]; response = p.readStringArray(); if (false) { num = p.readInt(); response = new String[num];

for (int i = 0; i < num; i++) { response[i] = p.readString(); } } return response; } private Object responseRaw(Parcel p) { int num; byte response[]; response = p.createByteArray(); return response; } private Object responseSMS(Parcel p) { int messageRef, errorCode; String ackPDU; messageRef = p.readInt(); ackPDU = p.readString(); errorCode = p.readInt(); SmsResponse response = new SmsResponse(messageRef, ackPDU, errorCode); return response; }

private Object responseICC_IO(Parcel p) { int sw1, sw2; byte data[] = null; Message ret; sw1 = p.readInt(); sw2 = p.readInt(); String s = p.readString(); if (RILJ_LOGD) riljLog("< iccIO: " + " 0x" + Integer.toHexString(sw1) + " 0x" + Integer.toHexString(sw2) + " " + s); return new IccIoResult(sw1, sw2, s); } private Object responseIccCardStatus(Parcel p) { IccCardApplication ca; IccCardStatus status = new IccCardStatus(); status.setCardState(p.readInt()); status.setUniversalPinState(p.readInt()); status.setGsmUmtsSubscriptionAppIndex(p.readInt()); status.setCdmaSubscriptionAppIndex(p.readInt()); int numApplications = p.readInt(); // limit to maximum allowed applications if (numApplications > IccCardStatus.CARD_MAX_APPS) { numApplications = IccCardStatus.CARD_MAX_APPS; } status.setNumApplications(numApplications); for (int i = 0 ; i < numApplications ; i++) { ca = new IccCardApplication(); ca.app_type = ca.AppTypeFromRILInt(p.readInt()); ca.app_state = ca.AppStateFromRILInt(p.readInt()); ca.perso_substate = ca.PersoSubstateFromRILInt(p.readInt()); ca.aid = p.readString(); ca.app_label = p.readString(); ca.pin1_replaced = p.readInt(); ca.pin1 = p.readInt(); ca.pin2 = p.readInt(); status.addApplication(ca); } return status; } private Object responseCallList(Parcel p) { int num; int voiceSettings; ArrayList<DriverCall> response; DriverCall dc; num = p.readInt(); response = new ArrayList<DriverCall>(num);

for (int i = 0 ; i < num ; i++) { dc = new DriverCall(); dc.state = DriverCall.stateFromCLCC(p.readInt()); dc.index = p.readInt(); dc.TOA = p.readInt(); dc.isMpty = (0 != p.readInt()); dc.isMT = (0 != p.readInt()); dc.als = p.readInt(); voiceSettings = p.readInt(); dc.isVoice = (0 == voiceSettings) ? false : true; dc.isVoicePrivacy = (0 != p.readInt()); dc.number = p.readString(); int np = p.readInt(); dc.numberPresentation = DriverCall.presentationFromCLIP(np); dc.name = p.readString(); dc.namePresentation = p.readInt(); int uusInfoPresent = p.readInt(); if (uusInfoPresent == 1) { // TODO: Copy the data to dc to forward to the apps. p.readInt(); p.readInt(); p.createByteArray(); } // Make sure there's a leading + on addresses with a TOA of 145 dc.number = PhoneNumberUtils.stringFromStringAndTOA(dc.number, dc.TOA); response.add(dc); if (dc.isVoicePrivacy) { mVoicePrivacyOnRegistrants.notifyRegistrants(); Log.d(LOG_TAG, "InCall VoicePrivacy is enabled"); } else { mVoicePrivacyOffRegistrants.notifyRegistrants(); Log.d(LOG_TAG, "InCall VoicePrivacy is disabled"); } } Collections.sort(response); return response; } private Object responseDataCallList(Parcel p) { int num; ArrayList<DataCallState> response; num = p.readInt(); response = new ArrayList<DataCallState>(num); for (int i = 0; i < num; i++) { DataCallState dataCall = new DataCallState(); dataCall.cid = p.readInt(); dataCall.active = p.readInt(); dataCall.type = p.readString(); dataCall.apn = p.readString(); dataCall.address = p.readString(); response.add(dataCall); } return response; } private Object responseNetworkInfos(Parcel p) { String strings[] = (String [])responseStrings(p); ArrayList<NetworkInfo> ret; if (strings.length % 4 != 0) { throw new RuntimeException( "RIL_REQUEST_QUERY_AVAILABLE_NETWORKS: invalid response. Got " + strings.length + " strings, expected multible of 4"); } ret = new ArrayList<NetworkInfo>(strings.length / 4); for (int i = 0 ; i < strings.length ; i += 4) { ret.add ( new NetworkInfo( strings[i+0], strings[i+1], strings[i+2], strings[i+3])); } return ret; } private Object responseCellList(Parcel p) {

int num, rssi; String location; ArrayList<NeighboringCellInfo> response; NeighboringCellInfo cell; num = p.readInt(); response = new ArrayList<NeighboringCellInfo>(); // Determine the radio access type String radioString = SystemProperties.get( TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE, "unknown"); int radioType; if (radioString.equals("GPRS")) { radioType = NETWORK_TYPE_GPRS; } else if (radioString.equals("EDGE")) { radioType = NETWORK_TYPE_EDGE; } else if (radioString.equals("UMTS")) { radioType = NETWORK_TYPE_UMTS; } else if (radioString.equals("HSDPA")) { radioType = NETWORK_TYPE_HSDPA; } else if (radioString.equals("HSUPA")) { radioType = NETWORK_TYPE_HSUPA; } else if (radioString.equals("HSPA")) { radioType = NETWORK_TYPE_HSPA; } else { radioType = NETWORK_TYPE_UNKNOWN; } // Interpret the location based on radio access type if (radioType != NETWORK_TYPE_UNKNOWN) { for (int i = 0 ; i < num ; i++) { rssi = p.readInt(); location = p.readString(); cell = new NeighboringCellInfo(rssi, location, radioType); response.add(cell); } } return response; } private Object responseGmsBroadcastConfig(Parcel p) { int num; ArrayList<SmsBroadcastConfigInfo> response; SmsBroadcastConfigInfo info; num = p.readInt(); response = new ArrayList<SmsBroadcastConfigInfo>(num); for (int i = 0; i < num; i++) { int fromId = p.readInt(); int toId = p.readInt(); int fromScheme = p.readInt(); int toScheme = p.readInt(); boolean selected = (p.readInt() == 1); info = new SmsBroadcastConfigInfo(fromId, toId, fromScheme, toScheme, selected); response.add(info); } return response; } private Object responseCdmaBroadcastConfig(Parcel p) { int numServiceCategories; int response[]; numServiceCategories = p.readInt(); if (numServiceCategories == 0) { // TODO: The logic of providing default values should // not be done by this transport layer. And needs to // be done by the vendor ril or application logic. int numInts; numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1; response = new int[numInts]; // Faking a default record for all possible records. response[0] = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES; // Loop over CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES set 'english' as // default language and selection status to false for all. for (int i = 1; i < numInts; i += CDMA_BSI_NO_OF_INTS_STRUCT ) { response[i + 0] = i / CDMA_BSI_NO_OF_INTS_STRUCT; response[i + 1] = 1; response[i + 2] = 0; } } else { int numInts; numInts = (numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT) + 1; response = new int[numInts]; response[0] = numServiceCategories; for (int i = 1 ; i < numInts; i++) {

response[i] = p.readInt(); } } return response; } private Object responseSignalStrength(Parcel p) { int numInts = 7; int response[]; /* TODO: Add SignalStrength class to match RIL_SignalStrength */ response = new int[numInts]; for (int i = 0 ; i < numInts ; i++) { response[i] = p.readInt(); } return response; } private ArrayList<CdmaInformationRecords> responseCdmaInformationRecord(Parcel p) { int numberOfInfoRecs; ArrayList<CdmaInformationRecords> response; /** * Loop through all of the information records unmarshalling them * and converting them to Java Objects. */ numberOfInfoRecs = p.readInt(); response = new ArrayList<CdmaInformationRecords>(numberOfInfoRecs); for (int i = 0; i < numberOfInfoRecs; i++) { CdmaInformationRecords InfoRec = new CdmaInformationRecords(p); response.add(InfoRec); } return response; } private Object responseCdmaCallWaiting(Parcel p) { CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification(); notification.number = p.readString(); notification.numberPresentation = notification.presentationFromCLIP(p.readInt()); notification.name = p.readString(); notification.namePresentation = notification.numberPresentation; notification.isPresent = p.readInt(); notification.signalType = p.readInt(); notification.alertPitch = p.readInt(); notification.signal = p.readInt(); return notification; } private Object responseCallRing(Parcel p){ char response[] = new char[4]; response[0] response[1] response[2] response[3] = = = = (char) (char) (char) (char) p.readInt(); p.readInt(); p.readInt(); p.readInt(); // // // // isPresent signalType alertPitch signal

return response; } private void notifyRegistrantsCdmaInfoRec(CdmaInformationRecords infoRec) { int response = RIL_UNSOL_CDMA_INFO_REC; if (infoRec.record instanceof CdmaInformationRecords.CdmaDisplayInfoRec) { if (mDisplayInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mDisplayInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaSignalInfoRec) { if (mSignalInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mSignalInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaNumberInfoRec) { if (mNumberInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mNumberInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaRedirectingNumberInfoRec) { if (mRedirNumInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mRedirNumInfoRegistrants.notifyRegistrants(

new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaLineControlInfoRec) { if (mLineControlInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mLineControlInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaT53ClirInfoRec) { if (mT53ClirInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mT53ClirInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } else if (infoRec.record instanceof CdmaInformationRecords.CdmaT53AudioControlInfoRec) { if (mT53AudCntrlInfoRegistrants != null) { if (RILJ_LOGD) unsljLogRet(response, infoRec.record); mT53AudCntrlInfoRegistrants.notifyRegistrants( new AsyncResult (null, infoRec.record, null)); } } } static String requestToString(int request) { /* cat libs/telephony/ril_commands.h \ | egrep "^ *{RIL_" \ | sed -re 's/\{RIL_([^,]+),[^,]+,([^}]+).+/case RIL_\1: return "\1";/' */ switch(request) { case RIL_REQUEST_GET_SIM_STATUS: return "GET_SIM_STATUS"; case RIL_REQUEST_ENTER_SIM_PIN: return "ENTER_SIM_PIN"; case RIL_REQUEST_ENTER_SIM_PUK: return "ENTER_SIM_PUK"; case RIL_REQUEST_ENTER_SIM_PIN2: return "ENTER_SIM_PIN2"; case RIL_REQUEST_ENTER_SIM_PUK2: return "ENTER_SIM_PUK2"; case RIL_REQUEST_CHANGE_SIM_PIN: return "CHANGE_SIM_PIN"; case RIL_REQUEST_CHANGE_SIM_PIN2: return "CHANGE_SIM_PIN2"; case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: return "ENTER_NETWORK_DEPERSONALIZATION"; case RIL_REQUEST_GET_CURRENT_CALLS: return "GET_CURRENT_CALLS"; case RIL_REQUEST_DIAL: return "DIAL"; case RIL_REQUEST_GET_IMSI: return "GET_IMSI"; case RIL_REQUEST_HANGUP: return "HANGUP"; case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: return "HANGUP_WAITING_OR_BACKGROUND"; case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: return "HANGUP_FOREGROUND_RESUME_BACKGROUND"; case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: return "REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE"; case RIL_REQUEST_CONFERENCE: return "CONFERENCE"; case RIL_REQUEST_UDUB: return "UDUB"; case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: return "LAST_CALL_FAIL_CAUSE"; case RIL_REQUEST_SIGNAL_STRENGTH: return "SIGNAL_STRENGTH"; case RIL_REQUEST_REGISTRATION_STATE: return "REGISTRATION_STATE"; case RIL_REQUEST_GPRS_REGISTRATION_STATE: return "GPRS_REGISTRATION_STATE"; case RIL_REQUEST_OPERATOR: return "OPERATOR"; case RIL_REQUEST_RADIO_POWER: return "RADIO_POWER"; case RIL_REQUEST_DTMF: return "DTMF"; case RIL_REQUEST_SEND_SMS: return "SEND_SMS"; case RIL_REQUEST_SEND_SMS_EXPECT_MORE: return "SEND_SMS_EXPECT_MORE"; case RIL_REQUEST_SETUP_DATA_CALL: return "SETUP_DATA_CALL"; case RIL_REQUEST_SIM_IO: return "SIM_IO"; case RIL_REQUEST_SEND_USSD: return "SEND_USSD"; case RIL_REQUEST_CANCEL_USSD: return "CANCEL_USSD"; case RIL_REQUEST_GET_CLIR: return "GET_CLIR"; case RIL_REQUEST_SET_CLIR: return "SET_CLIR"; case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: return "QUERY_CALL_FORWARD_STATUS"; case RIL_REQUEST_SET_CALL_FORWARD: return "SET_CALL_FORWARD"; case RIL_REQUEST_QUERY_CALL_WAITING: return "QUERY_CALL_WAITING"; case RIL_REQUEST_SET_CALL_WAITING: return "SET_CALL_WAITING"; case RIL_REQUEST_SMS_ACKNOWLEDGE: return "SMS_ACKNOWLEDGE"; case RIL_REQUEST_GET_IMEI: return "GET_IMEI"; case RIL_REQUEST_GET_IMEISV: return "GET_IMEISV"; case RIL_REQUEST_ANSWER: return "ANSWER"; case RIL_REQUEST_DEACTIVATE_DATA_CALL: return "DEACTIVATE_DATA_CALL"; case RIL_REQUEST_QUERY_FACILITY_LOCK: return "QUERY_FACILITY_LOCK"; case RIL_REQUEST_SET_FACILITY_LOCK: return "SET_FACILITY_LOCK"; case RIL_REQUEST_CHANGE_BARRING_PASSWORD: return "CHANGE_BARRING_PASSWORD"; case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: return "QUERY_NETWORK_SELECTION_MODE"; case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: return "SET_NETWORK_SELECTION_AUTOMATIC"; case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: return "SET_NETWORK_SELECTION_MANUAL"; case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : return "QUERY_AVAILABLE_NETWORKS "; case RIL_REQUEST_DTMF_START: return "DTMF_START"; case RIL_REQUEST_DTMF_STOP: return "DTMF_STOP"; case RIL_REQUEST_BASEBAND_VERSION: return "BASEBAND_VERSION"; case RIL_REQUEST_SEPARATE_CONNECTION: return "SEPARATE_CONNECTION"; case RIL_REQUEST_SET_MUTE: return "SET_MUTE"; case RIL_REQUEST_GET_MUTE: return "GET_MUTE"; case RIL_REQUEST_QUERY_CLIP: return "QUERY_CLIP"; case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: return "LAST_DATA_CALL_FAIL_CAUSE"; case RIL_REQUEST_DATA_CALL_LIST: return "DATA_CALL_LIST"; case RIL_REQUEST_RESET_RADIO: return "RESET_RADIO"; case RIL_REQUEST_OEM_HOOK_RAW: return "OEM_HOOK_RAW"; case RIL_REQUEST_OEM_HOOK_STRINGS: return "OEM_HOOK_STRINGS"; case RIL_REQUEST_SCREEN_STATE: return "SCREEN_STATE"; case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: return "SET_SUPP_SVC_NOTIFICATION"; case RIL_REQUEST_WRITE_SMS_TO_SIM: return "WRITE_SMS_TO_SIM";

case RIL_REQUEST_DELETE_SMS_ON_SIM: return "DELETE_SMS_ON_SIM"; case RIL_REQUEST_SET_BAND_MODE: return "SET_BAND_MODE"; case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: return "QUERY_AVAILABLE_BAND_MODE"; case RIL_REQUEST_STK_GET_PROFILE: return "REQUEST_STK_GET_PROFILE"; case RIL_REQUEST_STK_SET_PROFILE: return "REQUEST_STK_SET_PROFILE"; case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: return "REQUEST_STK_SEND_ENVELOPE_COMMAND"; case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: return "REQUEST_STK_SEND_TERMINAL_RESPONSE"; case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: return "REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM"; case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: return "REQUEST_EXPLICIT_CALL_TRANSFER"; case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: return "REQUEST_SET_PREFERRED_NETWORK_TYPE"; case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: return "REQUEST_GET_PREFERRED_NETWORK_TYPE"; case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: return "REQUEST_GET_NEIGHBORING_CELL_IDS"; case RIL_REQUEST_SET_LOCATION_UPDATES: return "REQUEST_SET_LOCATION_UPDATES"; case RIL_REQUEST_CDMA_SET_SUBSCRIPTION: return "RIL_REQUEST_CDMA_SET_SUBSCRIPTION"; case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: return "RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE"; case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: return "RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE"; case RIL_REQUEST_SET_TTY_MODE: return "RIL_REQUEST_SET_TTY_MODE"; case RIL_REQUEST_QUERY_TTY_MODE: return "RIL_REQUEST_QUERY_TTY_MODE"; case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: return "RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE"; case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: return "RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE"; case RIL_REQUEST_CDMA_FLASH: return "RIL_REQUEST_CDMA_FLASH"; case RIL_REQUEST_CDMA_BURST_DTMF: return "RIL_REQUEST_CDMA_BURST_DTMF"; case RIL_REQUEST_CDMA_SEND_SMS: return "RIL_REQUEST_CDMA_SEND_SMS"; case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: return "RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE"; case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: return "RIL_REQUEST_GSM_GET_BROADCAST_CONFIG"; case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: return "RIL_REQUEST_GSM_SET_BROADCAST_CONFIG"; case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: return "RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG"; case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: return "RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG"; case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: return "RIL_REQUEST_GSM_BROADCAST_ACTIVATION"; case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: return "RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY"; case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: return "RIL_REQUEST_CDMA_BROADCAST_ACTIVATION"; case RIL_REQUEST_CDMA_SUBSCRIPTION: return "RIL_REQUEST_CDMA_SUBSCRIPTION"; case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: return "RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM"; case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: return "RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM"; case RIL_REQUEST_DEVICE_IDENTITY: return "RIL_REQUEST_DEVICE_IDENTITY"; case RIL_REQUEST_GET_SMSC_ADDRESS: return "RIL_REQUEST_GET_SMSC_ADDRESS"; case RIL_REQUEST_SET_SMSC_ADDRESS: return "RIL_REQUEST_SET_SMSC_ADDRESS"; case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: return "REQUEST_EXIT_EMERGENCY_CALLBACK_MODE"; case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: return "RIL_REQUEST_REPORT_SMS_MEMORY_STATUS"; case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: return "RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING"; default: return "<unknown request>"; } } static String responseToString(int request) { /* cat libs/telephony/ril_unsol_commands.h \ | egrep "^ *{RIL_" \ | sed -re 's/\{RIL_([^,]+),[^,]+,([^}]+).+/case RIL_\1: return "\1";/' */ switch(request) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_NETWORK_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_NEW_SMS: return "UNSOL_RESPONSE_NEW_SMS"; case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT: return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT"; case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM: return "UNSOL_RESPONSE_NEW_SMS_ON_SIM"; case RIL_UNSOL_ON_USSD: return "UNSOL_ON_USSD"; case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST"; case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED"; case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH"; case RIL_UNSOL_DATA_CALL_LIST_CHANGED: return "UNSOL_DATA_CALL_LIST_CHANGED"; case RIL_UNSOL_SUPP_SVC_NOTIFICATION: return "UNSOL_SUPP_SVC_NOTIFICATION"; case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END"; case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND"; case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY"; case RIL_UNSOL_STK_CALL_SETUP: return "UNSOL_STK_CALL_SETUP"; case RIL_UNSOL_SIM_SMS_STORAGE_FULL: return "UNSOL_SIM_SMS_STORAGE_FULL"; case RIL_UNSOL_SIM_REFRESH: return "UNSOL_SIM_REFRESH"; case RIL_UNSOL_CALL_RING: return "UNSOL_CALL_RING"; case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: return "UNSOL_RESPONSE_SIM_STATUS_CHANGED"; case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: return "UNSOL_RESPONSE_CDMA_NEW_SMS"; case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS: return "UNSOL_RESPONSE_NEW_BROADCAST_SMS"; case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL: return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL"; case RIL_UNSOL_RESTRICTED_STATE_CHANGED: return "UNSOL_RESTRICTED_STATE_CHANGED"; case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE: return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE"; case RIL_UNSOL_CDMA_CALL_WAITING: return "UNSOL_CDMA_CALL_WAITING"; case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS: return "UNSOL_CDMA_OTA_PROVISION_STATUS"; case RIL_UNSOL_CDMA_INFO_REC: return "UNSOL_CDMA_INFO_REC"; case RIL_UNSOL_OEM_HOOK_RAW: return "UNSOL_OEM_HOOK_RAW"; case RIL_UNSOL_RINGBACK_TONE: return "UNSOL_RINGBACK_TONG"; case RIL_UNSOL_RESEND_INCALL_MUTE: return "UNSOL_RESEND_INCALL_MUTE"; default: return "<unknown reponse>"; } } private void riljLog(String msg) { Log.d(LOG_TAG, msg); } private void riljLogv(String msg) { Log.v(LOG_TAG, msg);

} private void unsljLog(int response) { riljLog("[UNSL]< " + responseToString(response)); } private void unsljLogMore(int response, String more) { riljLog("[UNSL]< " + responseToString(response) + " " + more); } private void unsljLogRet(int response, Object ret) { riljLog("[UNSL]< " + responseToString(response) + " " + retToString(response, ret)); } private void unsljLogvRet(int response, Object ret) { riljLogv("[UNSL]< " + responseToString(response) + " " + retToString(response, ret)); }

// ***** Methods for CDMA support public void getDeviceIdentity(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_DEVICE_IDENTITY, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void getCDMASubscription(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SUBSCRIPTION, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setPhoneType(int phoneType) { //Set by CDMAPhone and GSMPhone constructor mPhoneType = phoneType; } /** * {@inheritDoc} */ public void queryCdmaRoamingPreference(Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void setCdmaRoamingPreference(int cdmaRoamingType, Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, response); rr.mp.writeInt(1); rr.mp.writeInt(cdmaRoamingType); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + cdmaRoamingType); send(rr); } /** * {@inheritDoc} */ public void setCdmaSubscription(int cdmaSubscription , Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_CDMA_SET_SUBSCRIPTION, response); rr.mp.writeInt(1); rr.mp.writeInt(cdmaSubscription); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + cdmaSubscription); send(rr); } /** * {@inheritDoc} */ public void queryTTYMode(Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_QUERY_TTY_MODE, response); send(rr);

} /** * {@inheritDoc} */ public void setTTYMode(int ttyMode, Message response) { RILRequest rr = RILRequest.obtain( RILConstants.RIL_REQUEST_SET_TTY_MODE, response); rr.mp.writeInt(1); rr.mp.writeInt(ttyMode); send(rr); } /** * {@inheritDoc} */ public void sendCDMAFeatureCode(String FeatureCode, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_FLASH, response); rr.mp.writeString(FeatureCode); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " : " + FeatureCode); send(rr); } public void getCdmaBroadcastConfig(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG, response); send(rr); } // TODO: Change the configValuesArray to a RIL_BroadcastSMSConfig public void setCdmaBroadcastConfig(int[] configValuesArray, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, response); for(int i = 0; i < configValuesArray.length; i++) { rr.mp.writeInt(configValuesArray[i]); } if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } public void setCdmaBroadcastActivation(boolean activate, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_BROADCAST_ACTIVATION, response); rr.mp.writeInt(1); rr.mp.writeInt(activate ? 0 :1); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } /** * {@inheritDoc} */ public void exitEmergencyCallbackMode(Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, response); if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); send(rr); } }

ATTACHMENT F

/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.telephony; /** * TODO: This should probably not be an interface see * http://www.javaworld.com/javaworld/javaqa/2001-06/01-qa-0608-constants.html and google with * http://www.google.com/search?q=interface+constants&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a * * Also they should all probably be static final. */ /** * {@hide} */ public interface RILConstants { // From the top of ril.cpp int RIL_ERRNO_INVALID_RESPONSE = -1; // from RIL_Errno int SUCCESS = 0; int RADIO_NOT_AVAILABLE = 1; int GENERIC_FAILURE = 2; int PASSWORD_INCORRECT = 3; int SIM_PIN2 = 4; int SIM_PUK2 = 5; int REQUEST_NOT_SUPPORTED = 6; int REQUEST_CANCELLED = 7; int OP_NOT_ALLOWED_DURING_VOICE_CALL = 8; int OP_NOT_ALLOWED_BEFORE_REG_NW = 9; int SMS_SEND_FAIL_RETRY = 10; int SIM_ABSENT = 11; int SUBSCRIPTION_NOT_AVAILABLE = 12; int MODE_NOT_SUPPORTED = 13; int FDN_CHECK_FAILURE = 14; int ILLEGAL_SIM_OR_ME = 15;

/* If radio did not start or is resetting */ /* for PIN/PIN2 methods only! */ /* Operation requires SIM PIN2 to be entered */ /* Operation requires SIM PIN2 to be entered */

/* data operation is not allowed during voice call in class C */ /* request is not allowed before device registers to network */ /* send sms fail and need retry */ /* ICC card is absent */ /* fail to find CDMA subscription from specified location */ /* HW does not support preferred network type */ /* send operation barred error when FDN is enabled */ /* network selection failure due to wrong SIM/ME and no retries needed */

/* NETWORK_MODE_* See ril.h RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ int NETWORK_MODE_WCDMA_PREF = 0; /* GSM/WCDMA (WCDMA preferred) */ int NETWORK_MODE_GSM_ONLY = 1; /* GSM only */ int NETWORK_MODE_WCDMA_ONLY = 2; /* WCDMA only */ int NETWORK_MODE_GSM_UMTS = 3; /* GSM/WCDMA (auto mode, according to PRL) AVAILABLE Application Settings menu*/ int NETWORK_MODE_CDMA = 4; /* CDMA and EvDo (auto mode, according to PRL) AVAILABLE Application Settings menu*/ int NETWORK_MODE_CDMA_NO_EVDO = 5; /* CDMA only */ int NETWORK_MODE_EVDO_NO_CDMA = 6; /* EvDo only */ int NETWORK_MODE_GLOBAL = 7; /* GSM/WCDMA, CDMA, and EvDo (auto mode, according to PRL) AVAILABLE Application Settings menu*/ int PREFERRED_NETWORK_MODE = NETWORK_MODE_WCDMA_PREF; /* CDMA subscription source. See ril.h RIL_REQUEST_CDMA_SET_SUBSCRIPTION */ int SUBSCRIPTION_FROM_RUIM = 0; /* CDMA subscription from RUIM when available */ int SUBSCRIPTION_FROM_NV = 1; /* CDMA subscription from NV */ int PREFERRED_CDMA_SUBSCRIPTION = SUBSCRIPTION_FROM_NV; int CDMA_CELL_BROADCAST_SMS_DISABLED = 1; int CDMA_CELL_BROADCAST_SMS_ENABLED = 0; int NO_PHONE = 0; int GSM_PHONE = 1; int CDMA_PHONE = 2; int CDM_TTY_MODE_DISABLED = 0; int CDM_TTY_MODE_ENABLED = 1; int CDM_TTY_FULL_MODE = 1; int CDM_TTY_HCO_MODE = 2; int CDM_TTY_VCO_MODE = 3; /* Setup a packet data connection. See ril.h RIL_REQUEST_SETUP_DATA_CALL */

int int int int int int

SETUP_DATA_TECH_CDMA SETUP_DATA_TECH_GSM SETUP_DATA_AUTH_NONE SETUP_DATA_AUTH_PAP SETUP_DATA_AUTH_CHAP SETUP_DATA_AUTH_PAP_CHAP

= = = = = =

0; 1; 0; 1; 2; 3;

/* cat include/telephony/ril.h | \ egrep '^#define' | \ sed -re 's/^#define +([^ ]+)* +([^ ]+)/ int \1 = \2;/' \ >>java/android/com.android.internal.telephony/gsm/RILConstants.java */ /** * No restriction at all including voice/SMS/USSD/SS/AV64 * and packet data. */ int RIL_RESTRICTED_STATE_NONE = 0x00; /** * Block emergency call due to restriction. * But allow all normal voice/SMS/USSD/SS/AV64. */ int RIL_RESTRICTED_STATE_CS_EMERGENCY = 0x01; /** * Block all normal voice/SMS/USSD/SS/AV64 due to restriction. * Only Emergency call allowed. */ int RIL_RESTRICTED_STATE_CS_NORMAL = 0x02; /** * Block all voice/SMS/USSD/SS/AV64 * including emergency call due to restriction. */ int RIL_RESTRICTED_STATE_CS_ALL = 0x04; /** * Block packet data access due to restriction. */ int RIL_RESTRICTED_STATE_PS_ALL = 0x10; /** Data profile static final int static final int static final int for RIL_REQUEST_SETUP_DATA_CALL */ DATA_PROFILE_DEFAULT = 0; DATA_PROFILE_TETHERED = 1; DATA_PROFILE_OEM_BASE = 1000;

int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int

RIL_REQUEST_GET_SIM_STATUS = 1; RIL_REQUEST_ENTER_SIM_PIN = 2; RIL_REQUEST_ENTER_SIM_PUK = 3; RIL_REQUEST_ENTER_SIM_PIN2 = 4; RIL_REQUEST_ENTER_SIM_PUK2 = 5; RIL_REQUEST_CHANGE_SIM_PIN = 6; RIL_REQUEST_CHANGE_SIM_PIN2 = 7; RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION = 8; RIL_REQUEST_GET_CURRENT_CALLS = 9; RIL_REQUEST_DIAL = 10; RIL_REQUEST_GET_IMSI = 11; RIL_REQUEST_HANGUP = 12; RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND = 13; RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND = 14; RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE = 15; RIL_REQUEST_CONFERENCE = 16; RIL_REQUEST_UDUB = 17; RIL_REQUEST_LAST_CALL_FAIL_CAUSE = 18; RIL_REQUEST_SIGNAL_STRENGTH = 19; RIL_REQUEST_REGISTRATION_STATE = 20; RIL_REQUEST_GPRS_REGISTRATION_STATE = 21; RIL_REQUEST_OPERATOR = 22; RIL_REQUEST_RADIO_POWER = 23; RIL_REQUEST_DTMF = 24; RIL_REQUEST_SEND_SMS = 25; RIL_REQUEST_SEND_SMS_EXPECT_MORE = 26; RIL_REQUEST_SETUP_DATA_CALL = 27; RIL_REQUEST_SIM_IO = 28; RIL_REQUEST_SEND_USSD = 29; RIL_REQUEST_CANCEL_USSD = 30; RIL_REQUEST_GET_CLIR = 31; RIL_REQUEST_SET_CLIR = 32; RIL_REQUEST_QUERY_CALL_FORWARD_STATUS = 33; RIL_REQUEST_SET_CALL_FORWARD = 34; RIL_REQUEST_QUERY_CALL_WAITING = 35; RIL_REQUEST_SET_CALL_WAITING = 36; RIL_REQUEST_SMS_ACKNOWLEDGE = 37; RIL_REQUEST_GET_IMEI = 38; RIL_REQUEST_GET_IMEISV = 39; RIL_REQUEST_ANSWER = 40; RIL_REQUEST_DEACTIVATE_DATA_CALL = 41; RIL_REQUEST_QUERY_FACILITY_LOCK = 42; RIL_REQUEST_SET_FACILITY_LOCK = 43; RIL_REQUEST_CHANGE_BARRING_PASSWORD = 44; RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE = 45;

int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int int

RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC = 46; RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL = 47; RIL_REQUEST_QUERY_AVAILABLE_NETWORKS = 48; RIL_REQUEST_DTMF_START = 49; RIL_REQUEST_DTMF_STOP = 50; RIL_REQUEST_BASEBAND_VERSION = 51; RIL_REQUEST_SEPARATE_CONNECTION = 52; RIL_REQUEST_SET_MUTE = 53; RIL_REQUEST_GET_MUTE = 54; RIL_REQUEST_QUERY_CLIP = 55; RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE = 56; RIL_REQUEST_DATA_CALL_LIST = 57; RIL_REQUEST_RESET_RADIO = 58; RIL_REQUEST_OEM_HOOK_RAW = 59; RIL_REQUEST_OEM_HOOK_STRINGS = 60; RIL_REQUEST_SCREEN_STATE = 61; RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION = 62; RIL_REQUEST_WRITE_SMS_TO_SIM = 63; RIL_REQUEST_DELETE_SMS_ON_SIM = 64; RIL_REQUEST_SET_BAND_MODE = 65; RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE = 66; RIL_REQUEST_STK_GET_PROFILE = 67; RIL_REQUEST_STK_SET_PROFILE = 68; RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND = 69; RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE = 70; RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM = 71; RIL_REQUEST_EXPLICIT_CALL_TRANSFER = 72; RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE = 73; RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE = 74; RIL_REQUEST_GET_NEIGHBORING_CELL_IDS = 75; RIL_REQUEST_SET_LOCATION_UPDATES = 76; RIL_REQUEST_CDMA_SET_SUBSCRIPTION = 77; RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE = 78; RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE = 79; RIL_REQUEST_SET_TTY_MODE = 80; RIL_REQUEST_QUERY_TTY_MODE = 81; RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE = 82; RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE = 83; RIL_REQUEST_CDMA_FLASH = 84; RIL_REQUEST_CDMA_BURST_DTMF = 85; RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY = 86; RIL_REQUEST_CDMA_SEND_SMS = 87; RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE = 88; RIL_REQUEST_GSM_GET_BROADCAST_CONFIG = 89; RIL_REQUEST_GSM_SET_BROADCAST_CONFIG = 90; RIL_REQUEST_GSM_BROADCAST_ACTIVATION = 91; RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG = 92; RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG = 93; RIL_REQUEST_CDMA_BROADCAST_ACTIVATION = 94; RIL_REQUEST_CDMA_SUBSCRIPTION = 95; RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM = 96; RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM = 97; RIL_REQUEST_DEVICE_IDENTITY = 98; RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE = 99; RIL_REQUEST_GET_SMSC_ADDRESS = 100; RIL_REQUEST_SET_SMSC_ADDRESS = 101; RIL_REQUEST_REPORT_SMS_MEMORY_STATUS = 102; RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING = 103; RIL_UNSOL_RESPONSE_BASE = 1000; RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000; RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001; RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED = 1002; RIL_UNSOL_RESPONSE_NEW_SMS = 1003; RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004; RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005; RIL_UNSOL_ON_USSD = 1006; RIL_UNSOL_ON_USSD_REQUEST = 1007; RIL_UNSOL_NITZ_TIME_RECEIVED = 1008; RIL_UNSOL_SIGNAL_STRENGTH = 1009; RIL_UNSOL_DATA_CALL_LIST_CHANGED = 1010; RIL_UNSOL_SUPP_SVC_NOTIFICATION = 1011; RIL_UNSOL_STK_SESSION_END = 1012; RIL_UNSOL_STK_PROACTIVE_COMMAND = 1013; RIL_UNSOL_STK_EVENT_NOTIFY = 1014; RIL_UNSOL_STK_CALL_SETUP = 1015; RIL_UNSOL_SIM_SMS_STORAGE_FULL = 1016; RIL_UNSOL_SIM_REFRESH = 1017; RIL_UNSOL_CALL_RING = 1018; RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED = 1019; RIL_UNSOL_RESPONSE_CDMA_NEW_SMS = 1020; RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS = 1021; RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL = 1022; RIL_UNSOL_RESTRICTED_STATE_CHANGED = 1023; RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE = 1024; RIL_UNSOL_CDMA_CALL_WAITING = 1025; RIL_UNSOL_CDMA_OTA_PROVISION_STATUS = 1026; RIL_UNSOL_CDMA_INFO_REC = 1027; RIL_UNSOL_OEM_HOOK_RAW = 1028; RIL_UNSOL_RINGBACK_TONE = 1029; RIL_UNSOL_RESEND_INCALL_MUTE = 1030;

Vous aimerez peut-être aussi