Merge "Add log tag for IRadio and ISap services."
diff --git a/include/telephony/ril.h b/include/telephony/ril.h
index c6f33e3..37e0bde 100644
--- a/include/telephony/ril.h
+++ b/include/telephony/ril.h
@@ -78,6 +78,10 @@
* RIL_REQUEST_SET_SIM_CARD_POWER
* The new parameters for RIL_REQUEST_SETUP_DATA_CALL,
* Updated data structures: RIL_DataProfileInfo_v15, RIL_InitialAttachApn_v15
+ * New data structure RIL_DataRegistrationStateResponse,
+ * RIL_VoiceRegistrationStateResponse same is
+ * used in RIL_REQUEST_DATA_REGISTRATION_STATE and
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE respectively.
*/
#define RIL_VERSION 12
#define LAST_IMPRECISE_RIL_VERSION 12 // Better self-documented name
@@ -995,6 +999,35 @@
RIL_APPTYPE_ISIM = 5
} RIL_AppType;
+/*
+ * Please note that registration state UNKNOWN is
+ * treated as "out of service" in the Android telephony.
+ * Registration state REG_DENIED must be returned if Location Update
+ * Reject (with cause 17 - Network Failure) is received
+ * repeatedly from the network, to facilitate
+ * "managed roaming"
+ */
+typedef enum {
+ RIL_NOT_REG_AND_NOT_SEARCHING = 0, // Not registered, MT is not currently searching
+ // a new operator to register
+ RIL_REG_HOME = 1, // Registered, home network
+ RIL_NOT_REG_AND_SEARCHING = 2, // Not registered, but MT is currently searching
+ // a new operator to register
+ RIL_REG_DENIED = 3, // Registration denied
+ RIL_UNKNOWN = 4, // Unknown
+ RIL_REG_ROAMING = 5, // Registered, roaming
+ RIL_NOT_REG_AND_EMERGENCY_AVAILABLE_AND_NOT_SEARCHING = 10, // Same as
+ // RIL_NOT_REG_AND_NOT_SEARCHING but indicates that
+ // emergency calls are enabled.
+ RIL_NOT_REG_AND_EMERGENCY_AVAILABLE_AND_SEARCHING = 12, // Same as RIL_NOT_REG_AND_SEARCHING
+ // but indicates that
+ // emergency calls are enabled.
+ RIL_REG_DENIED_AND_EMERGENCY_AVAILABLE = 13, // Same as REG_DENIED but indicates that
+ // emergency calls are enabled.
+ RIL_UNKNOWN_AND_EMERGENCY_AVAILABLE = 14, // Same as UNKNOWN but indicates that
+ // emergency calls are enabled.
+} RIL_RegState;
+
typedef struct
{
RIL_AppType app_type;
@@ -1369,6 +1402,7 @@
// Must be the same as CellInfo.TYPE_XXX
typedef enum {
+ RIL_CELL_INFO_TYPE_NONE = 0, /* indicates no cell information */
RIL_CELL_INFO_TYPE_GSM = 1,
RIL_CELL_INFO_TYPE_CDMA = 2,
RIL_CELL_INFO_TYPE_LTE = 3,
@@ -1413,6 +1447,100 @@
} CellInfo;
} RIL_CellInfo_v12;
+typedef struct {
+ RIL_CellInfoType cellInfoType; /* cell type for selecting from union CellInfo */
+ union {
+ RIL_CellIdentityGsm_v12 cellIdentityGsm;
+ RIL_CellIdentityWcdma_v12 cellIdentityWcdma;
+ RIL_CellIdentityLte_v12 cellIdentityLte;
+ RIL_CellIdentityTdscdma cellIdentityTdscdma;
+ RIL_CellIdentityCdma cellIdentityCdma;
+ };
+}RIL_CellIdentity_v16;
+
+typedef struct {
+ RIL_RegState regState; // Valid reg states are RIL_NOT_REG_AND_NOT_SEARCHING,
+ // REG_HOME, RIL_NOT_REG_AND_SEARCHING, REG_DENIED,
+ // UNKNOWN, REG_ROAMING defined in RegState
+ RIL_RadioTechnology rat; // indicates the available voice radio technology,
+ // valid values as defined by RadioTechnology.
+ int32_t cssSupported; // concurrent services support indicator. if
+ // registered on a CDMA system.
+ // 0 - Concurrent services not supported,
+ // 1 - Concurrent services supported
+ int32_t roamingIndicator; // TSB-58 Roaming Indicator if registered
+ // on a CDMA or EVDO system or -1 if not.
+ // Valid values are 0-255.
+ int32_t systemIsInPrl; // indicates whether the current system is in the
+ // PRL if registered on a CDMA or EVDO system or -1 if
+ // not. 0=not in the PRL, 1=in the PRL
+ int32_t defaultRoamingIndicator; // default Roaming Indicator from the PRL,
+ // if registered on a CDMA or EVDO system or -1 if not.
+ // Valid values are 0-255.
+ int32_t reasonForDenial; // reasonForDenial if registration state is 3
+ // (Registration denied) this is an enumerated reason why
+ // registration was denied. See 3GPP TS 24.008,
+ // 10.5.3.6 and Annex G.
+ // 0 - General
+ // 1 - Authentication Failure
+ // 2 - IMSI unknown in HLR
+ // 3 - Illegal MS
+ // 4 - Illegal ME
+ // 5 - PLMN not allowed
+ // 6 - Location area not allowed
+ // 7 - Roaming not allowed
+ // 8 - No Suitable Cells in this Location Area
+ // 9 - Network failure
+ // 10 - Persistent location update reject
+ // 11 - PLMN not allowed
+ // 12 - Location area not allowed
+ // 13 - Roaming not allowed in this Location Area
+ // 15 - No Suitable Cells in this Location Area
+ // 17 - Network Failure
+ // 20 - MAC Failure
+ // 21 - Sync Failure
+ // 22 - Congestion
+ // 23 - GSM Authentication unacceptable
+ // 25 - Not Authorized for this CSG
+ // 32 - Service option not supported
+ // 33 - Requested service option not subscribed
+ // 34 - Service option temporarily out of order
+ // 38 - Call cannot be identified
+ // 48-63 - Retry upon entry into a new cell
+ // 95 - Semantically incorrect message
+ // 96 - Invalid mandatory information
+ // 97 - Message type non-existent or not implemented
+ // 98 - Message type not compatible with protocol state
+ // 99 - Information element non-existent or
+ // not implemented
+ // 100 - Conditional IE error
+ // 101 - Message not compatible with protocol state;
+ RIL_CellIdentity_v16 cellIdentity; // current cell information
+}RIL_VoiceRegistrationStateResponse;
+
+
+typedef struct {
+ RIL_RegState regState; // Valid reg states are RIL_NOT_REG_AND_NOT_SEARCHING,
+ // REG_HOME, RIL_NOT_REG_AND_SEARCHING, REG_DENIED,
+ // UNKNOWN, REG_ROAMING defined in RegState
+ RIL_RadioTechnology rat; // indicates the available data radio technology,
+ // valid values as defined by RadioTechnology.
+ int32_t reasonDataDenied; // if registration state is 3 (Registration
+ // denied) this is an enumerated reason why
+ // registration was denied. See 3GPP TS 24.008,
+ // Annex G.6 "Additional cause codes for GMM".
+ // 7 == GPRS services not allowed
+ // 8 == GPRS services and non-GPRS services not allowed
+ // 9 == MS identity cannot be derived by the network
+ // 10 == Implicitly detached
+ // 14 == GPRS services not allowed in this PLMN
+ // 16 == MSC temporarily not reachable
+ // 40 == No PDP context activated
+ int32_t maxDataCalls; // The maximum number of simultaneous Data Calls that
+ // must be established using setupDataCall().
+ RIL_CellIdentity_v16 cellIdentity; // Current cell information
+}RIL_DataRegistrationStateResponse;
+
/* Names of the CDMA info records (C.S0005 section 3.7.5) */
typedef enum {
RIL_CDMA_DISPLAY_INFO_REC,
@@ -2317,119 +2445,7 @@
* Request current registration state
*
* "data" is NULL
- * "response" is a "char **"
- * ((const char **)response)[0] is registration state 0-6,
- * 0 - Not registered, MT is not currently searching
- * a new operator to register
- * 1 - Registered, home network
- * 2 - Not registered, but MT is currently searching
- * a new operator to register
- * 3 - Registration denied
- * 4 - Unknown
- * 5 - Registered, roaming
- * 10 - Same as 0, but indicates that emergency calls
- * are enabled.
- * 12 - Same as 2, but indicates that emergency calls
- * are enabled.
- * 13 - Same as 3, but indicates that emergency calls
- * are enabled.
- * 14 - Same as 4, but indicates that emergency calls
- * are enabled.
- *
- * ((const char **)response)[1] is LAC if registered on a GSM/WCDMA system or
- * NULL if not.Valid LAC are 0x0000 - 0xffff
- * ((const char **)response)[2] is CID if registered on a * GSM/WCDMA or
- * NULL if not.
- * Valid CID are 0x00000000 - 0xffffffff
- * In GSM, CID is Cell ID (see TS 27.007)
- * in 16 bits
- * In UMTS, CID is UMTS Cell Identity
- * (see TS 25.331) in 28 bits
- * ((const char **)response)[3] indicates the available voice radio technology,
- * valid values as defined by RIL_RadioTechnology.
- * ((const char **)response)[4] is Base Station ID if registered on a CDMA
- * system or NULL if not. Base Station ID in
- * decimal format
- * ((const char **)response)[5] is Base Station latitude if registered on a
- * CDMA system or NULL if not. Base Station
- * latitude is a decimal number as specified in
- * 3GPP2 C.S0005-A v6.0. It is represented in
- * units of 0.25 seconds and ranges from -1296000
- * to 1296000, both values inclusive (corresponding
- * to a range of -90 to +90 degrees).
- * ((const char **)response)[6] is Base Station longitude if registered on a
- * CDMA system or NULL if not. Base Station
- * longitude is a decimal number as specified in
- * 3GPP2 C.S0005-A v6.0. It is represented in
- * units of 0.25 seconds and ranges from -2592000
- * to 2592000, both values inclusive (corresponding
- * to a range of -180 to +180 degrees).
- * ((const char **)response)[7] is concurrent services support indicator if
- * registered on a CDMA system 0-1.
- * 0 - Concurrent services not supported,
- * 1 - Concurrent services supported
- * ((const char **)response)[8] is System ID if registered on a CDMA system or
- * NULL if not. Valid System ID are 0 - 32767
- * ((const char **)response)[9] is Network ID if registered on a CDMA system or
- * NULL if not. Valid System ID are 0 - 65535
- * ((const char **)response)[10] is the TSB-58 Roaming Indicator if registered
- * on a CDMA or EVDO system or NULL if not. Valid values
- * are 0-255.
- * ((const char **)response)[11] indicates whether the current system is in the
- * PRL if registered on a CDMA or EVDO system or NULL if
- * not. 0=not in the PRL, 1=in the PRL
- * ((const char **)response)[12] is the default Roaming Indicator from the PRL,
- * if registered on a CDMA or EVDO system or NULL if not.
- * Valid values are 0-255.
- * ((const char **)response)[13] if registration state is 3 (Registration
- * denied) this is an enumerated reason why
- * registration was denied. See 3GPP TS 24.008,
- * 10.5.3.6 and Annex G.
- * 0 - General
- * 1 - Authentication Failure
- * 2 - IMSI unknown in HLR
- * 3 - Illegal MS
- * 4 - Illegal ME
- * 5 - PLMN not allowed
- * 6 - Location area not allowed
- * 7 - Roaming not allowed
- * 8 - No Suitable Cells in this Location Area
- * 9 - Network failure
- * 10 - Persistent location update reject
- * 11 - PLMN not allowed
- * 12 - Location area not allowed
- * 13 - Roaming not allowed in this Location Area
- * 15 - No Suitable Cells in this Location Area
- * 17 - Network Failure
- * 20 - MAC Failure
- * 21 - Sync Failure
- * 22 - Congestion
- * 23 - GSM Authentication unacceptable
- * 25 - Not Authorized for this CSG
- * 32 - Service option not supported
- * 33 - Requested service option not subscribed
- * 34 - Service option temporarily out of order
- * 38 - Call cannot be identified
- * 48-63 - Retry upon entry into a new cell
- * 95 - Semantically incorrect message
- * 96 - Invalid mandatory information
- * 97 - Message type non-existent or not implemented
- * 98 - Message not compatible with protocol state
- * 99 - Information element non-existent or not implemented
- * 100 - Conditional IE error
- * 101 - Message not compatible with protocol state
- * 111 - Protocol error, unspecified
- * ((const char **)response)[14] is the Primary Scrambling Code of the current
- * cell as described in TS 25.331, in hexadecimal
- * format, or NULL if unknown or not registered
- * to a UMTS network.
- *
- * Please note that registration state 4 ("unknown") is treated
- * as "out of service" in the Android telephony system
- *
- * Registration state 3 can be returned if Location Update Reject
- * (with cause 17 - Network Failure) is received repeatedly from the network,
- * to facilitate "managed roaming"
+ * "response" is a const RIL_VoiceRegistrationStateResponse *
*
* Valid errors:
* SUCCESS
@@ -2444,41 +2460,7 @@
* Request current DATA registration state
*
* "data" is NULL
- * "response" is a "char **"
- * ((const char **)response)[0] is registration state 0-5 from TS 27.007 10.1.20 AT+CGREG
- * ((const char **)response)[1] is LAC if registered or NULL if not
- * ((const char **)response)[2] is CID if registered or NULL if not
- * ((const char **)response)[3] indicates the available data radio technology,
- * valid values as defined by RIL_RadioTechnology.
- * ((const char **)response)[4] if registration state is 3 (Registration
- * denied) this is an enumerated reason why
- * registration was denied. See 3GPP TS 24.008,
- * Annex G.6 "Additonal cause codes for GMM".
- * 7 == GPRS services not allowed
- * 8 == GPRS services and non-GPRS services not allowed
- * 9 == MS identity cannot be derived by the network
- * 10 == Implicitly detached
- * 14 == GPRS services not allowed in this PLMN
- * 16 == MSC temporarily not reachable
- * 40 == No PDP context activated
- * ((const char **)response)[5] The maximum number of simultaneous Data Calls that can be
- * established using RIL_REQUEST_SETUP_DATA_CALL.
- *
- * The values at offsets 6..10 are optional LTE location information in decimal.
- * If a value is unknown that value may be NULL. If all values are NULL,
- * none need to be present.
- * ((const char **)response)[6] is TAC, a 16-bit Tracking Area Code.
- * ((const char **)response)[7] is CID, a 0-503 Physical Cell Identifier.
- * ((const char **)response)[8] is ECI, a 28-bit E-UTRAN Cell Identifier.
- * ((const char **)response)[9] is CSGID, a 27-bit Closed Subscriber Group Identity.
- * ((const char **)response)[10] is TADV, a 6-bit timing advance value.
- *
- * LAC and CID are in hexadecimal format.
- * valid LAC are 0x0000 - 0xffff
- * valid CID are 0x00000000 - 0x0fffffff
- *
- * Please note that registration state 4 ("unknown") is treated
- * as "out of service" in the Android telephony system
+ * "response" is a const RIL_DataRegistrationStateResponse *
*
* Valid errors:
* SUCCESS
diff --git a/libril/ril.cpp b/libril/ril.cpp
index 1c3c9d2..0323740 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -234,10 +234,6 @@
RIL_Errno e, void *response, size_t responselen);
static int responseSMS(Parcel &p, int slotId, int requestNumber, int responseType, int token,
RIL_Errno e, void *response, size_t responselen);
-static int responseDataCallList(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen);
-static int responseSetupDataCall(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen);
static int responseRaw(Parcel &p, int slotId, int requestNumber, int responseType, int token,
RIL_Errno e, void *response, size_t responselen);
static int responseSsn(Parcel &p, int slotId, int requestNumber, int responseType, int token,
@@ -2394,241 +2390,6 @@
return 0;
}
-static int responseDataCallListV4(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_Data_Call_Response_v4) != 0) {
- RLOGE("responseDataCallListV4: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_Data_Call_Response_v4));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- // Write version
- p.writeInt32(4);
-
- int num = responselen / sizeof(RIL_Data_Call_Response_v4);
- p.writeInt32(num);
-
- RIL_Data_Call_Response_v4 *p_cur = (RIL_Data_Call_Response_v4 *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32(p_cur[i].cid);
- p.writeInt32(p_cur[i].active);
- writeStringToParcel(p, p_cur[i].type);
- // apn is not used, so don't send.
- writeStringToParcel(p, p_cur[i].address);
- appendPrintBuf("%s[cid=%d,%s,%s,%s],", printBuf,
- p_cur[i].cid,
- (p_cur[i].active==0)?"down":"up",
- (char*)p_cur[i].type,
- (char*)p_cur[i].address);
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-static int responseDataCallListV6(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_Data_Call_Response_v6) != 0) {
- RLOGE("responseDataCallListV6: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_Data_Call_Response_v6));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- // Write version
- p.writeInt32(6);
-
- int num = responselen / sizeof(RIL_Data_Call_Response_v6);
- p.writeInt32(num);
-
- RIL_Data_Call_Response_v6 *p_cur = (RIL_Data_Call_Response_v6 *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32((int)p_cur[i].status);
- p.writeInt32(p_cur[i].suggestedRetryTime);
- p.writeInt32(p_cur[i].cid);
- p.writeInt32(p_cur[i].active);
- writeStringToParcel(p, p_cur[i].type);
- writeStringToParcel(p, p_cur[i].ifname);
- writeStringToParcel(p, p_cur[i].addresses);
- writeStringToParcel(p, p_cur[i].dnses);
- writeStringToParcel(p, p_cur[i].gateways);
- appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s],", printBuf,
- p_cur[i].status,
- p_cur[i].suggestedRetryTime,
- p_cur[i].cid,
- (p_cur[i].active==0)?"down":"up",
- (char*)p_cur[i].type,
- (char*)p_cur[i].ifname,
- (char*)p_cur[i].addresses,
- (char*)p_cur[i].dnses,
- (char*)p_cur[i].gateways);
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-static int responseDataCallListV9(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) {
- RLOGE("responseDataCallListV9: invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_Data_Call_Response_v9));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- // Write version
- p.writeInt32(10);
-
- int num = responselen / sizeof(RIL_Data_Call_Response_v9);
- p.writeInt32(num);
-
- RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32((int)p_cur[i].status);
- p.writeInt32(p_cur[i].suggestedRetryTime);
- p.writeInt32(p_cur[i].cid);
- p.writeInt32(p_cur[i].active);
- writeStringToParcel(p, p_cur[i].type);
- writeStringToParcel(p, p_cur[i].ifname);
- writeStringToParcel(p, p_cur[i].addresses);
- writeStringToParcel(p, p_cur[i].dnses);
- writeStringToParcel(p, p_cur[i].gateways);
- writeStringToParcel(p, p_cur[i].pcscf);
- appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf,
- p_cur[i].status,
- p_cur[i].suggestedRetryTime,
- p_cur[i].cid,
- (p_cur[i].active==0)?"down":"up",
- (char*)p_cur[i].type,
- (char*)p_cur[i].ifname,
- (char*)p_cur[i].addresses,
- (char*)p_cur[i].dnses,
- (char*)p_cur[i].gateways,
- (char*)p_cur[i].pcscf);
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-static int responseDataCallListV11(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (response == NULL && responselen != 0) {
- RLOGE("invalid response: NULL");
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
- (int)responselen, (int)sizeof(RIL_Data_Call_Response_v11));
- return RIL_ERRNO_INVALID_RESPONSE;
- }
-
- // Write version
- p.writeInt32(11);
-
- int num = responselen / sizeof(RIL_Data_Call_Response_v11);
- p.writeInt32(num);
-
- RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response;
- startResponse;
- int i;
- for (i = 0; i < num; i++) {
- p.writeInt32((int)p_cur[i].status);
- p.writeInt32(p_cur[i].suggestedRetryTime);
- p.writeInt32(p_cur[i].cid);
- p.writeInt32(p_cur[i].active);
- writeStringToParcel(p, p_cur[i].type);
- writeStringToParcel(p, p_cur[i].ifname);
- writeStringToParcel(p, p_cur[i].addresses);
- writeStringToParcel(p, p_cur[i].dnses);
- writeStringToParcel(p, p_cur[i].gateways);
- writeStringToParcel(p, p_cur[i].pcscf);
- p.writeInt32(p_cur[i].mtu);
- appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],", printBuf,
- p_cur[i].status,
- p_cur[i].suggestedRetryTime,
- p_cur[i].cid,
- (p_cur[i].active==0)?"down":"up",
- (char*)p_cur[i].type,
- (char*)p_cur[i].ifname,
- (char*)p_cur[i].addresses,
- (char*)p_cur[i].dnses,
- (char*)p_cur[i].gateways,
- (char*)p_cur[i].pcscf,
- p_cur[i].mtu);
- }
- removeLastChar;
- closeResponse;
-
- return 0;
-}
-
-static int responseDataCallList(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (s_callbacks.version <= LAST_IMPRECISE_RIL_VERSION) {
- if (s_callbacks.version < 5) {
- RLOGD("responseDataCallList: v4");
- return responseDataCallListV4(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- } else if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) {
- return responseDataCallListV6(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- } else if (responselen % sizeof(RIL_Data_Call_Response_v9) == 0) {
- return responseDataCallListV9(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- } else {
- return responseDataCallListV11(p, slotId, requestNumber, responseType, token, e,
- response, responselen);
- }
- } else { // RIL version >= 13
- if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) {
- RLOGE("Data structure expected is RIL_Data_Call_Response_v11");
- if (!isDebuggable()) {
- return RIL_ERRNO_INVALID_RESPONSE;
- } else {
- assert(0);
- }
- }
- return responseDataCallListV11(p, slotId, requestNumber, responseType, token, e, response,
- responselen);
- }
-}
-
-static int responseSetupDataCall(Parcel &p, int slotId, int requestNumber, int responseType,
- int token, RIL_Errno e, void *response, size_t responselen) {
- if (s_callbacks.version < 5) {
- return responseStringsWithVersion(s_callbacks.version, p, slotId, requestNumber,
- responseType, token, e, response, responselen);
- } else {
- return responseDataCallList(p, slotId, requestNumber, responseType, token, e, response,
- responselen);
- }
-}
-
static int responseRaw(Parcel &p, int slotId, int requestNumber, int responseType, int token,
RIL_Errno e, void *response, size_t responselen) {
if (response == NULL && responselen != 0) {
@@ -3215,6 +2976,9 @@
p.writeInt32(p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);
break;
}
+ default: {
+ break;
+ }
}
p_cur += 1;
}
@@ -3311,6 +3075,9 @@
p.writeInt32(p_cur->CellInfo.tdscdma.signalStrengthTdscdma.rscp);
break;
}
+ default: {
+ break;
+ }
}
p_cur += 1;
}
@@ -4508,36 +4275,15 @@
appendPrintBuf("Ack [%04d]< %s", pRI->token, requestToString(pRI->pCI->requestNumber));
if (pRI->cancelled == 0) {
- Parcel p;
+ pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(
+ (int) socket_id);
+ int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
+ assert(rwlockRet == 0);
- p.writeInt32 (RESPONSE_SOLICITED_ACK);
- p.writeInt32 (pRI->token);
+ radio::acknowledgeRequest((int) socket_id, pRI->token);
- // TODO : Below block of if condition will go away once below commands are converted
- // to hidl supported apis. They are left out as they use common functions used by
- // unsolicited commands present in other CL
- int cmdId = pRI->pCI->requestNumber;
- if(cmdId != RIL_REQUEST_SETUP_DATA_CALL
- && cmdId != RIL_REQUEST_SET_INITIAL_ATTACH_APN
- && cmdId != RIL_REQUEST_SET_DATA_PROFILE) {
- pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(
- (int) socket_id);
- int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
- assert(rwlockRet == 0);
-
- radio::acknowledgeRequest((int) socket_id, pRI->token);
-
- rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
- assert(rwlockRet == 0);
-
- return;
- }
-
- if (fd < 0) {
- RLOGD ("RIL onRequestAck: Command channel closed");
- }
-
- sendResponse(p, socket_id);
+ rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
+ assert(rwlockRet == 0);
}
}
extern "C" void
@@ -4566,7 +4312,8 @@
// response does not go back up the command socket
RLOGD("C[locl]< %s", requestToString(pRI->pCI->requestNumber));
- goto done;
+ free(pRI);
+ return;
}
appendPrintBuf("[%04d]< %s",
@@ -4591,52 +4338,19 @@
p.writeInt32 (e);
- bool hidlized = false;
- int cmdId = pRI->pCI->requestNumber;
- if(cmdId != RIL_REQUEST_SETUP_DATA_CALL
- && cmdId != RIL_REQUEST_SET_INITIAL_ATTACH_APN
- && cmdId != RIL_REQUEST_SET_DATA_PROFILE) {
- hidlized = true;
- }
+ // there is a response payload, no matter success or not.
+ RLOGE ("Calling responseFunction() for token %d", pRI->token);
- if (response != NULL || hidlized) {
- // there is a response payload, no matter success or not.
- RLOGE ("Calling responseFunction() for token %d", pRI->token);
+ pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock((int) socket_id);
+ int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
+ assert(rwlockRet == 0);
- pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock((int) socket_id);
- int rwlockRet = pthread_rwlock_rdlock(radioServiceRwlockPtr);
- assert(rwlockRet == 0);
+ ret = pRI->pCI->responseFunction(p, (int) socket_id, pRI->pCI->requestNumber,
+ responseType, pRI->token, e, response, responselen);
- ret = pRI->pCI->responseFunction(p, (int) socket_id, pRI->pCI->requestNumber,
- responseType, pRI->token, e, response, responselen);
-
- rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
- assert(rwlockRet == 0);
-
- if (hidlized) {
- free(pRI);
- return;
- }
-
- /* if an error occurred, rewind and mark it */
- if (ret != 0) {
- RLOGE ("responseFunction error, ret %d", ret);
- p.setDataPosition(errorOffset);
- p.writeInt32 (ret);
- }
- }
-
- if (e != RIL_E_SUCCESS) {
- appendPrintBuf("%s fails by %s", printBuf, failCauseToString(e));
- }
-
- if (fd < 0) {
- RLOGD ("RIL_onRequestComplete: Command channel closed");
- }
- sendResponse(p, socket_id);
+ rwlockRet = pthread_rwlock_unlock(radioServiceRwlockPtr);
+ assert(rwlockRet == 0);
}
-
-done:
free(pRI);
}
diff --git a/libril/ril_commands.h b/libril/ril_commands.h
index 05c1475..08a4428 100644
--- a/libril/ril_commands.h
+++ b/libril/ril_commands.h
@@ -41,7 +41,7 @@
{RIL_REQUEST_DTMF, dispatchString, radio::sendDtmfResponse},
{RIL_REQUEST_SEND_SMS, dispatchStrings, radio::sendSmsResponse},
{RIL_REQUEST_SEND_SMS_EXPECT_MORE, dispatchStrings, radio::sendSMSExpectMoreResponse},
- {RIL_REQUEST_SETUP_DATA_CALL, dispatchDataCall, responseSetupDataCall},
+ {RIL_REQUEST_SETUP_DATA_CALL, dispatchDataCall, radio::setupDataCallResponse},
{RIL_REQUEST_SIM_IO, dispatchSIM_IO, radio::iccIOForAppResponse},
{RIL_REQUEST_SEND_USSD, dispatchString, radio::sendUssdResponse},
{RIL_REQUEST_CANCEL_USSD, dispatchVoid, radio::cancelPendingUssdResponse},
@@ -125,7 +125,7 @@
{RIL_REQUEST_VOICE_RADIO_TECH, dispatchVoid, radio::getVoiceRadioTechnologyResponse},
{RIL_REQUEST_GET_CELL_INFO_LIST, dispatchVoid, radio::getCellInfoListResponse},
{RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, dispatchInts, radio::setCellInfoListRateResponse},
- {RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, responseVoid},
+ {RIL_REQUEST_SET_INITIAL_ATTACH_APN, dispatchSetInitialAttachApn, radio::setInitialAttachApnResponse},
{RIL_REQUEST_IMS_REGISTRATION_STATE, dispatchVoid, radio::getImsRegistrationStateResponse},
{RIL_REQUEST_IMS_SEND_SMS, dispatchImsSms, radio::sendImsSmsResponse},
{RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC, dispatchSIM_APDU, radio::iccTransmitApduBasicChannelResponse},
@@ -142,7 +142,7 @@
{RIL_REQUEST_SIM_AUTHENTICATION, dispatchSimAuthentication, radio::requestIccSimAuthenticationResponse},
{RIL_REQUEST_GET_DC_RT_INFO, dispatchVoid, responseDcRtInfo},
{RIL_REQUEST_SET_DC_RT_INFO_RATE, dispatchInts, responseVoid},
- {RIL_REQUEST_SET_DATA_PROFILE, dispatchDataProfile, responseVoid},
+ {RIL_REQUEST_SET_DATA_PROFILE, dispatchDataProfile, radio::setDataProfileResponse},
{RIL_REQUEST_SHUTDOWN, dispatchVoid, radio::requestShutdownResponse},
{RIL_REQUEST_GET_RADIO_CAPABILITY, dispatchVoid, radio::getRadioCapabilityResponse},
{RIL_REQUEST_SET_RADIO_CAPABILITY, dispatchRadioCapability, radio::setRadioCapabilityResponse},
diff --git a/libril/ril_service.cpp b/libril/ril_service.cpp
index def4405..59a0fd5 100644
--- a/libril/ril_service.cpp
+++ b/libril/ril_service.cpp
@@ -169,7 +169,8 @@
RadioTechnology radioTechnology,
const DataProfileInfo& profileInfo,
bool modemCognitive,
- bool roamingAllowed);
+ bool roamingAllowed,
+ bool isRoaming);
Return<void> iccIOForApp(int32_t serial,
const IccIo& iccIo);
@@ -356,7 +357,7 @@
Return<void> setCellInfoListRate(int32_t serial, int32_t rate);
Return<void> setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo,
- bool modemCognitive);
+ bool modemCognitive, bool isRoaming);
Return<void> getImsRegistrationState(int32_t serial);
@@ -392,7 +393,7 @@
const ::android::hardware::hidl_string& aid);
Return<void> setDataProfile(int32_t serial,
- const ::android::hardware::hidl_vec<DataProfileInfo>& profiles);
+ const ::android::hardware::hidl_vec<DataProfileInfo>& profiles, bool isRoaming);
Return<void> requestShutdown(int32_t serial);
@@ -448,7 +449,8 @@
char *ptr = va_arg(ap, char *);
if (ptr) {
#ifdef MEMSET_FREED
- memsetString (ptr);
+ // TODO: Should pass in the maximum length of the string
+ memsetString(ptr);
#endif
free(ptr);
}
@@ -456,6 +458,12 @@
va_end(ap);
}
+void sendErrorResponse(RequestInfo *pRI, RIL_Errno err) {
+ android::Parcel p; // TODO: should delete this after translation of all commands is complete
+ pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
+ (int) RadioResponseType::SOLICITED, pRI->token, err, NULL, 0);
+}
+
/**
* Copies over src to dest. If memory allocation fails, responseFunction() is called for the
* request with error RIL_E_NO_MEMORY.
@@ -470,9 +478,7 @@
*dest = (char *) calloc(len + 1, sizeof(char));
if (*dest == NULL) {
RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber));
- android::Parcel p; // TODO: should delete this after translation of all commands is complete
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return false;
}
strncpy(*dest, src, len + 1);
@@ -521,12 +527,10 @@
}
char **pStrings;
- android::Parcel p; // TODO: should delete this after translation of all commands is complete
pStrings = (char **)calloc(countStrings, sizeof(char *));
if (pStrings == NULL) {
RLOGE("Memory allocation failed for request %s", requestToString(request));
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, request,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return false;
}
va_list ap;
@@ -567,12 +571,10 @@
int countStrings = data.size();
char **pStrings;
- android::Parcel p; // TODO: should delete this after translation of all commands is complete
pStrings = (char **)calloc(countStrings, sizeof(char *));
if (pStrings == NULL) {
RLOGE("Memory allocation failed for request %s", requestToString(request));
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, request,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return false;
}
@@ -607,13 +609,11 @@
return false;
}
- android::Parcel p; // TODO: should delete this after translation of all commands is complete
+ int *pInts = (int *)calloc(countInts, sizeof(int));
- int *pInts = (int *) calloc(countInts, sizeof(int));
if (pInts == NULL) {
RLOGE("Memory allocation failed for request %s", requestToString(request));
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, request,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return false;
}
va_list ap;
@@ -970,15 +970,66 @@
return Void();
}
-Return<void> RadioImpl::setupDataCall(int32_t serial,
- RadioTechnology radioTechnology,
- const DataProfileInfo& profileInfo,
- bool modemCognitive,
- bool roamingAllowed) {
+const char *convertMvnoTypeToString(MvnoType type) {
+ switch (type) {
+ case MvnoType::IMSI: return "imsi";
+ case MvnoType::GID: return "gid";
+ case MvnoType::SPN: return "spn";
+ default: return NULL;
+ }
+}
+
+Return<void> RadioImpl::setupDataCall(int32_t serial, RadioTechnology radioTechnology,
+ const DataProfileInfo& dataProfileInfo, bool modemCognitive,
+ bool roamingAllowed, bool isRoaming) {
+
RLOGD("RadioImpl::setupDataCall: serial %d", serial);
- // todo: dispatch request
-
+ if (s_vendorFunctions->version >= 4 && s_vendorFunctions->version <= 14) {
+ const hidl_string &protocol =
+ (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol);
+ dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 7,
+ std::to_string((int) radioTechnology + 2).c_str(),
+ std::to_string((int) dataProfileInfo.profileId).c_str(),
+ dataProfileInfo.apn.c_str(),
+ dataProfileInfo.user.c_str(),
+ dataProfileInfo.password.c_str(),
+ std::to_string((int) dataProfileInfo.authType).c_str(),
+ protocol.c_str());
+ } else if (s_vendorFunctions->version >= 15) {
+ const char *mvnoTypeStr = convertMvnoTypeToString(dataProfileInfo.mvnoType);
+ if (mvnoTypeStr == NULL) {
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId,
+ RIL_REQUEST_SETUP_DATA_CALL);
+ if (pRI != NULL) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ }
+ return Void();
+ }
+ dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 15,
+ std::to_string((int) radioTechnology + 2).c_str(),
+ std::to_string((int) dataProfileInfo.profileId).c_str(),
+ dataProfileInfo.apn.c_str(),
+ dataProfileInfo.user.c_str(),
+ dataProfileInfo.password.c_str(),
+ std::to_string((int) dataProfileInfo.authType).c_str(),
+ dataProfileInfo.protocol.c_str(),
+ dataProfileInfo.roamingProtocol.c_str(),
+ std::to_string(dataProfileInfo.supportedApnTypesBitmap).c_str(),
+ std::to_string(dataProfileInfo.bearerBitmap).c_str(),
+ BOOL_TO_INT(modemCognitive),
+ std::to_string(dataProfileInfo.mtu).c_str(),
+ mvnoTypeStr,
+ dataProfileInfo.mvnoMatchData.c_str(),
+ BOOL_TO_INT(roamingAllowed));
+ } else {
+ RLOGE("Unsupported RIL version %d, min version expected 4", s_vendorFunctions->version);
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId,
+ RIL_REQUEST_SETUP_DATA_CALL);
+ if (pRI != NULL) {
+ sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED);
+ }
+ }
return Void();
}
@@ -1624,7 +1675,7 @@
}
Return<void> RadioImpl::setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo,
- bool modemCognitive) {
+ bool modemCognitive, bool isRoaming) {
RLOGD("RadioImpl::setInitialAttachApn: serial %d", serial);
RequestInfo *pRI = android::addRequestToList(serial, mSlotId,
RIL_REQUEST_SET_INITIAL_ATTACH_APN);
@@ -1632,11 +1683,70 @@
return Void();
}
- RIL_InitialAttachApn pf;
- memset(&pf, 0, sizeof(pf));
+ if (s_vendorFunctions->version <= 14) {
+ RIL_InitialAttachApn iaa = {};
- // todo: populate pf
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI);
+ if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
+ return Void();
+ }
+
+ const hidl_string &protocol =
+ (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol);
+
+ if (!copyHidlStringToRil(&iaa.protocol, protocol, pRI)) {
+ return Void();
+ }
+ iaa.authtype = (int) dataProfileInfo.authType;
+ if (!copyHidlStringToRil(&iaa.username, dataProfileInfo.user, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&iaa.password, dataProfileInfo.password, pRI)) {
+ return Void();
+ }
+
+ s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI);
+
+ memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.password);
+ } else {
+ RIL_InitialAttachApn_v15 iaa = {};
+
+ if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&iaa.protocol, dataProfileInfo.protocol, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&iaa.roamingProtocol, dataProfileInfo.roamingProtocol, pRI)) {
+ return Void();
+ }
+ iaa.authtype = (int) dataProfileInfo.authType;
+ if (!copyHidlStringToRil(&iaa.username, dataProfileInfo.user, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&iaa.password, dataProfileInfo.password, pRI)) {
+ return Void();
+ }
+ iaa.supportedTypesBitmask = dataProfileInfo.supportedApnTypesBitmap;
+ iaa.bearerBitmask = dataProfileInfo.bearerBitmap;
+ iaa.modemCognitive = BOOL_TO_INT(modemCognitive);
+ iaa.mtu = dataProfileInfo.mtu;
+
+ // Note that there is no need for memory allocation/free.
+ iaa.mvnoType = (char *) convertMvnoTypeToString(dataProfileInfo.mvnoType);
+ if (iaa.mvnoType == NULL) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+
+ if (!copyHidlStringToRil(&iaa.mvnoMatchData, dataProfileInfo.mvnoMatchData, pRI)) {
+ return Void();
+ }
+
+ s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI);
+
+ memsetAndFreeStrings(6, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username,
+ iaa.password, iaa.mvnoMatchData);
+ }
return Void();
}
@@ -1659,9 +1769,7 @@
if (message.gsmMessage.size() != 1) {
RLOGE("dispatchImsGsmSms: Invalid len %s", requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_INVALID_ARGUMENTS, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
return false;
}
@@ -1669,9 +1777,7 @@
if (pStrings == NULL) {
RLOGE("dispatchImsGsmSms: Memory allocation failed for request %s",
requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return false;
}
@@ -1714,9 +1820,7 @@
if (message.cdmaMessage.size() != 1) {
RLOGE("dispatchImsCdmaSms: Invalid len %s", requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_INVALID_ARGUMENTS, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
return false;
}
@@ -1749,9 +1853,7 @@
} else {
RLOGE("RadioImpl::sendImsSms: Invalid radio tech %s",
requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_INVALID_ARGUMENTS, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
}
return Void();
}
@@ -1891,31 +1993,196 @@
}
/**
- * dataProfilePtrs are contained in dataProfiles (dataProfilePtrs[i] = &dataProfiles[i])
+ * @param numProfiles number of data profile
+ * @param dataProfiles the pointer to the actual data profiles. The acceptable type is
+ RIL_DataProfileInfo or RIL_DataProfileInfo_v15.
+ * @param dataProfilePtrs the pointer to the pointers that point to each data profile structure
+ * @param numfields number of string-type member in the data profile structure
+ * @param ... the variadic parameters are pointers to each string-type member
**/
-void freeSetDataProfileData(int num, RIL_DataProfileInfo *dataProfiles,
- RIL_DataProfileInfo **dataProfilePtrs, int freeNumProfiles) {
- for (int i = 0; i < freeNumProfiles; i++) {
- memsetAndFreeStrings(4, dataProfiles[i].apn, dataProfiles[i].protocol, dataProfiles[i].user,
- dataProfiles[i].password);
+template <typename T>
+void freeSetDataProfileData(int numProfiles, T *dataProfiles, T **dataProfilePtrs,
+ int numfields, ...) {
+ va_list args;
+ va_start(args, numfields);
+
+ // Iterate through each string-type field that need to be free.
+ for (int i = 0; i < numfields; i++) {
+ // Iterate through each data profile and free that specific string-type field.
+ // The type 'char *T::*' is a type of pointer to a 'char *' member inside T structure.
+ char *T::*ptr = va_arg(args, char *T::*);
+ for (int j = 0; j < numProfiles; j++) {
+ memsetAndFreeStrings(1, dataProfiles[j].*ptr);
+ }
}
+ va_end(args);
+
#ifdef MEMSET_FREED
- memset(dataProfiles, 0, num * sizeof(RIL_DataProfileInfo));
- memset(dataProfilePtrs, 0, num * sizeof(RIL_DataProfileInfo *));
+ memset(dataProfiles, 0, numProfiles * sizeof(T));
+ memset(dataProfilePtrs, 0, numProfiles * sizeof(T *));
#endif
free(dataProfiles);
free(dataProfilePtrs);
}
-Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfileInfo>& profiles) {
+Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfileInfo>& profiles,
+ bool isRoaming) {
RLOGD("RadioImpl::setDataProfile: serial %d", serial);
RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_DATA_PROFILE);
if (pRI == NULL) {
return Void();
}
- // todo - dispatch request
+ size_t num = profiles.size();
+ bool success = false;
+
+ if (s_vendorFunctions->version <= 14) {
+
+ RIL_DataProfileInfo *dataProfiles =
+ (RIL_DataProfileInfo *) calloc(num, sizeof(RIL_DataProfileInfo));
+
+ if (dataProfiles == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+
+ RIL_DataProfileInfo **dataProfilePtrs =
+ (RIL_DataProfileInfo **) calloc(num, sizeof(RIL_DataProfileInfo *));
+ if (dataProfilePtrs == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ free(dataProfiles);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+
+ for (size_t i = 0; i < num; i++) {
+ dataProfilePtrs[i] = &dataProfiles[i];
+
+ success = copyHidlStringToRil(&dataProfiles[i].apn, profiles[i].apn, pRI);
+
+ const hidl_string &protocol =
+ (isRoaming ? profiles[i].roamingProtocol : profiles[i].protocol);
+
+ if (success && !copyHidlStringToRil(&dataProfiles[i].protocol, protocol, pRI)) {
+ success = false;
+ }
+
+ if (success && !copyHidlStringToRil(&dataProfiles[i].user, profiles[i].user, pRI)) {
+ success = false;
+ }
+ if (success && !copyHidlStringToRil(&dataProfiles[i].password, profiles[i].password,
+ pRI)) {
+ success = false;
+ }
+
+ if (!success) {
+ freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4,
+ &RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol,
+ &RIL_DataProfileInfo::user, &RIL_DataProfileInfo::password);
+ return Void();
+ }
+
+ dataProfiles[i].profileId = (RIL_DataProfile) profiles[i].profileId;
+ dataProfiles[i].authType = (int) profiles[i].authType;
+ dataProfiles[i].type = (int) profiles[i].type;
+ dataProfiles[i].maxConnsTime = profiles[i].maxConnsTime;
+ dataProfiles[i].maxConns = profiles[i].maxConns;
+ dataProfiles[i].waitTime = profiles[i].waitTime;
+ dataProfiles[i].enabled = BOOL_TO_INT(profiles[i].enabled);
+ }
+
+ s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
+ num * sizeof(RIL_DataProfileInfo *), pRI);
+
+ freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4,
+ &RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol,
+ &RIL_DataProfileInfo::user, &RIL_DataProfileInfo::password);
+ } else {
+ RIL_DataProfileInfo_v15 *dataProfiles =
+ (RIL_DataProfileInfo_v15 *) calloc(num, sizeof(RIL_DataProfileInfo_v15));
+
+ if (dataProfiles == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+
+ RIL_DataProfileInfo_v15 **dataProfilePtrs =
+ (RIL_DataProfileInfo_v15 **) calloc(num, sizeof(RIL_DataProfileInfo_v15 *));
+ if (dataProfilePtrs == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ free(dataProfiles);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+
+ for (size_t i = 0; i < num; i++) {
+ dataProfilePtrs[i] = &dataProfiles[i];
+
+ success = copyHidlStringToRil(&dataProfiles[i].apn, profiles[i].apn, pRI);
+ if (success && !copyHidlStringToRil(&dataProfiles[i].protocol, profiles[i].protocol,
+ pRI)) {
+ success = false;
+ }
+ if (success && !copyHidlStringToRil(&dataProfiles[i].roamingProtocol,
+ profiles[i].roamingProtocol, pRI)) {
+ success = false;
+ }
+ if (success && !copyHidlStringToRil(&dataProfiles[i].user, profiles[i].user, pRI)) {
+ success = false;
+ }
+ if (success && !copyHidlStringToRil(&dataProfiles[i].password, profiles[i].password,
+ pRI)) {
+ success = false;
+ }
+
+ if (success && !copyHidlStringToRil(&dataProfiles[i].mvnoMatchData,
+ profiles[i].mvnoMatchData, pRI)) {
+ success = false;
+ }
+
+ if (success) {
+ dataProfiles[i].mvnoType = (char *) convertMvnoTypeToString(profiles[i].mvnoType);
+ if (dataProfiles[i].mvnoType == NULL) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ success = false;
+ }
+ }
+
+ if (!success) {
+ freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6,
+ &RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol,
+ &RIL_DataProfileInfo_v15::roamingProtocol, &RIL_DataProfileInfo_v15::user,
+ &RIL_DataProfileInfo_v15::password, &RIL_DataProfileInfo_v15::mvnoMatchData);
+ return Void();
+ }
+
+ dataProfiles[i].profileId = (RIL_DataProfile) profiles[i].profileId;
+ dataProfiles[i].authType = (int) profiles[i].authType;
+ dataProfiles[i].type = (int) profiles[i].type;
+ dataProfiles[i].maxConnsTime = profiles[i].maxConnsTime;
+ dataProfiles[i].maxConns = profiles[i].maxConns;
+ dataProfiles[i].waitTime = profiles[i].waitTime;
+ dataProfiles[i].enabled = BOOL_TO_INT(profiles[i].enabled);
+ dataProfiles[i].supportedTypesBitmask = profiles[i].supportedApnTypesBitmap;
+ dataProfiles[i].bearerBitmask = profiles[i].bearerBitmap;
+ dataProfiles[i].mtu = profiles[i].mtu;
+ }
+
+ s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
+ num * sizeof(RIL_DataProfileInfo_v15 *), pRI);
+
+ freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6,
+ &RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol,
+ &RIL_DataProfileInfo_v15::roamingProtocol, &RIL_DataProfileInfo_v15::user,
+ &RIL_DataProfileInfo_v15::password, &RIL_DataProfileInfo_v15::mvnoMatchData);
+ }
return Void();
}
@@ -1997,9 +2264,7 @@
if (allowedCarriers == NULL) {
RLOGE("RadioImpl::setAllowedCarriers: Memory allocation failed for request %s",
requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
return Void();
}
cr.allowed_carriers = allowedCarriers;
@@ -2009,9 +2274,7 @@
if (excludedCarriers == NULL) {
RLOGE("RadioImpl::setAllowedCarriers: Memory allocation failed for request %s",
requestToString(pRI->pCI->requestNumber));
- android::Parcel p;
- pRI->pCI->responseFunction(p, (int) pRI->socket_id, pRI->pCI->requestNumber,
- (int) RadioResponseType::SOLICITED, pRI->token, RIL_E_NO_MEMORY, NULL, 0);
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
#ifdef MEMSET_FREED
memset(allowedCarriers, 0, cr.len_allowed_carriers * sizeof(RIL_Carrier));
#endif
@@ -2592,6 +2855,254 @@
return 0;
}
+RIL_CellInfoType getCellInfoTypeRadioTechnology(char *rat) {
+ if (rat == NULL) {
+ return RIL_CELL_INFO_TYPE_NONE;
+ }
+
+ int radioTech = atoi(rat);
+
+ switch(radioTech) {
+
+ case RADIO_TECH_GPRS:
+ case RADIO_TECH_EDGE:
+ case RADIO_TECH_GSM: {
+ return RIL_CELL_INFO_TYPE_GSM;
+ }
+
+ case RADIO_TECH_UMTS:
+ case RADIO_TECH_HSDPA:
+ case RADIO_TECH_HSUPA:
+ case RADIO_TECH_HSPA:
+ case RADIO_TECH_HSPAP: {
+ return RIL_CELL_INFO_TYPE_WCDMA;
+ }
+
+ case RADIO_TECH_IS95A:
+ case RADIO_TECH_IS95B:
+ case RADIO_TECH_1xRTT:
+ case RADIO_TECH_EVDO_0:
+ case RADIO_TECH_EVDO_A:
+ case RADIO_TECH_EVDO_B:
+ case RADIO_TECH_EHRPD: {
+ return RIL_CELL_INFO_TYPE_CDMA;
+ }
+
+ case RADIO_TECH_LTE:
+ case RADIO_TECH_LTE_CA: {
+ return RIL_CELL_INFO_TYPE_LTE;
+ }
+
+ case RADIO_TECH_TD_SCDMA: {
+ return RIL_CELL_INFO_TYPE_TD_SCDMA;
+ }
+
+ default: {
+ break;
+ }
+ }
+
+ return RIL_CELL_INFO_TYPE_NONE;
+
+}
+
+void fillCellIdentityResponse(CellIdentity &cellIdentity, RIL_CellIdentity_v16 &rilCellIdentity) {
+
+ cellIdentity.cellIdentityGsm.resize(0);
+ cellIdentity.cellIdentityWcdma.resize(0);
+ cellIdentity.cellIdentityCdma.resize(0);
+ cellIdentity.cellIdentityTdscdma.resize(0);
+ cellIdentity.cellIdentityLte.resize(0);
+ cellIdentity.cellInfoType = (CellInfoType)rilCellIdentity.cellInfoType;
+ switch(rilCellIdentity.cellInfoType) {
+
+ case RIL_CELL_INFO_TYPE_GSM: {
+ cellIdentity.cellIdentityGsm.resize(1);
+ cellIdentity.cellIdentityGsm[0].mcc =
+ std::to_string(rilCellIdentity.cellIdentityGsm.mcc);
+ cellIdentity.cellIdentityGsm[0].mnc =
+ std::to_string(rilCellIdentity.cellIdentityGsm.mnc);
+ cellIdentity.cellIdentityGsm[0].lac = rilCellIdentity.cellIdentityGsm.lac;
+ cellIdentity.cellIdentityGsm[0].cid = rilCellIdentity.cellIdentityGsm.cid;
+ cellIdentity.cellIdentityGsm[0].arfcn = rilCellIdentity.cellIdentityGsm.arfcn;
+ cellIdentity.cellIdentityGsm[0].bsic = rilCellIdentity.cellIdentityGsm.bsic;
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_WCDMA: {
+ cellIdentity.cellIdentityWcdma.resize(1);
+ cellIdentity.cellIdentityWcdma[0].mcc =
+ std::to_string(rilCellIdentity.cellIdentityWcdma.mcc);
+ cellIdentity.cellIdentityWcdma[0].mnc =
+ std::to_string(rilCellIdentity.cellIdentityWcdma.mnc);
+ cellIdentity.cellIdentityWcdma[0].lac = rilCellIdentity.cellIdentityWcdma.lac;
+ cellIdentity.cellIdentityWcdma[0].cid = rilCellIdentity.cellIdentityWcdma.cid;
+ cellIdentity.cellIdentityWcdma[0].psc = rilCellIdentity.cellIdentityWcdma.psc;
+ cellIdentity.cellIdentityWcdma[0].uarfcn = rilCellIdentity.cellIdentityWcdma.uarfcn;
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_CDMA: {
+ cellIdentity.cellIdentityCdma.resize(1);
+ cellIdentity.cellIdentityCdma[0].networkId = rilCellIdentity.cellIdentityCdma.networkId;
+ cellIdentity.cellIdentityCdma[0].systemId = rilCellIdentity.cellIdentityCdma.systemId;
+ cellIdentity.cellIdentityCdma[0].baseStationId =
+ rilCellIdentity.cellIdentityCdma.basestationId;
+ cellIdentity.cellIdentityCdma[0].longitude = rilCellIdentity.cellIdentityCdma.longitude;
+ cellIdentity.cellIdentityCdma[0].latitude = rilCellIdentity.cellIdentityCdma.latitude;
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_LTE: {
+ cellIdentity.cellIdentityLte.resize(1);
+ cellIdentity.cellIdentityLte[0].mcc =
+ std::to_string(rilCellIdentity.cellIdentityLte.mcc);
+ cellIdentity.cellIdentityLte[0].mnc =
+ std::to_string(rilCellIdentity.cellIdentityLte.mnc);
+ cellIdentity.cellIdentityLte[0].ci = rilCellIdentity.cellIdentityLte.ci;
+ cellIdentity.cellIdentityLte[0].pci = rilCellIdentity.cellIdentityLte.pci;
+ cellIdentity.cellIdentityLte[0].tac = rilCellIdentity.cellIdentityLte.tac;
+ cellIdentity.cellIdentityLte[0].earfcn = rilCellIdentity.cellIdentityLte.earfcn;
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_TD_SCDMA: {
+ cellIdentity.cellIdentityTdscdma.resize(1);
+ cellIdentity.cellIdentityTdscdma[0].mcc =
+ std::to_string(rilCellIdentity.cellIdentityTdscdma.mcc);
+ cellIdentity.cellIdentityTdscdma[0].mnc =
+ std::to_string(rilCellIdentity.cellIdentityTdscdma.mnc);
+ cellIdentity.cellIdentityTdscdma[0].lac = rilCellIdentity.cellIdentityTdscdma.lac;
+ cellIdentity.cellIdentityTdscdma[0].cid = rilCellIdentity.cellIdentityTdscdma.cid;
+ cellIdentity.cellIdentityTdscdma[0].cpid = rilCellIdentity.cellIdentityTdscdma.cpid;
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+}
+
+int convertResponseStringEntryToInt(char **response, int index, int numStrings) {
+ if ((response != NULL) && (numStrings > index) && (response[index] != NULL)) {
+ return atoi(response[index]);
+ }
+
+ return -1;
+}
+
+void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
+ int numStrings, char** response) {
+
+ RIL_CellIdentity_v16 rilCellIdentity;
+ int32_t *tmp = (int32_t*)&rilCellIdentity;
+
+ for (int i = 0; i < sizeof(RIL_CellIdentity_v16)/sizeof(int32_t); i++) {
+ tmp[i] = -1;
+ }
+
+ rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]);
+ switch(rilCellIdentity.cellInfoType) {
+
+ case RIL_CELL_INFO_TYPE_GSM: {
+ rilCellIdentity.cellIdentityGsm.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityGsm.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_WCDMA: {
+ rilCellIdentity.cellIdentityWcdma.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityWcdma.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ rilCellIdentity.cellIdentityWcdma.psc =
+ convertResponseStringEntryToInt(response, 14, numStrings);
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ rilCellIdentity.cellIdentityTdscdma.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityTdscdma.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ break;
+ }
+
+ case RIL_CELL_INFO_TYPE_CDMA:{
+ rilCellIdentity.cellIdentityCdma.basestationId =
+ convertResponseStringEntryToInt(response, 4, numStrings);
+ rilCellIdentity.cellIdentityCdma.longitude =
+ convertResponseStringEntryToInt(response, 5, numStrings);
+ rilCellIdentity.cellIdentityCdma.latitude =
+ convertResponseStringEntryToInt(response, 6, numStrings);
+ rilCellIdentity.cellIdentityCdma.systemId =
+ convertResponseStringEntryToInt(response, 8, numStrings);
+ rilCellIdentity.cellIdentityCdma.networkId =
+ convertResponseStringEntryToInt(response, 9, numStrings);
+ break;
+ }
+
+ default: {
+ break;
+ }
+ }
+
+ fillCellIdentityResponse(cellIdentity, rilCellIdentity);
+}
+
+void fillCellIdentityFromDataRegStateResponseString(CellIdentity &cellIdentity,
+ int numStrings, char** response) {
+
+ RIL_CellIdentity_v16 rilCellIdentity;
+ int32_t *tmp = (int32_t*)&rilCellIdentity;
+
+ for (int i = 0; i < sizeof(RIL_CellIdentity_v16)/sizeof(int32_t); i++) {
+ tmp[i] = -1;
+ }
+
+ rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]);
+ switch(rilCellIdentity.cellInfoType) {
+ case RIL_CELL_INFO_TYPE_GSM: {
+ rilCellIdentity.cellIdentityGsm.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityGsm.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ break;
+ }
+ case RIL_CELL_INFO_TYPE_WCDMA: {
+ rilCellIdentity.cellIdentityWcdma.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityWcdma.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ break;
+ }
+ case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ rilCellIdentity.cellIdentityTdscdma.lac =
+ convertResponseStringEntryToInt(response, 1, numStrings);
+ rilCellIdentity.cellIdentityTdscdma.cid =
+ convertResponseStringEntryToInt(response, 2, numStrings);
+ break;
+ }
+ case RIL_CELL_INFO_TYPE_LTE: {
+ rilCellIdentity.cellIdentityLte.tac =
+ convertResponseStringEntryToInt(response, 6, numStrings);
+ rilCellIdentity.cellIdentityLte.pci =
+ convertResponseStringEntryToInt(response, 7, numStrings);
+ rilCellIdentity.cellIdentityLte.ci =
+ convertResponseStringEntryToInt(response, 8, numStrings);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+
+ fillCellIdentityResponse(cellIdentity, rilCellIdentity);
+}
+
int radio::getVoiceRegistrationStateResponse(android::Parcel &p, int slotId, int requestNumber,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen) {
@@ -2602,29 +3113,44 @@
populateResponseInfo(responseInfo, serial, responseType, e);
VoiceRegStateResult voiceRegResponse = {};
-
int numStrings = responseLen / sizeof(char *);
-
- if (response == NULL || numStrings != 15) {
- RLOGE("radio::getVoiceRegistrationStateResponse Invalid response: NULL");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response == NULL) {
+ RLOGE("radio::getVoiceRegistrationStateResponse Invalid response: NULL");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else if (s_vendorFunctions->version <= 14) {
+ if (numStrings != 15) {
+ RLOGE("radio::getVoiceRegistrationStateResponse Invalid response: NULL");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else {
+ char **resp = (char **) response;
+ voiceRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4);
+ voiceRegResponse.rat = ATOI_NULL_HANDLED(resp[3]);
+ voiceRegResponse.cssSupported = ATOI_NULL_HANDLED_DEF(resp[7], 0);
+ voiceRegResponse.roamingIndicator = ATOI_NULL_HANDLED(resp[10]);
+ voiceRegResponse.systemIsInPrl = ATOI_NULL_HANDLED_DEF(resp[11], 0);
+ voiceRegResponse.defaultRoamingIndicator = ATOI_NULL_HANDLED_DEF(resp[12], 0);
+ voiceRegResponse.reasonForDenial = ATOI_NULL_HANDLED_DEF(resp[13], 0);
+ fillCellIdentityFromVoiceRegStateResponseString(voiceRegResponse.cellIdentity,
+ numStrings, resp);
+ }
} else {
- char **resp = (char **) response;
- voiceRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4);
- voiceRegResponse.lac = ATOI_NULL_HANDLED(resp[1]);
- voiceRegResponse.cid = ATOI_NULL_HANDLED(resp[2]);
- voiceRegResponse.rat = ATOI_NULL_HANDLED(resp[3]);
- voiceRegResponse.baseStationId = ATOI_NULL_HANDLED(resp[4]);
- voiceRegResponse.baseStationLatitude = ATOI_NULL_HANDLED_DEF(resp[5], INT_MAX);
- voiceRegResponse.baseStationLongitude = ATOI_NULL_HANDLED_DEF(resp[6], INT_MAX);
- voiceRegResponse.cssSupported = ATOI_NULL_HANDLED_DEF(resp[7], 0);
- voiceRegResponse.systemId = ATOI_NULL_HANDLED_DEF(resp[8], 0);
- voiceRegResponse.networkId = ATOI_NULL_HANDLED_DEF(resp[9], 0);
- voiceRegResponse.roamingIndicator = ATOI_NULL_HANDLED(resp[10]);
- voiceRegResponse.systemIsInPrl = ATOI_NULL_HANDLED_DEF(resp[11], 0);
- voiceRegResponse.defaultRoamingIndicator = ATOI_NULL_HANDLED_DEF(resp[12], 0);
- voiceRegResponse.reasonForDenial = ATOI_NULL_HANDLED_DEF(resp[13], 0);
- voiceRegResponse.psc = ATOI_NULL_HANDLED(resp[14]);
+ RIL_VoiceRegistrationStateResponse *voiceRegState =
+ (RIL_VoiceRegistrationStateResponse *)response;
+
+ if (responseLen != sizeof(RIL_VoiceRegistrationStateResponse)) {
+ RLOGE("radio::getVoiceRegistrationStateResponse Invalid response: NULL");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else {
+ voiceRegResponse.regState = (RegState) voiceRegState->regState;
+ voiceRegResponse.rat = voiceRegState->rat;;
+ voiceRegResponse.cssSupported = voiceRegState->cssSupported;
+ voiceRegResponse.roamingIndicator = voiceRegState->roamingIndicator;
+ voiceRegResponse.systemIsInPrl = voiceRegState->systemIsInPrl;
+ voiceRegResponse.defaultRoamingIndicator = voiceRegState->defaultRoamingIndicator;
+ voiceRegResponse.reasonForDenial = voiceRegState->reasonForDenial;
+ fillCellIdentityResponse(voiceRegResponse.cellIdentity,
+ voiceRegState->cellIdentity);
+ }
}
Return<void> retStatus =
@@ -2648,24 +3174,36 @@
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
DataRegStateResult dataRegResponse = {};
- int numStrings = responseLen / sizeof(char *);
- if (response == NULL || (numStrings != 6 && numStrings != 11)) {
+ if (response == NULL) {
RLOGE("radio::getDataRegistrationStateResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else if (s_vendorFunctions->version <= 14) {
+ int numStrings = responseLen / sizeof(char *);
+ if ((numStrings != 6) && (numStrings != 11)) {
+ RLOGE("radio::getDataRegistrationStateResponse Invalid response: NULL");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else {
+ char **resp = (char **) response;
+ dataRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4);
+ dataRegResponse.rat = ATOI_NULL_HANDLED_DEF(resp[3], 0);
+ dataRegResponse.reasonDataDenied = ATOI_NULL_HANDLED(resp[4]);
+ dataRegResponse.maxDataCalls = ATOI_NULL_HANDLED_DEF(resp[5], 1);
+ fillCellIdentityFromDataRegStateResponseString(dataRegResponse.cellIdentity,
+ numStrings, resp);
+ }
} else {
- char **resp = (char **) response;
- dataRegResponse.regState = (RegState) ATOI_NULL_HANDLED_DEF(resp[0], 4);
- dataRegResponse.lac = ATOI_NULL_HANDLED(resp[1]);
- dataRegResponse.cid = ATOI_NULL_HANDLED(resp[2]);
- dataRegResponse.rat = ATOI_NULL_HANDLED_DEF(resp[3], 0);
- dataRegResponse.reasonDataDenied = ATOI_NULL_HANDLED(resp[4]);
- dataRegResponse.maxDataCalls = ATOI_NULL_HANDLED_DEF(resp[5], 1);
- if (numStrings == 11) {
- dataRegResponse.tac = ATOI_NULL_HANDLED(resp[6]);
- dataRegResponse.phyCid = ATOI_NULL_HANDLED(resp[7]);
- dataRegResponse.eci = ATOI_NULL_HANDLED(resp[8]);
- dataRegResponse.csgid = ATOI_NULL_HANDLED(resp[9]);
- dataRegResponse.tadv = ATOI_NULL_HANDLED(resp[10]);
+ RIL_DataRegistrationStateResponse *dataRegState =
+ (RIL_DataRegistrationStateResponse *)response;
+
+ if (responseLen != sizeof(RIL_DataRegistrationStateResponse)) {
+ RLOGE("radio::getDataRegistrationStateResponse Invalid response: NULL");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ } else {
+ dataRegResponse.regState = (RegState) dataRegState->regState;
+ dataRegResponse.rat = dataRegState->rat;;
+ dataRegResponse.reasonDataDenied = dataRegState->reasonDataDenied;
+ dataRegResponse.maxDataCalls = dataRegState->maxDataCalls;
+ fillCellIdentityResponse(dataRegResponse.cellIdentity, dataRegState->cellIdentity);
}
}
@@ -2823,6 +3361,7 @@
if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) {
RLOGE("radio::setupDataCallResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ result.status = DataCallFailCause::ERROR_UNSPECIFIED;
result.type = hidl_string();
result.ifname = hidl_string();
result.addresses = hidl_string();
@@ -5466,7 +6005,7 @@
void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse,
SetupDataCallResult& dcResult) {
- dcResult.status = dcResponse->status;
+ dcResult.status = (DataCallFailCause) dcResponse->status;
dcResult.suggestedRetryTime = dcResponse->suggestedRetryTime;
dcResult.cid = dcResponse->cid;
dcResult.active = dcResponse->active;
@@ -6317,6 +6856,9 @@
rillCellInfo->CellInfo.tdscdma.signalStrengthTdscdma.rscp;
break;
}
+ default: {
+ break;
+ }
}
rillCellInfo += 1;
}