klte-common: libril: Fix SMS on certain variants

* Samsung added an int to the end of the RIL_SMS_Response
  struct in some of the variants (like vzw) but not all
* The presence of this field was discovered by examining
  the stock RIL.java, which conditionally read an extra
  int from the parcel, based on the device specific
  CscFeature_RIL_SmsErrorClassRetry feature
* This causes SMS messages to show as "failed to send"
  in the app, when they actually suceeded in sending
* Allow Samsung's custom struct and AOSP's to fix it

* Forward port to ril-caf on lineage-15.1

Change-Id: I6b3e545c2c42ab2de2ac11e93dfdf9546248080a
This commit is contained in:
Kevin F. Haggerty 2017-10-24 22:05:11 -06:00
parent 613d3fdea2
commit 345ceb6a2c
2 changed files with 15 additions and 5 deletions

View File

@ -590,6 +590,11 @@ typedef struct {
-1 if unknown or not applicable*/
} RIL_SMS_Response;
typedef struct {
RIL_SMS_Response response;
int retryCount; /* Samsung */
} RIL_SMS_Response_Ext;
/** Used by RIL_REQUEST_WRITE_SMS_TO_SIM */
typedef struct {
int status; /* Status of message. See TS 27.005 3.1, "<stat>": */

View File

@ -3991,15 +3991,20 @@ SendSmsResult makeSendSmsResult(RadioResponseInfo& responseInfo, int serial, int
populateResponseInfo(responseInfo, serial, responseType, e);
SendSmsResult result = {};
if (response == NULL || responseLen != sizeof(RIL_SMS_Response)) {
RLOGE("Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
result.ackPDU = hidl_string();
} else {
if (response != NULL && responseLen == sizeof(RIL_SMS_Response)) {
RIL_SMS_Response *resp = (RIL_SMS_Response *) response;
result.messageRef = resp->messageRef;
result.ackPDU = convertCharPtrToHidlString(resp->ackPDU);
result.errorCode = resp->errorCode;
} else if (response != NULL && responseLen == sizeof(RIL_SMS_Response_Ext)) {
RIL_SMS_Response *resp = &(((RIL_SMS_Response_Ext *) response)->response);
result.messageRef = resp->messageRef;
result.ackPDU = convertCharPtrToHidlString(resp->ackPDU);
result.errorCode = resp->errorCode;
} else {
RLOGE("Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
result.ackPDU = hidl_string();
}
return result;
}