libril and libsecnativefeature and msm8974-common

This commit is contained in:
Valera1978 2018-07-05 18:58:39 +03:00
parent 08200f33a8
commit 9f164b31ff
32 changed files with 7 additions and 15089 deletions

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2014 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.
*/
#ifndef RIL_EX_H_INCLUDED
#define RIL_EX_H_INCLUDED
#include <telephony/ril.h>
#include <telephony/record_stream.h>
#define NUM_ELEMS_SOCKET(a) (sizeof (a) / sizeof (a)[0])
struct ril_event;
void rilEventAddWakeup_helper(struct ril_event *ev);
int blockingWrite_helper(int fd, void* data, size_t len);
enum SocketWakeType {DONT_WAKE, WAKE_PARTIAL};
typedef enum {
RIL_TELEPHONY_SOCKET,
RIL_SAP_SOCKET
} RIL_SOCKET_TYPE;
typedef struct SocketListenParam {
RIL_SOCKET_ID socket_id;
int fdListen;
int fdCommand;
const char* processName;
struct ril_event* commands_event;
struct ril_event* listen_event;
void (*processCommandsCallback)(int fd, short flags, void *param);
RecordStream *p_rs;
RIL_SOCKET_TYPE type;
} SocketListenParam;
#endif

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2006 The Android Open Source Project
* Copyright (C) 2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -420,10 +421,10 @@ typedef struct {
typedef struct {
RIL_CallState state;
char index; /* Connection Index for use with, eg, AT+CHLD */
char call_id; /* Samsung call_id */
char foo1; /* Samsung */
char foo2; /* Samsung */
unsigned char index; /* Connection Index for use with, eg, AT+CHLD */
unsigned char call_id; /* Samsung field */
unsigned char pad; /* Unsigned gap padding */
char pad1; /* Signed gap padding */
int toa; /* type of address, eg 145 = intl */
char isMpty; /* nonzero if is mpty call */
char isMT; /* nonzero if call is mobile terminated */
@ -433,11 +434,9 @@ typedef struct {
char isVoicePrivacy; /* nonzero if CDMA voice privacy mode is active */
char * number; /* Remote party number */
int numberPresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
char call_type; /* Samsung*/
char call_domain;/* Samsung*/
int namePresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
char * csv; /* Samsung */
char * name; /* Remote party name */
int namePresentation; /* 0=Allowed, 1=Restricted, 2=Not Specified/Unknown 3=Payphone */
long call_details; /* Samsung call detail additions. Just padding, do not use */
RIL_UUS_Info * uusInfo; /* NULL or Pointer to User-User Signaling Information */
} RIL_Call;
@ -1128,7 +1127,6 @@ typedef struct
int pin2_num_retries;
int puk2_num_retries;
int perso_unblock_retries;
/* End of Samsung SIM PIN/Unlock fields */
} RIL_AppStatus;
/* Deprecated, use RIL_CardStatus_v6 */
@ -6338,44 +6336,6 @@ typedef struct {
#define RIL_RESPONSE_ACKNOWLEDGEMENT 800
/**********************************************************
* SAMSUNG REQUESTS
**********************************************************/
#define SAMSUNG_REQUEST_BASE 10000
#define RIL_REQUEST_DIAL_EMERGENCY_CALL 10001
#define RIL_REQUEST_CALL_DEFLECTION 10002
#define RIL_REQUEST_MODIFY_CALL_INITIATE 10003
#define RIL_REQUEST_MODIFY_CALL_CONFIRM 10004
#define RIL_REQUEST_SET_VOICE_DOMAIN_PREF 10005
#define RIL_REQUEST_SAFE_MODE 10006
#define RIL_REQUEST_SET_TRANSMIT_POWER 10007
#define RIL_REQUEST_GET_CELL_BROADCAST_CONFIG 10008
#define RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO 10009
#define RIL_REQUEST_GET_PHONEBOOK_ENTRY 10010
#define RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY 10011
#define RIL_REQUEST_USIM_PB_CAPA 10012
#define RIL_REQUEST_LOCK_INFO 10013
#define RIL_REQUEST_STK_SIM_INIT_EVENT 10014
#define RIL_REQUEST_SET_PREFERRED_NETWORK_LIST 10015
#define RIL_REQUEST_GET_PREFERRED_NETWORK_LIST 10016
#define RIL_REQUEST_CHANGE_SIM_PERSO 10017
#define RIL_REQUEST_ENTER_SIM_PERSO 10018
#define RIL_REQUEST_SEND_ENCODED_USSD 10019
#define RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE 10020
#define RIL_REQUEST_HANGUP_VT 10021
#define RIL_REQUEST_HOLD 10022
#define RIL_REQUEST_SET_SIM_POWER 10023
#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP 10025
#define RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF 10026
#define RIL_REQUEST_GET_INCOMING_COMMUNICATION_BARRING 10027
#define RIL_REQUEST_SET_INCOMING_COMMUNICATION_BARRING 10028
#define RIL_REQUEST_QUERY_CNAP 10029
#define RIL_REQUEST_SET_TRANSFER_CALL 10030
#define RIL_REQUEST_GET_DISABLE_2G 10031
#define RIL_REQUEST_SET_DISABLE_2G 10032
#define RIL_REQUEST_REFRESH_NITZ_TIME 10033
/***********************************************************************/
@ -7044,43 +7004,6 @@ typedef struct {
*/
#define RIL_UNSOL_KEEPALIVE_STATUS 1050
/**********************************************************
* SAMSUNG UNSOLS
**********************************************************/
#define SAMSUNG_UNSOL_BASE 11000
#define RIL_UNSOL_RELEASE_COMPLETE_MESSAGE 11001
#define RIL_UNSOL_STK_SEND_SMS_RESULT 11002
#define RIL_UNSOL_STK_CALL_CONTROL_RESULT 11003
#define RIL_UNSOL_DEVICE_READY_NOTI 11008
#define RIL_UNSOL_GPS_NOTI 11009
#define RIL_UNSOL_AM 11010
#define RIL_UNSOL_SAP 11013
#define RIL_UNSOL_UART 11020
#define RIL_UNSOL_SIM_PB_READY 11021
#define RIL_UNSOL_VE 11024
#define RIL_UNSOL_FACTORY_AM 11026
#define RIL_UNSOL_IMS_REGISTRATION_STATE_CHANGED 11027
#define RIL_UNSOL_MODIFY_CALL 11028
#define RIL_UNSOL_CS_FALLBACK 11030
#define RIL_UNSOL_VOICE_SYSTEM_ID 11032
#define RIL_UNSOL_IMS_RETRYOVER 11034
#define RIL_UNSOL_PB_INIT_COMPLETE 11035
#define RIL_UNSOL_HYSTERESIS_DCN 11037
#define RIL_UNSOL_CP_POSITION 11038
#define RIL_UNSOL_HOME_NETWORK_NOTI 11043
#define RIL_UNSOL_STK_CALL_STATUS 11054
#define RIL_UNSOL_MODEM_CAP 11056
#define RIL_UNSOL_SIM_SWAP_STATE_CHANGED 11057
#define RUL_UNSOL_SIM_COUNT_MISMATCHED 11058
#define RIL_UNSOL_DUN 11060
#define RIL_UNSOL_IMS_PREFERENCE_CHANGED 11061
#define RIL_UNSOL_SIM_APPLICATION_REFRESH 11062
#define RIL_UNSOL_UICC_APPLICATION_STATUS 11063
#define RIL_UNSOL_VOICE_RADIO_BEARER_HO_STATUS 11064
#define RIL_UNSOL_CLM_NOTI 11065
#define RIL_UNSOL_SIM_ICCID_NOTI 11066
/***********************************************************************/

View File

@ -1,806 +0,0 @@
/*
* 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.
*/
/*
* ISSUES:
*
*/
/**
* TODO
*
*
*/
#ifndef ANDROID_RIL_CDMA_SMS_H
#define ANDROID_RIL_CDMA_SMS_H 1
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Used by RIL_REQUEST_CDMA_SEND_SMS and RIL_UNSOL_RESPONSE_CDMA_NEW_SMS */
#define RIL_CDMA_SMS_ADDRESS_MAX 36
#define RIL_CDMA_SMS_SUBADDRESS_MAX 36
#define RIL_CDMA_SMS_BEARER_DATA_MAX 255
typedef enum {
RIL_CDMA_SMS_DIGIT_MODE_4_BIT = 0, /* DTMF digits */
RIL_CDMA_SMS_DIGIT_MODE_8_BIT = 1,
RIL_CDMA_SMS_DIGIT_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_DigitMode;
typedef enum {
RIL_CDMA_SMS_NUMBER_MODE_NOT_DATA_NETWORK = 0,
RIL_CDMA_SMS_NUMBER_MODE_DATA_NETWORK = 1,
RIL_CDMA_SMS_NUMBER_MODE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_NumberMode;
typedef enum {
RIL_CDMA_SMS_NUMBER_TYPE_UNKNOWN = 0,
RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP = 1,
/* INTERNATIONAL is used when number mode is not data network address.
* DATA_IP is used when the number mode is data network address
*/
RIL_CDMA_SMS_NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2,
/* NATIONAL is used when the number mode is not data network address.
* INTERNET_MAIL is used when the number mode is data network address.
* For INTERNET_MAIL, in the address data "digits", each byte contains
* an ASCII character. Examples are "x@y.com,a@b.com - ref TIA/EIA-637A 3.4.3.3
*/
RIL_CDMA_SMS_NUMBER_TYPE_NETWORK = 3,
RIL_CDMA_SMS_NUMBER_TYPE_SUBSCRIBER = 4,
RIL_CDMA_SMS_NUMBER_TYPE_ALPHANUMERIC = 5,
/* GSM SMS: address value is GSM 7-bit chars */
RIL_CDMA_SMS_NUMBER_TYPE_ABBREVIATED = 6,
RIL_CDMA_SMS_NUMBER_TYPE_RESERVED_7 = 7,
RIL_CDMA_SMS_NUMBER_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_NumberType;
typedef enum {
RIL_CDMA_SMS_NUMBER_PLAN_UNKNOWN = 0,
RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY = 1, /* CCITT E.164 and E.163, including ISDN plan */
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_2 = 2,
RIL_CDMA_SMS_NUMBER_PLAN_DATA = 3, /* CCITT X.121 */
RIL_CDMA_SMS_NUMBER_PLAN_TELEX = 4, /* CCITT F.69 */
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_5 = 5,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_6 = 6,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_7 = 7,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_8 = 8,
RIL_CDMA_SMS_NUMBER_PLAN_PRIVATE = 9,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_10 = 10,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_11 = 11,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_12 = 12,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_13 = 13,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_14 = 14,
RIL_CDMA_SMS_NUMBER_PLAN_RESERVED_15 = 15,
RIL_CDMA_SMS_NUMBER_PLAN_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_NumberPlan;
typedef struct {
RIL_CDMA_SMS_DigitMode digit_mode;
/* Indicates 4-bit or 8-bit */
RIL_CDMA_SMS_NumberMode number_mode;
/* Used only when digitMode is 8-bit */
RIL_CDMA_SMS_NumberType number_type;
/* Used only when digitMode is 8-bit.
* To specify an international address, use the following:
* digitMode = RIL_CDMA_SMS_DIGIT_MODE_8_BIT
* numberMode = RIL_CDMA_SMS_NOT_DATA_NETWORK
* numberType = RIL_CDMA_SMS_NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP
* numberPlan = RIL_CDMA_SMS_NUMBER_PLAN_TELEPHONY
* numberOfDigits = number of digits
* digits = ASCII digits, e.g. '1', '2', '3'3, '4', and '5'
*/
RIL_CDMA_SMS_NumberPlan number_plan;
/* Used only when digitMode is 8-bit */
unsigned char number_of_digits;
unsigned char digits[ RIL_CDMA_SMS_ADDRESS_MAX ];
/* Each byte in this array represnts a 40bit or 8-bit digit of address data */
} RIL_CDMA_SMS_Address;
typedef enum {
RIL_CDMA_SMS_SUBADDRESS_TYPE_NSAP = 0, /* CCITT X.213 or ISO 8348 AD2 */
RIL_CDMA_SMS_SUBADDRESS_TYPE_USER_SPECIFIED = 1, /* e.g. X.25 */
RIL_CDMA_SMS_SUBADDRESS_TYPE_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_SubaddressType;
typedef struct {
RIL_CDMA_SMS_SubaddressType subaddressType;
/* 1 means the last byte's lower 4 bits should be ignored */
unsigned char odd;
unsigned char number_of_digits;
/* Each byte respresents a 8-bit digit of subaddress data */
unsigned char digits[ RIL_CDMA_SMS_SUBADDRESS_MAX ];
} RIL_CDMA_SMS_Subaddress;
typedef struct {
int uTeleserviceID;
unsigned char bIsServicePresent;
int uServicecategory;
RIL_CDMA_SMS_Address sAddress;
RIL_CDMA_SMS_Subaddress sSubAddress;
int uBearerDataLen;
unsigned char aBearerData[ RIL_CDMA_SMS_BEARER_DATA_MAX ];
} RIL_CDMA_SMS_Message;
/* Used by RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE */
typedef enum {
RIL_CDMA_SMS_NO_ERROR = 0,
RIL_CDMA_SMS_ERROR = 1,
RIL_CDMA_SMS_ERROR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_ErrorClass;
typedef struct {
RIL_CDMA_SMS_ErrorClass uErrorClass;
int uSMSCauseCode; /* As defined in N.S00005, 6.5.2.125.
Currently, only 35 (resource shortage) and
39 (other terminal problem) are reported. */
} RIL_CDMA_SMS_Ack;
/* Used by RIL_REQUEST_CDMA_SMS_GET_BROADCAST_CONFIG and
RIL_REQUEST_CDMA_SMS_SET_BROADCAST_CONFIG */
typedef struct {
int service_category;
int language;
unsigned char selected;
} RIL_CDMA_BroadcastSmsConfigInfo;
/* Used by RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM */
typedef struct {
int status; /* Status of message. See TS 27.005 3.1, "<stat>": */
/* 0 = "REC UNREAD" */
/* 1 = "REC READ" */
/* 2 = "STO UNSENT" */
/* 3 = "STO SENT" */
RIL_CDMA_SMS_Message message;
} RIL_CDMA_SMS_WriteArgs;
/* Used by RIL_REQUEST_ENCODE_CDMA_SMS and RIL_REQUEST_DECODE_CDMA_SMS*/
#define RIL_CDMA_SMS_UDH_MAX_SND_SIZE 128
#define RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX 131 /* 140 - 3 - 6 */
#define RIL_CDMA_SMS_MAX_UD_HEADERS 7
#define RIL_CDMA_SMS_USER_DATA_MAX 229
#define RIL_CDMA_SMS_ADDRESS_MAX 36
#define RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE 128
#define RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE 32
#define RIL_CDMA_SMS_UDH_VAR_PIC_SIZE 134
#define RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS 4
#define RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE 32
#define RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE 8
#define RIL_CDMA_SMS_UDH_OTHER_SIZE 226
#define RIL_CDMA_SMS_IP_ADDRESS_SIZE 4
/* ------------------- */
/* ---- User Data ---- */
/* ------------------- */
typedef enum {
RIL_CDMA_SMS_UDH_CONCAT_8 = 0x00,
RIL_CDMA_SMS_UDH_SPECIAL_SM,
/* 02 - 03 Reserved */
RIL_CDMA_SMS_UDH_PORT_8 = 0x04,
RIL_CDMA_SMS_UDH_PORT_16,
RIL_CDMA_SMS_UDH_SMSC_CONTROL,
RIL_CDMA_SMS_UDH_SOURCE,
RIL_CDMA_SMS_UDH_CONCAT_16,
RIL_CDMA_SMS_UDH_WCMP,
RIL_CDMA_SMS_UDH_TEXT_FORMATING,
RIL_CDMA_SMS_UDH_PRE_DEF_SOUND,
RIL_CDMA_SMS_UDH_USER_DEF_SOUND,
RIL_CDMA_SMS_UDH_PRE_DEF_ANIM,
RIL_CDMA_SMS_UDH_LARGE_ANIM,
RIL_CDMA_SMS_UDH_SMALL_ANIM,
RIL_CDMA_SMS_UDH_LARGE_PICTURE,
RIL_CDMA_SMS_UDH_SMALL_PICTURE,
RIL_CDMA_SMS_UDH_VAR_PICTURE,
RIL_CDMA_SMS_UDH_USER_PROMPT = 0x13,
RIL_CDMA_SMS_UDH_EXTENDED_OBJECT = 0x14,
/* 15 - 1F Reserved for future EMS */
RIL_CDMA_SMS_UDH_RFC822 = 0x20,
/* 21 - 6F Reserved for future use */
/* 70 - 7f Reserved for (U)SIM Toolkit Security Headers */
/* 80 - 9F SME to SME specific use */
/* A0 - BF Reserved for future use */
/* C0 - DF SC specific use */
/* E0 - FF Reserved for future use */
RIL_CDMA_SMS_UDH_OTHER = 0xFFFF, /* For unsupported or proprietary headers */
RIL_CDMA_SMS_UDH_ID_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_UdhId;
typedef struct {
/*indicates the reference number for a particular concatenated short message. */
/*it is constant for every short message which makes up a particular concatenated short message*/
unsigned char msg_ref;
/*indicates the total number of short messages within the concatenated short message.
The value shall start at 1 and remain constant for every
short message which makes up the concatenated short message.
if it is 0 then the receiving entity shall ignore the whole Information Element*/
unsigned char total_sm;
/*
* it indicates the sequence number of a particular short message within the concatenated short
* message. The value shall start at 1 and increment by one for every short message sent
* within the concatenated short message. If the value is zero or the value is
* greater than the value in octet 2 then the receiving
* entity shall ignore the whole Information Element.
*/
unsigned char seq_num;
} RIL_CDMA_SMS_UdhConcat8;
/* GW message waiting actions
*/
typedef enum {
RIL_CDMA_SMS_GW_MSG_WAITING_NONE,
RIL_CDMA_SMS_GW_MSG_WAITING_DISCARD,
RIL_CDMA_SMS_GW_MSG_WAITING_STORE,
RIL_CDMA_SMS_GW_MSG_WAITING_NONE_1111,
RIL_CDMA_SMS_GW_MSG_WAITING_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_GWMsgWaiting;
/* GW message waiting types
*/
typedef enum {
RIL_CDMA_SMS_GW_MSG_WAITING_VOICEMAIL,
RIL_CDMA_SMS_GW_MSG_WAITING_FAX,
RIL_CDMA_SMS_GW_MSG_WAITING_EMAIL,
RIL_CDMA_SMS_GW_MSG_WAITING_OTHER,
RIL_CDMA_SMS_GW_MSG_WAITING_KIND_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_GWMsgWaitingKind;
typedef struct {
RIL_CDMA_SMS_GWMsgWaiting msg_waiting;
RIL_CDMA_SMS_GWMsgWaitingKind msg_waiting_kind;
/*it indicates the number of messages of the type specified in Octet 1 waiting.*/
unsigned char message_count;
} RIL_CDMA_SMS_UdhSpecialSM;
typedef struct {
unsigned char dest_port;
unsigned char orig_port;
} RIL_CDMA_SMS_UdhWap8;
typedef struct {
unsigned short dest_port;
unsigned short orig_port;
} RIL_CDMA_SMS_UdhWap16;
typedef struct {
unsigned short msg_ref;
unsigned char total_sm;
unsigned char seq_num;
} RIL_CDMA_SMS_UdhConcat16;
typedef enum {
RIL_CDMA_SMS_UDH_LEFT_ALIGNMENT = 0,
RIL_CDMA_SMS_UDH_CENTER_ALIGNMENT,
RIL_CDMA_SMS_UDH_RIGHT_ALIGNMENT,
RIL_CDMA_SMS_UDH_DEFAULT_ALIGNMENT,
RIL_CDMA_SMS_UDH_MAX_ALIGNMENT,
RIL_CDMA_SMS_UDH_ALIGNMENT_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_UdhAlignment;
typedef enum {
RIL_CDMA_SMS_UDH_FONT_NORMAL = 0,
RIL_CDMA_SMS_UDH_FONT_LARGE,
RIL_CDMA_SMS_UDH_FONT_SMALL,
RIL_CDMA_SMS_UDH_FONT_RESERVED,
RIL_CDMA_SMS_UDH_FONT_MAX,
RIL_CDMA_SMS_UDH_FONT_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_UdhFontSize;
typedef enum {
RIL_CDMA_SMS_UDH_TEXT_COLOR_BLACK = 0x0,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREY = 0x1,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_RED = 0x2,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_YELLOW = 0x3,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_GREEN = 0x4,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_CYAN = 0x5,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_BLUE = 0x6,
RIL_CDMA_SMS_UDH_TEXT_COLOR_DARK_MAGENTA = 0x7,
RIL_CDMA_SMS_UDH_TEXT_COLOR_GREY = 0x8,
RIL_CDMA_SMS_UDH_TEXT_COLOR_WHITE = 0x9,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_RED = 0xA,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_YELLOW = 0xB,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_GREEN = 0xC,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_CYAN = 0xD,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_BLUE = 0xE,
RIL_CDMA_SMS_UDH_TEXT_COLOR_BRIGHT_MAGENTA = 0xF,
RIL_CDMA_SMS_UDH_TEXT_COLOR_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_UdhTextColor;
typedef struct {
unsigned char start_position;
unsigned char text_formatting_length;
RIL_CDMA_SMS_UdhAlignment alignment_type ; /*bit 0 and bit 1*/
RIL_CDMA_SMS_UdhFontSize font_size ; /*bit 3 and bit 2*/
unsigned char style_bold; /*bit 4 */
unsigned char style_italic; /*bit 5 */
unsigned char style_underlined; /*bit 6 */
unsigned char style_strikethrough; /*bit 7 */
/* if FALSE, ignore the following color information */
unsigned char is_color_present;
RIL_CDMA_SMS_UdhTextColor text_color_foreground;
RIL_CDMA_SMS_UdhTextColor text_color_background;
} RIL_CDMA_SMS_UdhTextFormating;
/* Predefined sound
*/
typedef struct {
unsigned char position;
unsigned char snd_number;
} RIL_CDMA_SMS_UdhPreDefSound;
/* User Defined sound
*/
typedef struct {
unsigned char data_length;
unsigned char position;
unsigned char user_def_sound[RIL_CDMA_SMS_UDH_MAX_SND_SIZE];
} RIL_CDMA_SMS_UdhUserDefSound;
/* Large picture
*/
typedef struct {
unsigned char position;
unsigned char data[RIL_CDMA_SMS_UDH_LARGE_PIC_SIZE];
} RIL_CDMA_SMS_UdhLargePictureData;
/* Small picture
*/
typedef struct {
unsigned char position;
unsigned char data[RIL_CDMA_SMS_UDH_SMALL_PIC_SIZE];
} RIL_CDMA_SMS_UdhSmallPictureData;
/* Variable length picture
*/
typedef struct {
unsigned char position;
unsigned char width; /* Number of pixels - Should be a mutliple of 8 */
unsigned char height;
unsigned char data[RIL_CDMA_SMS_UDH_VAR_PIC_SIZE];
} RIL_CDMA_SMS_UdhVarPicture;
/* Predefined animation
*/
typedef struct {
unsigned char position;
unsigned char animation_number;
} RIL_CDMA_SMS_UdhPreDefAnim;
/* Large animation
*/
typedef struct {
unsigned char position;
unsigned char data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_LARGE_BITMAP_SIZE];
} RIL_CDMA_SMS_UdhLargeAnim;
/* Small animation
*/
typedef struct {
unsigned char position;
unsigned char data[RIL_CDMA_SMS_UDH_ANIM_NUM_BITMAPS][RIL_CDMA_SMS_UDH_SMALL_BITMAP_SIZE];
} RIL_CDMA_SMS_UdhSmallAnim;
/* User Prompt Indicator UDH
*/
typedef struct {
unsigned char number_of_objects;
/* Number of objects of the same kind that follow this header which will
** be stitched together by the applications. For example, 5 small pictures
** are to be stitched together horizontally, or 6 iMelody tones are to be
** connected together with intermediate iMelody header and footer ignored.
** Allowed objects to be stitched:
** - Images (small, large, variable)
** - User defined sounds
*/
} RIL_CDMA_SMS_UdhUserPrompt;
typedef struct {
unsigned char length;
unsigned char data[RIL_CDMA_SMS_UDH_EO_DATA_SEGMENT_MAX];
/* RIL_CDMA_SMS_UDH_EO_VCARD: See http://www.imc.org/pdi/vcard-21.doc for payload */
/* RIL_CDMA_SMS_UDH_EO_VCALENDAR: See http://www.imc.org/pdi/vcal-10.doc */
/* Or: Unsupported/proprietary extended objects */
} RIL_CDMA_SMS_UdhEoContent;
/* Extended Object UDH
*/
/* Extended Object IDs/types
*/
typedef enum {
RIL_CDMA_SMS_UDH_EO_VCARD = 0x09,
RIL_CDMA_SMS_UDH_EO_VCALENDAR = 0x0A,
RIL_CDMA_SMS_UDH_EO_MAX32 = 0x10000000 /* Force constant ENUM size in structures */
} RIL_CDMA_SMS_UdhEoId;
typedef struct {
/* Extended objects are to be used together with 16-bit concatenation
** UDH. The max number of segments supported for E.O. is 8 at least.
*/
RIL_CDMA_SMS_UdhEoContent content;
unsigned char first_segment;
/* The following fields are only present in the first segment of a
** concatenated SMS message.
*/
unsigned char reference;
/* Identify those extended object segments which should be linked together
*/
unsigned short length;
/* Length of the whole extended object data
*/
unsigned char control;
RIL_CDMA_SMS_UdhEoId type;
unsigned short position;
/* Absolute position of the E.O. in the whole text after concatenation,
** starting from 1.
*/
} RIL_CDMA_SMS_UdhEo;
typedef struct {
RIL_CDMA_SMS_UdhId header_id;
unsigned char header_length;
unsigned char data[RIL_CDMA_SMS_UDH_OTHER_SIZE];
} RIL_CDMA_SMS_UdhOther;
typedef struct {
unsigned char header_length;
} RIL_CDMA_SMS_UdhRfc822;
typedef struct {
RIL_CDMA_SMS_UdhId header_id;
union {
RIL_CDMA_SMS_UdhConcat8 concat_8; // 00
RIL_CDMA_SMS_UdhSpecialSM special_sm; // 01
RIL_CDMA_SMS_UdhWap8 wap_8; // 04
RIL_CDMA_SMS_UdhWap16 wap_16; // 05
RIL_CDMA_SMS_UdhConcat16 concat_16; // 08
RIL_CDMA_SMS_UdhTextFormating text_formating; // 0a
RIL_CDMA_SMS_UdhPreDefSound pre_def_sound; // 0b
RIL_CDMA_SMS_UdhUserDefSound user_def_sound; // 0c
RIL_CDMA_SMS_UdhPreDefAnim pre_def_anim; // 0d
RIL_CDMA_SMS_UdhLargeAnim large_anim; // 0e
RIL_CDMA_SMS_UdhSmallAnim small_anim; // 0f
RIL_CDMA_SMS_UdhLargePictureData large_picture; // 10
RIL_CDMA_SMS_UdhSmallPictureData small_picture; // 11
RIL_CDMA_SMS_UdhVarPicture var_picture; // 12
RIL_CDMA_SMS_UdhUserPrompt user_prompt; // 13
RIL_CDMA_SMS_UdhEo eo; // 14
RIL_CDMA_SMS_UdhRfc822 rfc822; // 20
RIL_CDMA_SMS_UdhOther other;
}u;
} RIL_CDMA_SMS_Udh;
/* ----------------------------- */
/* -- User data encoding type -- */
/* ----------------------------- */
typedef enum {
RIL_CDMA_SMS_ENCODING_OCTET = 0, /* 8-bit */
RIL_CDMA_SMS_ENCODING_IS91EP, /* varies */
RIL_CDMA_SMS_ENCODING_ASCII, /* 7-bit */
RIL_CDMA_SMS_ENCODING_IA5, /* 7-bit */
RIL_CDMA_SMS_ENCODING_UNICODE, /* 16-bit */
RIL_CDMA_SMS_ENCODING_SHIFT_JIS, /* 8 or 16-bit */
RIL_CDMA_SMS_ENCODING_KOREAN, /* 8 or 16-bit */
RIL_CDMA_SMS_ENCODING_LATIN_HEBREW, /* 8-bit */
RIL_CDMA_SMS_ENCODING_LATIN, /* 8-bit */
RIL_CDMA_SMS_ENCODING_GSM_7_BIT_DEFAULT, /* 7-bit */
RIL_CDMA_SMS_ENCODING_MAX32 = 0x10000000
} RIL_CDMA_SMS_UserDataEncoding;
/* ------------------------ */
/* -- IS-91 EP data type -- */
/* ------------------------ */
typedef enum {
RIL_CDMA_SMS_IS91EP_VOICE_MAIL = 0x82,
RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE_FULL = 0x83,
RIL_CDMA_SMS_IS91EP_CLI_ORDER = 0x84,
RIL_CDMA_SMS_IS91EP_SHORT_MESSAGE = 0x85,
RIL_CDMA_SMS_IS91EP_MAX32 = 0x10000000
} RIL_CDMA_SMS_IS91EPType;
typedef struct {
/* NOTE: If message_id.udh_present == TRUE:
** 'num_headers' is the number of User Data Headers (UDHs),
** and 'headers' include all those headers.
*/
unsigned char num_headers;
RIL_CDMA_SMS_Udh headers[RIL_CDMA_SMS_MAX_UD_HEADERS];
RIL_CDMA_SMS_UserDataEncoding encoding;
RIL_CDMA_SMS_IS91EPType is91ep_type;
/*----------------------------------------------------------------------
'data_len' indicates the valid number of bytes in the 'data' array.
'padding_bits' (0-7) indicates how many bits in the last byte of 'data'
are invalid bits. This parameter is only used for Mobile-Originated
messages. There is no way for the API to tell how many padding bits
exist in the received message. Instead, the application can find out how
many padding bits exist in the user data when decoding the user data.
'data' has the raw bits of the user data field of the SMS message.
The client software should decode the raw user data according to its
supported encoding types and languages.
EXCEPTION 1: CMT-91 user data raw bits are first translated into BD fields
(e.g. num_messages, callback, etc.) The translated user data field in
VMN and Short Message is in the form of ASCII characters, each occupying
a byte in the resulted 'data'.
EXCEPTION 2: GSM 7-bit Default characters are decoded so that each byte
has one 7-bit GSM character.
'number_of_digits' is the number of digits/characters (7, 8, 16, or
whatever bits) in the raw user data, which can be used by the client
when decoding the user data according to the encoding type and language.
-------------------------------------------------------------------------*/
unsigned char data_len;
unsigned char padding_bits;
unsigned char data[ RIL_CDMA_SMS_USER_DATA_MAX ];
unsigned char number_of_digits;
} RIL_CDMA_SMS_CdmaUserData;
/* -------------------- */
/* ---- Message Id ---- */
/* -------------------- */
typedef enum {
RIL_CDMA_SMS_BD_TYPE_RESERVED_0 = 0,
RIL_CDMA_SMS_BD_TYPE_DELIVER, /* MT only */
RIL_CDMA_SMS_BD_TYPE_SUBMIT, /* MO only */
RIL_CDMA_SMS_BD_TYPE_CANCELLATION, /* MO only */
RIL_CDMA_SMS_BD_TYPE_DELIVERY_ACK, /* MT only */
RIL_CDMA_SMS_BD_TYPE_USER_ACK, /* MT & MO */
RIL_CDMA_SMS_BD_TYPE_READ_ACK, /* MT & MO */
RIL_CDMA_SMS_BD_TYPE_MAX32 = 0x10000000
} RIL_CDMA_SMS_BdMessageType;
typedef unsigned int RIL_CDMA_SMS_MessageNumber;
typedef struct {
RIL_CDMA_SMS_BdMessageType type;
RIL_CDMA_SMS_MessageNumber id_number;
unsigned char udh_present;
/* NOTE: if FEATURE_SMS_UDH is not defined,
** udh_present should be ignored.
*/
} RIL_CDMA_SMS_MessageId;
typedef unsigned char RIL_CDMA_SMS_UserResponse;
/* ------------------- */
/* ---- Timestamp ---- */
/* ------------------- */
typedef struct {
/* If 'year' is between 96 and 99, the actual year is 1900 + 'year';
if 'year' is between 00 and 95, the actual year is 2000 + 'year'.
NOTE: Each field has two BCD digits and byte arrangement is <MSB, ... ,LSB>
*/
unsigned char year; /* 0x00-0x99 */
unsigned char month; /* 0x01-0x12 */
unsigned char day; /* 0x01-0x31 */
unsigned char hour; /* 0x00-0x23 */
unsigned char minute; /* 0x00-0x59 */
unsigned char second; /* 0x00-0x59 */
signed char timezone; /* +/-, [-48,+48] number of 15 minutes - GW only */
} RIL_CDMA_SMS_Timestamp;
/* ------------------ */
/* ---- Priority ---- */
/* ------------------ */
typedef enum {
RIL_CDMA_SMS_PRIORITY_NORMAL = 0,
RIL_CDMA_SMS_PRIORITY_INTERACTIVE,
RIL_CDMA_SMS_PRIORITY_URGENT,
RIL_CDMA_SMS_PRIORITY_EMERGENCY,
RIL_CDMA_SMS_PRIORITY_MAX32 = 0x10000000
} RIL_CDMA_SMS_Priority;
/* ----------------- */
/* ---- Privacy ---- */
/* ----------------- */
typedef enum {
RIL_CDMA_SMS_PRIVACY_NORMAL = 0,
RIL_CDMA_SMS_PRIVACY_RESTRICTED,
RIL_CDMA_SMS_PRIVACY_CONFIDENTIAL,
RIL_CDMA_SMS_PRIVACY_SECRET,
RIL_CDMA_SMS_PRIVACY_MAX32 = 0x10000000
} RIL_CDMA_SMS_Privacy;
/* ---------------------- */
/* ---- Reply option ---- */
/* ---------------------- */
typedef struct {
/* whether user ack is requested
*/
unsigned char user_ack_requested;
/* whether delivery ack is requested.
Should be FALSE for incoming messages.
*/
unsigned char delivery_ack_requested;
/* Message originator requests the receiving phone to send back a READ_ACK
** message automatically when the user reads the received message.
*/
unsigned char read_ack_requested;
} RIL_CDMA_SMS_ReplyOption;
typedef enum {
RIL_CDMA_SMS_ALERT_MODE_DEFAULT = 0,
RIL_CDMA_SMS_ALERT_MODE_LOW_PRIORITY = 1,
RIL_CDMA_SMS_ALERT_MODE_MEDIUM_PRIORITY = 2,
RIL_CDMA_SMS_ALERT_MODE_HIGH_PRIORITY = 3,
/* For pre-IS637A implementations, alert_mode only has values of True/False:
*/
RIL_CDMA_SMS_ALERT_MODE_OFF = 0,
RIL_CDMA_SMS_ALERT_MODE_ON = 1
} RIL_CDMA_SMS_AlertMode;
/* ------------------ */
/* ---- Language ---- */
/* ------------------ */
typedef enum {
RIL_CDMA_SMS_LANGUAGE_UNSPECIFIED = 0,
RIL_CDMA_SMS_LANGUAGE_ENGLISH,
RIL_CDMA_SMS_LANGUAGE_FRENCH,
RIL_CDMA_SMS_LANGUAGE_SPANISH,
RIL_CDMA_SMS_LANGUAGE_JAPANESE,
RIL_CDMA_SMS_LANGUAGE_KOREAN,
RIL_CDMA_SMS_LANGUAGE_CHINESE,
RIL_CDMA_SMS_LANGUAGE_HEBREW,
RIL_CDMA_SMS_LANGUAGE_MAX32 = 0x10000000
} RIL_CDMA_SMS_Language;
/* ---------------------------------- */
/* ---------- Display Mode ---------- */
/* ---------------------------------- */
typedef enum {
RIL_CDMA_SMS_DISPLAY_MODE_IMMEDIATE = 0,
RIL_CDMA_SMS_DISPLAY_MODE_DEFAULT = 1,
RIL_CDMA_SMS_DISPLAY_MODE_USER_INVOKE = 2,
RIL_CDMA_SMS_DISPLAY_MODE_RESERVED = 3
} RIL_CDMA_SMS_DisplayMode;
/* IS-637B parameters/fields
*/
/* ---------------------------------- */
/* ---------- Delivery Status ------- */
/* ---------------------------------- */
typedef enum {
RIL_CDMA_SMS_DELIVERY_STATUS_ACCEPTED = 0, /* ERROR_CLASS_NONE */
RIL_CDMA_SMS_DELIVERY_STATUS_DEPOSITED_TO_INTERNET = 1, /* ERROR_CLASS_NONE */
RIL_CDMA_SMS_DELIVERY_STATUS_DELIVERED = 2, /* ERROR_CLASS_NONE */
RIL_CDMA_SMS_DELIVERY_STATUS_CANCELLED = 3, /* ERROR_CLASS_NONE */
RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_CONGESTION = 4, /* ERROR_CLASS_TEMP & PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_NETWORK_ERROR = 5, /* ERROR_CLASS_TEMP & PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_CANCEL_FAILED = 6, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_BLOCKED_DESTINATION = 7, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_TEXT_TOO_LONG = 8, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_DUPLICATE_MESSAGE = 9, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_INVALID_DESTINATION = 10, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_MESSAGE_EXPIRED = 13, /* ERROR_CLASS_PERM */
RIL_CDMA_SMS_DELIVERY_STATUS_UNKNOWN_ERROR = 0x1F /* ERROR_CLASS_PERM */
/* All the other values are reserved */
} RIL_CDMA_SMS_DeliveryStatusE;
typedef struct {
RIL_CDMA_SMS_ErrorClass error_class;
RIL_CDMA_SMS_DeliveryStatusE status;
} RIL_CDMA_SMS_DeliveryStatus;
typedef struct {
unsigned char address[RIL_CDMA_SMS_IP_ADDRESS_SIZE];
unsigned char is_valid;
} RIL_CDMA_SMS_IpAddress;
/* This special parameter captures any unrecognized/proprietary parameters
*/
typedef struct {
unsigned char input_other_len;
unsigned char desired_other_len; /* used during decoding */
unsigned char * other_data;
} RIL_CDMA_SMS_OtherParm;
typedef struct {
/* the mask indicates which fields are present in this message */
unsigned int mask;
RIL_CDMA_SMS_MessageId message_id;
RIL_CDMA_SMS_CdmaUserData user_data;
RIL_CDMA_SMS_UserResponse user_response;
RIL_CDMA_SMS_Timestamp mc_time;
RIL_CDMA_SMS_Timestamp validity_absolute;
RIL_CDMA_SMS_Timestamp validity_relative;
RIL_CDMA_SMS_Timestamp deferred_absolute;
RIL_CDMA_SMS_Timestamp deferred_relative;
RIL_CDMA_SMS_Priority priority;
RIL_CDMA_SMS_Privacy privacy;
RIL_CDMA_SMS_ReplyOption reply_option;
unsigned char num_messages; /* the actual value; not BCDs */
RIL_CDMA_SMS_AlertMode alert_mode;
/* For pre-IS-637A implementations, alert_mode is either Off or On. */
RIL_CDMA_SMS_Language language;
RIL_CDMA_SMS_Address callback;
RIL_CDMA_SMS_DisplayMode display_mode;
RIL_CDMA_SMS_DeliveryStatus delivery_status;
unsigned int deposit_index;
RIL_CDMA_SMS_IpAddress ip_address;
unsigned char rsn_no_notify;
/* See function comments of wms_ts_decode() and
** wms_ts_decode_cdma_bd_with_other() for details regarding 'other' parameters
*/
RIL_CDMA_SMS_OtherParm other;
} RIL_CDMA_SMS_ClientBd;
typedef struct {
unsigned char length; /* length, in bytes, of the encoded SMS message */
unsigned char * data; /* the encoded SMS message (max 255 bytes) */
} RIL_CDMA_Encoded_SMS;
#ifdef __cplusplus
}
#endif
#endif /*ANDROID_RIL_CDMA_SMS_H*/

View File

@ -1,50 +0,0 @@
# Copyright 2006 The Android Open Source Project
ifeq ($(BOARD_PROVIDES_LIBRIL),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_VENDOR_MODULE := true
LOCAL_SRC_FILES:= \
ril.cpp \
ril_event.cpp\
RilSapSocket.cpp \
ril_service.cpp \
sap_service.cpp
LOCAL_SHARED_LIBRARIES := \
liblog \
libutils \
libcutils \
libhardware_legacy \
librilutils \
android.hardware.radio@1.0 \
android.hardware.radio@1.1 \
android.hardware.radio.deprecated@1.0 \
libhidlbase \
libhidltransport \
libhwbinder
LOCAL_STATIC_LIBRARIES := \
libprotobuf-c-nano-enable_malloc \
LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror
ifeq ($(SIM_COUNT), 2)
LOCAL_CFLAGS += -DANDROID_MULTI_SIM -DDSDA_RILD1
LOCAL_CFLAGS += -DANDROID_SIM_COUNT_2
endif
LOCAL_C_INCLUDES += external/nanopb-c
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/../include
LOCAL_MODULE:= libril
LOCAL_CLANG := true
LOCAL_SANITIZE := integer
include $(BUILD_SHARED_LIBRARY)
endif # BOARD_PROVIDES_LIBRIL

View File

@ -1,190 +0,0 @@
Copyright (c) 2005-2008, 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.
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.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View File

@ -1,290 +0,0 @@
/*
* Copyright (C) 2014 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.
*/
#define __STDC_LIMIT_MACROS
#include <stdint.h>
#define RIL_SHLIB
#include "telephony/ril.h"
#include "RilSapSocket.h"
#include "pb_decode.h"
#include "pb_encode.h"
#undef LOG_TAG
#define LOG_TAG "RIL_UIM_SOCKET"
#include <utils/Log.h>
#include <arpa/inet.h>
#include <errno.h>
#include <sap_service.h>
static RilSapSocket::RilSapSocketList *head = NULL;
extern "C" void
RIL_requestTimedCallback (RIL_TimedCallback callback, void *param,
const struct timeval *relativeTime);
struct RIL_Env RilSapSocket::uimRilEnv = {
.OnRequestComplete = RilSapSocket::sOnRequestComplete,
.OnUnsolicitedResponse = RilSapSocket::sOnUnsolicitedResponse,
.RequestTimedCallback = RIL_requestTimedCallback
};
void RilSapSocket::sOnRequestComplete (RIL_Token t,
RIL_Errno e,
void *response,
size_t responselen) {
RilSapSocket *sap_socket;
SapSocketRequest *request = (SapSocketRequest*) t;
RLOGD("Socket id:%d", request->socketId);
sap_socket = getSocketById(request->socketId);
if (sap_socket) {
sap_socket->onRequestComplete(t,e,response,responselen);
} else {
RLOGE("Invalid socket id");
if (request->curr->payload) {
free(request->curr->payload);
}
free(request->curr);
free(request);
}
}
#if defined(ANDROID_MULTI_SIM)
void RilSapSocket::sOnUnsolicitedResponse(int unsolResponse,
const void *data,
size_t datalen,
RIL_SOCKET_ID socketId) {
RilSapSocket *sap_socket = getSocketById(socketId);
if (sap_socket) {
sap_socket->onUnsolicitedResponse(unsolResponse, (void *)data, datalen);
}
}
#else
void RilSapSocket::sOnUnsolicitedResponse(int unsolResponse,
const void *data,
size_t datalen) {
RilSapSocket *sap_socket = getSocketById(RIL_SOCKET_1);
if(sap_socket){
sap_socket->onUnsolicitedResponse(unsolResponse, (void *)data, datalen);
}
}
#endif
void RilSapSocket::printList() {
RilSapSocketList *current = head;
RLOGD("Printing socket list");
while(NULL != current) {
RLOGD("SocketName:%s",current->socket->name);
RLOGD("Socket id:%d",current->socket->id);
current = current->next;
}
}
RilSapSocket *RilSapSocket::getSocketById(RIL_SOCKET_ID socketId) {
RilSapSocket *sap_socket;
RilSapSocketList *current = head;
RLOGD("Entered getSocketById");
printList();
while(NULL != current) {
if(socketId == current->socket->id) {
sap_socket = current->socket;
return sap_socket;
}
current = current->next;
}
return NULL;
}
void RilSapSocket::initSapSocket(const char *socketName,
RIL_RadioFunctions *uimFuncs) {
if (strcmp(socketName, RIL1_SERVICE_NAME) == 0) {
if(!SocketExists(socketName)) {
addSocketToList(socketName, RIL_SOCKET_1, uimFuncs);
}
}
#if (SIM_COUNT >= 2)
if (strcmp(socketName, RIL2_SERVICE_NAME) == 0) {
if(!SocketExists(socketName)) {
addSocketToList(socketName, RIL_SOCKET_2, uimFuncs);
}
}
#endif
#if (SIM_COUNT >= 3)
if (strcmp(socketName, RIL3_SERVICE_NAME) == 0) {
if(!SocketExists(socketName)) {
addSocketToList(socketName, RIL_SOCKET_3, uimFuncs);
}
}
#endif
#if (SIM_COUNT >= 4)
if (strcmp(socketName, RIL4_SERVICE_NAME) == 0) {
if(!SocketExists(socketName)) {
addSocketToList(socketName, RIL_SOCKET_4, uimFuncs);
}
}
#endif
}
void RilSapSocket::addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
RIL_RadioFunctions *uimFuncs) {
RilSapSocket* socket = NULL;
RilSapSocketList *current;
if(!SocketExists(socketName)) {
socket = new RilSapSocket(socketName, socketid, uimFuncs);
RilSapSocketList* listItem = (RilSapSocketList*)malloc(sizeof(RilSapSocketList));
if (!listItem) {
RLOGE("addSocketToList: OOM");
delete socket;
return;
}
listItem->socket = socket;
listItem->next = NULL;
RLOGD("Adding socket with id: %d", socket->id);
if(NULL == head) {
head = listItem;
head->next = NULL;
}
else {
current = head;
while(NULL != current->next) {
current = current->next;
}
current->next = listItem;
}
}
}
bool RilSapSocket::SocketExists(const char *socketName) {
RilSapSocketList* current = head;
while(NULL != current) {
if(strcmp(current->socket->name, socketName) == 0) {
return true;
}
current = current->next;
}
return false;
}
RilSapSocket::RilSapSocket(const char *socketName,
RIL_SOCKET_ID socketId,
RIL_RadioFunctions *inputUimFuncs):
RilSocket(socketName, socketId) {
if (inputUimFuncs) {
uimFuncs = inputUimFuncs;
}
}
void RilSapSocket::dispatchRequest(MsgHeader *req) {
// SapSocketRequest will be deallocated in onRequestComplete()
SapSocketRequest* currRequest=(SapSocketRequest*)malloc(sizeof(SapSocketRequest));
if (!currRequest) {
RLOGE("dispatchRequest: OOM");
// Free MsgHeader allocated in pushRecord()
free(req);
return;
}
currRequest->token = req->token;
currRequest->curr = req;
currRequest->p_next = NULL;
currRequest->socketId = id;
pendingResponseQueue.enqueue(currRequest);
if (uimFuncs) {
RLOGI("RilSapSocket::dispatchRequest [%d] > SAP REQUEST type: %d. id: %d. error: %d, \
token 0x%p",
req->token,
req->type,
req->id,
req->error,
currRequest );
#if defined(ANDROID_MULTI_SIM)
uimFuncs->onRequest(req->id, req->payload->bytes, req->payload->size, currRequest, id);
#else
uimFuncs->onRequest(req->id, req->payload->bytes, req->payload->size, currRequest);
#endif
}
}
void RilSapSocket::onRequestComplete(RIL_Token t, RIL_Errno e, void *response,
size_t response_len) {
SapSocketRequest* request= (SapSocketRequest*)t;
MsgHeader *hdr = request->curr;
MsgHeader rsp;
rsp.token = request->curr->token;
rsp.type = MsgType_RESPONSE;
rsp.id = request->curr->id;
rsp.error = (Error)e;
rsp.payload = (pb_bytes_array_t *)calloc(1, sizeof(pb_bytes_array_t) + response_len);
if (!rsp.payload) {
RLOGE("onRequestComplete: OOM");
} else {
if (response && response_len > 0) {
memcpy(rsp.payload->bytes, response, response_len);
rsp.payload->size = response_len;
} else {
rsp.payload->size = 0;
}
RLOGE("RilSapSocket::onRequestComplete: Token:%d, MessageId:%d ril token 0x%p",
hdr->token, hdr->id, t);
sap::processResponse(&rsp, this);
free(rsp.payload);
}
// Deallocate SapSocketRequest
if(!pendingResponseQueue.checkAndDequeue(hdr->id, hdr->token)) {
RLOGE("Token:%d, MessageId:%d", hdr->token, hdr->id);
RLOGE ("RilSapSocket::onRequestComplete: invalid Token or Message Id");
}
// Deallocate MsgHeader
free(hdr);
}
void RilSapSocket::onUnsolicitedResponse(int unsolResponse, void *data, size_t datalen) {
if (data && datalen > 0) {
pb_bytes_array_t *payload = (pb_bytes_array_t *)calloc(1,
sizeof(pb_bytes_array_t) + datalen);
if (!payload) {
RLOGE("onUnsolicitedResponse: OOM");
return;
}
memcpy(payload->bytes, data, datalen);
payload->size = datalen;
MsgHeader rsp;
rsp.payload = payload;
rsp.type = MsgType_UNSOL_RESPONSE;
rsp.id = (MsgId)unsolResponse;
rsp.error = Error_RIL_E_SUCCESS;
sap::processUnsolResponse(&rsp, this);
free(payload);
}
}

View File

@ -1,200 +0,0 @@
/*
* Copyright (C) 2014 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.
*/
#ifndef RIL_UIM_SOCKET_H_INCLUDED
#define RIL_UIM_SOCKET_H_INCLUDED
#define RIL_SHLIB
#include "telephony/ril.h"
#include "RilSocket.h"
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
/**
* RilSapSocket is a derived class, derived from the RilSocket abstract
* class, representing sockets for communication between bluetooth SAP module and
* the ril daemon.
* <p>
* This class performs the following functions :
* <ul>
* <li>Initialize the socket.
* <li>Process the requests coming on the socket.
* <li>Provide handlers for Unsolicited and request responses.
* <li>Request and pending response queue handling.
* </ul>
*/
class RilSapSocket : public RilSocket {
/**
* Place holder for the radio functions returned by the initialization
* function. Currenty only onRequest handler is being used.
*/
RIL_RadioFunctions* uimFuncs;
/**
* Wrapper struct for handling the requests in the queue.
*/
typedef struct SapSocketRequest {
int token;
MsgHeader* curr;
struct SapSocketRequest* p_next;
RIL_SOCKET_ID socketId;
} SapSocketRequest;
/**
* Queue for requests that are pending dispatch.
*/
Ril_queue<SapSocketRequest> dispatchQueue;
/**
* Queue for requests that are dispatched but are pending response
*/
Ril_queue<SapSocketRequest> pendingResponseQueue;
public:
/**
* Initialize the socket and add the socket to the list.
*
* @param Name of the socket.
* @param Radio functions to be used by the socket.
*/
static void initSapSocket(const char *socketName,
RIL_RadioFunctions *uimFuncs);
/**
* Ril envoronment variable that holds the request and
* unsol response handlers.
*/
static struct RIL_Env uimRilEnv;
/**
* Function to print the socket list.
*/
static void printList();
/**
* Dispatches the request to the lower layers.
* It calls the on request function.
*
* @param request The request message.
*/
void dispatchRequest(MsgHeader *request);
/**
* Class method to get the socket from the socket list.
*
* @param socketId Socket id.
* @return the sap socket.
*/
static RilSapSocket* getSocketById(RIL_SOCKET_ID socketId);
/**
* Datatype to handle the socket list.
*/
typedef struct RilSapSocketList {
RilSapSocket* socket;
RilSapSocketList *next;
} RilSapSocketList;
protected:
/**
* Socket handler to be called when a request has
* been completed.
*
* @param Token associated with the request.
* @param Error, if any, while processing the request.
* @param The response payload.
* @param Response payload length.
*/
void onRequestComplete(RIL_Token t,RIL_Errno e,
void *response, size_t response_len);
/**
* Socket handler to be called when there is an
* unsolicited response.
*
* @param Message id.
* @param Response data.
* @param Response data length.
*/
void onUnsolicitedResponse(int unsolResponse,
void *data, size_t datalen);
/**
* Class method to add the sap socket to the list of sockets.
* Does nothing if the socket is already present in the list.
* Otherwise, calls the constructor of the parent class(To startlistening)
* and add socket to the socket list.
*/
static void addSocketToList(const char *socketName, RIL_SOCKET_ID socketid,
RIL_RadioFunctions *uimFuncs);
/**
* Check if a socket of the given name exists in the socket list.
*
* @param Socket name.
* @return true if exists, false otherwise.
*/
static bool SocketExists(const char *socketName);
private:
/**
* Constructor.
*
* @param Socket name.
* @param Socket id.
* @param Radio functions.
*/
RilSapSocket(const char *socketName,
RIL_SOCKET_ID socketId,
RIL_RadioFunctions *inputUimFuncs);
/**
* Class method that selects the socket on which the onRequestComplete
* is called.
*
* @param Token associated with the request.
* @param Error, if any, while processing the request.
* @param The response payload.
* @param Response payload length.
*/
static void sOnRequestComplete(RIL_Token t,
RIL_Errno e, void *response, size_t responselen);
#if defined(ANDROID_MULTI_SIM)
/**
* Class method that selects the socket on which the onUnsolicitedResponse
* is called.
*
* @param Message id.
* @param Response data.
* @param Response data length.
* @param Socket id.
*/
static void sOnUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen, RIL_SOCKET_ID socket_id);
#else
/**
* Class method that selects the socket on which the onUnsolicitedResponse
* is called.
*
* @param Message id.
* @param Response data.
* @param Response data length.
*/
static void sOnUnsolicitedResponse(int unsolResponse, const void *data,
size_t datalen);
#endif
};
#endif /*RIL_UIM_SOCKET_H_INCLUDED*/

View File

@ -1,70 +0,0 @@
/*
* Copyright (C) 2014 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.
*/
#ifndef RIL_SOCKET_H_INCLUDED
#define RIL_SOCKET_H_INCLUDED
#include <libril/ril_ex.h>
#include "rilSocketQueue.h"
#include <ril_event.h>
/**
* Abstract socket class representing sockets in rild.
* <p>
* This class performs the following functions :
* <ul>
* <li> Start socket listen.
* <li> Handle socket listen and command callbacks.
* </ul>
*/
class RilSocket {
protected:
/**
* Socket name.
*/
const char* name;
/**
* Socket id.
*/
RIL_SOCKET_ID id;
public:
/**
* Constructor.
*
* @param Socket name.
* @param Socket id.
*/
RilSocket(const char* socketName, RIL_SOCKET_ID socketId) {
name = socketName;
id = socketId;
}
/**
* Get socket id.
*
* @return RIL_SOCKET_ID socket id.
*/
RIL_SOCKET_ID getSocketId(void) {
return id;
}
virtual ~RilSocket(){}
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,167 +0,0 @@
/*
* Copyright (C) 2014 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.
*/
#include "pb_decode.h"
#include <pthread.h>
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
#include <utils/Log.h>
using namespace std;
/**
* Template queue class to handling requests for a rild socket.
* <p>
* This class performs the following functions :
* <ul>
* <li>Enqueue.
* <li>Dequeue.
* <li>Check and dequeue.
* </ul>
*/
template <typename T>
class Ril_queue {
/**
* Mutex attribute used in queue mutex initialization.
*/
pthread_mutexattr_t attr;
/**
* Queue mutex variable for synchronized queue access.
*/
pthread_mutex_t mutex_instance;
/**
* Condition to be waited on for dequeuing.
*/
pthread_cond_t cond;
/**
* Front of the queue.
*/
T *front;
public:
/**
* Remove the first element of the queue.
*
* @return first element of the queue.
*/
T* dequeue(void);
/**
* Add a request to the front of the queue.
*
* @param Request to be added.
*/
void enqueue(T* request);
/**
* Check if the queue is empty.
*/
int empty(void);
/**
* Check and remove an element with a particular message id and token.
*
* @param Request message id.
* @param Request token.
*/
int checkAndDequeue( MsgId id, int token);
/**
* Queue constructor.
*/
Ril_queue(void);
};
template <typename T>
Ril_queue<T>::Ril_queue(void) {
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex_instance, &attr);
cond = PTHREAD_COND_INITIALIZER;
front = NULL;
}
template <typename T>
T* Ril_queue<T>::dequeue(void) {
T* temp = NULL;
pthread_mutex_lock(&mutex_instance);
while(empty()) {
pthread_cond_wait(&cond, &mutex_instance);
}
temp = this->front;
if(NULL != this->front->p_next) {
this->front = this->front->p_next;
} else {
this->front = NULL;
}
pthread_mutex_unlock(&mutex_instance);
return temp;
}
template <typename T>
void Ril_queue<T>::enqueue(T* request) {
pthread_mutex_lock(&mutex_instance);
if(NULL == this->front) {
this->front = request;
request->p_next = NULL;
} else {
request->p_next = this->front;
this->front = request;
}
pthread_cond_broadcast(&cond);
pthread_mutex_unlock(&mutex_instance);
}
template <typename T>
int Ril_queue<T>::checkAndDequeue(MsgId id, int token) {
int ret = 0;
T* temp;
pthread_mutex_lock(&mutex_instance);
for(T **ppCur = &(this->front); *ppCur != NULL; ppCur = &((*ppCur)->p_next)) {
if (token == (*ppCur)->token && id == (*ppCur)->curr->id) {
ret = 1;
temp = *ppCur;
*ppCur = (*ppCur)->p_next;
free(temp);
break;
}
}
pthread_mutex_unlock(&mutex_instance);
return ret;
}
template <typename T>
int Ril_queue<T>::empty(void) {
if(this->front == NULL) {
return 1;
} else {
return 0;
}
}

View File

@ -1,162 +0,0 @@
/* //device/libs/telephony/ril_commands.h
**
** Copyright 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.
*/
{0, NULL}, //none
{RIL_REQUEST_GET_SIM_STATUS, radio::getIccCardStatusResponse},
{RIL_REQUEST_ENTER_SIM_PIN, radio::supplyIccPinForAppResponse},
{RIL_REQUEST_ENTER_SIM_PUK, radio::supplyIccPukForAppResponse},
{RIL_REQUEST_ENTER_SIM_PIN2, radio::supplyIccPin2ForAppResponse},
{RIL_REQUEST_ENTER_SIM_PUK2, radio::supplyIccPuk2ForAppResponse},
{RIL_REQUEST_CHANGE_SIM_PIN, radio::changeIccPinForAppResponse},
{RIL_REQUEST_CHANGE_SIM_PIN2, radio::changeIccPin2ForAppResponse},
{RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, radio::supplyNetworkDepersonalizationResponse},
{RIL_REQUEST_GET_CURRENT_CALLS, radio::getCurrentCallsResponse},
{RIL_REQUEST_DIAL, radio::dialResponse},
{RIL_REQUEST_GET_IMSI, radio::getIMSIForAppResponse},
{RIL_REQUEST_HANGUP, radio::hangupConnectionResponse},
{RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND, radio::hangupWaitingOrBackgroundResponse},
{RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND, radio::hangupForegroundResumeBackgroundResponse},
{RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, radio::switchWaitingOrHoldingAndActiveResponse},
{RIL_REQUEST_CONFERENCE, radio::conferenceResponse},
{RIL_REQUEST_UDUB, radio::rejectCallResponse},
{RIL_REQUEST_LAST_CALL_FAIL_CAUSE, radio::getLastCallFailCauseResponse},
{RIL_REQUEST_SIGNAL_STRENGTH, radio::getSignalStrengthResponse},
{RIL_REQUEST_VOICE_REGISTRATION_STATE, radio::getVoiceRegistrationStateResponse},
{RIL_REQUEST_DATA_REGISTRATION_STATE, radio::getDataRegistrationStateResponse},
{RIL_REQUEST_OPERATOR, radio::getOperatorResponse},
{RIL_REQUEST_RADIO_POWER, radio::setRadioPowerResponse},
{RIL_REQUEST_DTMF, radio::sendDtmfResponse},
{RIL_REQUEST_SEND_SMS, radio::sendSmsResponse},
{RIL_REQUEST_SEND_SMS_EXPECT_MORE, radio::sendSMSExpectMoreResponse},
{RIL_REQUEST_SETUP_DATA_CALL, radio::setupDataCallResponse},
{RIL_REQUEST_SIM_IO, radio::iccIOForAppResponse},
{RIL_REQUEST_SEND_USSD, radio::sendUssdResponse},
{RIL_REQUEST_CANCEL_USSD, radio::cancelPendingUssdResponse},
{RIL_REQUEST_GET_CLIR, radio::getClirResponse},
{RIL_REQUEST_SET_CLIR, radio::setClirResponse},
{RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, radio::getCallForwardStatusResponse},
{RIL_REQUEST_SET_CALL_FORWARD, radio::setCallForwardResponse},
{RIL_REQUEST_QUERY_CALL_WAITING, radio::getCallWaitingResponse},
{RIL_REQUEST_SET_CALL_WAITING, radio::setCallWaitingResponse},
{RIL_REQUEST_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingGsmSmsResponse},
{RIL_REQUEST_GET_IMEI, NULL},
{RIL_REQUEST_GET_IMEISV, NULL},
{RIL_REQUEST_ANSWER, radio::acceptCallResponse},
{RIL_REQUEST_DEACTIVATE_DATA_CALL, radio::deactivateDataCallResponse},
{RIL_REQUEST_QUERY_FACILITY_LOCK, radio::getFacilityLockForAppResponse},
{RIL_REQUEST_SET_FACILITY_LOCK, radio::setFacilityLockForAppResponse},
{RIL_REQUEST_CHANGE_BARRING_PASSWORD, radio::setBarringPasswordResponse},
{RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE, radio::getNetworkSelectionModeResponse},
{RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC, radio::setNetworkSelectionModeAutomaticResponse},
{RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, radio::setNetworkSelectionModeManualResponse},
{RIL_REQUEST_QUERY_AVAILABLE_NETWORKS , radio::getAvailableNetworksResponse},
{RIL_REQUEST_DTMF_START, radio::startDtmfResponse},
{RIL_REQUEST_DTMF_STOP, radio::stopDtmfResponse},
{RIL_REQUEST_BASEBAND_VERSION, radio::getBasebandVersionResponse},
{RIL_REQUEST_SEPARATE_CONNECTION, radio::separateConnectionResponse},
{RIL_REQUEST_SET_MUTE, radio::setMuteResponse},
{RIL_REQUEST_GET_MUTE, radio::getMuteResponse},
{RIL_REQUEST_QUERY_CLIP, radio::getClipResponse},
{RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE, NULL},
{RIL_REQUEST_DATA_CALL_LIST, radio::getDataCallListResponse},
{RIL_REQUEST_RESET_RADIO, NULL},
{RIL_REQUEST_OEM_HOOK_RAW, radio::sendRequestRawResponse},
{RIL_REQUEST_OEM_HOOK_STRINGS, radio::sendRequestStringsResponse},
{RIL_REQUEST_SCREEN_STATE, radio::sendDeviceStateResponse}, // Note the response function is different.
{RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, radio::setSuppServiceNotificationsResponse},
{RIL_REQUEST_WRITE_SMS_TO_SIM, radio::writeSmsToSimResponse},
{RIL_REQUEST_DELETE_SMS_ON_SIM, radio::deleteSmsOnSimResponse},
{RIL_REQUEST_SET_BAND_MODE, radio::setBandModeResponse},
{RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE, radio::getAvailableBandModesResponse},
{RIL_REQUEST_STK_GET_PROFILE, NULL},
{RIL_REQUEST_STK_SET_PROFILE, NULL},
{RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, radio::sendEnvelopeResponse},
{RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, radio::sendTerminalResponseToSimResponse},
{RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, radio::handleStkCallSetupRequestFromSimResponse},
{RIL_REQUEST_EXPLICIT_CALL_TRANSFER, radio::explicitCallTransferResponse},
{RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, radio::setPreferredNetworkTypeResponse},
{RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE, radio::getPreferredNetworkTypeResponse},
{RIL_REQUEST_GET_NEIGHBORING_CELL_IDS, radio::getNeighboringCidsResponse},
{RIL_REQUEST_SET_LOCATION_UPDATES, radio::setLocationUpdatesResponse},
{RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, radio::setCdmaSubscriptionSourceResponse},
{RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, radio::setCdmaRoamingPreferenceResponse},
{RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE, radio::getCdmaRoamingPreferenceResponse},
{RIL_REQUEST_SET_TTY_MODE, radio::setTTYModeResponse},
{RIL_REQUEST_QUERY_TTY_MODE, radio::getTTYModeResponse},
{RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, radio::setPreferredVoicePrivacyResponse},
{RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE, radio::getPreferredVoicePrivacyResponse},
{RIL_REQUEST_CDMA_FLASH, radio::sendCDMAFeatureCodeResponse},
{RIL_REQUEST_CDMA_BURST_DTMF, radio::sendBurstDtmfResponse},
{RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY, NULL},
{RIL_REQUEST_CDMA_SEND_SMS, radio::sendCdmaSmsResponse},
{RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE, radio::acknowledgeLastIncomingCdmaSmsResponse},
{RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG, radio::getGsmBroadcastConfigResponse},
{RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG, radio::setGsmBroadcastConfigResponse},
{RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, radio::setGsmBroadcastActivationResponse},
{RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG, radio::getCdmaBroadcastConfigResponse},
{RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG, radio::setCdmaBroadcastConfigResponse},
{RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION, radio::setCdmaBroadcastActivationResponse},
{RIL_REQUEST_CDMA_SUBSCRIPTION, radio::getCDMASubscriptionResponse},
{RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM, radio::writeSmsToRuimResponse},
{RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM, radio::deleteSmsOnRuimResponse},
{RIL_REQUEST_DEVICE_IDENTITY, radio::getDeviceIdentityResponse},
{RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE, radio::exitEmergencyCallbackModeResponse},
{RIL_REQUEST_GET_SMSC_ADDRESS, radio::getSmscAddressResponse},
{RIL_REQUEST_SET_SMSC_ADDRESS, radio::setSmscAddressResponse},
{RIL_REQUEST_REPORT_SMS_MEMORY_STATUS, radio::reportSmsMemoryStatusResponse},
{RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING, radio::reportStkServiceIsRunningResponse},
{RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE, radio::getCdmaSubscriptionSourceResponse},
{RIL_REQUEST_ISIM_AUTHENTICATION, radio::requestIsimAuthenticationResponse},
{RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU, radio::acknowledgeIncomingGsmSmsWithPduResponse},
{RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS, radio::sendEnvelopeWithStatusResponse},
{RIL_REQUEST_VOICE_RADIO_TECH, radio::getVoiceRadioTechnologyResponse},
{RIL_REQUEST_GET_CELL_INFO_LIST, radio::getCellInfoListResponse},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, radio::setCellInfoListRateResponse},
{RIL_REQUEST_SET_INITIAL_ATTACH_APN, radio::setInitialAttachApnResponse},
{RIL_REQUEST_IMS_REGISTRATION_STATE, radio::getImsRegistrationStateResponse},
{RIL_REQUEST_IMS_SEND_SMS, radio::sendImsSmsResponse},
{RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, radio::iccTransmitApduBasicChannelResponse},
{RIL_REQUEST_SIM_OPEN_CHANNEL, radio::iccOpenLogicalChannelResponse},
{RIL_REQUEST_SIM_CLOSE_CHANNEL, radio::iccCloseLogicalChannelResponse},
{RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL, radio::iccTransmitApduLogicalChannelResponse},
{RIL_REQUEST_NV_READ_ITEM, radio::nvReadItemResponse},
{RIL_REQUEST_NV_WRITE_ITEM, radio::nvWriteItemResponse},
{RIL_REQUEST_NV_WRITE_CDMA_PRL, radio::nvWriteCdmaPrlResponse},
{RIL_REQUEST_NV_RESET_CONFIG, radio::nvResetConfigResponse},
{RIL_REQUEST_SET_UICC_SUBSCRIPTION, radio::setUiccSubscriptionResponse},
{RIL_REQUEST_ALLOW_DATA, radio::setDataAllowedResponse},
{RIL_REQUEST_GET_HARDWARE_CONFIG, radio::getHardwareConfigResponse},
{RIL_REQUEST_SIM_AUTHENTICATION, radio::requestIccSimAuthenticationResponse},
{RIL_REQUEST_GET_DC_RT_INFO, NULL},
{RIL_REQUEST_SET_DC_RT_INFO_RATE, NULL},
{RIL_REQUEST_SET_DATA_PROFILE, radio::setDataProfileResponse},
{RIL_REQUEST_SHUTDOWN, radio::requestShutdownResponse},
{RIL_REQUEST_GET_RADIO_CAPABILITY, radio::getRadioCapabilityResponse},
{RIL_REQUEST_SET_RADIO_CAPABILITY, radio::setRadioCapabilityResponse},
{RIL_REQUEST_START_LCE, radio::startLceServiceResponse},
{RIL_REQUEST_STOP_LCE, radio::stopLceServiceResponse},
{RIL_REQUEST_PULL_LCEDATA, radio::pullLceDataResponse},
{RIL_REQUEST_GET_ACTIVITY_INFO, radio::getModemActivityInfoResponse},
{RIL_REQUEST_SET_CARRIER_RESTRICTIONS, radio::setAllowedCarriersResponse},
{RIL_REQUEST_GET_CARRIER_RESTRICTIONS, radio::getAllowedCarriersResponse},
{RIL_REQUEST_SEND_DEVICE_STATE, radio::sendDeviceStateResponse},
{RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, radio::setIndicationFilterResponse},
{RIL_REQUEST_SET_SIM_CARD_POWER, radio::setSimCardPowerResponse},
{RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, radio::setCarrierInfoForImsiEncryptionResponse},
{RIL_REQUEST_START_NETWORK_SCAN, radio::startNetworkScanResponse},
{RIL_REQUEST_STOP_NETWORK_SCAN, radio::stopNetworkScanResponse},
{RIL_REQUEST_START_KEEPALIVE, radio::startKeepaliveResponse},
{RIL_REQUEST_STOP_KEEPALIVE, radio::stopKeepaliveResponse},

View File

@ -1,50 +0,0 @@
/* //device/libs/telephony/ril_commands.h
**
** Copyright 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.
*/
{SAMSUNG_REQUEST_BASE, NULL}, // 10000
{RIL_REQUEST_DIAL_EMERGENCY_CALL, radio::dialResponse}, // 10001
{RIL_REQUEST_CALL_DEFLECTION, NULL}, // 10002
{RIL_REQUEST_MODIFY_CALL_INITIATE, NULL}, // 10003
{RIL_REQUEST_MODIFY_CALL_CONFIRM, NULL}, // 10004
{RIL_REQUEST_SET_VOICE_DOMAIN_PREF, NULL}, // 10005
{RIL_REQUEST_SAFE_MODE, NULL}, // 10006
{RIL_REQUEST_SET_TRANSMIT_POWER, NULL}, // 10007
{RIL_REQUEST_GET_CELL_BROADCAST_CONFIG, NULL}, // 10008
{RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO, NULL}, // 10009
{RIL_REQUEST_GET_PHONEBOOK_ENTRY, NULL}, // 10010
{RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY, NULL}, // 10011
{RIL_REQUEST_USIM_PB_CAPA, NULL}, // 10012
{RIL_REQUEST_LOCK_INFO, NULL}, // 10013
{RIL_REQUEST_STK_SIM_INIT_EVENT, NULL}, // 10014
{RIL_REQUEST_SET_PREFERRED_NETWORK_LIST, NULL}, // 10015
{RIL_REQUEST_GET_PREFERRED_NETWORK_LIST, NULL}, // 10016
{RIL_REQUEST_CHANGE_SIM_PERSO, NULL}, // 10017
{RIL_REQUEST_ENTER_SIM_PERSO, NULL}, // 10018
{RIL_REQUEST_SEND_ENCODED_USSD, NULL}, // 10019
{RIL_REQUEST_CDMA_SEND_SMS_EXPECT_MORE, NULL}, // 10020
{RIL_REQUEST_HANGUP_VT, NULL}, // 10021
{RIL_REQUEST_HOLD, NULL}, // 10022
{RIL_REQUEST_SET_SIM_POWER, NULL}, // 10023
{10024, NULL}, // 10024
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP, NULL}, // 10025
{RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF, NULL}, // 10026
{RIL_REQUEST_GET_INCOMING_COMMUNICATION_BARRING, NULL}, // 10027
{RIL_REQUEST_SET_INCOMING_COMMUNICATION_BARRING, NULL}, // 10028
{RIL_REQUEST_QUERY_CNAP, NULL}, // 10029
{RIL_REQUEST_SET_TRANSFER_CALL, NULL}, // 10030
{RIL_REQUEST_GET_DISABLE_2G, NULL}, // 10031
{RIL_REQUEST_SET_DISABLE_2G, NULL}, // 10032
{RIL_REQUEST_REFRESH_NITZ_TIME, NULL}, // 10033

View File

@ -1,384 +0,0 @@
/* //device/libs/telephony/ril_event.cpp
**
** Copyright 2008, 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.
*/
#define LOG_TAG "RILC"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <utils/Log.h>
#include <ril_event.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t listMutex;
#define MUTEX_ACQUIRE() pthread_mutex_lock(&listMutex)
#define MUTEX_RELEASE() pthread_mutex_unlock(&listMutex)
#define MUTEX_INIT() pthread_mutex_init(&listMutex, NULL)
#define MUTEX_DESTROY() pthread_mutex_destroy(&listMutex)
#ifndef timeradd
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#endif
#ifndef timercmp
#define timercmp(a, b, op) \
((a)->tv_sec == (b)->tv_sec \
? (a)->tv_usec op (b)->tv_usec \
: (a)->tv_sec op (b)->tv_sec)
#endif
#ifndef timersub
#define timersub(a, b, res) \
do { \
(res)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(res)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((res)->tv_usec < 0) { \
(res)->tv_usec += 1000000; \
(res)->tv_sec -= 1; \
} \
} while(0);
#endif
static fd_set readFds;
static int nfds = 0;
static struct ril_event * watch_table[MAX_FD_EVENTS];
static struct ril_event timer_list;
static struct ril_event pending_list;
#define DEBUG 0
#if DEBUG
#define dlog(x...) RLOGD( x )
static void dump_event(struct ril_event * ev)
{
dlog("~~~~ Event %x ~~~~", (unsigned int)ev);
dlog(" next = %x", (unsigned int)ev->next);
dlog(" prev = %x", (unsigned int)ev->prev);
dlog(" fd = %d", ev->fd);
dlog(" pers = %d", ev->persist);
dlog(" timeout = %ds + %dus", (int)ev->timeout.tv_sec, (int)ev->timeout.tv_usec);
dlog(" func = %x", (unsigned int)ev->func);
dlog(" param = %x", (unsigned int)ev->param);
dlog("~~~~~~~~~~~~~~~~~~");
}
#else
#define dlog(x...) do {} while(0)
#define dump_event(x) do {} while(0)
#endif
static void getNow(struct timeval * tv)
{
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec/1000;
}
static void init_list(struct ril_event * list)
{
memset(list, 0, sizeof(struct ril_event));
list->next = list;
list->prev = list;
list->fd = -1;
}
static void addToList(struct ril_event * ev, struct ril_event * list)
{
ev->next = list;
ev->prev = list->prev;
ev->prev->next = ev;
list->prev = ev;
dump_event(ev);
}
static void removeFromList(struct ril_event * ev)
{
dlog("~~~~ +removeFromList ~~~~");
dump_event(ev);
ev->next->prev = ev->prev;
ev->prev->next = ev->next;
ev->next = NULL;
ev->prev = NULL;
dlog("~~~~ -removeFromList ~~~~");
}
static void removeWatch(struct ril_event * ev, int index)
{
dlog("~~~~ +removeWatch ~~~~");
watch_table[index] = NULL;
ev->index = -1;
FD_CLR(ev->fd, &readFds);
if (ev->fd+1 == nfds) {
int n = 0;
for (int i = 0; i < MAX_FD_EVENTS; i++) {
struct ril_event * rev = watch_table[i];
if ((rev != NULL) && (rev->fd > n)) {
n = rev->fd;
}
}
nfds = n + 1;
dlog("~~~~ nfds = %d ~~~~", nfds);
}
dlog("~~~~ -removeWatch ~~~~");
}
static void processTimeouts()
{
dlog("~~~~ +processTimeouts ~~~~");
MUTEX_ACQUIRE();
struct timeval now;
struct ril_event * tev = timer_list.next;
struct ril_event * next;
getNow(&now);
// walk list, see if now >= ev->timeout for any events
dlog("~~~~ Looking for timers <= %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
while ((tev != &timer_list) && (timercmp(&now, &tev->timeout, >))) {
// Timer expired
dlog("~~~~ firing timer ~~~~");
next = tev->next;
removeFromList(tev);
addToList(tev, &pending_list);
tev = next;
}
MUTEX_RELEASE();
dlog("~~~~ -processTimeouts ~~~~");
}
static void processReadReadies(fd_set * rfds, int n)
{
dlog("~~~~ +processReadReadies (%d) ~~~~", n);
MUTEX_ACQUIRE();
for (int i = 0; (i < MAX_FD_EVENTS) && (n > 0); i++) {
struct ril_event * rev = watch_table[i];
if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
addToList(rev, &pending_list);
if (rev->persist == false) {
removeWatch(rev, i);
}
n--;
}
}
MUTEX_RELEASE();
dlog("~~~~ -processReadReadies (%d) ~~~~", n);
}
static void firePending()
{
dlog("~~~~ +firePending ~~~~");
struct ril_event * ev = pending_list.next;
while (ev != &pending_list) {
struct ril_event * next = ev->next;
removeFromList(ev);
ev->func(ev->fd, 0, ev->param);
ev = next;
}
dlog("~~~~ -firePending ~~~~");
}
static int calcNextTimeout(struct timeval * tv)
{
struct ril_event * tev = timer_list.next;
struct timeval now;
getNow(&now);
// Sorted list, so calc based on first node
if (tev == &timer_list) {
// no pending timers
return -1;
}
dlog("~~~~ now = %ds + %dus ~~~~", (int)now.tv_sec, (int)now.tv_usec);
dlog("~~~~ next = %ds + %dus ~~~~",
(int)tev->timeout.tv_sec, (int)tev->timeout.tv_usec);
if (timercmp(&tev->timeout, &now, >)) {
timersub(&tev->timeout, &now, tv);
} else {
// timer already expired.
tv->tv_sec = tv->tv_usec = 0;
}
return 0;
}
// Initialize internal data structs
void ril_event_init()
{
MUTEX_INIT();
FD_ZERO(&readFds);
init_list(&timer_list);
init_list(&pending_list);
memset(watch_table, 0, sizeof(watch_table));
}
// Initialize an event
void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param)
{
dlog("~~~~ ril_event_set %x ~~~~", (unsigned int)ev);
memset(ev, 0, sizeof(struct ril_event));
ev->fd = fd;
ev->index = -1;
ev->persist = persist;
ev->func = func;
ev->param = param;
fcntl(fd, F_SETFL, O_NONBLOCK);
}
// Add event to watch list
void ril_event_add(struct ril_event * ev)
{
dlog("~~~~ +ril_event_add ~~~~");
MUTEX_ACQUIRE();
for (int i = 0; i < MAX_FD_EVENTS; i++) {
if (watch_table[i] == NULL) {
watch_table[i] = ev;
ev->index = i;
dlog("~~~~ added at %d ~~~~", i);
dump_event(ev);
FD_SET(ev->fd, &readFds);
if (ev->fd >= nfds) nfds = ev->fd+1;
dlog("~~~~ nfds = %d ~~~~", nfds);
break;
}
}
MUTEX_RELEASE();
dlog("~~~~ -ril_event_add ~~~~");
}
// Add timer event
void ril_timer_add(struct ril_event * ev, struct timeval * tv)
{
dlog("~~~~ +ril_timer_add ~~~~");
MUTEX_ACQUIRE();
struct ril_event * list;
if (tv != NULL) {
// add to timer list
list = timer_list.next;
ev->fd = -1; // make sure fd is invalid
struct timeval now;
getNow(&now);
timeradd(&now, tv, &ev->timeout);
// keep list sorted
while (timercmp(&list->timeout, &ev->timeout, < )
&& (list != &timer_list)) {
list = list->next;
}
// list now points to the first event older than ev
addToList(ev, list);
}
MUTEX_RELEASE();
dlog("~~~~ -ril_timer_add ~~~~");
}
// Remove event from watch or timer list
void ril_event_del(struct ril_event * ev)
{
dlog("~~~~ +ril_event_del ~~~~");
MUTEX_ACQUIRE();
if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) {
MUTEX_RELEASE();
return;
}
removeWatch(ev, ev->index);
MUTEX_RELEASE();
dlog("~~~~ -ril_event_del ~~~~");
}
#if DEBUG
static void printReadies(fd_set * rfds)
{
for (int i = 0; (i < MAX_FD_EVENTS); i++) {
struct ril_event * rev = watch_table[i];
if (rev != NULL && FD_ISSET(rev->fd, rfds)) {
dlog("DON: fd=%d is ready", rev->fd);
}
}
}
#else
#define printReadies(rfds) do {} while(0)
#endif
void ril_event_loop()
{
int n;
fd_set rfds;
struct timeval tv;
struct timeval * ptv;
for (;;) {
// make local copy of read fd_set
memcpy(&rfds, &readFds, sizeof(fd_set));
if (-1 == calcNextTimeout(&tv)) {
// no pending timers; block indefinitely
dlog("~~~~ no timers; blocking indefinitely ~~~~");
ptv = NULL;
} else {
dlog("~~~~ blocking for %ds + %dus ~~~~", (int)tv.tv_sec, (int)tv.tv_usec);
ptv = &tv;
}
printReadies(&rfds);
n = select(nfds, &rfds, NULL, NULL, ptv);
printReadies(&rfds);
dlog("~~~~ %d events fired ~~~~", n);
if (n < 0) {
if (errno == EINTR) continue;
RLOGE("ril_event: select error (%d)", errno);
// bail?
return;
}
// Check for timeouts
processTimeouts();
// Check for read-ready
processReadReadies(&rfds, n);
// Fire away
firePending();
}
}

View File

@ -1,52 +0,0 @@
/* //device/libs/telephony/ril_event.h
**
** Copyright 2008, 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.
*/
// Max number of fd's we watch at any one time. Increase if necessary.
#define MAX_FD_EVENTS 8
typedef void (*ril_event_cb)(int fd, short events, void *userdata);
struct ril_event {
struct ril_event *next;
struct ril_event *prev;
int fd;
int index;
bool persist;
struct timeval timeout;
ril_event_cb func;
void *param;
};
// Initialize internal data structs
void ril_event_init();
// Initialize an event
void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param);
// Add event to watch list
void ril_event_add(struct ril_event * ev);
// Add timer event
void ril_timer_add(struct ril_event * ev, struct timeval * tv);
// Remove event from watch list
void ril_event_del(struct ril_event * ev);
// Event loop
void ril_event_loop();

View File

@ -1,98 +0,0 @@
/*
* Copyright (c) 2016 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.
*/
#ifndef ANDROID_RIL_INTERNAL_H
#define ANDROID_RIL_INTERNAL_H
namespace android {
#define RIL_SERVICE_NAME_BASE "slot"
#define RIL1_SERVICE_NAME "slot1"
#define RIL2_SERVICE_NAME "slot2"
#define RIL3_SERVICE_NAME "slot3"
#define RIL4_SERVICE_NAME "slot4"
/* Constants for response types */
#define RESPONSE_SOLICITED 0
#define RESPONSE_UNSOLICITED 1
#define RESPONSE_SOLICITED_ACK 2
#define RESPONSE_SOLICITED_ACK_EXP 3
#define RESPONSE_UNSOLICITED_ACK_EXP 4
// Enable verbose logging
#define VDBG 0
#define MIN(a,b) ((a)<(b) ? (a) : (b))
// Enable RILC log
#define RILC_LOG 0
#if RILC_LOG
#define startRequest sprintf(printBuf, "(")
#define closeRequest sprintf(printBuf, "%s)", printBuf)
#define printRequest(token, req) \
RLOGD("[%04d]> %s %s", token, requestToString(req), printBuf)
#define startResponse sprintf(printBuf, "%s {", printBuf)
#define closeResponse sprintf(printBuf, "%s}", printBuf)
#define printResponse RLOGD("%s", printBuf)
#define clearPrintBuf printBuf[0] = 0
#define removeLastChar printBuf[strlen(printBuf)-1] = 0
#define appendPrintBuf(x...) snprintf(printBuf, PRINTBUF_SIZE, x)
#else
#define startRequest
#define closeRequest
#define printRequest(token, req)
#define startResponse
#define closeResponse
#define printResponse
#define clearPrintBuf
#define removeLastChar
#define appendPrintBuf(x...)
#endif
typedef struct CommandInfo CommandInfo;
extern "C" const char * requestToString(int request);
typedef struct RequestInfo {
int32_t token; //this is not RIL_Token
CommandInfo *pCI;
struct RequestInfo *p_next;
char cancelled;
char local; // responses to local commands do not go back to command process
RIL_SOCKET_ID socket_id;
int wasAckSent; // Indicates whether an ack was sent earlier
} RequestInfo;
typedef struct CommandInfo {
int requestNumber;
int(*responseFunction) (int slotId, int responseType, int token,
RIL_Errno e, void *response, size_t responselen);
} CommandInfo;
RequestInfo * addRequestToList(int serial, int slotId, int request);
char * RIL_getServiceName();
void releaseWakeLock();
void onNewCommandConnect(RIL_SOCKET_ID socket_id);
} // namespace android
#endif //ANDROID_RIL_INTERNAL_H

File diff suppressed because it is too large Load Diff

View File

@ -1,748 +0,0 @@
/*
* Copyright (c) 2016 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.
*/
#ifndef RIL_SERVICE_H
#define RIL_SERVICE_H
#include <telephony/ril.h>
#include <ril_internal.h>
namespace radio {
void registerService(RIL_RadioFunctions *callbacks, android::CommandInfo *commands);
int getIccCardStatusResponse(int slotId, int responseType,
int token, RIL_Errno e, void *response, size_t responselen);
int supplyIccPinForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int supplyIccPukForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int supplyIccPin2ForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int supplyIccPuk2ForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int changeIccPinForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int changeIccPin2ForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int supplyNetworkDepersonalizationResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getCurrentCallsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int dialResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
int getIMSIForAppResponse(int slotId, int responseType,
int serial, RIL_Errno e, void *response, size_t responselen);
int hangupConnectionResponse(int slotId, int responseType,
int serial, RIL_Errno e, void *response, size_t responselen);
int hangupWaitingOrBackgroundResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int hangupForegroundResumeBackgroundResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int switchWaitingOrHoldingAndActiveResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int conferenceResponse(int slotId, int responseType,
int serial, RIL_Errno e, void *response, size_t responselen);
int rejectCallResponse(int slotId, int responseType,
int serial, RIL_Errno e, void *response, size_t responselen);
int getLastCallFailCauseResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getSignalStrengthResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int getVoiceRegistrationStateResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getDataRegistrationStateResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getOperatorResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setRadioPowerResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendDtmfResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendSmsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendSMSExpectMoreResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setupDataCallResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responseLen);
int iccIOForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendUssdResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int cancelPendingUssdResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getClirResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
int setClirResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response, size_t responselen);
int getCallForwardStatusResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCallForwardResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getCallWaitingResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCallWaitingResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int acknowledgeLastIncomingGsmSmsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int acceptCallResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int deactivateDataCallResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getFacilityLockForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setFacilityLockForAppResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setBarringPasswordResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getNetworkSelectionModeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setNetworkSelectionModeAutomaticResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setNetworkSelectionModeManualResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getAvailableNetworksResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int startNetworkScanResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int stopNetworkScanResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int startDtmfResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int stopDtmfResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getBasebandVersionResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int separateConnectionResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setMuteResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getMuteResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getClipResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getDataCallListResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int setSuppServiceNotificationsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int writeSmsToSimResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int deleteSmsOnSimResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setBandModeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getAvailableBandModesResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendEnvelopeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendTerminalResponseToSimResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int handleStkCallSetupRequestFromSimResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int explicitCallTransferResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setPreferredNetworkTypeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getPreferredNetworkTypeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getNeighboringCidsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setLocationUpdatesResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCdmaSubscriptionSourceResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCdmaRoamingPreferenceResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getCdmaRoamingPreferenceResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setTTYModeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getTTYModeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setPreferredVoicePrivacyResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getPreferredVoicePrivacyResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendCDMAFeatureCodeResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int sendBurstDtmfResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int sendCdmaSmsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int acknowledgeLastIncomingCdmaSmsResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getGsmBroadcastConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setGsmBroadcastConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setGsmBroadcastActivationResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getCdmaBroadcastConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCdmaBroadcastConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCdmaBroadcastActivationResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getCDMASubscriptionResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int writeSmsToRuimResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int deleteSmsOnRuimResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getDeviceIdentityResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int exitEmergencyCallbackModeResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getSmscAddressResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int setCdmaBroadcastActivationResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setSmscAddressResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int reportSmsMemoryStatusResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int reportStkServiceIsRunningResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int getCdmaSubscriptionSourceResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int requestIsimAuthenticationResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int acknowledgeIncomingGsmSmsWithPduResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int sendEnvelopeWithStatusResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int getVoiceRadioTechnologyResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getCellInfoListResponse(int slotId,
int responseType,
int serial, RIL_Errno e, void *response,
size_t responseLen);
int setCellInfoListRateResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setInitialAttachApnResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getImsRegistrationStateResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int sendImsSmsResponse(int slotId, int responseType,
int serial, RIL_Errno e, void *response, size_t responselen);
int iccTransmitApduBasicChannelResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int iccOpenLogicalChannelResponse(int slotId,
int responseType, int serial, RIL_Errno e, void *response,
size_t responselen);
int iccCloseLogicalChannelResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int iccTransmitApduLogicalChannelResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int nvReadItemResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int nvWriteItemResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int nvWriteCdmaPrlResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int nvResetConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setUiccSubscriptionResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setDataAllowedResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getHardwareConfigResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int requestIccSimAuthenticationResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setDataProfileResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int requestShutdownResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getRadioCapabilityResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int setRadioCapabilityResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int startLceServiceResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int stopLceServiceResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int pullLceDataResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int getModemActivityInfoResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setAllowedCarriersResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int getAllowedCarriersResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int sendDeviceStateResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setIndicationFilterResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int setSimCardPowerResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int startKeepaliveResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
int stopKeepaliveResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responselen);
void acknowledgeRequest(int slotId, int serial);
int radioStateChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen);
int callStateChangedInd(int slotId, int indType, int token,
RIL_Errno e, void *response, size_t responselen);
int networkStateChangedInd(int slotId, int indType,
int token, RIL_Errno e, void *response, size_t responselen);
int newSmsInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int newSmsStatusReportInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int newSmsOnSimInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int onUssdInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int nitzTimeReceivedInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int currentSignalStrengthInd(int slotId,
int indicationType, int token, RIL_Errno e,
void *response, size_t responselen);
int dataCallListChangedInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int suppSvcNotifyInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int stkSessionEndInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int stkProactiveCommandInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int stkEventNotifyInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int stkCallSetupInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int simSmsStorageFullInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int simRefreshInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int callRingInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int simStatusChangedInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int cdmaNewSmsInd(int slotId, int indicationType,
int token, RIL_Errno e, void *response, size_t responselen);
int newBroadcastSmsInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cdmaRuimSmsStorageFullInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int restrictedStateChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int enterEmergencyCallbackModeInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cdmaCallWaitingInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cdmaOtaProvisionStatusInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cdmaInfoRecInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int oemHookRawInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int indicateRingbackToneInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int resendIncallMuteInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cdmaSubscriptionSourceChangedInd(int slotId,
int indicationType, int token, RIL_Errno e,
void *response, size_t responselen);
int cdmaPrlChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int exitEmergencyCallbackModeInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int rilConnectedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int voiceRadioTechChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int cellInfoListInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int imsNetworkStateChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int subscriptionStatusChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int srvccStateNotifyInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int hardwareConfigChangedInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int radioCapabilityIndicationInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int onSupplementaryServiceIndicationInd(int slotId,
int indicationType, int token, RIL_Errno e,
void *response, size_t responselen);
int stkCallControlAlphaNotifyInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int lceDataInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int pcoDataInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int modemResetInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int networkScanResultInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int keepaliveStatusInd(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responselen);
int sendRequestRawResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int sendRequestStringsResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int setCarrierInfoForImsiEncryptionResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
int carrierInfoForImsiEncryption(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen);
pthread_rwlock_t * getRadioServiceRwlock(int slotId);
} // namespace radio
#endif // RIL_SERVICE_H

View File

@ -1,66 +0,0 @@
/* //device/libs/telephony/ril_unsol_commands.h
**
** Copyright 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.
*/
{RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, radio::radioStateChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, radio::callStateChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED, radio::networkStateChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_NEW_SMS, radio::newSmsInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, radio::newSmsStatusReportInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM, radio::newSmsOnSimInd, WAKE_PARTIAL},
{RIL_UNSOL_ON_USSD, radio::onUssdInd, WAKE_PARTIAL},
{RIL_UNSOL_ON_USSD_REQUEST, radio::onUssdInd, DONT_WAKE},
{RIL_UNSOL_NITZ_TIME_RECEIVED, radio::nitzTimeReceivedInd, WAKE_PARTIAL},
{RIL_UNSOL_SIGNAL_STRENGTH, radio::currentSignalStrengthInd, DONT_WAKE},
{RIL_UNSOL_DATA_CALL_LIST_CHANGED, radio::dataCallListChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_SUPP_SVC_NOTIFICATION, radio::suppSvcNotifyInd, WAKE_PARTIAL},
{RIL_UNSOL_STK_SESSION_END, radio::stkSessionEndInd, WAKE_PARTIAL},
{RIL_UNSOL_STK_PROACTIVE_COMMAND, radio::stkProactiveCommandInd, WAKE_PARTIAL},
{RIL_UNSOL_STK_EVENT_NOTIFY, radio::stkEventNotifyInd, WAKE_PARTIAL},
{RIL_UNSOL_STK_CALL_SETUP, radio::stkCallSetupInd, WAKE_PARTIAL},
{RIL_UNSOL_SIM_SMS_STORAGE_FULL, radio::simSmsStorageFullInd, WAKE_PARTIAL},
{RIL_UNSOL_SIM_REFRESH, radio::simRefreshInd, WAKE_PARTIAL},
{RIL_UNSOL_CALL_RING, radio::callRingInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, radio::simStatusChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_CDMA_NEW_SMS, radio::cdmaNewSmsInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, radio::newBroadcastSmsInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL, radio::cdmaRuimSmsStorageFullInd, WAKE_PARTIAL},
{RIL_UNSOL_RESTRICTED_STATE_CHANGED, radio::restrictedStateChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE, radio::enterEmergencyCallbackModeInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_CALL_WAITING, radio::cdmaCallWaitingInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, radio::cdmaOtaProvisionStatusInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_INFO_REC, radio::cdmaInfoRecInd, WAKE_PARTIAL},
{RIL_UNSOL_OEM_HOOK_RAW, radio::oemHookRawInd, WAKE_PARTIAL},
{RIL_UNSOL_RINGBACK_TONE, radio::indicateRingbackToneInd, WAKE_PARTIAL},
{RIL_UNSOL_RESEND_INCALL_MUTE, radio::resendIncallMuteInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, radio::cdmaSubscriptionSourceChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_CDMA_PRL_CHANGED, radio::cdmaPrlChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE, radio::exitEmergencyCallbackModeInd, WAKE_PARTIAL},
{RIL_UNSOL_RIL_CONNECTED, radio::rilConnectedInd, WAKE_PARTIAL},
{RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, radio::voiceRadioTechChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_CELL_INFO_LIST, radio::cellInfoListInd, WAKE_PARTIAL},
{RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED, radio::imsNetworkStateChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, radio::subscriptionStatusChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_SRVCC_STATE_NOTIFY, radio::srvccStateNotifyInd, WAKE_PARTIAL},
{RIL_UNSOL_HARDWARE_CONFIG_CHANGED, radio::hardwareConfigChangedInd, WAKE_PARTIAL},
{RIL_UNSOL_DC_RT_INFO_CHANGED, NULL, WAKE_PARTIAL},
{RIL_UNSOL_RADIO_CAPABILITY, radio::radioCapabilityIndicationInd, WAKE_PARTIAL},
{RIL_UNSOL_ON_SS, radio::onSupplementaryServiceIndicationInd, WAKE_PARTIAL},
{RIL_UNSOL_STK_CC_ALPHA_NOTIFY, radio::stkCallControlAlphaNotifyInd, WAKE_PARTIAL},
{RIL_UNSOL_LCEDATA_RECV, radio::lceDataInd, WAKE_PARTIAL},
{RIL_UNSOL_PCO_DATA, radio::pcoDataInd, WAKE_PARTIAL},
{RIL_UNSOL_MODEM_RESTART, radio::modemResetInd, WAKE_PARTIAL},
{RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, radio::carrierInfoForImsiEncryption, WAKE_PARTIAL},
{RIL_UNSOL_NETWORK_SCAN_RESULT, radio::networkScanResultInd, WAKE_PARTIAL},

View File

@ -1,83 +0,0 @@
/* //device/libs/telephony/ril_unsol_commands.h
**
** Copyright 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.
*/
{SAMSUNG_UNSOL_BASE, NULL, WAKE_PARTIAL}, // 11000, actually UNSOL_RESPONSE_NEW_CB_MSG
{RIL_UNSOL_RELEASE_COMPLETE_MESSAGE, NULL, WAKE_PARTIAL}, // 11001
{RIL_UNSOL_STK_SEND_SMS_RESULT, /* responseInts */ NULL, WAKE_PARTIAL}, // 11002
{RIL_UNSOL_STK_CALL_CONTROL_RESULT, /* responseString */ NULL, WAKE_PARTIAL}, // 11003
{11004, NULL, WAKE_PARTIAL}, // 11004
{11005, NULL, WAKE_PARTIAL}, // 11005
{11006, NULL, WAKE_PARTIAL}, // 11006
{11007, NULL, WAKE_PARTIAL}, // 11007
{RIL_UNSOL_DEVICE_READY_NOTI, NULL, WAKE_PARTIAL}, // 11008
{RIL_UNSOL_GPS_NOTI, NULL, WAKE_PARTIAL}, // 11009
{RIL_UNSOL_AM, /* responseString */ NULL, WAKE_PARTIAL}, // 11010
{11011, NULL, WAKE_PARTIAL}, // 11011
{11012, NULL, WAKE_PARTIAL}, // 11012
{RIL_UNSOL_SAP, /* responseRaw */ NULL, WAKE_PARTIAL}, // 11013
{11014, NULL, WAKE_PARTIAL}, // 11014
{11015, NULL, WAKE_PARTIAL}, // 11015
{11016, NULL, WAKE_PARTIAL}, // 11016
{11017, NULL, WAKE_PARTIAL}, // 11017
{11018, NULL, WAKE_PARTIAL}, // 11018
{11019, NULL, WAKE_PARTIAL}, // 11019
{RIL_UNSOL_UART, /* responseRaw */ NULL, WAKE_PARTIAL}, // 11020
{RIL_UNSOL_SIM_PB_READY, NULL, WAKE_PARTIAL}, // 11021
{11022, NULL, WAKE_PARTIAL}, // 11022
{11023, NULL, WAKE_PARTIAL}, // 11023
{RIL_UNSOL_VE, /* responseRaw */ NULL, WAKE_PARTIAL}, // 11024
{11025, NULL, WAKE_PARTIAL},
{RIL_UNSOL_FACTORY_AM, NULL, WAKE_PARTIAL}, // 11026
{RIL_UNSOL_IMS_REGISTRATION_STATE_CHANGED, /* responseInts */ NULL, WAKE_PARTIAL}, // 11027
{RIL_UNSOL_MODIFY_CALL, NULL, WAKE_PARTIAL}, // 11028
{11029, NULL, WAKE_PARTIAL}, // 11029
{RIL_UNSOL_CS_FALLBACK, /* responseInts */ NULL, WAKE_PARTIAL}, // 11030
{11031, NULL, WAKE_PARTIAL}, // 11031
{RIL_UNSOL_VOICE_SYSTEM_ID, /* responseInts */ NULL, WAKE_PARTIAL}, // 11032
{11033, NULL, WAKE_PARTIAL}, // 11033
{RIL_UNSOL_IMS_RETRYOVER, NULL, WAKE_PARTIAL}, // 11034
{RIL_UNSOL_PB_INIT_COMPLETE, NULL, WAKE_PARTIAL}, // 11035
{11036, NULL, WAKE_PARTIAL}, // 11036
{RIL_UNSOL_HYSTERESIS_DCN, NULL, WAKE_PARTIAL}, // 11037
{RIL_UNSOL_CP_POSITION, NULL, WAKE_PARTIAL}, // 11038
{11039, NULL, WAKE_PARTIAL}, // 11039
{11040, NULL, WAKE_PARTIAL}, // 11040
{11041, NULL, WAKE_PARTIAL}, // 11041
{11042, NULL, WAKE_PARTIAL}, // 11042
{RIL_UNSOL_HOME_NETWORK_NOTI, NULL, WAKE_PARTIAL}, // 11043
{11044, NULL, WAKE_PARTIAL}, // 11044
{11045, NULL, WAKE_PARTIAL}, // 11045
{11046, NULL, WAKE_PARTIAL}, // 11046
{11047, NULL, WAKE_PARTIAL}, // 11047
{11048, NULL, WAKE_PARTIAL}, // 11048
{11049, NULL, WAKE_PARTIAL}, // 11049
{11050, NULL, WAKE_PARTIAL}, // 11050
{11051, NULL, WAKE_PARTIAL}, // 11051
{11052, NULL, WAKE_PARTIAL}, // 11052
{11053, NULL, WAKE_PARTIAL}, // 11053
{RIL_UNSOL_STK_CALL_STATUS, /* responseInts */ NULL, WAKE_PARTIAL}, // 11054
{11055, NULL, WAKE_PARTIAL}, // 11055
{RIL_UNSOL_MODEM_CAP, /* responseRaw */ NULL, WAKE_PARTIAL}, // 11056
{RIL_UNSOL_SIM_SWAP_STATE_CHANGED, /* responseInts */ NULL, WAKE_PARTIAL}, // 11057
{RUL_UNSOL_SIM_COUNT_MISMATCHED, /* responseInts */ NULL, WAKE_PARTIAL}, // 11058
{11059, NULL, WAKE_PARTIAL}, // 11059
{RIL_UNSOL_DUN, /* responseStrings */ NULL, WAKE_PARTIAL}, // 11060
{RIL_UNSOL_IMS_PREFERENCE_CHANGED, /* responseInts */ NULL, WAKE_PARTIAL}, // 11061
{RIL_UNSOL_SIM_APPLICATION_REFRESH, /* responseInts */ NULL, WAKE_PARTIAL}, // 11062
{RIL_UNSOL_UICC_APPLICATION_STATUS, NULL, WAKE_PARTIAL}, // 11063
{RIL_UNSOL_VOICE_RADIO_BEARER_HO_STATUS, /* responseInts */ NULL, WAKE_PARTIAL}, // 11064
{RIL_UNSOL_CLM_NOTI, NULL, WAKE_PARTIAL}, // 11065
{RIL_UNSOL_SIM_ICCID_NOTI, /* responseString */ NULL, WAKE_PARTIAL}, // 11066

View File

@ -1,965 +0,0 @@
/*
* Copyright (c) 2016 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.
*/
#define LOG_TAG "RIL_SAP"
#include <android/hardware/radio/1.1/ISap.h>
#include <hwbinder/IPCThreadState.h>
#include <hwbinder/ProcessState.h>
#include <sap_service.h>
#include "pb_decode.h"
#include "pb_encode.h"
using namespace android::hardware::radio::V1_0;
using ::android::hardware::Return;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_array;
using ::android::hardware::Void;
using android::CommandInfo;
using android::RequestInfo;
using android::requestToString;
using android::sp;
struct SapImpl;
#if (SIM_COUNT >= 2)
sp<SapImpl> sapService[SIM_COUNT];
#else
sp<SapImpl> sapService[1];
#endif
struct SapImpl : public android::hardware::radio::V1_1::ISap {
int32_t slotId;
sp<ISapCallback> sapCallback;
RIL_SOCKET_ID rilSocketId;
Return<void> setCallback(const ::android::sp<ISapCallback>& sapCallbackParam);
Return<void> connectReq(int32_t token, int32_t maxMsgSize);
Return<void> disconnectReq(int32_t token);
Return<void> apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command);
Return<void> transferAtrReq(int32_t token);
Return<void> powerReq(int32_t token, bool state);
Return<void> resetSimReq(int32_t token);
Return<void> transferCardReaderStatusReq(int32_t token);
Return<void> setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol);
MsgHeader* createMsgHeader(MsgId msgId, int32_t token);
Return<void> addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen, uint8_t *reqPtr);
void sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...);
void checkReturnStatus(Return<void>& ret);
};
void SapImpl::checkReturnStatus(Return<void>& ret) {
if (ret.isOk() == false) {
RLOGE("checkReturnStatus: unable to call response/indication callback: %s",
ret.description().c_str());
// Remote process (SapRilReceiver.java) hosting the callback must be dead. Reset the
// callback object; there's no other recovery to be done here. When the client process is
// back up, it will call setCallback()
sapCallback = NULL;
}
}
Return<void> SapImpl::setCallback(const ::android::sp<ISapCallback>& sapCallbackParam) {
RLOGD("SapImpl::setCallback for slotId %d", slotId);
sapCallback = sapCallbackParam;
return Void();
}
MsgHeader* SapImpl::createMsgHeader(MsgId msgId, int32_t token) {
// Memory for msg will be freed by RilSapSocket::onRequestComplete()
MsgHeader *msg = (MsgHeader *)calloc(1, sizeof(MsgHeader));
if (msg == NULL) {
return NULL;
}
msg->token = token;
msg->type = MsgType_REQUEST;
msg->id = msgId;
msg->error = Error_RIL_E_SUCCESS;
return msg;
}
Return<void> SapImpl::addPayloadAndDispatchRequest(MsgHeader *msg, uint16_t reqLen,
uint8_t *reqPtr) {
pb_bytes_array_t *payload = (pb_bytes_array_t *) malloc(sizeof(pb_bytes_array_t) - 1 + reqLen);
msg->payload = payload;
if (msg->payload == NULL) {
sendFailedResponse(msg->id, msg->token, 2, reqPtr, msg);
return Void();
}
msg->payload->size = reqLen;
memcpy(msg->payload->bytes, reqPtr, reqLen);
RilSapSocket *sapSocket = RilSapSocket::getSocketById(rilSocketId);
if (sapSocket) {
RLOGD("SapImpl::addPayloadAndDispatchRequest: calling dispatchRequest");
sapSocket->dispatchRequest(msg);
} else {
RLOGE("SapImpl::addPayloadAndDispatchRequest: sapSocket is null");
sendFailedResponse(msg->id, msg->token, 3, msg->payload, reqPtr, msg);
return Void();
}
free(payload);
free(reqPtr);
return Void();
}
void SapImpl::sendFailedResponse(MsgId msgId, int32_t token, int numPointers, ...) {
va_list ap;
va_start(ap, numPointers);
for (int i = 0; i < numPointers; i++) {
void *ptr = va_arg(ap, void *);
if (ptr) free(ptr);
}
va_end(ap);
Return<void> retStatus;
switch(msgId) {
case MsgId_RIL_SIM_SAP_CONNECT:
retStatus = sapCallback->connectResponse(token, SapConnectRsp::CONNECT_FAILURE, 0);
break;
case MsgId_RIL_SIM_SAP_DISCONNECT:
retStatus = sapCallback->disconnectResponse(token);
break;
case MsgId_RIL_SIM_SAP_APDU: {
hidl_vec<uint8_t> apduRsp;
retStatus = sapCallback->apduResponse(token, SapResultCode::GENERIC_FAILURE, apduRsp);
break;
}
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: {
hidl_vec<uint8_t> atr;
retStatus = sapCallback->transferAtrResponse(token, SapResultCode::GENERIC_FAILURE,
atr);
break;
}
case MsgId_RIL_SIM_SAP_POWER:
retStatus = sapCallback->powerResponse(token, SapResultCode::GENERIC_FAILURE);
break;
case MsgId_RIL_SIM_SAP_RESET_SIM:
retStatus = sapCallback->resetSimResponse(token, SapResultCode::GENERIC_FAILURE);
break;
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS:
retStatus = sapCallback->transferCardReaderStatusResponse(token,
SapResultCode::GENERIC_FAILURE, 0);
break;
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL:
retStatus = sapCallback->transferProtocolResponse(token, SapResultCode::NOT_SUPPORTED);
break;
default:
return;
}
sapService[slotId]->checkReturnStatus(retStatus);
}
Return<void> SapImpl::connectReq(int32_t token, int32_t maxMsgSize) {
RLOGD("SapImpl::connectReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_CONNECT, token);
if (msg == NULL) {
RLOGE("SapImpl::connectReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_CONNECT_REQ *****/
RIL_SIM_SAP_CONNECT_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_CONNECT_REQ));
req.max_message_size = maxMsgSize;
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) {
RLOGE("SapImpl::connectReq: Error getting encoded size for RIL_SIM_SAP_CONNECT_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::connectReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::connectReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_CONNECT_REQ_fields, &req)) {
RLOGE("SapImpl::connectReq: Error encoding RIL_SIM_SAP_CONNECT_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_CONNECT, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_CONNECT_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::disconnectReq(int32_t token) {
RLOGD("SapImpl::disconnectReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_DISCONNECT, token);
if (msg == NULL) {
RLOGE("SapImpl::disconnectReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ *****/
RIL_SIM_SAP_DISCONNECT_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_DISCONNECT_REQ));
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) {
RLOGE("SapImpl::disconnectReq: Error getting encoded size for RIL_SIM_SAP_DISCONNECT_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::disconnectReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::disconnectReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_DISCONNECT_REQ_fields, &req)) {
RLOGE("SapImpl::disconnectReq: Error encoding RIL_SIM_SAP_DISCONNECT_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_DISCONNECT, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_DISCONNECT_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::apduReq(int32_t token, SapApduType type, const hidl_vec<uint8_t>& command) {
RLOGD("SapImpl::apduReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_APDU, token);
if (msg == NULL) {
RLOGE("SapImpl::apduReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_APDU_REQ *****/
RIL_SIM_SAP_APDU_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_APDU_REQ));
req.type = (RIL_SIM_SAP_APDU_REQ_Type)type;
if (command.size() > 0) {
req.command = (pb_bytes_array_t *)malloc(sizeof(pb_bytes_array_t) - 1 + command.size());
if (req.command == NULL) {
RLOGE("SapImpl::apduReq: Error allocating memory for req.command");
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 1, msg);
return Void();
}
req.command->size = command.size();
memcpy(req.command->bytes, command.data(), command.size());
}
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_APDU_REQ_fields, &req)) {
RLOGE("SapImpl::apduReq: Error getting encoded size for RIL_SIM_SAP_APDU_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::apduReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 2, req.command, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::apduReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_APDU_REQ_fields, &req)) {
RLOGE("SapImpl::apduReq: Error encoding RIL_SIM_SAP_APDU_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_APDU, token, 3, req.command, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_APDU_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::transferAtrReq(int32_t token) {
RLOGD("SapImpl::transferAtrReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token);
if (msg == NULL) {
RLOGE("SapImpl::transferAtrReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ *****/
RIL_SIM_SAP_TRANSFER_ATR_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_ATR_REQ));
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) {
RLOGE("SapImpl::transferAtrReq: Error getting encoded size for "
"RIL_SIM_SAP_TRANSFER_ATR_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::transferAtrReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::transferAtrReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_ATR_REQ_fields, &req)) {
RLOGE("SapImpl::transferAtrReq: Error encoding RIL_SIM_SAP_TRANSFER_ATR_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_ATR, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_TRANSFER_ATR_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::powerReq(int32_t token, bool state) {
RLOGD("SapImpl::powerReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_POWER, token);
if (msg == NULL) {
RLOGE("SapImpl::powerReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_POWER_REQ *****/
RIL_SIM_SAP_POWER_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_POWER_REQ));
req.state = state;
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_POWER_REQ_fields, &req)) {
RLOGE("SapImpl::powerReq: Error getting encoded size for RIL_SIM_SAP_POWER_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::powerReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::powerReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_POWER_REQ_fields, &req)) {
RLOGE("SapImpl::powerReq: Error encoding RIL_SIM_SAP_POWER_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_POWER, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_POWER_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::resetSimReq(int32_t token) {
RLOGD("SapImpl::resetSimReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_RESET_SIM, token);
if (msg == NULL) {
RLOGE("SapImpl::resetSimReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ *****/
RIL_SIM_SAP_RESET_SIM_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_RESET_SIM_REQ));
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) {
RLOGE("SapImpl::resetSimReq: Error getting encoded size for RIL_SIM_SAP_RESET_SIM_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::resetSimReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::resetSimReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_RESET_SIM_REQ_fields, &req)) {
RLOGE("SapImpl::resetSimReq: Error encoding RIL_SIM_SAP_RESET_SIM_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_RESET_SIM, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_RESET_SIM_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::transferCardReaderStatusReq(int32_t token) {
RLOGD("SapImpl::transferCardReaderStatusReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token);
if (msg == NULL) {
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ *****/
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ));
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields,
&req)) {
RLOGE("SapImpl::transferCardReaderStatusReq: Error getting encoded size for "
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::transferCardReaderStatusReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::transferCardReaderStatusReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ_fields, &req)) {
RLOGE("SapImpl::transferCardReaderStatusReq: Error encoding "
"RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
Return<void> SapImpl::setTransferProtocolReq(int32_t token, SapTransferProtocol transferProtocol) {
RLOGD("SapImpl::setTransferProtocolReq");
MsgHeader *msg = createMsgHeader(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token);
if (msg == NULL) {
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for msg");
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 0);
return Void();
}
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ *****/
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ req;
memset(&req, 0, sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ));
req.protocol = (RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_Protocol)transferProtocol;
size_t encodedSize = 0;
if (!pb_get_encoded_size(&encodedSize, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) {
RLOGE("SapImpl::setTransferProtocolReq: Error getting encoded size for "
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg);
return Void();
}
uint8_t *buffer = (uint8_t *)calloc(1, encodedSize);
if (buffer == NULL) {
RLOGE("SapImpl::setTransferProtocolReq: Error allocating memory for buffer");
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 1, msg);
return Void();
}
pb_ostream_t stream = pb_ostream_from_buffer(buffer, encodedSize);
RLOGD("SapImpl::setTransferProtocolReq calling pb_encode");
if (!pb_encode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ_fields, &req)) {
RLOGE("SapImpl::setTransferProtocolReq: Error encoding "
"RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ");
sendFailedResponse(MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL, token, 2, buffer, msg);
return Void();
}
/***** Encode RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_REQ done *****/
/* encoded req is payload */
return addPayloadAndDispatchRequest(msg, stream.bytes_written, buffer);
}
void *sapDecodeMessage(MsgId msgId, MsgType msgType, uint8_t *payloadPtr, size_t payloadLen) {
void *responsePtr = NULL;
pb_istream_t stream;
/* Create the stream */
stream = pb_istream_from_buffer((uint8_t *)payloadPtr, payloadLen);
/* Decode based on the message id */
switch (msgId)
{
case MsgId_RIL_SIM_SAP_CONNECT:
responsePtr = malloc(sizeof(RIL_SIM_SAP_CONNECT_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_CONNECT_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_CONNECT_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_DISCONNECT:
if (msgType == MsgType_RESPONSE) {
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_RSP");
return NULL;
}
}
} else {
responsePtr = malloc(sizeof(RIL_SIM_SAP_DISCONNECT_IND));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_DISCONNECT_IND_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_DISCONNECT_IND");
return NULL;
}
}
}
break;
case MsgId_RIL_SIM_SAP_APDU:
responsePtr = malloc(sizeof(RIL_SIM_SAP_APDU_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_APDU_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_APDU_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_TRANSFER_ATR:
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_ATR_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_ATR_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_ATR_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_POWER:
responsePtr = malloc(sizeof(RIL_SIM_SAP_POWER_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_POWER_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_POWER_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_RESET_SIM:
responsePtr = malloc(sizeof(RIL_SIM_SAP_RESET_SIM_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_RESET_SIM_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_RESET_SIM_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_STATUS:
responsePtr = malloc(sizeof(RIL_SIM_SAP_STATUS_IND));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_STATUS_IND_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_STATUS_IND");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS:
responsePtr = malloc(sizeof(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_fields,
responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_ERROR_RESP:
responsePtr = malloc(sizeof(RIL_SIM_SAP_ERROR_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_ERROR_RSP_fields, responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_ERROR_RSP");
return NULL;
}
}
break;
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL:
responsePtr = malloc(sizeof(RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP));
if (responsePtr) {
if (!pb_decode(&stream, RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_fields,
responsePtr)) {
RLOGE("Error decoding RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP");
return NULL;
}
}
break;
default:
break;
}
return responsePtr;
} /* sapDecodeMessage */
sp<SapImpl> getSapImpl(RilSapSocket *sapSocket) {
switch (sapSocket->getSocketId()) {
case RIL_SOCKET_1:
RLOGD("getSapImpl: returning sapService[0]");
return sapService[0];
#if (SIM_COUNT >= 2)
case RIL_SOCKET_2:
return sapService[1];
#if (SIM_COUNT >= 3)
case RIL_SOCKET_3:
return sapService[2];
#if (SIM_COUNT >= 4)
case RIL_SOCKET_4:
return sapService[3];
#endif
#endif
#endif
default:
return NULL;
}
}
SapResultCode convertApduResponseProtoToHal(RIL_SIM_SAP_APDU_RSP_Response responseProto) {
switch(responseProto) {
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SUCCESS:
return SapResultCode::SUCCESS;
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_GENERIC_FAILURE:
return SapResultCode::GENERIC_FAILURE;
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_NOT_READY:
return SapResultCode::CARD_NOT_ACCESSSIBLE;
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
return SapResultCode::CARD_ALREADY_POWERED_OFF;
case RIL_SIM_SAP_APDU_RSP_Response_RIL_E_SIM_ABSENT:
return SapResultCode::CARD_REMOVED;
default:
return SapResultCode::GENERIC_FAILURE;
}
}
SapResultCode convertTransferAtrResponseProtoToHal(
RIL_SIM_SAP_TRANSFER_ATR_RSP_Response responseProto) {
switch(responseProto) {
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SUCCESS:
return SapResultCode::SUCCESS;
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_GENERIC_FAILURE:
return SapResultCode::GENERIC_FAILURE;
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
return SapResultCode::CARD_ALREADY_POWERED_OFF;
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_ABSENT:
return SapResultCode::CARD_REMOVED;
case RIL_SIM_SAP_TRANSFER_ATR_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE:
return SapResultCode::DATA_NOT_AVAILABLE;
default:
return SapResultCode::GENERIC_FAILURE;
}
}
SapResultCode convertPowerResponseProtoToHal(RIL_SIM_SAP_POWER_RSP_Response responseProto) {
switch(responseProto) {
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SUCCESS:
return SapResultCode::SUCCESS;
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_GENERIC_FAILURE:
return SapResultCode::GENERIC_FAILURE;
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ABSENT:
return SapResultCode::CARD_REMOVED;
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
return SapResultCode::CARD_ALREADY_POWERED_OFF;
case RIL_SIM_SAP_POWER_RSP_Response_RIL_E_SIM_ALREADY_POWERED_ON:
return SapResultCode::CARD_ALREADY_POWERED_ON;
default:
return SapResultCode::GENERIC_FAILURE;
}
}
SapResultCode convertResetSimResponseProtoToHal(RIL_SIM_SAP_RESET_SIM_RSP_Response responseProto) {
switch(responseProto) {
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SUCCESS:
return SapResultCode::SUCCESS;
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_GENERIC_FAILURE:
return SapResultCode::GENERIC_FAILURE;
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ABSENT:
return SapResultCode::CARD_REMOVED;
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_NOT_READY:
return SapResultCode::CARD_NOT_ACCESSSIBLE;
case RIL_SIM_SAP_RESET_SIM_RSP_Response_RIL_E_SIM_ALREADY_POWERED_OFF:
return SapResultCode::CARD_ALREADY_POWERED_OFF;
}
return SapResultCode::GENERIC_FAILURE;
}
SapResultCode convertTransferCardReaderStatusResponseProtoToHal(
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response responseProto) {
switch(responseProto) {
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SUCCESS:
return SapResultCode::SUCCESS;
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_GENERIC_FAILURE:
return SapResultCode::GENERIC_FAILURE;
case RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP_Response_RIL_E_SIM_DATA_NOT_AVAILABLE:
return SapResultCode::DATA_NOT_AVAILABLE;
}
return SapResultCode::GENERIC_FAILURE;
}
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket, MsgType msgType) {
MsgId msgId = rsp->id;
uint8_t *data = rsp->payload->bytes;
size_t dataLen = rsp->payload->size;
void *messagePtr = sapDecodeMessage(msgId, msgType, data, dataLen);
sp<SapImpl> sapImpl = getSapImpl(sapSocket);
if (sapImpl->sapCallback == NULL) {
RLOGE("processResponse: sapCallback == NULL; msgId = %d; msgType = %d",
msgId, msgType);
return;
}
if (messagePtr == NULL) {
RLOGE("processResponse: *messagePtr == NULL; msgId = %d; msgType = %d",
msgId, msgType);
sapImpl->sendFailedResponse(msgId, rsp->token, 0);
return;
}
RLOGD("processResponse: sapCallback != NULL; msgId = %d; msgType = %d",
msgId, msgType);
Return<void> retStatus;
switch (msgId) {
case MsgId_RIL_SIM_SAP_CONNECT: {
RIL_SIM_SAP_CONNECT_RSP *connectRsp = (RIL_SIM_SAP_CONNECT_RSP *)messagePtr;
RLOGD("processResponse: calling sapCallback->connectResponse %d %d %d",
rsp->token,
connectRsp->response,
connectRsp->max_message_size);
retStatus = sapImpl->sapCallback->connectResponse(rsp->token,
(SapConnectRsp)connectRsp->response,
connectRsp->max_message_size);
break;
}
case MsgId_RIL_SIM_SAP_DISCONNECT:
if (msgType == MsgType_RESPONSE) {
RLOGD("processResponse: calling sapCallback->disconnectResponse %d", rsp->token);
retStatus = sapImpl->sapCallback->disconnectResponse(rsp->token);
} else {
RIL_SIM_SAP_DISCONNECT_IND *disconnectInd =
(RIL_SIM_SAP_DISCONNECT_IND *)messagePtr;
RLOGD("processResponse: calling sapCallback->disconnectIndication %d %d",
rsp->token, disconnectInd->disconnectType);
retStatus = sapImpl->sapCallback->disconnectIndication(rsp->token,
(SapDisconnectType)disconnectInd->disconnectType);
}
break;
case MsgId_RIL_SIM_SAP_APDU: {
RIL_SIM_SAP_APDU_RSP *apduRsp = (RIL_SIM_SAP_APDU_RSP *)messagePtr;
SapResultCode apduResponse = convertApduResponseProtoToHal(apduRsp->response);
RLOGD("processResponse: calling sapCallback->apduResponse %d %d",
rsp->token, apduResponse);
hidl_vec<uint8_t> apduRspVec;
if (apduRsp->apduResponse != NULL && apduRsp->apduResponse->size > 0) {
apduRspVec.setToExternal(apduRsp->apduResponse->bytes, apduRsp->apduResponse->size);
}
retStatus = sapImpl->sapCallback->apduResponse(rsp->token, apduResponse, apduRspVec);
break;
}
case MsgId_RIL_SIM_SAP_TRANSFER_ATR: {
RIL_SIM_SAP_TRANSFER_ATR_RSP *transferAtrRsp =
(RIL_SIM_SAP_TRANSFER_ATR_RSP *)messagePtr;
SapResultCode transferAtrResponse =
convertTransferAtrResponseProtoToHal(transferAtrRsp->response);
RLOGD("processResponse: calling sapCallback->transferAtrResponse %d %d",
rsp->token, transferAtrResponse);
hidl_vec<uint8_t> transferAtrRspVec;
if (transferAtrRsp->atr != NULL && transferAtrRsp->atr->size > 0) {
transferAtrRspVec.setToExternal(transferAtrRsp->atr->bytes,
transferAtrRsp->atr->size);
}
retStatus = sapImpl->sapCallback->transferAtrResponse(rsp->token, transferAtrResponse,
transferAtrRspVec);
break;
}
case MsgId_RIL_SIM_SAP_POWER: {
SapResultCode powerResponse = convertPowerResponseProtoToHal(
((RIL_SIM_SAP_POWER_RSP *)messagePtr)->response);
RLOGD("processResponse: calling sapCallback->powerResponse %d %d",
rsp->token, powerResponse);
retStatus = sapImpl->sapCallback->powerResponse(rsp->token, powerResponse);
break;
}
case MsgId_RIL_SIM_SAP_RESET_SIM: {
SapResultCode resetSimResponse = convertResetSimResponseProtoToHal(
((RIL_SIM_SAP_RESET_SIM_RSP *)messagePtr)->response);
RLOGD("processResponse: calling sapCallback->resetSimResponse %d %d",
rsp->token, resetSimResponse);
retStatus = sapImpl->sapCallback->resetSimResponse(rsp->token, resetSimResponse);
break;
}
case MsgId_RIL_SIM_SAP_STATUS: {
RIL_SIM_SAP_STATUS_IND *statusInd = (RIL_SIM_SAP_STATUS_IND *)messagePtr;
RLOGD("processResponse: calling sapCallback->statusIndication %d %d",
rsp->token, statusInd->statusChange);
retStatus = sapImpl->sapCallback->statusIndication(rsp->token,
(SapStatus)statusInd->statusChange);
break;
}
case MsgId_RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS: {
RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *transferStatusRsp =
(RIL_SIM_SAP_TRANSFER_CARD_READER_STATUS_RSP *)messagePtr;
SapResultCode transferCardReaderStatusResponse =
convertTransferCardReaderStatusResponseProtoToHal(
transferStatusRsp->response);
RLOGD("processResponse: calling sapCallback->transferCardReaderStatusResponse %d %d %d",
rsp->token,
transferCardReaderStatusResponse,
transferStatusRsp->CardReaderStatus);
retStatus = sapImpl->sapCallback->transferCardReaderStatusResponse(rsp->token,
transferCardReaderStatusResponse,
transferStatusRsp->CardReaderStatus);
break;
}
case MsgId_RIL_SIM_SAP_ERROR_RESP: {
RLOGD("processResponse: calling sapCallback->errorResponse %d", rsp->token);
retStatus = sapImpl->sapCallback->errorResponse(rsp->token);
break;
}
case MsgId_RIL_SIM_SAP_SET_TRANSFER_PROTOCOL: {
SapResultCode setTransferProtocolResponse;
if (((RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP *)messagePtr)->response ==
RIL_SIM_SAP_SET_TRANSFER_PROTOCOL_RSP_Response_RIL_E_SUCCESS) {
setTransferProtocolResponse = SapResultCode::SUCCESS;
} else {
setTransferProtocolResponse = SapResultCode::NOT_SUPPORTED;
}
RLOGD("processResponse: calling sapCallback->transferProtocolResponse %d %d",
rsp->token, setTransferProtocolResponse);
retStatus = sapImpl->sapCallback->transferProtocolResponse(rsp->token,
setTransferProtocolResponse);
break;
}
default:
return;
}
sapImpl->checkReturnStatus(retStatus);
}
void sap::processResponse(MsgHeader *rsp, RilSapSocket *sapSocket) {
processResponse(rsp, sapSocket, MsgType_RESPONSE);
}
void sap::processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket) {
processResponse(rsp, sapSocket, MsgType_UNSOL_RESPONSE);
}
void sap::registerService(RIL_RadioFunctions *callbacks) {
using namespace android::hardware;
int simCount = 1;
const char *serviceNames[] = {
android::RIL_getServiceName()
#if (SIM_COUNT >= 2)
, RIL2_SERVICE_NAME
#if (SIM_COUNT >= 3)
, RIL3_SERVICE_NAME
#if (SIM_COUNT >= 4)
, RIL4_SERVICE_NAME
#endif
#endif
#endif
};
RIL_SOCKET_ID socketIds[] = {
RIL_SOCKET_1
#if (SIM_COUNT >= 2)
, RIL_SOCKET_2
#if (SIM_COUNT >= 3)
, RIL_SOCKET_3
#if (SIM_COUNT >= 4)
, RIL_SOCKET_4
#endif
#endif
#endif
};
#if (SIM_COUNT >= 2)
simCount = SIM_COUNT;
#endif
for (int i = 0; i < simCount; i++) {
sapService[i] = new SapImpl;
sapService[i]->slotId = i;
sapService[i]->rilSocketId = socketIds[i];
RLOGD("registerService: starting ISap %s for slotId %d", serviceNames[i], i);
android::status_t status = sapService[i]->registerAsService(serviceNames[i]);
RLOGD("registerService: started ISap %s status %d", serviceNames[i], status);
}
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2016 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.
*/
#ifndef SAP_SERVICE_H
#define SAP_SERVICE_H
#include <telephony/ril.h>
#include <ril_internal.h>
#include <RilSapSocket.h>
#include <hardware/ril/librilutils/proto/sap-api.pb.h>
namespace sap {
void registerService(RIL_RadioFunctions *callbacks);
void processResponse(MsgHeader *rsp, RilSapSocket *sapSocket);
void processUnsolResponse(MsgHeader *rsp, RilSapSocket *sapSocket);
} // namespace android
#endif // RIL_SERVICE_H

View File

@ -1,20 +0,0 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
SecNativeFeatureCIf.cpp \
SecNativeFeatureCppIf.cpp
LOCAL_C_INCLUDES += \
external/expat/lib
LOCAL_SHARED_LIBRARIES := \
libexpat
LOCAL_CFLAGS := -Wall -Werror
LOCAL_MODULE := libsecnativefeature
include $(BUILD_SHARED_LIBRARY)

View File

@ -1,31 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_H
#define SEC_NATIVE_FEATURE_H
#include "SecNativeFeatureTagAll.h"
// define TAG for default value
/*
#define Str_NoTag ""
#define Bool_NoTag false
#define Int_NoTag (0)
#define TAG_BOOLEAN_TEST_TRUE "CscFeature_BooleanTestTrue"
#define TAG_BOOLEAN_TEST_FALSE "CscFeature_BooleanTestFalse"
#define TAG_BOOLEAN_TEST_NULL "CscFeature_BooleanTestNull"
#define TAG_STRING_TEST "CscFeature_StringTest"
#define TAG_STRING_TEST_NULL "CscFeature_StringTestNull"
#define TAG_INTEGER_TEST "CscFeature_IntegerTest"
#define TAG_INTEGER_TEST_NULL "CscFeature_IntegerTestNull"
#define TAG_FMRADIO_RTPLUS "CscFeature_FMRadioRTPlus"
#define TAG_FMRADIO_SEASETTING "CscFeature_FMRadioSEASetting"
*/
#ifdef __cplusplus
#include "SecNativeFeatureCppIf.h"
#else
#include "SecNativeFeatureCIf.h"
#endif
#endif // SEC_NATIVE_FEATURE_H

View File

@ -1,85 +0,0 @@
#include <string>
#include <iostream>
#include "SecNativeFeatureCppIf.h"
#include "SecNativeFeatureCIf.h"
#include <expat.h>
#include <stdlib.h>
int
SecNativeFeature_getEnableStatus(const char* tag)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getEnableStatus(tag);
}
return 0;
}
int
SecNativeFeature_getEnableStatusWithDefault(const char* tag, int defaultValue)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getEnableStatus(tag, defaultValue);
}
return defaultValue;
}
int
SecNativeFeature_getInteger(const char* tag)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getInteger(tag);
}
return -1;
}
int
SecNativeFeature_getIntegerWithDefault(const char* tag, int defaultValue)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getInteger(tag, defaultValue);
}
return defaultValue;
}
const char*
SecNativeFeature_getString(const char* tag)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getString(tag);
}
return NULL;
}
const char*
SecNativeFeature_getStringWithDefault(const char* tag, char* defaultValue)
{
SecNativeFeature* instance = SecNativeFeature::getInstance();
if (instance)
{
return instance->getString(tag, defaultValue);
}
return defaultValue;
}

View File

@ -1,24 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_CIF_H
#define SEC_NATIVE_FEATURE_CIF_H
#ifdef __cplusplus
#define DECLARE_BEGIN_C extern "C" {
#define DECLARE_END_C }
#else
#define DECLARE_BEGIN_C
#define DECLARE_END_C
#endif
DECLARE_BEGIN_C
int SecNativeFeature_getEnableStatus(const char* tag);
int SecNativeFeature_getEnableStatusWithDefault(const char* tag, int defaultValue);
int SecNativeFeature_getInteger(const char* tag);
int SecNativeFeature_getIntegerWithDefault(const char* tag, int defaultValue);
const char* SecNativeFeature_getString(const char* tag);
const char* SecNativeFeature_getStringWithDefault(const char* tag, char* defaultValue);
DECLARE_END_C
#endif // SEC_NATIVE_FEATURE_CIF_H

View File

@ -1,187 +0,0 @@
#include <string>
#include <iostream>
#include "SecNativeFeatureCppIf.h"
#include <expat.h>
#include <stdlib.h>
// feature file location (which should be "/system/csc/feature.xml")
#define FEATURE_FILE "/system/csc/feature.xml"
// feature file location (which should be "/system/csc/others.xml")
#define MPS_FEATURE_FILE "/system/csc/others.xml"
// XML parsing using expat lib - handlers
typedef struct{
std::string curr_name;
std::map<std::string,std::string> *pFeatures;
int depth;
} ParserUserData;
static void XMLCALL
charDataHandler(void *userData, const char *s, int len){
ParserUserData* pData = (ParserUserData*)userData;
std::string value(s, len);
std::string curr_name = pData->curr_name;
if(!curr_name.empty()){
std::map<std::string,std::string>::iterator result = (*pData->pFeatures).find(curr_name);
if (result != (*pData->pFeatures).end()) {
value = result->second + value;
(*pData->pFeatures).erase(curr_name);
}
std::map<std::string,std::string>::iterator begin;
begin = (*pData->pFeatures).begin();
std::pair<std::string,std::string> feature(curr_name,value);
(*pData->pFeatures).insert(begin, feature);
}
// else{
// // printf("no name\n");
// }
}
static void XMLCALL
startElement(void *userData, const char *name, const char **atts __unused)
{
ParserUserData* pData = (ParserUserData*)userData;
pData->curr_name.assign(name);
pData->depth += 1;
}
static void XMLCALL
endElement(void *userData, const char *name __unused)
{
ParserUserData* pData = (ParserUserData*)userData;
pData->curr_name.clear();
pData->depth -= 1;
}
// SecNativeFeture class implementation
SecNativeFeature* SecNativeFeature::_instance = NULL;
SecNativeFeature::SecNativeFeature() {
int load_result = 0;
_features.clear();
load_result = _loadFeature();
if (load_result == -1){
// todo : handle _loadFeature errors here.
}
}
SecNativeFeature::~SecNativeFeature() {
delete _instance;
}
SecNativeFeature* SecNativeFeature::getInstance() {
if(_instance == NULL) {
_instance = new SecNativeFeature();
}
return _instance;
}
bool SecNativeFeature::getEnableStatus(const char* tag) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return false;
}
if(found->second.compare("true") == 0 || found->second.compare("TRUE") == 0) {
return true;
}
return false;
}
bool SecNativeFeature::getEnableStatus(const char* tag, bool defaultValue) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return defaultValue;
}
if(found->second.compare("true") == 0 || found->second.compare("TRUE") == 0) {
return true;
}
return defaultValue;
}
const char* SecNativeFeature::getString(const char* tag) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return "";
}
return found->second.c_str();
}
const char* SecNativeFeature::getString(const char* tag, char* defaultValue) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return defaultValue;
}
return found->second.c_str();
}
int SecNativeFeature::getInteger(const char* tag) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return -1;
}
std::string raw_value = _features.find(tag)->second;
return atoi(raw_value.c_str());
}
int SecNativeFeature::getInteger(const char* tag, int defaultValue) {
std::map<std::string,std::string>::iterator found;
found = _features.find(tag);
if(found == _features.end()) {
return defaultValue;
}
std::string raw_value = _features.find(tag)->second;
return atoi(raw_value.c_str());
}
int SecNativeFeature::_loadFeature(){
char buf[BUFSIZ];
XML_Parser parser = XML_ParserCreate(NULL);
int done;
FILE * pFeatureFile = NULL;
ParserUserData userData;
userData.curr_name = std::string ();
userData.pFeatures = &_features;
userData.depth = 0;
pFeatureFile = fopen(FEATURE_FILE, "r");
if (pFeatureFile == NULL) {
pFeatureFile = fopen(MPS_FEATURE_FILE, "r");
if (pFeatureFile == NULL) {
return -1;
}
}
XML_SetUserData(parser, &userData);
XML_SetElementHandler(parser, startElement, endElement);
XML_SetCharacterDataHandler(parser, charDataHandler);
do {
size_t len = fread(buf, 1, sizeof(buf), pFeatureFile);
if ((len != sizeof(buf)) && (ferror(pFeatureFile))){
fclose(pFeatureFile);
return -1;
}
done = len < sizeof(buf);
if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {
if(pFeatureFile) {
fclose(pFeatureFile);
}
return -1;
}
} while (!done);
XML_ParserFree(parser);
fclose(pFeatureFile);
return 0;
}

