Change to parse DATA_CALL_LIST correctly based on version.
Bug: 16242255
Change-Id: I9c6dfb41f074da9558f721ca0432f40edc2d4d22
diff --git a/libril/ril.cpp b/libril/ril.cpp
index f526294..a25d536 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -1981,7 +1981,7 @@
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(int) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseInts: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(int));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2019,7 +2019,7 @@
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(char *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseStrings: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof(char *));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2075,7 +2075,7 @@
}
if (responselen % sizeof (RIL_Call *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCallList: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_Call *));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2170,11 +2170,14 @@
}
if (responselen % sizeof(RIL_Data_Call_Response_v4) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ 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);
@@ -2201,17 +2204,20 @@
static int responseDataCallListV6(Parcel &p, void *response, size_t responselen)
{
- if (response == NULL && responselen != 0) {
+ if (response == NULL && responselen != 0) {
RLOGE("invalid response: NULL");
return RIL_ERRNO_INVALID_RESPONSE;
}
if (responselen % sizeof(RIL_Data_Call_Response_v6) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ 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);
@@ -2247,10 +2253,8 @@
static int responseDataCallList(Parcel &p, void *response, size_t responselen)
{
- // Write version
- p.writeInt32(s_callbacks.version);
-
if (s_callbacks.version < 5) {
+ RLOGD("responseDataCallList: v4");
return responseDataCallListV4(p, response, responselen);
} else {
if (response == NULL && responselen != 0) {
@@ -2260,15 +2264,19 @@
// Support v6 or v9 with new rils
if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) {
+ RLOGD("responseDataCallList: v6");
return responseDataCallListV6(p, response, responselen);
}
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseDataCallList: 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);
@@ -2367,7 +2375,7 @@
}
if (responselen % sizeof(RIL_CallForwardInfo *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseCallForwards: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_CallForwardInfo *));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2436,7 +2444,7 @@
}
if (responselen % sizeof (RIL_NeighboringCell *) != 0) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCellList: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_NeighboringCell *));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2485,7 +2493,7 @@
}
if (responselen != sizeof (RIL_CDMA_InformationRecords)) {
- RLOGE("invalid response length %d expected multiple of %d\n",
+ RLOGE("responseCdmaInformationRecords: invalid response length %d expected multiple of %d\n",
(int)responselen, (int)sizeof (RIL_CDMA_InformationRecords *));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2847,7 +2855,7 @@
}
if (responselen % sizeof(RIL_CellInfo) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseCellInfoList: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_CellInfo));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -2996,7 +3004,7 @@
}
if (responselen % sizeof(RIL_HardwareConfig) != 0) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseHardwareConfig: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_HardwareConfig));
return RIL_ERRNO_INVALID_RESPONSE;
}
@@ -3229,7 +3237,7 @@
{
int num = responselen / sizeof(RIL_DcRtInfo);
if ((responselen % sizeof(RIL_DcRtInfo) != 0) || (num != 1)) {
- RLOGE("invalid response length %d expected multiple of %d",
+ RLOGE("responseDcRtInfo: invalid response length %d expected multiple of %d",
(int)responselen, (int)sizeof(RIL_DcRtInfo));
return RIL_ERRNO_INVALID_RESPONSE;
}