diff options
author | Chao Liu <yjl@google.com> | 2015-05-14 16:13:46 -0700 |
---|---|---|
committer | Chao Liu <yjl@google.com> | 2015-06-18 15:05:55 -0700 |
commit | 548a81ee5d5d2cb58925ce62564ac9dfbb90431c (patch) | |
tree | 8337d7208976aecc2517dba4260abe3a491501c1 | |
parent | 7315749476fdfcdbdcba4763b45d0b28bbca6e2d (diff) | |
download | android_hardware_ril-548a81ee5d5d2cb58925ce62564ac9dfbb90431c.tar.gz android_hardware_ril-548a81ee5d5d2cb58925ce62564ac9dfbb90431c.tar.bz2 android_hardware_ril-548a81ee5d5d2cb58925ce62564ac9dfbb90431c.zip |
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
-rw-r--r-- | include/telephony/ril.h | 5 | ||||
-rw-r--r-- | libril/ril.cpp | 30 | ||||
-rw-r--r-- | libril/ril_commands.h | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index 8cde697..2e71367 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -616,6 +616,11 @@ typedef enum { CALL_FAIL_ERROR_UNSPECIFIED = 0xffff } RIL_LastCallFailCause; +typedef struct { + RIL_LastCallFailCause cause_code; + char * vendor_cause; +} RIL_LastCallFailCauseInfo; + /* See RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE */ typedef enum { PDP_FAIL_NONE = 0, /* No error, connection ok */ 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 dispatchSimAuthentication(Parcel &p, RequestInfo *pRI); 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 @@ responseInts(Parcel &p, void *response, size_t responselen) { 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) { diff --git a/libril/ril_commands.h b/libril/ril_commands.h index eb90426..163aa46 100644 --- a/libril/ril_commands.h +++ b/libril/ril_commands.h @@ -32,7 +32,7 @@ {RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE, dispatchVoid, responseVoid}, {RIL_REQUEST_CONFERENCE, dispatchVoid, responseVoid}, {RIL_REQUEST_UDUB, dispatchVoid, responseVoid}, - {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, dispatchVoid, responseInts}, + {RIL_REQUEST_LAST_CALL_FAIL_CAUSE, dispatchVoid, responseFailCause}, {RIL_REQUEST_SIGNAL_STRENGTH, dispatchVoid, responseRilSignalStrength}, {RIL_REQUEST_VOICE_REGISTRATION_STATE, dispatchVoid, responseStrings}, {RIL_REQUEST_DATA_REGISTRATION_STATE, dispatchVoid, responseStrings}, |