View File

@ -1,27 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_CPPIF_H
#define SEC_NATIVE_FEATURE_CPPIF_H
#include <string>
#include <map>
class SecNativeFeature {
public:
bool getEnableStatus(const char* tag);
bool getEnableStatus(const char* tag, bool defaultValue);
const char* getString(const char* tag);
const char* getString(const char* tag, char* defaultValue);
int getInteger(const char* tag);
int getInteger(const char* tag, int defaultValue);
static SecNativeFeature* getInstance();
private:
static SecNativeFeature* _instance;
SecNativeFeature();
~SecNativeFeature();
int _loadFeature();
int _loadDefault();
std::map<std::string,std::string> _features;
};
#endif // SEC_NATIVE_FEATURE_CPPIF_H

View File

@ -1,20 +0,0 @@
/*
* CSC Features
* Auto generated by gen_cscfeaturetag_ih.pl
* DO NOT EDIT THIS FILE
*/
/*
#include "SecNativeFeatureTagGMS.h"
#include "SecNativeFeatureTagIMS.h"
#include "SecNativeFeatureTagMediaProvider.h"
#include "SecNativeFeatureTagNFC.h"
#include "SecNativeFeatureTagRIL.h"
#include "SecNativeFeatureTagStreaming.h"
#include "SecNativeFeatureTagWiFi.h"
#include "SecNativeFeatureTagBT.h"
*/
#include "SecNativeFeatureTagFramework.h"
#include "SecNativeFeatureTagCommon.h"
#include "SecNativeFeatureTagWeb.h"

