From: Sanket Padawe Date: Thu, 10 Aug 2017 04:30:03 +0000 (+0000) Subject: DO NOT MERGE Fix security vulnerability in pre-O rild code. am: bb6567cbaf am: 57170e... X-Git-Tag: android-x86-8.1-r3~1^2~3^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b60ee03fbe0c048554117d4e2d2cf6eb4123b141;hp=20df21ecc7bddfb11af1dbf707a589227eb3055f;p=android-x86%2Fhardware-ril.git DO NOT MERGE Fix security vulnerability in pre-O rild code. am: bb6567cbaf am: 57170e4964 am: 44fd51827a -s ours am: 023b8082b7 -s ours am: 774711be8f am: 39840dc5e3 -s ours am: 3a546ebf0a am: 8ad718398a am: 472cfd25ea am: 2a86c777ef -s ours am: b916a4067b am: 21e26b21ee am: 52858488cd am: bd35fe83b0 am: 915b6f46e3 -s ours am: 20df21ecc7 Change-Id: I85053c3094d7cef9b85403e99b7564f3731a05cd --- diff --git a/CleanSpec.mk b/CleanSpec.mk index ffa18d5..cca8c69 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -52,3 +52,5 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/bin/rild) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/init/rild.rc) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/libril.so) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/libril.so) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/librilutils.so) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/librilutils.so) diff --git a/include/libril/ril_ex.h b/include/libril/ril_ex.h index 251e8ff..757bcf9 100644 --- a/include/libril/ril_ex.h +++ b/include/libril/ril_ex.h @@ -22,6 +22,8 @@ #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); diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 5b1e2d6..df0e467 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -77,7 +77,9 @@ extern "C" { * RIL_UNSOL_MODEM_RESTART, * RIL_REQUEST_SEND_DEVICE_STATE, * RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER, - * RIL_REQUEST_SET_SIM_CARD_POWER + * RIL_REQUEST_SET_SIM_CARD_POWER, + * RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, + * RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION * The new parameters for RIL_REQUEST_SETUP_DATA_CALL, * Updated data structures: RIL_DataProfileInfo_v15, RIL_InitialAttachApn_v15 * New data structure RIL_DataRegistrationStateResponse, @@ -85,6 +87,9 @@ extern "C" { * used in RIL_REQUEST_DATA_REGISTRATION_STATE and * RIL_REQUEST_VOICE_REGISTRATION_STATE respectively. * New data structure RIL_OpenChannelParams. + * RIL_REQUEST_START_NETWORK_SCAN + * RIL_REQUEST_STOP_NETWORK_SCAN + * RIL_UNSOL_NETWORK_SCAN_RESULT */ #define RIL_VERSION 12 #define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name @@ -99,6 +104,9 @@ extern "C" { #define MAX_DEBUG_SOCKET_NAME_LENGTH 12 #define MAX_QEMU_PIPE_NAME_LENGTH 11 #define MAX_UUID_LENGTH 64 +#define MAX_BANDS 8 +#define MAX_CHANNELS 32 +#define MAX_RADIO_ACCESS_NETWORKS 8 typedef void * RIL_Token; @@ -743,6 +751,20 @@ typedef struct { */ } RIL_CarrierRestrictions; +typedef struct { + char * mcc; /* MCC of the Carrier. */ + char * mnc ; /* MNC of the Carrier. */ + uint8_t * carrierKey; /* Public Key from the Carrier used to encrypt the + * IMSI/IMPI. + */ + char * keyIdentifier; /* The keyIdentifier Attribute value pair that helps + * a server locate the private key to decrypt the + * permanent identity. + */ + int64_t expirationTime; /* Date-Time (in UTC) when the key will expire. */ + +} RIL_CarrierInfoForImsiEncryption; + /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */ typedef enum { CALL_FAIL_UNOBTAINABLE_NUMBER = 1, @@ -2027,6 +2049,141 @@ typedef struct { P2Constants:NO_P2 if to be ignored */ } RIL_OpenChannelParams; +typedef enum { + RIL_ONE_SHOT = 0x01, // Performs the scan only once + RIL_PERIODIC = 0x02 // Performs the scan periodically until cancelled +} RIL_ScanType; + +typedef enum { + GERAN = 0x01, // GSM EDGE Radio Access Network + UTRAN = 0x02, // Universal Terrestrial Radio Access Network + EUTRAN = 0x03, // Evolved Universal Terrestrial Radio Access Network +} RIL_RadioAccessNetworks; + +typedef enum { + GERAN_BAND_T380 = 1, + GERAN_BAND_T410 = 2, + GERAN_BAND_450 = 3, + GERAN_BAND_480 = 4, + GERAN_BAND_710 = 5, + GERAN_BAND_750 = 6, + GERAN_BAND_T810 = 7, + GERAN_BAND_850 = 8, + GERAN_BAND_P900 = 9, + GERAN_BAND_E900 = 10, + GERAN_BAND_R900 = 11, + GERAN_BAND_DCS1800 = 12, + GERAN_BAND_PCS1900 = 13, + GERAN_BAND_ER900 = 14, +} RIL_GeranBands; + +typedef enum { + UTRAN_BAND_1 = 1, + UTRAN_BAND_2 = 2, + UTRAN_BAND_3 = 3, + UTRAN_BAND_4 = 4, + UTRAN_BAND_5 = 5, + UTRAN_BAND_6 = 6, + UTRAN_BAND_7 = 7, + UTRAN_BAND_8 = 8, + UTRAN_BAND_9 = 9, + UTRAN_BAND_10 = 10, + UTRAN_BAND_11 = 11, + UTRAN_BAND_12 = 12, + UTRAN_BAND_13 = 13, + UTRAN_BAND_14 = 14, + UTRAN_BAND_19 = 19, + UTRAN_BAND_20 = 20, + UTRAN_BAND_21 = 21, + UTRAN_BAND_22 = 22, + UTRAN_BAND_25 = 25, + UTRAN_BAND_26 = 26, +} RIL_UtranBands; + +typedef enum { + EUTRAN_BAND_1 = 1, + EUTRAN_BAND_2 = 2, + EUTRAN_BAND_3 = 3, + EUTRAN_BAND_4 = 4, + EUTRAN_BAND_5 = 5, + EUTRAN_BAND_6 = 6, + EUTRAN_BAND_7 = 7, + EUTRAN_BAND_8 = 8, + EUTRAN_BAND_9 = 9, + EUTRAN_BAND_10 = 10, + EUTRAN_BAND_11 = 11, + EUTRAN_BAND_12 = 12, + EUTRAN_BAND_13 = 13, + EUTRAN_BAND_14 = 14, + EUTRAN_BAND_17 = 17, + EUTRAN_BAND_18 = 18, + EUTRAN_BAND_19 = 19, + EUTRAN_BAND_20 = 20, + EUTRAN_BAND_21 = 21, + EUTRAN_BAND_22 = 22, + EUTRAN_BAND_23 = 23, + EUTRAN_BAND_24 = 24, + EUTRAN_BAND_25 = 25, + EUTRAN_BAND_26 = 26, + EUTRAN_BAND_27 = 27, + EUTRAN_BAND_28 = 28, + EUTRAN_BAND_30 = 30, + EUTRAN_BAND_31 = 31, + EUTRAN_BAND_33 = 33, + EUTRAN_BAND_34 = 34, + EUTRAN_BAND_35 = 35, + EUTRAN_BAND_36 = 36, + EUTRAN_BAND_37 = 37, + EUTRAN_BAND_38 = 38, + EUTRAN_BAND_39 = 39, + EUTRAN_BAND_40 = 40, + EUTRAN_BAND_41 = 41, + EUTRAN_BAND_42 = 42, + EUTRAN_BAND_43 = 43, + EUTRAN_BAND_44 = 44, + EUTRAN_BAND_45 = 45, + EUTRAN_BAND_46 = 46, + EUTRAN_BAND_47 = 47, + EUTRAN_BAND_48 = 48, + EUTRAN_BAND_65 = 65, + EUTRAN_BAND_66 = 66, + EUTRAN_BAND_68 = 68, + EUTRAN_BAND_70 = 70, +} RIL_EutranBands; + +typedef struct { + RIL_RadioAccessNetworks radio_access_network; // The type of network to scan. + uint32_t bands_length; // Length of bands + union { + RIL_GeranBands geran_bands[MAX_BANDS]; + RIL_UtranBands utran_bands[MAX_BANDS]; + RIL_EutranBands eutran_bands[MAX_BANDS]; + } bands; + uint32_t channels_length; // Length of channels + uint32_t channels[MAX_CHANNELS]; // Frequency channels to scan +} RIL_RadioAccessSpecifier; + +typedef struct { + RIL_ScanType type; // Type of the scan + int32_t interval; // Time interval in seconds + // between periodic scans, only + // valid when type=RIL_PERIODIC + uint32_t specifiers_length; // Length of specifiers + RIL_RadioAccessSpecifier specifiers[MAX_RADIO_ACCESS_NETWORKS]; // Radio access networks + // with bands/channels. +} RIL_NetworkScanRequest; + +typedef enum { + PARTIAL = 0x01, // The result contains a part of the scan results + COMPLETE = 0x02, // The result contains the last part of the scan results +} RIL_ScanStatus; + +typedef struct { + RIL_ScanStatus status; // The status of the scan + uint32_t network_infos_length; // Total length of RIL_CellInfo + RIL_CellInfo_v12* network_infos; // List of network information +} RIL_NetworkScanResult; + /** * RIL_REQUEST_GET_SIM_STATUS * @@ -2037,7 +2194,14 @@ typedef struct { * "response" is const RIL_CardStatus_v6 * * * Valid errors: - * Must never fail + * + * SUCCESS + * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_SIM_STATUS 1 @@ -2058,6 +2222,13 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ENTER_SIM_PIN 2 @@ -2081,6 +2252,13 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT * (PUK is invalid) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ENTER_SIM_PUK 3 @@ -2103,6 +2281,13 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ENTER_SIM_PIN2 4 @@ -2126,6 +2311,13 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT * (PUK2 is invalid) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ENTER_SIM_PUK2 5 @@ -2149,7 +2341,13 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT * (old PIN is invalid) - * + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_CHANGE_SIM_PIN 6 @@ -2174,6 +2372,13 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT * (old PIN2 is invalid) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED * */ @@ -2196,6 +2401,11 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * PASSWORD_INCORRECT * (code is invalid) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION 8 @@ -2215,6 +2425,10 @@ typedef struct { * RADIO_NOT_AVAILABLE (radio resetting) * NO_MEMORY * (request will be made again in a few hundred msec) + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_CURRENT_CALLS 9 @@ -2247,8 +2461,10 @@ typedef struct { * NO_NETWORK_FOUND * INVALID_CALL_ID * DEVICE_IN_USE - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED * ABORTED + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_DIAL 10 @@ -2266,6 +2482,12 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_SIM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_IMSI 11 @@ -2294,6 +2516,9 @@ typedef struct { * NO_MEMORY * INVALID_CALL_ID * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_HANGUP 12 @@ -2321,6 +2546,9 @@ typedef struct { * NO_RESOURCES * OPERATION_NOT_ALLOWED * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND 13 @@ -2347,6 +2575,8 @@ typedef struct { * OPERATION_NOT_ALLOWED * INVALID_ARGUMENTS * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND 14 @@ -2382,6 +2612,9 @@ typedef struct { * INVALID_ARGUMENTS * INVALID_CALL_ID * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE 15 @@ -2405,6 +2638,9 @@ typedef struct { * INVALID_CALL_ID * INVALID_ARGUMENTS * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_CONFERENCE 16 @@ -2428,6 +2664,8 @@ typedef struct { * INVALID_CALL_ID * OPERATION_NOT_ALLOWED * INVALID_ARGUMENTS + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_UDUB 17 @@ -2477,6 +2715,10 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * NO_MEMORY + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */ @@ -2502,6 +2744,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SIGNAL_STRENGTH 19 @@ -2516,6 +2760,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_VOICE_REGISTRATION_STATE 20 @@ -2536,6 +2785,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_DATA_REGISTRATION_STATE 21 @@ -2561,6 +2812,8 @@ typedef struct { * INTERNAL_ERR * SYSTEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_OPERATOR 22 @@ -2596,6 +2849,8 @@ typedef struct { * OPERATION_NOT_ALLOWED * INVALID_MODEM_STATE * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_RADIO_POWER 23 @@ -2623,6 +2878,10 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * INVALID_CALL_ID + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_DTMF_STOP, RIL_REQUEST_DTMF_START * @@ -2662,7 +2921,11 @@ typedef struct { * INVALID_SMSC_ADDRESS * MODEM_ERR * NETWORK_ERR - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * FIXME how do we specify TP-Message-Reference if we need to resend? */ @@ -2704,7 +2967,11 @@ typedef struct { * NETWORK_ERR * ENCODING_ERR * INVALID_SMSC_ADDRESS - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_SEND_SMS_EXPECT_MORE 26 @@ -2780,8 +3047,9 @@ typedef struct { * * Other errors could include: * RADIO_NOT_AVAILABLE, OP_NOT_ALLOWED_BEFORE_REG_TO_NW, - * OP_NOT_ALLOWED_DURING_VOICE_CALL and REQUEST_NOT_SUPPORTED, - * INVALID_ARGUMENTS + * OP_NOT_ALLOWED_DURING_VOICE_CALL, REQUEST_NOT_SUPPORTED, + * INVALID_ARGUMENTS, INTERNAL_ERR, NO_MEMORY, NO_RESOURCES + * and CANCELLED * * See also: RIL_REQUEST_DEACTIVATE_DATA_CALL */ @@ -2811,6 +3079,9 @@ typedef struct { * RADIO_NOT_AVAILABLE * SIM_PIN2 * SIM_PUK2 + * INVALID_SIM_STATE + * SIM_ERR + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_IO 28 @@ -2849,6 +3120,9 @@ typedef struct { * ABORTED * SYSTEM_ERR * INVALID_STATE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_CANCEL_USSD, RIL_UNSOL_ON_USSD */ @@ -2872,6 +3146,9 @@ typedef struct { * INTERNAL_ERR * NO_MEMORY * INVALID_STATE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_CANCEL_USSD 30 @@ -2896,6 +3173,9 @@ typedef struct { * INTERNAL_ERR * FDN_CHECK_FAILURE * SYSTEM_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_CLIR 31 @@ -2915,6 +3195,11 @@ typedef struct { * SS_MODIFIED_TO_SS * INVALID_ARGUMENTS * SYSTEM_ERR + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_CLIR 32 @@ -2947,6 +3232,9 @@ typedef struct { * INTERNAL_ERR * NO_MEMORY * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_QUERY_CALL_FORWARD_STATUS 33 @@ -2972,6 +3260,9 @@ typedef struct { * INTERNAL_ERR * INVALID_STATE * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_CALL_FORWARD 34 @@ -3006,6 +3297,9 @@ typedef struct { * NO_MEMORY * FDN_CHECK_FAILURE * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_QUERY_CALL_WAITING 35 @@ -3033,6 +3327,9 @@ typedef struct { * INTERNAL_ERR * INVALID_STATE * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_CALL_WAITING 36 @@ -3059,6 +3356,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SMS_ACKNOWLEDGE 37 @@ -3082,6 +3384,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_GET_IMEI 38 @@ -3106,6 +3410,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_GET_IMEISV 39 @@ -3132,6 +3438,9 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * INVALID_CALL_ID + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ANSWER 40 @@ -3162,6 +3471,10 @@ typedef struct { * INVALID_STATE * INVALID_ARGUMENTS * REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED * * See also: RIL_REQUEST_SETUP_DATA_CALL */ @@ -3200,6 +3513,9 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_QUERY_FACILITY_LOCK 42 @@ -3237,6 +3553,9 @@ typedef struct { * MODEM_ERR * INVALID_STATE * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_SET_FACILITY_LOCK 43 @@ -3267,6 +3586,9 @@ typedef struct { * INTERNAL_ERR * SYSTEM_ERR * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CHANGE_BARRING_PASSWORD 44 @@ -3292,6 +3614,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE 45 @@ -3318,6 +3642,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and * no retries needed, such as illegal SIM or ME. @@ -3348,6 +3674,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * Note: Returns ILLEGAL_SIM_OR_ME when the failure is permanent and * no retries needed, such as illegal SIM or ME. @@ -3386,6 +3714,8 @@ typedef struct { * REQUEST_NOT_SUPPORTED * CANCELLED * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_QUERY_AVAILABLE_NETWORKS 48 @@ -3413,6 +3743,9 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * INVALID_CALL_ID + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_STOP */ @@ -3437,6 +3770,9 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * INVALID_CALL_ID + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_DTMF, RIL_REQUEST_DTMF_START */ @@ -3461,6 +3797,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_BASEBAND_VERSION 51 @@ -3496,6 +3834,8 @@ typedef struct { * INVALID_CALL_ID * INVALID_STATE * OPERATION_NOT_ALLOWED + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SEPARATE_CONNECTION 52 @@ -3519,6 +3859,10 @@ typedef struct { * INVALID_ARGUMENTS * NO_MEMORY * REQUEST_RATE_LIMITED + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_MUTE 53 @@ -3540,6 +3884,10 @@ typedef struct { * SS_MODIFIED_TO_SS * NO_MEMORY * REQUEST_RATE_LIMITED + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_MUTE 54 @@ -3565,6 +3913,9 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * FDN_CHECK_FAILURE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_QUERY_CLIP 55 @@ -3592,6 +3943,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_LAST_CALL_FAIL_CAUSE * @@ -3614,6 +3970,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_UNSOL_DATA_CALL_LIST_CHANGED */ @@ -3719,6 +4080,8 @@ typedef struct { * INTERNAL_ERR * SYSTEM_ERR * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SCREEN_STATE 61 @@ -3747,6 +4110,9 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_UNSOL_SUPP_SVC_NOTIFICATION. */ @@ -3773,8 +4139,11 @@ typedef struct { * NO_MEMORY * NO_RESOURCES * INVALID_MODEM_STATE - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED * INVALID_SMSC_ADDRESS + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_WRITE_SMS_TO_SIM 63 @@ -3798,6 +4167,11 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * NO_SUCH_ENTRY + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_DELETE_SMS_ON_SIM 64 @@ -3822,6 +4196,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * See also: RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE */ @@ -3846,6 +4222,8 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * See also: RIL_REQUEST_SET_BAND_MODE */ @@ -3866,6 +4244,11 @@ typedef struct { * Valid errors: * RIL_E_SUCCESS * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STK_GET_PROFILE 67 @@ -3883,6 +4266,11 @@ typedef struct { * Valid errors: * RIL_E_SUCCESS * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STK_SET_PROFILE 68 @@ -3904,12 +4292,19 @@ typedef struct { * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) * SIM_BUSY * OPERATION_NOT_ALLOWED - */ -#define RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND 69 - -/** - * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE - * + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_ARGUMENTS + * MODEM_ERR + * REQUEST_NOT_SUPPORTED + */ +#define RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND 69 + +/** + * RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE + * * Requests to send a terminal response to SIM for a received * proactive command * @@ -3922,6 +4317,12 @@ typedef struct { * RIL_E_SUCCESS * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) * RIL_E_OPERATION_NOT_ALLOWED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE 70 @@ -3943,6 +4344,11 @@ typedef struct { * RIL_E_SUCCESS * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) * RIL_E_OPERATION_NOT_ALLOWED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM 71 @@ -3967,6 +4373,9 @@ typedef struct { * INVALID_CALL_ID * INVALID_STATE * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_EXPLICIT_CALL_TRANSFER 72 @@ -3991,6 +4400,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE 73 @@ -4014,6 +4425,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * See also: RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE */ @@ -4036,6 +4449,8 @@ typedef struct { * MODEM_ERR * NO_NETWORK_FOUND * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_GET_NEIGHBORING_CELL_IDS 75 @@ -4064,6 +4479,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * * See also: RIL_REQUEST_SCREEN_STATE, RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED */ @@ -4085,6 +4502,11 @@ typedef struct { * RADIO_NOT_AVAILABLE * SIM_ABSENT * SUBSCRIPTION_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE */ @@ -4112,6 +4534,8 @@ typedef struct { * MODEM_ERR * REQUEST_NOT_SUPPORTED * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE 78 @@ -4138,6 +4562,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE 79 @@ -4160,11 +4586,14 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * INTERNAL_ERR - * NO_MEMOR + * NO_MEMORY * INVALID_ARGUMENTS * MODEM_ERR * INTERNAL_ERR - * NO_MEMORYY + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_TTY_MODE 80 @@ -4190,6 +4619,9 @@ typedef struct { * INTERNAL_ERR * NO_MEMORY * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_QUERY_TTY_MODE 81 @@ -4214,6 +4646,9 @@ typedef struct { * INTERNAL_ERR * NO_MEMORY * INVALID_CALL_ID + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE 82 @@ -4237,6 +4672,9 @@ typedef struct { * INTERNAL_ERR * NO_MEMORY * INVALID_ARGUMENTS + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE 83 @@ -4260,6 +4698,9 @@ typedef struct { * INTERNAL_ERR * INVALID_CALL_ID * INVALID_STATE + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_FLASH 84 @@ -4287,6 +4728,10 @@ typedef struct { * MODEM_ERR * INTERNAL_ERR * INVALID_CALL_ID + * NO_RESOURCES + * CANCELLED + * OPERATION_NOT_ALLOWED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_BURST_DTMF 85 @@ -4316,6 +4761,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY 86 @@ -4350,7 +4797,10 @@ typedef struct { * NETWORK_ERR * ENCODING_ERR * INVALID_SMSC_ADDRESS - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_SEND_SMS 87 @@ -4376,9 +4826,10 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * INVALID_STATE - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED * NETWORK_NOT_READY * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE 88 @@ -4403,7 +4854,11 @@ typedef struct { * NO_RESOURCES * MODEM_ERR * SYSTEM_ERR - * + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG 89 @@ -4427,6 +4882,11 @@ typedef struct { * REQUEST_RATE_LIMITED * MODEM_ERR * SYSTEM_ERR + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG 90 @@ -4451,7 +4911,12 @@ typedef struct { * NO_MEMORY * SYSTEM_ERR * REQUEST_RATE_LIMITED - * MODEM_ERR +* MODEM_ERR +* INTERNAL_ERR +* NO_RESOURCES +* CANCELLED +* INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION 91 @@ -4476,6 +4941,11 @@ typedef struct { * NO_RESOURCES * MODEM_ERR * SYSTEM_ERR + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG 92 @@ -4500,6 +4970,11 @@ typedef struct { * REQUEST_RATE_LIMITED * MODEM_ERR * SYSTEM_ERR + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG 93 @@ -4525,6 +5000,11 @@ typedef struct { * SYSTEM_ERR * REQUEST_RATE_LIMITED * MODEM_ERR + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION 94 @@ -4560,6 +5040,9 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED * */ @@ -4587,8 +5070,11 @@ typedef struct { * NO_MEMORY * NO_RESOURCES * INVALID_MODEM_STATE - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED * INVALID_SMSC_ADDRESS + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM 96 @@ -4612,6 +5098,11 @@ typedef struct { * SYSTEM_ERR * MODEM_ERR * NO_SUCH_ENTRY + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM 97 @@ -4647,6 +5138,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_DEVICE_IDENTITY 98 @@ -4672,6 +5165,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE 99 @@ -4696,6 +5191,9 @@ typedef struct { * INVALID_ARGUMENTS * INVALID_MODEM_STATE * NOT_PROVISIONED + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_GET_SMSC_ADDRESS 100 @@ -4719,6 +5217,9 @@ typedef struct { * REQUEST_RATE_LIMITED * MODEM_ERR * NO_RESOURCES + * INTERNAL_ERR + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_SET_SMSC_ADDRESS 101 @@ -4743,6 +5244,10 @@ typedef struct { * SYSTEM_ERR * REQUEST_RATE_LIMITED * MODEM_ERR + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_REPORT_SMS_MEMORY_STATUS 102 @@ -4759,6 +5264,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING 103 @@ -4778,6 +5288,11 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * SUBSCRIPTION_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * * See also: RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE */ @@ -4795,6 +5310,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ISIM_AUTHENTICATION 105 @@ -4815,6 +5335,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU 106 @@ -4842,6 +5367,11 @@ typedef struct { * RIL_E_RADIO_NOT_AVAILABLE (radio resetting) * SIM_BUSY * OPERATION_NOT_ALLOWED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS 107 @@ -4858,6 +5388,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_VOICE_RADIO_TECH 108 @@ -4882,6 +5417,8 @@ typedef struct { * MODEM_ERR * NO_NETWORK_FOUND * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_GET_CELL_INFO_LIST 109 @@ -4907,6 +5444,8 @@ typedef struct { * SYSTEM_ERR * INVALID_ARGUMENTS * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE 110 @@ -4941,6 +5480,8 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_SET_INITIAL_ATTACH_APN 111 @@ -4968,6 +5509,12 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_IMS_REGISTRATION_STATE 112 @@ -5000,7 +5547,11 @@ typedef struct { * NETWORK_ERR * ENCODING_ERR * INVALID_SMSC_ADDRESS - * MODE_NOT_SUPPORTED + * OPERATION_NOT_ALLOWED + * INTERNAL_ERR + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED * */ #define RIL_REQUEST_IMS_SEND_SMS 113 @@ -5021,6 +5572,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC 114 @@ -5043,6 +5599,14 @@ typedef struct { * RADIO_NOT_AVAILABLE * MISSING_RESOURCE * NO_SUCH_ELEMENT + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * SIM_ERR + * INVALID_SIM_STATE + * MISSING_RESOURCE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_OPEN_CHANNEL 115 @@ -5060,6 +5624,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_CLOSE_CHANNEL 116 @@ -5078,6 +5647,11 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL 117 @@ -5094,6 +5668,7 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_NV_READ_ITEM 118 @@ -5110,6 +5685,7 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_NV_WRITE_ITEM 119 @@ -5126,6 +5702,7 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_NV_WRITE_CDMA_PRL 120 @@ -5145,6 +5722,7 @@ typedef struct { * Valid errors: * SUCCESS * RADIO_NOT_AVAILABLE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_NV_RESET_CONFIG 121 @@ -5167,6 +5745,8 @@ typedef struct { * INVALID_ARGUMENTS * MODEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_SET_UICC_SUBSCRIPTION 122 @@ -5195,6 +5775,8 @@ typedef struct { * DEVICE_IN_USE * INVALID_MODEM_STATE * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED * */ #define RIL_REQUEST_ALLOW_DATA 123 @@ -5208,6 +5790,10 @@ typedef struct { * "data" is NULL * * "response" is an array of RIL_HardwareConfig. + * + * Valid errors: + * RADIO_NOT_AVAILABLE + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_GET_HARDWARE_CONFIG 124 @@ -5229,6 +5815,17 @@ typedef struct { * int sw1; Status bytes per 3GPP TS 31.102 section 7.3 * int sw2; * char *simResponse; Response in Base64 format, see 3GPP TS 31.102 7.1.2 + * + * Valid errors: + * RADIO_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * INVALID_MODEM_STATE + * INVALID_ARGUMENTS + * SIM_ERR + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SIM_AUTHENTICATION 125 @@ -5246,6 +5843,10 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED * * See also: RIL_UNSOL_DC_RT_INFO_CHANGED */ @@ -5282,6 +5883,11 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE (radio resetting) * SUBSCRIPTION_NOT_AVAILABLE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_SET_DATA_PROFILE 128 @@ -5302,6 +5908,8 @@ typedef struct { * INTERNAL_ERR * SYSTEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SHUTDOWN 129 @@ -5318,6 +5926,10 @@ typedef struct { * OPERATION_NOT_ALLOWED * INVALID_STATE * REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_GET_RADIO_CAPABILITY 130 @@ -5344,6 +5956,8 @@ typedef struct { * MODEM_ERR * INVALID_STATE * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_RADIO_CAPABILITY 131 @@ -5364,6 +5978,9 @@ typedef struct { * LCE_NOT_SUPPORTED * INTERNAL_ERR * REQUEST_NOT_SUPPORTED + * NO_MEMORY + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_START_LCE 132 @@ -5379,6 +5996,11 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * LCE_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_STOP_LCE 133 @@ -5393,6 +6015,11 @@ typedef struct { * SUCCESS * RADIO_NOT_AVAILABLE * LCE_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED */ #define RIL_REQUEST_PULL_LCEDATA 134 @@ -5418,6 +6045,7 @@ typedef struct { * MODEM_ERR * NOT_PROVISIONED * REQUEST_NOT_SUPPORTED + * NO_RESOURCES CANCELLED */ #define RIL_REQUEST_GET_ACTIVITY_INFO 135 @@ -5451,6 +6079,10 @@ typedef struct { * RIL_E_INVALID_ARGUMENTS * RIL_E_RADIO_NOT_AVAILABLE * RIL_E_REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_CARRIER_RESTRICTIONS 136 @@ -5469,6 +6101,10 @@ typedef struct { * RIL_E_SUCCESS * RIL_E_RADIO_NOT_AVAILABLE * RIL_E_REQUEST_NOT_SUPPORTED + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_GET_CARRIER_RESTRICTIONS 137 @@ -5493,6 +6129,8 @@ typedef struct { * SYSTEM_ERR * INVALID_ARGUMENTS * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SEND_DEVICE_STATE 138 @@ -5518,6 +6156,8 @@ typedef struct { * INTERNAL_ERR * SYSTEM_ERR * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_UNSOLICITED_RESPONSE_FILTER 139 @@ -5545,8 +6185,125 @@ typedef struct { * REQUEST_NOT_SUPPORTED * SIM_ABSENT * INVALID_ARGUMENTS + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED */ #define RIL_REQUEST_SET_SIM_CARD_POWER 140 + +/** + * RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION + * + * Provide Carrier specific information to the modem that will be used to + * encrypt the IMSI and IMPI. Sent by the framework during boot, carrier + * switch and everytime we receive a new certificate. + * + * "data" is the RIL_CarrierInfoForImsiEncryption * structure. + * + * "response" is NULL + * + * Valid errors: + * RIL_E_SUCCESS + * RIL_E_RADIO_NOT_AVAILABLE + * SIM_ABSENT + * RIL_E_REQUEST_NOT_SUPPORTED + * INVALID_ARGUMENTS + * MODEM_INTERNAL_FAILURE + * INTERNAL_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + */ +#define RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION 141 + +/** + * RIL_REQUEST_START_NETWORK_SCAN + * + * Starts a new network scan + * + * Request to start a network scan with specified radio access networks with frequency bands and/or + * channels. + * + * "data" is a const RIL_NetworkScanRequest *. + * "response" is NULL + * + * Valid errors: + * SUCCESS + * RADIO_NOT_AVAILABLE + * OPERATION_NOT_ALLOWED + * DEVICE_IN_USE + * INTERNAL_ERR + * NO_MEMORY + * MODEM_ERR + * INVALID_ARGUMENTS + * REQUEST_NOT_SUPPORTED + * NO_RESOURCES + * CANCELLED + * + */ +#define RIL_REQUEST_START_NETWORK_SCAN 142 + +/** + * RIL_REQUEST_STOP_NETWORK_SCAN + * + * Stops an ongoing network scan + * + * Request to stop the ongoing network scan. Since the modem can only perform one scan at a time, + * there is no parameter for this request. + * + * "data" is NULL + * "response" is NULL + * + * Valid errors: + * SUCCESS + * INTERNAL_ERR + * MODEM_ERR + * NO_MEMORY + * NO_RESOURCES + * CANCELLED + * REQUEST_NOT_SUPPORTED + * + */ +#define RIL_REQUEST_STOP_NETWORK_SCAN 143 + +/** + * RIL_REQUEST_START_KEEPALIVE + * + * Start a keepalive session + * + * Request that the modem begin sending keepalive packets on a particular + * data call, with a specified source, destination, and format. + * + * "data" is a const RIL_RequestKeepalive + * "response" is RIL_KeepaliveStatus with a valid "handle" + * + * Valid errors: + * SUCCESS + * NO_RESOURCES + * INVALID_ARGUMENTS + * + */ +#define RIL_REQUEST_START_KEEPALIVE 144 + +/** + * RIL_REQUEST_STOP_KEEPALIVE + * + * Stops an ongoing keepalive session + * + * Requests that a keepalive session with the given handle be stopped. + * there is no parameter for this request. + * + * "data" is an integer handle + * "response" is NULL + * + * Valid errors: + * SUCCESS + * INVALID_ARGUMENTS + * + */ +#define RIL_REQUEST_STOP_KEEPALIVE 145 + /***********************************************************************/ /** @@ -6201,6 +6958,36 @@ typedef struct { */ #define RIL_UNSOL_MODEM_RESTART 1047 +/** + * RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION + * + * Called when the modem needs Carrier specific information that will + * be used to encrypt IMSI and IMPI. + * + * "data" is NULL + * + */ +#define RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION 1048 + +/** + * RIL_UNSOL_NETWORK_SCAN_RESULT + * + * Returns incremental result for the network scan which is started by + * RIL_REQUEST_START_NETWORK_SCAN, sent to report results, status, or errors. + * + * "data" is NULL + * "response" is a const RIL_NetworkScanResult * + */ +#define RIL_UNSOL_NETWORK_SCAN_RESULT 1049 + +/** + * RIL_UNSOL_KEEPALIVE_STATUS + * + * "data" is NULL + * "response" is a const RIL_KeepaliveStatus * + */ +#define RIL_UNSOL_KEEPALIVE_STATUS 1050 + /***********************************************************************/ @@ -6361,6 +7148,35 @@ typedef struct { loosely defined in LTE Layer 3 spec 24.008 */ } RIL_PCO_Data; +typedef enum { + NATT_IPV4 = 0, /* Keepalive specified by RFC 3948 Sec. 2.3 using IPv4 */ + NATT_IPV6 = 1 /* Keepalive specified by RFC 3948 Sec. 2.3 using IPv6 */ +} RIL_KeepaliveType; + +#define MAX_INADDR_LEN 16 +typedef struct { + RIL_KeepaliveType type; /* Type of keepalive packet */ + char sourceAddress[MAX_INADDR_LEN]; /* Source address in network-byte order */ + int sourcePort; /* Source port if applicable, or 0x7FFFFFFF; + the maximum value is 65535 */ + char destinationAddress[MAX_INADDR_LEN]; /* Destination address in network-byte order */ + int destinationPort; /* Destination port if applicable or 0x7FFFFFFF; + the maximum value is 65535 */ + int maxKeepaliveIntervalMillis; /* Maximum milliseconds between two packets */ + int cid; /* Context ID, uniquely identifies this call */ +} RIL_KeepaliveRequest; + +typedef enum { + KEEPALIVE_ACTIVE, /* Keepalive session is active */ + KEEPALIVE_INACTIVE, /* Keepalive session is inactive */ + KEEPALIVE_PENDING /* Keepalive session status not available */ +} RIL_KeepaliveStatusCode; + +typedef struct { + uint32_t sessionHandle; + RIL_KeepaliveStatusCode code; +} RIL_KeepaliveStatus; + #ifdef RIL_SHLIB struct RIL_Env { /** diff --git a/libril/Android.mk b/libril/Android.mk index 3ba5bba..5264a81 100644 --- a/libril/Android.mk +++ b/libril/Android.mk @@ -19,6 +19,7 @@ LOCAL_SHARED_LIBRARIES := \ libhardware_legacy \ librilutils \ android.hardware.radio@1.0 \ + android.hardware.radio@1.1 \ android.hardware.radio.deprecated@1.0 \ libhidlbase \ libhidltransport \ @@ -27,7 +28,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \ libprotobuf-c-nano-enable_malloc \ -LOCAL_CFLAGS += -Wno-unused-parameter +LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter -Werror ifeq ($(SIM_COUNT), 2) LOCAL_CFLAGS += -DANDROID_MULTI_SIM -DDSDA_RILD1 diff --git a/libril/RilSapSocket.h b/libril/RilSapSocket.h index 1f6163e..8c8c4bc 100644 --- a/libril/RilSapSocket.h +++ b/libril/RilSapSocket.h @@ -36,22 +36,6 @@ */ class RilSapSocket : public RilSocket { /** - * Function pointer to the ril initialization funtion. - * - * @param Ril environment variable with place request and - * response handlers and timeout handler. - * - * @param Number of arguements for the initialization function. - * - * @param Arguements to the initialization function used to - * generate instance id of the ril daemon. - * - * @return Radio functions with handlers for onRequest, onStateRequest, - * supports, onCancel and getVersion. - */ - RIL_RadioFunctions *(*UimInit)(const struct RIL_Env *, int argc, char **argv); - - /** * Place holder for the radio functions returned by the initialization * function. Currenty only onRequest handler is being used. */ diff --git a/libril/ril.cpp b/libril/ril.cpp index 6366920..6d375ca 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -114,12 +114,8 @@ RIL_RadioFunctions s_callbacks = {0, NULL, NULL, NULL, NULL, NULL}; static int s_registerCalled = 0; static pthread_t s_tid_dispatch; -static pthread_t s_tid_reader; static int s_started = 0; -static int s_fdDebug = -1; -static int s_fdDebug_socket2 = -1; - static int s_fdWakeupRead; static int s_fdWakeupWrite; @@ -128,44 +124,30 @@ int s_wakelock_count = 0; static struct ril_event s_wakeupfd_event; static pthread_mutex_t s_pendingRequestsMutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_writeMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t s_wakeLockCountMutex = PTHREAD_MUTEX_INITIALIZER; static RequestInfo *s_pendingRequests = NULL; #if (SIM_COUNT >= 2) static pthread_mutex_t s_pendingRequestsMutex_socket2 = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_writeMutex_socket2 = PTHREAD_MUTEX_INITIALIZER; static RequestInfo *s_pendingRequests_socket2 = NULL; #endif #if (SIM_COUNT >= 3) static pthread_mutex_t s_pendingRequestsMutex_socket3 = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_writeMutex_socket3 = PTHREAD_MUTEX_INITIALIZER; static RequestInfo *s_pendingRequests_socket3 = NULL; #endif #if (SIM_COUNT >= 4) static pthread_mutex_t s_pendingRequestsMutex_socket4 = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t s_writeMutex_socket4 = PTHREAD_MUTEX_INITIALIZER; static RequestInfo *s_pendingRequests_socket4 = NULL; #endif -static struct ril_event s_wake_timeout_event; -static struct ril_event s_debug_event; - - static const struct timeval TIMEVAL_WAKE_TIMEOUT = {ANDROID_WAKE_LOCK_SECS,ANDROID_WAKE_LOCK_USECS}; static pthread_mutex_t s_startupMutex = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t s_startupCond = PTHREAD_COND_INITIALIZER; -static pthread_mutex_t s_dispatchMutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t s_dispatchCond = PTHREAD_COND_INITIALIZER; - -static RequestInfo *s_toDispatchHead = NULL; -static RequestInfo *s_toDispatchTail = NULL; - static UserCallbackInfo *s_last_wake_timeout_info = NULL; static void *s_lastNITZTimeData = NULL; @@ -435,9 +417,6 @@ extern "C" void RIL_setcallbacks (const RIL_RadioFunctions *callbacks) { extern "C" void RIL_register (const RIL_RadioFunctions *callbacks) { - int ret; - int flags; - RLOGI("SIM_COUNT: %d", SIM_COUNT); if (callbacks == NULL) { @@ -573,9 +552,7 @@ checkAndDequeueRequestInfoIfAck(struct RequestInfo *pRI, bool isAck) { extern "C" void RIL_onRequestAck(RIL_Token t) { RequestInfo *pRI; - int ret; - size_t errorOffset; RIL_SOCKET_ID socket_id = RIL_SOCKET_1; pRI = (RequestInfo *)t; @@ -609,7 +586,6 @@ extern "C" void RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen) { RequestInfo *pRI; int ret; - size_t errorOffset; RIL_SOCKET_ID socket_id = RIL_SOCKET_1; pRI = (RequestInfo *)t; @@ -827,7 +803,7 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, } #if VDBG - RLOGI("%s UNSOLICITED: %s length:%d", rilSocketIdToString(soc_id), + RLOGI("%s UNSOLICITED: %s length:%zu", rilSocketIdToString(soc_id), requestToString(unsolResponse), datalen); #endif @@ -955,7 +931,7 @@ failCauseToString(RIL_Errno e) { case RIL_E_SIM_FULL: return "E_SIM_FULL"; case RIL_E_NETWORK_REJECT: return "E_NETWORK_REJECT"; case RIL_E_OPERATION_NOT_ALLOWED: return "E_OPERATION_NOT_ALLOWED"; - case RIL_E_EMPTY_RECORD: "E_EMPTY_RECORD"; + case RIL_E_EMPTY_RECORD: return "E_EMPTY_RECORD"; case RIL_E_INVALID_SMS_FORMAT: return "E_INVALID_SMS_FORMAT"; case RIL_E_ENCODING_ERR: return "E_ENCODING_ERR"; case RIL_E_INVALID_SMSC_ADDRESS: return "E_INVALID_SMSC_ADDRESS"; @@ -1170,6 +1146,7 @@ requestToString(int request) { case RIL_REQUEST_GET_ACTIVITY_INFO: return "GET_ACTIVITY_INFO"; case RIL_REQUEST_SET_CARRIER_RESTRICTIONS: return "SET_CARRIER_RESTRICTIONS"; case RIL_REQUEST_GET_CARRIER_RESTRICTIONS: return "GET_CARRIER_RESTRICTIONS"; + case RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION: return "SET_CARRIER_INFO_IMSI_ENCRYPTION"; case RIL_RESPONSE_ACKNOWLEDGEMENT: return "RESPONSE_ACKNOWLEDGEMENT"; case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED"; case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED"; @@ -1215,6 +1192,7 @@ requestToString(int request) { case RIL_UNSOL_DC_RT_INFO_CHANGED: return "UNSOL_DC_RT_INFO_CHANGED"; case RIL_UNSOL_RADIO_CAPABILITY: return "UNSOL_RADIO_CAPABILITY"; case RIL_UNSOL_MODEM_RESTART: return "UNSOL_MODEM_RESTART"; + case RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION: return "UNSOL_CARRIER_INFO_IMSI_ENCRYPTION"; case RIL_UNSOL_ON_SS: return "UNSOL_ON_SS"; case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: return "UNSOL_STK_CC_ALPHA_NOTIFY"; case RIL_UNSOL_LCEDATA_RECV: return "UNSOL_LCEDATA_RECV"; @@ -1246,4 +1224,4 @@ rilSocketIdToString(RIL_SOCKET_ID socket_id) } } -} /* namespace android */ \ No newline at end of file +} /* namespace android */ diff --git a/libril/ril_commands.h b/libril/ril_commands.h index c9ec0cc..94c2a26 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -155,3 +155,8 @@ {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}, diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp index e2fb254..d661acf 100644 --- a/libril/ril_service.cpp +++ b/libril/ril_service.cpp @@ -16,7 +16,11 @@ #define LOG_TAG "RILC" -#include +#include +#include +#include +#include + #include #include @@ -28,9 +32,7 @@ #define INVALID_HEX_CHAR 16 -// Enable verbose logging -#define VDBG 0 - +using namespace android::hardware::radio; using namespace android::hardware::radio::V1_0; using namespace android::hardware::radio::deprecated::V1_0; using ::android::hardware::configureRpcThreadpool; @@ -108,10 +110,12 @@ void convertRilDataCallListToHal(void *response, size_t responseLen, void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec& records); -struct RadioImpl : public IRadio { +struct RadioImpl : public V1_1::IRadio { int32_t mSlotId; sp mRadioResponse; sp mRadioIndication; + sp mRadioResponseV1_1; + sp mRadioIndicationV1_1; Return setResponseFunctions( const ::android::sp& radioResponse, @@ -242,6 +246,10 @@ struct RadioImpl : public IRadio { Return getAvailableNetworks(int32_t serial); + Return startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request); + + Return stopNetworkScan(int32_t serial); + Return startDtmf(int32_t serial, const ::android::hardware::hidl_string& s); @@ -430,10 +438,19 @@ struct RadioImpl : public IRadio { Return setIndicationFilter(int32_t serial, int32_t indicationFilter); + Return startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive); + + Return stopKeepalive(int32_t serial, int32_t sessionHandle); + Return setSimCardPower(int32_t serial, bool powerUp); + Return setSimCardPower_1_1(int32_t serial, + const V1_1::CardPowerState state); Return responseAcknowledgement(); + Return setCarrierInfoForImsiEncryption(int32_t serial, + const V1_1::ImsiEncryptionInfo& message); + void checkReturnStatus(Return& ret); }; @@ -460,8 +477,8 @@ void memsetAndFreeStrings(int numPointers, ...) { char *ptr = va_arg(ap, char *); if (ptr) { #ifdef MEMSET_FREED - // TODO: Should pass in the maximum length of the string - memsetString(ptr); +#define MAX_STRING_LENGTH 4096 + memset(ptr, 0, strnlen(ptr, MAX_STRING_LENGTH)); #endif free(ptr); } @@ -732,6 +749,8 @@ void checkReturnStatus(int32_t slotId, Return& ret, bool isRadioService) { if (isRadioService) { radioService[slotId]->mRadioResponse = NULL; radioService[slotId]->mRadioIndication = NULL; + radioService[slotId]->mRadioResponseV1_1 = NULL; + radioService[slotId]->mRadioIndicationV1_1 = NULL; } else { oemHookService[slotId]->mOemHookResponse = NULL; oemHookService[slotId]->mOemHookIndication = NULL; @@ -767,6 +786,13 @@ Return RadioImpl::setResponseFunctions( mRadioResponse = radioResponseParam; mRadioIndication = radioIndicationParam; + mRadioResponseV1_1 = V1_1::IRadioResponse::castFrom(mRadioResponse).withDefault(nullptr); + mRadioIndicationV1_1 = V1_1::IRadioIndication::castFrom(mRadioIndication).withDefault(nullptr); + if (mRadioResponseV1_1 == nullptr || mRadioIndicationV1_1 == nullptr) { + mRadioResponseV1_1 = nullptr; + mRadioIndicationV1_1 = nullptr; + } + mCounterRadio[mSlotId]++; ret = pthread_rwlock_unlock(radioServiceRwlockPtr); @@ -1315,6 +1341,80 @@ Return RadioImpl::getAvailableNetworks(int32_t serial) { return Void(); } +Return RadioImpl::startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) { +#if VDBG + RLOGD("startNetworkScan: serial %d", serial); +#endif + + RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_START_NETWORK_SCAN); + if (pRI == NULL) { + return Void(); + } + + if (request.specifiers.size() > MAX_RADIO_ACCESS_NETWORKS) { + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + + RIL_NetworkScanRequest scan_request = {}; + + scan_request.type = (RIL_ScanType) request.type; + scan_request.interval = request.interval; + scan_request.specifiers_length = request.specifiers.size(); + for (size_t i = 0; i < request.specifiers.size(); ++i) { + if (request.specifiers[i].geranBands.size() > MAX_BANDS || + request.specifiers[i].utranBands.size() > MAX_BANDS || + request.specifiers[i].eutranBands.size() > MAX_BANDS || + request.specifiers[i].channels.size() > MAX_CHANNELS) { + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + const V1_1::RadioAccessSpecifier& ras_from = + request.specifiers[i]; + RIL_RadioAccessSpecifier& ras_to = scan_request.specifiers[i]; + + ras_to.radio_access_network = (RIL_RadioAccessNetworks) ras_from.radioAccessNetwork; + ras_to.channels_length = ras_from.channels.size(); + + std::copy(ras_from.channels.begin(), ras_from.channels.end(), ras_to.channels); + const std::vector * bands = nullptr; + switch (request.specifiers[i].radioAccessNetwork) { + case V1_1::RadioAccessNetworks::GERAN: + ras_to.bands_length = ras_from.geranBands.size(); + bands = (std::vector *) &ras_from.geranBands; + break; + case V1_1::RadioAccessNetworks::UTRAN: + ras_to.bands_length = ras_from.utranBands.size(); + bands = (std::vector *) &ras_from.utranBands; + break; + case V1_1::RadioAccessNetworks::EUTRAN: + ras_to.bands_length = ras_from.eutranBands.size(); + bands = (std::vector *) &ras_from.eutranBands; + break; + default: + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + // safe to copy to geran_bands because it's a union member + for (size_t idx = 0; idx < ras_to.bands_length; ++idx) { + ras_to.bands.geran_bands[idx] = (RIL_GeranBands) (*bands)[idx]; + } + } + + CALL_ONREQUEST(RIL_REQUEST_START_NETWORK_SCAN, &scan_request, sizeof(scan_request), pRI, + mSlotId); + + return Void(); +} + +Return RadioImpl::stopNetworkScan(int32_t serial) { +#if VDBG + RLOGD("stopNetworkScan: serial %d", serial); +#endif + dispatchVoid(serial, mSlotId, RIL_REQUEST_STOP_NETWORK_SCAN); + return Void(); +} + Return RadioImpl::startDtmf(int32_t serial, const hidl_string& s) { #if VDBG RLOGD("startDtmf: serial %d", serial); @@ -1401,7 +1501,6 @@ Return RadioImpl::writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWri RIL_SMS_WriteArgs args; args.status = (int) smsWriteArgs.status; - int len; if (!copyHidlStringToRil(&args.pdu, smsWriteArgs.pdu, pRI)) { return Void(); } @@ -2033,7 +2132,7 @@ bool dispatchImsGsmSms(const ImsSmsMessage& message, RequestInfo *pRI) { if (!copyHidlStringToRil(&pStrings[0], message.gsmMessage[0].smscPdu, pRI)) { #ifdef MEMSET_FREED - memset(pStrings, 0, datalen); + memset(pStrings, 0, dataLen); #endif free(pStrings); return false; @@ -2042,7 +2141,7 @@ bool dispatchImsGsmSms(const ImsSmsMessage& message, RequestInfo *pRI) { if (!copyHidlStringToRil(&pStrings[1], message.gsmMessage[0].pdu, pRI)) { memsetAndFreeStrings(1, pStrings[0]); #ifdef MEMSET_FREED - memset(pStrings, 0, datalen); + memset(pStrings, 0, dataLen); #endif free(pStrings); return false; @@ -2057,16 +2156,20 @@ bool dispatchImsGsmSms(const ImsSmsMessage& message, RequestInfo *pRI) { } #ifdef MEMSET_FREED - memset(pStrings, 0, datalen); + memset(pStrings, 0, dataLen); #endif free(pStrings); return true; } +struct ImsCdmaSms { + RIL_IMS_SMS_Message imsSms; + RIL_CDMA_SMS_Message cdmaSms; +}; + bool dispatchImsCdmaSms(const ImsSmsMessage& message, RequestInfo *pRI) { - RIL_IMS_SMS_Message rism = {}; - RIL_CDMA_SMS_Message rcsm = {}; + ImsCdmaSms temp = {}; if (message.cdmaMessage.size() != 1) { RLOGE("dispatchImsCdmaSms: Invalid len %s", requestToString(pRI->pCI->requestNumber)); @@ -2074,15 +2177,20 @@ bool dispatchImsCdmaSms(const ImsSmsMessage& message, RequestInfo *pRI) { return false; } - rism.tech = RADIO_TECH_3GPP2; - rism.retry = BOOL_TO_INT(message.retry); - rism.messageRef = message.messageRef; - rism.message.cdmaMessage = &rcsm; + temp.imsSms.tech = RADIO_TECH_3GPP2; + temp.imsSms.retry = BOOL_TO_INT(message.retry); + temp.imsSms.messageRef = message.messageRef; + temp.imsSms.message.cdmaMessage = &temp.cdmaSms; - constructCdmaSms(rcsm, message.cdmaMessage[0]); + constructCdmaSms(temp.cdmaSms, message.cdmaMessage[0]); - CALL_ONREQUEST(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) + - sizeof(uint8_t) + sizeof(int32_t) + sizeof(rcsm), pRI, pRI->socket_id); + // Vendor code expects payload length to include actual msg payload + // (sizeof(RIL_CDMA_SMS_Message)) instead of (RIL_CDMA_SMS_Message *) + size of other fields in + // RIL_IMS_SMS_Message + int payloadLen = sizeof(RIL_RadioTechnologyFamily) + sizeof(uint8_t) + sizeof(int32_t) + + sizeof(RIL_CDMA_SMS_Message); + + CALL_ONREQUEST(pRI->pCI->requestNumber, &temp.imsSms, payloadLen, pRI, pRI->socket_id); return true; } @@ -2285,7 +2393,6 @@ Return RadioImpl::requestIccSimAuthentication(int32_t serial, int32_t auth pf.authContext = authContext; - int len; if (!copyHidlStringToRil(&pf.authData, authData, pRI)) { return Void(); } @@ -2452,7 +2559,6 @@ Return RadioImpl::setDataProfile(int32_t serial, const hidl_vec RadioImpl::setSimCardPower(int32_t serial, bool powerUp) { return Void(); } +Return RadioImpl::setSimCardPower_1_1(int32_t serial, const V1_1::CardPowerState state) { +#if VDBG + RLOGD("setSimCardPower_1_1: serial %d state %d", serial, state); +#endif + dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SIM_CARD_POWER, 1, state); + return Void(); +} + +Return RadioImpl::setCarrierInfoForImsiEncryption(int32_t serial, + const V1_1::ImsiEncryptionInfo& data) { +#if VDBG + RLOGD("setCarrierInfoForImsiEncryption: serial %d", serial); +#endif + RequestInfo *pRI = android::addRequestToList( + serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION); + if (pRI == NULL) { + return Void(); + } + + RIL_CarrierInfoForImsiEncryption imsiEncryption = {}; + + if (!copyHidlStringToRil(&imsiEncryption.mnc, data.mnc, pRI)) { + return Void(); + } + if (!copyHidlStringToRil(&imsiEncryption.mcc, data.mcc, pRI)) { + memsetAndFreeStrings(1, imsiEncryption.mnc); + return Void(); + } + if (!copyHidlStringToRil(&imsiEncryption.keyIdentifier, data.keyIdentifier, pRI)) { + memsetAndFreeStrings(2, imsiEncryption.mnc, imsiEncryption.mcc); + return Void(); + } + int32_t lSize = data.carrierKey.size(); + imsiEncryption.carrierKey = new uint8_t[lSize]; + memcpy(imsiEncryption.carrierKey, data.carrierKey.data(), lSize); + imsiEncryption.expirationTime = data.expirationTime; + CALL_ONREQUEST(pRI->pCI->requestNumber, &imsiEncryption, + sizeof(RIL_CarrierInfoForImsiEncryption), pRI, mSlotId); + delete(imsiEncryption.carrierKey); + return Void(); +} + +Return RadioImpl::startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) { +#if VDBG + RLOGD("%s(): %d", __FUNCTION__, serial); +#endif + RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_START_KEEPALIVE); + if (pRI == NULL) { + return Void(); + } + + RIL_KeepaliveRequest kaReq = {}; + + kaReq.type = static_cast(keepalive.type); + switch(kaReq.type) { + case NATT_IPV4: + if (keepalive.sourceAddress.size() != 4 || + keepalive.destinationAddress.size() != 4) { + RLOGE("Invalid address for keepalive!"); + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + break; + case NATT_IPV6: + if (keepalive.sourceAddress.size() != 16 || + keepalive.destinationAddress.size() != 16) { + RLOGE("Invalid address for keepalive!"); + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + break; + default: + RLOGE("Unknown packet keepalive type!"); + sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); + return Void(); + } + + ::memcpy(kaReq.sourceAddress, keepalive.sourceAddress.data(), keepalive.sourceAddress.size()); + kaReq.sourcePort = keepalive.sourcePort; + + ::memcpy(kaReq.destinationAddress, + keepalive.destinationAddress.data(), keepalive.destinationAddress.size()); + kaReq.destinationPort = keepalive.destinationPort; + + kaReq.maxKeepaliveIntervalMillis = keepalive.maxKeepaliveIntervalMillis; + kaReq.cid = keepalive.cid; // This is the context ID of the data call + + CALL_ONREQUEST(pRI->pCI->requestNumber, &kaReq, sizeof(RIL_KeepaliveRequest), pRI, mSlotId); + return Void(); +} + +Return RadioImpl::stopKeepalive(int32_t serial, int32_t sessionHandle) { +#if VDBG + RLOGD("%s(): %d", __FUNCTION__, serial); +#endif + RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_STOP_KEEPALIVE); + if (pRI == NULL) { + return Void(); + } + + CALL_ONREQUEST(pRI->pCI->requestNumber, &sessionHandle, sizeof(uint32_t), pRI, mSlotId); + return Void(); +} + Return RadioImpl::responseAcknowledgement() { android::releaseWakeLock(); return Void(); @@ -2797,11 +3007,14 @@ int radio::getIccCardStatusResponse(int slotId, RadioResponseInfo responseInfo = {}; populateResponseInfo(responseInfo, serial, responseType, e); CardStatus cardStatus = {}; - if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) { + RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response); + if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6) + || p_cur->gsm_umts_subscription_app_index >= p_cur->num_applications + || p_cur->cdma_subscription_app_index >= p_cur->num_applications + || p_cur->ims_subscription_app_index >= p_cur->num_applications) { RLOGE("getIccCardStatusResponse: Invalid response"); if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; } else { - RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response); cardStatus.cardState = (CardState) p_cur->card_state; cardStatus.universalPinState = (PinState) p_cur->universal_pin_state; cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index; @@ -3475,9 +3688,10 @@ void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity, case RIL_CELL_INFO_TYPE_CDMA:{ rilCellIdentity.cellIdentityCdma.basestationId = convertResponseStringEntryToInt(response, 4, numStrings); - rilCellIdentity.cellIdentityCdma.longitude = - convertResponseStringEntryToInt(response, 5, numStrings); + /* Order of Lat. and Long. swapped between RIL and HIDL interface versions. */ rilCellIdentity.cellIdentityCdma.latitude = + convertResponseStringEntryToInt(response, 5, numStrings); + rilCellIdentity.cellIdentityCdma.longitude = convertResponseStringEntryToInt(response, 6, numStrings); rilCellIdentity.cellIdentityCdma.systemId = convertResponseStringEntryToInt(response, 8, numStrings); @@ -4243,7 +4457,6 @@ int radio::getNetworkSelectionModeResponse(int slotId, RadioResponseInfo responseInfo = {}; populateResponseInfo(responseInfo, serial, responseType, e); bool manual = false; - int serviceClass; if (response == NULL || responseLen != sizeof(int)) { RLOGE("getNetworkSelectionModeResponse Invalid response: NULL"); if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; @@ -4478,7 +4691,6 @@ int radio::getMuteResponse(int slotId, RadioResponseInfo responseInfo = {}; populateResponseInfo(responseInfo, serial, responseType, e); bool enable = false; - int serviceClass; if (response == NULL || responseLen != sizeof(int)) { RLOGE("getMuteResponse Invalid response: NULL"); if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; @@ -6343,6 +6555,23 @@ int radio::sendDeviceStateResponse(int slotId, return 0; } +int radio::setCarrierInfoForImsiEncryptionResponse(int slotId, + int responseType, int serial, RIL_Errno e, + void *response, size_t responseLen) { + RLOGD("setCarrierInfoForImsiEncryptionResponse: serial %d", serial); + if (radioService[slotId]->mRadioResponseV1_1 != NULL) { + RadioResponseInfo responseInfo = {}; + populateResponseInfo(responseInfo, serial, responseType, e); + Return retStatus = radioService[slotId]->mRadioResponseV1_1-> + setCarrierInfoForImsiEncryptionResponse(responseInfo); + radioService[slotId]->checkReturnStatus(retStatus); + } else { + RLOGE("setCarrierInfoForImsiEncryptionResponse: radioService[%d]->mRadioResponseV1_1 == " + "NULL", slotId); + } + return 0; +} + int radio::setIndicationFilterResponse(int slotId, int responseType, int serial, RIL_Errno e, void *response, size_t responselen) { @@ -6364,7 +6593,6 @@ int radio::setIndicationFilterResponse(int slotId, return 0; } - int radio::setSimCardPowerResponse(int slotId, int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { @@ -6372,19 +6600,120 @@ int radio::setSimCardPowerResponse(int slotId, RLOGD("setSimCardPowerResponse: serial %d", serial); #endif - if (radioService[slotId]->mRadioResponse != NULL) { + if (radioService[slotId]->mRadioResponse != NULL + || radioService[slotId]->mRadioResponseV1_1 != NULL) { + RadioResponseInfo responseInfo = {}; + populateResponseInfo(responseInfo, serial, responseType, e); + if (radioService[slotId]->mRadioResponseV1_1 != NULL) { + Return retStatus = radioService[slotId]->mRadioResponseV1_1-> + setSimCardPowerResponse_1_1(responseInfo); + radioService[slotId]->checkReturnStatus(retStatus); + } else { + RLOGD("setSimCardPowerResponse: radioService[%d]->mRadioResponseV1_1 == NULL", + slotId); + Return retStatus + = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo); + radioService[slotId]->checkReturnStatus(retStatus); + } + } else { + RLOGE("setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL && " + "radioService[%d]->mRadioResponseV1_1 == NULL", slotId, slotId); + } + return 0; +} + +int radio::startNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e, + void *response, size_t responseLen) { +#if VDBG + RLOGD("startNetworkScanResponse: serial %d", serial); +#endif + + if (radioService[slotId]->mRadioResponseV1_1 != NULL) { RadioResponseInfo responseInfo = {}; populateResponseInfo(responseInfo, serial, responseType, e); Return retStatus - = radioService[slotId]->mRadioResponse->setSimCardPowerResponse(responseInfo); + = radioService[slotId]->mRadioResponseV1_1->startNetworkScanResponse(responseInfo); radioService[slotId]->checkReturnStatus(retStatus); } else { - RLOGE("setSimCardPowerResponse: radioService[%d]->mRadioResponse == NULL", slotId); + RLOGE("startNetworkScanResponse: radioService[%d]->mRadioResponseV1_1 == NULL", slotId); } return 0; } +int radio::stopNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e, + void *response, size_t responseLen) { +#if VDBG + RLOGD("stopNetworkScanResponse: serial %d", serial); +#endif + + if (radioService[slotId]->mRadioResponseV1_1 != NULL) { + RadioResponseInfo responseInfo = {}; + populateResponseInfo(responseInfo, serial, responseType, e); + Return retStatus + = radioService[slotId]->mRadioResponseV1_1->stopNetworkScanResponse(responseInfo); + radioService[slotId]->checkReturnStatus(retStatus); + } else { + RLOGE("stopNetworkScanResponse: radioService[%d]->mRadioResponseV1_1 == NULL", slotId); + } + + return 0; +} + +void convertRilKeepaliveStatusToHal(const RIL_KeepaliveStatus *rilStatus, + V1_1::KeepaliveStatus& halStatus) { + halStatus.sessionHandle = rilStatus->sessionHandle; + halStatus.code = static_cast(rilStatus->code); +} + +int radio::startKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e, + void *response, size_t responseLen) { +#if VDBG + RLOGD("%s(): %d", __FUNCTION__, serial); +#endif + RadioResponseInfo responseInfo = {}; + populateResponseInfo(responseInfo, serial, responseType, e); + + // If we don't have a radio service, there's nothing we can do + if (radioService[slotId]->mRadioResponseV1_1 == NULL) { + RLOGE("%s: radioService[%d]->mRadioResponseV1_1 == NULL", __FUNCTION__, slotId); + return 0; + } + + V1_1::KeepaliveStatus ks = {}; + if (response == NULL || responseLen != sizeof(V1_1::KeepaliveStatus)) { + RLOGE("%s: invalid response - %d", __FUNCTION__, static_cast(e)); + if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE; + } else { + convertRilKeepaliveStatusToHal(static_cast(response), ks); + } + + Return retStatus = + radioService[slotId]->mRadioResponseV1_1->startKeepaliveResponse(responseInfo, ks); + radioService[slotId]->checkReturnStatus(retStatus); + return 0; +} + +int radio::stopKeepaliveResponse(int slotId, int responseType, int serial, RIL_Errno e, + void *response, size_t responseLen) { +#if VDBG + RLOGD("%s(): %d", __FUNCTION__, serial); +#endif + RadioResponseInfo responseInfo = {}; + populateResponseInfo(responseInfo, serial, responseType, e); + + // If we don't have a radio service, there's nothing we can do + if (radioService[slotId]->mRadioResponseV1_1 == NULL) { + RLOGE("%s: radioService[%d]->mRadioResponseV1_1 == NULL", __FUNCTION__, slotId); + return 0; + } + + Return retStatus = + radioService[slotId]->mRadioResponseV1_1->stopKeepaliveResponse(responseInfo); + radioService[slotId]->checkReturnStatus(retStatus); + return 0; +} + int radio::sendRequestRawResponse(int slotId, int responseType, int serial, RIL_Errno e, void *response, size_t responseLen) { @@ -6449,7 +6778,11 @@ int radio::sendRequestStringsResponse(int slotId, return 0; } -// Radio Indication functions +/*************************************************************************************************** + * INDICATION FUNCTIONS + * The below function handle unsolicited messages coming from the Radio + * (messages for which there is no pending request) + **************************************************************************************************/ RadioIndicationType convertIntToRadioIndicationType(int indicationType) { return indicationType == RESPONSE_UNSOLICITED ? (RadioIndicationType::UNSOLICITED) : @@ -6932,7 +7265,7 @@ int radio::simRefreshInd(int slotId, int indicationType, SimRefreshResult refreshResult = {}; RIL_SimRefreshResponse_v7 *simRefreshResponse = ((RIL_SimRefreshResponse_v7 *) response); refreshResult.type = - (android::hardware::radio::V1_0::SimRefreshType) simRefreshResponse->result; + (V1_0::SimRefreshType) simRefreshResponse->result; refreshResult.efId = simRefreshResponse->ef_id; refreshResult.aid = convertCharPtrToHidlString(simRefreshResponse->aid); @@ -7017,18 +7350,18 @@ int radio::cdmaNewSmsInd(int slotId, int indicationType, msg.isServicePresent = rilMsg->bIsServicePresent; msg.serviceCategory = rilMsg->uServicecategory; msg.address.digitMode = - (android::hardware::radio::V1_0::CdmaSmsDigitMode) rilMsg->sAddress.digit_mode; + (V1_0::CdmaSmsDigitMode) rilMsg->sAddress.digit_mode; msg.address.numberMode = - (android::hardware::radio::V1_0::CdmaSmsNumberMode) rilMsg->sAddress.number_mode; + (V1_0::CdmaSmsNumberMode) rilMsg->sAddress.number_mode; msg.address.numberType = - (android::hardware::radio::V1_0::CdmaSmsNumberType) rilMsg->sAddress.number_type; + (V1_0::CdmaSmsNumberType) rilMsg->sAddress.number_type; msg.address.numberPlan = - (android::hardware::radio::V1_0::CdmaSmsNumberPlan) rilMsg->sAddress.number_plan; + (V1_0::CdmaSmsNumberPlan) rilMsg->sAddress.number_plan; int digitLimit = MIN((rilMsg->sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); msg.address.digits.setToExternal(rilMsg->sAddress.digits, digitLimit); - msg.subAddress.subaddressType = (android::hardware::radio::V1_0::CdmaSmsSubaddressType) + msg.subAddress.subaddressType = (V1_0::CdmaSmsSubaddressType) rilMsg->sSubAddress.subaddressType; msg.subAddress.odd = rilMsg->sSubAddress.odd; @@ -7805,10 +8138,10 @@ int radio::hardwareConfigChangedInd(int slotId, void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc) { RIL_RadioCapability *rilRadioCapability = (RIL_RadioCapability *) response; rc.session = rilRadioCapability->session; - rc.phase = (android::hardware::radio::V1_0::RadioCapabilityPhase) rilRadioCapability->phase; + rc.phase = (V1_0::RadioCapabilityPhase) rilRadioCapability->phase; rc.raf = rilRadioCapability->rat; rc.logicalModemUuid = convertCharPtrToHidlString(rilRadioCapability->logicalModemUuid); - rc.status = (android::hardware::radio::V1_0::RadioCapabilityStatus) rilRadioCapability->status; + rc.status = (V1_0::RadioCapabilityStatus) rilRadioCapability->status; } int radio::radioCapabilityIndicationInd(int slotId, @@ -8035,6 +8368,95 @@ int radio::modemResetInd(int slotId, return 0; } +int radio::networkScanResultInd(int slotId, + int indicationType, int token, RIL_Errno e, void *response, + size_t responseLen) { +#if VDBG + RLOGD("networkScanResultInd"); +#endif + if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndicationV1_1 != NULL) { + if (response == NULL || responseLen == 0) { + RLOGE("networkScanResultInd: invalid response"); + return 0; + } + RLOGD("networkScanResultInd"); + +#if VDBG + RLOGD("networkScanResultInd"); +#endif + + RIL_NetworkScanResult *networkScanResult = (RIL_NetworkScanResult *) response; + + V1_1::NetworkScanResult result; + result.status = (V1_1::ScanStatus) networkScanResult->status; + result.error = (RadioError) e; + convertRilCellInfoListToHal( + networkScanResult->network_infos, + networkScanResult->network_infos_length * sizeof(RIL_CellInfo_v12), + result.networkInfos); + + Return retStatus = radioService[slotId]->mRadioIndicationV1_1->networkScanResult( + convertIntToRadioIndicationType(indicationType), result); + radioService[slotId]->checkReturnStatus(retStatus); + } else { + RLOGE("networkScanResultInd: radioService[%d]->mRadioIndicationV1_1 == NULL", slotId); + } + return 0; +} + +int radio::carrierInfoForImsiEncryption(int slotId, + int indicationType, int token, RIL_Errno e, void *response, + size_t responseLen) { + if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndicationV1_1 != NULL) { + if (response == NULL || responseLen == 0) { + RLOGE("carrierInfoForImsiEncryption: invalid response"); + return 0; + } + RLOGD("carrierInfoForImsiEncryption"); + Return retStatus = radioService[slotId]->mRadioIndicationV1_1-> + carrierInfoForImsiEncryption(convertIntToRadioIndicationType(indicationType)); + radioService[slotId]->checkReturnStatus(retStatus); + } else { + RLOGE("carrierInfoForImsiEncryption: radioService[%d]->mRadioIndicationV1_1 == NULL", + slotId); + } + + return 0; +} + +int radio::keepaliveStatusInd(int slotId, + int indicationType, int token, RIL_Errno e, void *response, + size_t responseLen) { +#if VDBG + RLOGD("%s(): token=%d", __FUNCTION__, token); +#endif + if (radioService[slotId] == NULL || radioService[slotId]->mRadioIndication == NULL) { + RLOGE("%s: radioService[%d]->mRadioIndication == NULL", __FUNCTION__, slotId); + return 0; + } + + auto ret = V1_1::IRadioIndication::castFrom( + radioService[slotId]->mRadioIndication); + if (!ret.isOk()) { + RLOGE("%s: ret.isOk() == false for radioService[%d]", __FUNCTION__, slotId); + return 0; + } + sp radioIndicationV1_1 = ret; + + if (response == NULL || responseLen != sizeof(V1_1::KeepaliveStatus)) { + RLOGE("%s: invalid response", __FUNCTION__); + return 0; + } + + V1_1::KeepaliveStatus ks; + convertRilKeepaliveStatusToHal(static_cast(response), ks); + + Return retStatus = radioIndicationV1_1->keepaliveStatus( + convertIntToRadioIndicationType(indicationType), ks); + radioService[slotId]->checkReturnStatus(retStatus); + return 0; +} + int radio::oemHookRawInd(int slotId, int indicationType, int token, RIL_Errno e, void *response, size_t responseLen) { @@ -8089,7 +8511,8 @@ void radio::registerService(RIL_RadioFunctions *callbacks, CommandInfo *commands radioService[i]->mSlotId = i; oemHookService[i] = new OemHookImpl; oemHookService[i]->mSlotId = i; - RLOGD("registerService: starting IRadio %s", serviceNames[i]); + RLOGD("registerService: starting android::hardware::radio::V1_1::IRadio %s", + serviceNames[i]); android::status_t status = radioService[i]->registerAsService(serviceNames[i]); status = oemHookService[i]->registerAsService(serviceNames[i]); diff --git a/libril/ril_service.h b/libril/ril_service.h index 441b587..2240e2a 100644 --- a/libril/ril_service.h +++ b/libril/ril_service.h @@ -199,6 +199,14 @@ 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); @@ -533,6 +541,14 @@ 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, @@ -701,6 +717,14 @@ 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); @@ -709,8 +733,16 @@ 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 \ No newline at end of file +#endif // RIL_SERVICE_H diff --git a/libril/ril_unsol_commands.h b/libril/ril_unsol_commands.h index 948eaeb..bd2cf70 100644 --- a/libril/ril_unsol_commands.h +++ b/libril/ril_unsol_commands.h @@ -62,3 +62,5 @@ {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}, diff --git a/libril/sap_service.cpp b/libril/sap_service.cpp index 7bed05a..b9c7e58 100644 --- a/libril/sap_service.cpp +++ b/libril/sap_service.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "RIL_SAP" -#include +#include #include #include @@ -42,7 +42,7 @@ sp sapService[SIM_COUNT]; sp sapService[1]; #endif -struct SapImpl : public ISap { +struct SapImpl : public android::hardware::radio::V1_1::ISap { int32_t slotId; sp sapCallback; RIL_SOCKET_ID rilSocketId; @@ -532,7 +532,6 @@ Return SapImpl::setTransferProtocolReq(int32_t token, SapTransferProtocol void *sapDecodeMessage(MsgId msgId, MsgType msgType, uint8_t *payloadPtr, size_t payloadLen) { void *responsePtr = NULL; - bool decodeStatus = false; pb_istream_t stream; /* Create the stream */ diff --git a/librilutils/Android.mk b/librilutils/Android.mk index 455f9bc..275fea9 100644 --- a/librilutils/Android.mk +++ b/librilutils/Android.mk @@ -14,9 +14,12 @@ LOCAL_C_INCLUDES += \ LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(LOCAL_PATH)/../include +LOCAL_CFLAGS := -Wall -Wextra -Werror + LOCAL_PROTOC_OPTIMIZE_TYPE := nanopb-c-enable_malloc LOCAL_MODULE:= librilutils +LOCAL_VENDOR_MODULE:= true include $(BUILD_SHARED_LIBRARY) @@ -36,9 +39,12 @@ LOCAL_C_INCLUDES += \ LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(LOCAL_PATH)/../include +LOCAL_CFLAGS : -Wall -Wextra -Werror + LOCAL_PROTOC_OPTIMIZE_TYPE := nanopb-c-enable_malloc LOCAL_MODULE:= librilutils_static +LOCAL_VENDOR_MODULE:= true include $(BUILD_STATIC_LIBRARY) @@ -49,6 +55,7 @@ include $(CLEAR_VARS) src_proto := $(LOCAL_PATH) LOCAL_MODULE := sap-api-java-static LOCAL_SRC_FILES := proto/sap-api.proto +LOCAL_CFLAGS := -Wall -Wextra -Werror LOCAL_PROTOC_OPTIMIZE_TYPE := micro include $(BUILD_STATIC_JAVA_LIBRARY) diff --git a/reference-ril/Android.mk b/reference-ril/Android.mk index d9908c1..6afdbd3 100644 --- a/reference-ril/Android.mk +++ b/reference-ril/Android.mk @@ -14,8 +14,11 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ liblog libcutils libutils libril librilutils +LOCAL_STATIC_LIBRARIES := libqemu_pipe libbase + # for asprinf LOCAL_CFLAGS := -D_GNU_SOURCE +LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-variable -Wno-unused-function -Werror LOCAL_C_INCLUDES := @@ -31,6 +34,8 @@ ifeq ($(TARGET_DEVICE),dream) LOCAL_CFLAGS += -DPOLL_CALL_STATE -DUSE_QMI endif +LOCAL_VENDOR_MODULE:= true + ifeq (foo,foo) #build shared library LOCAL_SHARED_LIBRARIES += \ diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index 9b9c624..f451fb0 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include "ril.h" @@ -606,8 +606,7 @@ static void requestOrSendDataCallList(RIL_Token *t) } responses[i].dnses = dnslist; - /* There is only on gateway in the emulator */ - responses[i].gateways = "10.0.2.2"; + responses[i].gateways = "10.0.2.2 fe80::2"; responses[i].mtu = DEFAULT_MTU; } else { @@ -803,9 +802,11 @@ static void requestGetCurrentCalls(void *data __unused, size_t datalen __unused, } return; +#ifdef WORKAROUND_ERRONEOUS_ANSWER error: RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); at_response_free(p_response); +#endif } static void requestDial(void *data, size_t datalen __unused, RIL_Token t) @@ -888,9 +889,13 @@ static void requestSignalStrength(void *data __unused, size_t datalen __unused, ATResponse *p_response = NULL; int err; char *line; - int count =0; - int numofElements=sizeof(RIL_SignalStrength_v6)/sizeof(int); - int response[numofElements]; + int count = 0; + // Accept a response that is at least v6, and up to v10 + int minNumOfElements=sizeof(RIL_SignalStrength_v6)/sizeof(int); + int maxNumOfElements=sizeof(RIL_SignalStrength_v10)/sizeof(int); + int response[maxNumOfElements]; + + memset(response, 0, sizeof(response)); err = at_send_command_singleline("AT+CSQ", "+CSQ:", &p_response); @@ -904,9 +909,9 @@ static void requestSignalStrength(void *data __unused, size_t datalen __unused, err = at_tok_start(&line); if (err < 0) goto error; - for (count =0; count < numofElements; count ++) { + for (count = 0; count < maxNumOfElements; count++) { err = at_tok_nextint(&line, &(response[count])); - if (err < 0) goto error; + if (err < 0 && count < minNumOfElements) goto error; } RIL_onRequestComplete(t, RIL_E_SUCCESS, response, sizeof(response)); @@ -1075,12 +1080,6 @@ static void requestCdmaDeviceIdentity(int request __unused, void *data __unused, RIL_onRequestComplete(t, RIL_E_SUCCESS, responseStr, count*sizeof(char*)); at_response_free(p_response); - - return; -error: - RLOGE("requestCdmaDeviceIdentity must never return an error when radio is on"); - at_response_free(p_response); - RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); } static void requestCdmaGetSubscriptionSource(int request __unused, void *data, @@ -1169,11 +1168,6 @@ static void requestCdmaSubscription(int request __unused, void *data __unused, responseStr[3] = "8587777777"; // MIN responseStr[4] = "1"; // PRL Version RIL_onRequestComplete(t, RIL_E_SUCCESS, responseStr, count*sizeof(char*)); - - return; -error: - RLOGE("requestRegistrationState must never return an error when radio is on"); - RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0); } static void requestCdmaGetRoamingPreference(int request __unused, void *data __unused, diff --git a/rild/Android.mk b/rild/Android.mk index 4f5802b..7ac505c 100644 --- a/rild/Android.mk +++ b/rild/Android.mk @@ -17,6 +17,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \ librilutils_static LOCAL_CFLAGS := -DRIL_SHLIB +LOCAL_CFLAGS += -Wall -Wextra -Werror ifeq ($(SIM_COUNT), 2) LOCAL_CFLAGS += -DANDROID_MULTI_SIM