Add an optional vendor_cause string to
RIL_REQUEST_LAST_CALL_FAIL_CAUSE's response.
This vendor cause string will be passed to Telecom's DisconnectCause,
which could help us figure out why we are seeing so many ERROR_UNSPECIFIED.
bug:17701976
Original partner change:
https://partner-android-review.googlesource.com/#/c/215710/
Change-Id: I0c54733a03b2fe2bd48b3d3b21efc5e3ebd9ef66
diff --git a/libril/ril.cpp b/libril/ril.cpp
index 32c4376..a27495e 100644
--- a/libril/ril.cpp
+++ b/libril/ril.cpp
@@ -270,6 +270,7 @@
static void dispatchDataProfile(Parcel &p, RequestInfo *pRI);
static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI);
static int responseInts(Parcel &p, void *response, size_t responselen);
+static int responseFailCause(Parcel &p, void *response, size_t responselen);
static int responseStrings(Parcel &p, void *response, size_t responselen);
static int responseString(Parcel &p, void *response, size_t responselen);
static int responseVoid(Parcel &p, void *response, size_t responselen);
@@ -2170,6 +2171,35 @@
return 0;
}
+// Response is an int or RIL_LastCallFailCauseInfo.
+// Currently, only Shamu plans to use RIL_LastCallFailCauseInfo.
+// TODO(yjl): Let all implementations use RIL_LastCallFailCauseInfo.
+static int responseFailCause(Parcel &p, void *response, size_t responselen) {
+ if (response == NULL && responselen != 0) {
+ RLOGE("invalid response: NULL");
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ if (responselen == sizeof(int)) {
+ return responseInts(p, response, responselen);
+ } else if (responselen == sizeof(RIL_LastCallFailCauseInfo)) {
+ startResponse;
+ RIL_LastCallFailCauseInfo *p_fail_cause_info = (RIL_LastCallFailCauseInfo *) response;
+ appendPrintBuf("%s[cause_code=%d,vendor_cause=%s]", printBuf, p_fail_cause_info->cause_code,
+ p_fail_cause_info->vendor_cause);
+ p.writeInt32(p_fail_cause_info->cause_code);
+ writeStringToParcel(p, p_fail_cause_info->vendor_cause);
+ removeLastChar;
+ closeResponse;
+ } else {
+ RLOGE("responseFailCause: invalid response length %d expected an int or "
+ "RIL_LastCallFailCauseInfo", (int)responselen);
+ return RIL_ERRNO_INVALID_RESPONSE;
+ }
+
+ return 0;
+}
+
/** response is a char **, pointing to an array of char *'s
The parcel will begin with the version */
static int responseStringsWithVersion(int version, Parcel &p, void *response, size_t responselen) {