View File

@ -1,9 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_TAG_COMMON_H
#define SEC_NATIVE_FEATURE_TAG_COMMON_H
// Note
// The string must be same as the string in CSCFeatureTagCommon.java
// Because one feature coulde be implemented both in java layer and in native layer
#define TAG_CSCFEATURE_COMMON_USECHAMELEON "CscFeature_Common_UseChameleon"
#endif // SEC_NATIVE_FEATURE_TAG_COMMON_H

View File

@ -1,16 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_TAG_FRAMEWORK_H
#define SEC_NATIVE_FEATURE_TAG_FRAMEWORK_H
// Note
// The string must be same as the string in CSCFeatureTagFramework.java
// Because one feature coulde be implemented both in java layer and in native layer
#define TAG_CSCFEATURE_FRAMEWORK_ENABLEBIDIRECTION "CscFeature_Framework_EnableBidirection"
#define TAG_CSCFEATURE_FRAMEWORK_ENABLEHARFBUZZ "CscFeature_Framework_EnableHarfbuzz"
#define TAG_CSCFEATURE_FRAMEWORK_ENABLETHAIVIETRESHAPING "CscFeature_Framework_EnableThaiVietReshaping"
#endif // SEC_NATIVE_FEATURE_TAG_FRAMEWORK_H

