msm8974-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 9a9121b070
commit 8c30fb5d12
2 changed files with 16 additions and 5 deletions

View File

@ -586,6 +586,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

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 The Android Open Source Project
* Copyright (c) 2018 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -3971,15 +3972,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;
}