View File

@ -1,150 +0,0 @@
#ifndef SEC_NATIVE_FEATURE_TAG_WEB_H
#define SEC_NATIVE_FEATURE_TAG_WEB_H
// Note
// The string must be same as the string in CSCFeatureTagWeb.java
// Because one feature coulde be implemented both in java layer and in native layer
// The default values for each types
// This means the specified TAG is not defined
#define CSCFeatureTagWeb_Str_NoTag ""
#define CSCFeatureTagWeb_Bool_NoTag false
#define CSCFeatureTagWeb_Int_NoTag 0
// To define custom UserAgent string
// If this value is not defined, the default Android UserAgent will be sent to server
#define CSCFeatureTagWeb_SetUserAgent "CscFeature_Web_SetUserAgent"
// To define UAProfile string
// If this value is not defined, UAProfile will not be sent to server
#define CSCFeatureTagWeb_SetUAProfile "CscFeature_Web_SetUAProfile"
// Change homepage_base regardless language and APN
#define CscFeatureTagWeb_SetHomepageURL "CscFeature_Web_SetHomepageURL"
// Disable RSS button on the url bar
#define CscFeatureTagWeb_DisableRSS "CscFeature_Web_DisableRSS"
// Remove voicesearch button on the url bar
#define CscFeatureTagWeb_DisableVoiceSearch "CscFeature_Web_DisableVoiceSearch"
// Disable showing activity chooser on redirecting in case when 3rd party browser also installed
#define CscFeatureTagWeb_DisableRedirectionChooser "CscFeature_Web_DisableRedirectionChooser"
// Enable UAProfile in Header
#define CscFeatureTagWeb_Bool_EnableUAProfile "CscFeature_Web_Bool_EnableUAProfile"
// To Enable the GateConfig Logs(USA STA requirement for stability test)
#define CscFeatureTagWeb_Bool_EnableGateConfig "CscFeature_Web_EnableLogStabililtyTest"
//add for Handling Operator UA
#define CscFeature_Web_OverrideUserAgent "CscFeature_Web_OverrideUserAgent"
// add menu clear today history
#define CscFeatureTagWeb_EnableDeletingTodayHistory "CscFeature_Web_EnableDeletingTodayHistory"
// To enable bookmark overwrite
#define CscFeatureTagWeb_EnableOverwritingBookmark "CscFeature_Web_EnableOverwritingBookmark"
// To enable downloaded folder notification
#define CscFeatureTagWeb_EnableDownloadedFolderInNotificationBar "CscFeature_Web_EnableDownloadedFolderInNotificationBar"
//Enable DeviceID at Header(USA ATT Requirement)
#define CscFeatureTag_Web_Bool_DeviceID "CscFeature_Web_UseDeviceIdInHeader"
// support uploading contacts in VCard format (China-Telecom requirement)
#define CscFeatureTagWeb_SupportVcfUpload "CscFeature_Web_SupportVcfUpload"
//Parse XHTML document as HTML (ignore parse error. China-Telecom requirement)
#define CscFeatureTagWeb_ParseXHtmlToHtml "CscFeature_Web_ParseXHtmlToHtml"
//Block SD & CD download ( NAGSM common requirement)
#define CscFeatureTag_Web_Bool_BlockSDCDDownload "CscFeature_Web_BlockSDCDDownload"
// display download progress on notification bar (China-Telecom requirement)
#define CscFeatureTagWeb_ShowDownloadProgressOnNotification "CscFeature_Web_ShowDownloadProgressOnNotification"
// show browser version in browser settings (China-Telecom requirement)
#define CscFeatureTagWeb_ShowVersionInSetting "CscFeature_Web_ShowVersionInSetting"
// support "exit browser" option (China-Telecom requirement)
#define CscFeatureTagWeb_AddOptionToTerminate "CscFeature_Web_AddOptionToTerminate"
// Add "Delete-all" function at Download list (China-Telecom requirement)
#define CscFeatureTagWeb_EnableDeleteAllOnDownloadList "CscFeature_Web_EnableDeleteAllOnDownloadList"
// Support save-as function and default folder by mime-type (China-Telecom requirement)
#define CscFeatureTagWeb_SupportDownloadSaveAs "CscFeature_Web_SupportDownloadSaveAs"
// support delete-all option in bookmarks page (China-Telecom requirement)
#define CscFeatureTagWeb_EnableDeleteAllBookmarks "CscFeature_Web_EnableDeleteAllBookmarks"
// Add "FullHandwriting IME issue "(China-Common requirement)
#define CscFeatureTagWeb_EnableOptionEditTextDuringFullHwr "CscFeature_Web_EnableOptionEditTextDuringFullHwr"
// support offline-startup page includes bookmarks, history, search dialog (China-Telecom requirement)
#define CscFeatureTagWeb_SupportOfflineStartupPage "CscFeature_Web_SupportOfflineStartupPage"
// support not to set factory-reset-homepage to PREF_HOMEPAGE
#define CscFeatureTagWeb_Bool_DisableSetFactoryResetHomeToPrefHome "CscFeature_Web_Bool_DisableSetFactoryResetHomeToPrefHome"
// Show roaming dialog (ATT Requirement)
#define CscFeatureTagWeb_Bool_ShowRoamingDialog "CscFeature_Web_EnableRoamingDialog"
// set download folder by mime-type for China-Telecom requirement
#define CscFeatureTagWeb_SetDownloadFolderNameByMimeType "CscFeature_Web_SetDownloadFolderNameByMimeType"
// Disable showing activity chooser for defined string
#define CscFeature_Web_DisableChooser4 "CscFeature_Web_DisableChooser4"
// Enable download hebrew filename
#define CscFeature_Web_SupportHebrewFileName "CscFeature_Web_SupportHebrewFileName"
// remove google in search engine list
#define CscFeatureTagWeb_DisableGoogleInBrowserSearchEngine "CscFeature_Web_DisableGoogleInBrowserSearchEngine"
// set off overview mode as default (CTC Requirement)
#define CscFeatureTagWeb_SetOffOverviewModeAsDefault "CscFeature_Web_SetOffOverviewModeAsDefault"
// Disable setting homepage as it is set in APN when SIM changed
#define CscFeature_Web_EnableAutoSimHomeUrlInProfile "CscFeature_Web_EnableAutoSimHomeUrlInProfile"
// Add download file name decode feature for China region
#define CscFeatureTagWeb_SupportDownloadedFileNameInChineseChar "CscFeature_Web_SupportDownloadedFileNameInChineseChar"
// support multiAPN (CMCC Requirement)
#define CscFeatureTagWeb_EnableMultipleApn4 "CscFeature_Web_EnableMultipleApn4"
// Enable Ask to exit on back (CMCC Requirement)
#define CscFeatureTagWeb_EnablePromptToExit "CscFeature_Web_EnablePromptToExit"
// Enable EMOJI for JPN
#define CscFeatureTagWeb_EnableEmoji "CscFeature_Web_Bool_EnableEmoji"
// Show Wifi AP List when WIFI switch is on (CMCC Requirement)
#define CscFeatureTagWeb_ShowWifiAPList "CscFeature_Web_ShowWifiAPList"
// Enable Operator's toolbar (ATT Requirement)
#define CscFeatureTagWeb_EnableOperatorToolbar "CscFeature_Web_EnableOperatorToolbar"
// Set TCP Connection timout (China Requirement)
#define CscFeatureTagWeb_SetTcpConnTimeoutAs "CscFeature_Web_SetTcpConnTimeoutAs"
// Add WML mime type to Accept Header (CMCC Requirement)
#define CscFeatureTagWeb_AddWmlToHttpAcceptHeader4 "CscFeature_Web_AddWmlToHttpAcceptHeader4"
// change block zoom method to position based touch block zoom (Australia Requirement)
#define CscFeature_Web_BlockZoomBaseOnTouchPosition "CscFeature_Web_BlockZoomBaseOnTouchPosition"
// Remove Partial View During Horizontal Scroll in Nav Screen (Australia Requirement)
#define CscFeature_Web_RemovePartialViewDuringHorizontalScroll "CscFeature_Web_RemovePartialViewDuringHorizontalScroll"
// Show Popup for MaxLength reached during Url input (CMCC Requirement)
#define CscFeatureTagWeb_EnablePopup4MaxLengthReachedDuringUrlInput "CscFeature_Web_EnablePopup4MaxLengthReachedDuringUrlInput"
// Support Tel Number in the page to go to dialing app (KOR Requirement)
#define CscFeature_Web_RecognizeTelNumber "CscFeature_Web_RecognizeTelNumber"
// Large file transfer in Internet download (VZW Requirement)
#define CscFeature_Web_EnableWifiOption4LargeFileDownload "CscFeature_Web_EnableWifiOption4LargeFileDownload"
// Add additional accept charset to Accept Header (CTC Requirement)
#define CscFeature_Web_AddCharSetToHttpHeader "CscFeature_Web_AddCharSetToHttpHeader"
// max connection per host for performance
#define CscFeature_Web_MaxConnectionPerHost "CscFeature_Web_MaxConnectionPerHost"
#endif // SEC_NATIVE_FEATURE_TAG_WEB_H