|
|
|
@ -23,7 +23,7 @@ |
|
|
|
|
#include <telephony/ril_cdma_sms.h> |
|
|
|
|
#include <cutils/sockets.h> |
|
|
|
|
#include <cutils/jstring.h> |
|
|
|
|
#include <cutils/record_stream.h> |
|
|
|
|
#include <telephony/record_stream.h> |
|
|
|
|
#include <utils/Log.h> |
|
|
|
|
#include <utils/SystemClock.h> |
|
|
|
|
#include <pthread.h> |
|
|
|
@ -207,9 +207,13 @@ static void dispatchRaw(Parcel& p, RequestInfo *pRI); |
|
|
|
|
static void dispatchSmsWrite (Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchDataCall (Parcel& p, RequestInfo *pRI); |
|
|
|
|
static void dispatchVoiceRadioTech (Parcel& p, RequestInfo *pRI); |
|
|
|
|
static void dispatchSetInitialAttachApn (Parcel& p, RequestInfo *pRI); |
|
|
|
|
static void dispatchCdmaSubscriptionSource (Parcel& p, RequestInfo *pRI); |
|
|
|
|
|
|
|
|
|
static void dispatchCdmaSms(Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchImsSms(Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchImsCdmaSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef); |
|
|
|
|
static void dispatchImsGsmSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef); |
|
|
|
|
static void dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchCdmaBrSmsCnf(Parcel &p, RequestInfo *pRI); |
|
|
|
@ -909,9 +913,8 @@ invalid: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchCdmaSms(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
RIL_CDMA_SMS_Message rcsm; |
|
|
|
|
static status_t |
|
|
|
|
constructCdmaSms(Parcel &p, RequestInfo *pRI, RIL_CDMA_SMS_Message& rcsm) { |
|
|
|
|
int32_t t; |
|
|
|
|
uint8_t ut; |
|
|
|
|
status_t status; |
|
|
|
@ -975,7 +978,7 @@ dispatchCdmaSms(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startRequest; |
|
|
|
@ -987,6 +990,18 @@ dispatchCdmaSms(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
|
|
|
|
|
printRequest(pRI->token, pRI->pCI->requestNumber); |
|
|
|
|
|
|
|
|
|
return status; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchCdmaSms(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
RIL_CDMA_SMS_Message rcsm; |
|
|
|
|
|
|
|
|
|
ALOGD("dispatchCdmaSms"); |
|
|
|
|
if (NO_ERROR != constructCdmaSms(p, pRI, rcsm)) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
s_callbacks.onRequest(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm),pRI); |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
@ -1000,6 +1015,149 @@ invalid: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchImsCdmaSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef) { |
|
|
|
|
RIL_IMS_SMS_Message rism; |
|
|
|
|
RIL_CDMA_SMS_Message rcsm; |
|
|
|
|
|
|
|
|
|
ALOGD("dispatchImsCdmaSms: retry=%d, messageRef=%d", retry, messageRef); |
|
|
|
|
|
|
|
|
|
if (NO_ERROR != constructCdmaSms(p, pRI, rcsm)) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
memset(&rism, 0, sizeof(rism)); |
|
|
|
|
rism.tech = RADIO_TECH_3GPP2; |
|
|
|
|
rism.retry = retry; |
|
|
|
|
rism.messageRef = messageRef; |
|
|
|
|
rism.message.cdmaMessage = &rcsm; |
|
|
|
|
|
|
|
|
|
s_callbacks.onRequest(pRI->pCI->requestNumber, &rism, |
|
|
|
|
sizeof(RIL_RadioTechnologyFamily)+sizeof(uint8_t)+sizeof(int32_t) |
|
|
|
|
+sizeof(rcsm),pRI); |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memset(&rcsm, 0, sizeof(rcsm)); |
|
|
|
|
memset(&rism, 0, sizeof(rism)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
invalid: |
|
|
|
|
invalidCommandBlock(pRI); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchImsGsmSms(Parcel &p, RequestInfo *pRI, uint8_t retry, int32_t messageRef) { |
|
|
|
|
RIL_IMS_SMS_Message rism; |
|
|
|
|
int32_t countStrings; |
|
|
|
|
status_t status; |
|
|
|
|
size_t datalen; |
|
|
|
|
char **pStrings; |
|
|
|
|
ALOGD("dispatchImsGsmSms: retry=%d, messageRef=%d", retry, messageRef); |
|
|
|
|
|
|
|
|
|
status = p.readInt32 (&countStrings); |
|
|
|
|
|
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
memset(&rism, 0, sizeof(rism)); |
|
|
|
|
rism.tech = RADIO_TECH_3GPP; |
|
|
|
|
rism.retry = retry; |
|
|
|
|
rism.messageRef = messageRef; |
|
|
|
|
|
|
|
|
|
startRequest; |
|
|
|
|
appendPrintBuf("%sformat=%d,", printBuf, rism.format); |
|
|
|
|
if (countStrings == 0) { |
|
|
|
|
// just some non-null pointer
|
|
|
|
|
pStrings = (char **)alloca(sizeof(char *)); |
|
|
|
|
datalen = 0; |
|
|
|
|
} else if (((int)countStrings) == -1) { |
|
|
|
|
pStrings = NULL; |
|
|
|
|
datalen = 0; |
|
|
|
|
} else { |
|
|
|
|
datalen = sizeof(char *) * countStrings; |
|
|
|
|
|
|
|
|
|
pStrings = (char **)alloca(datalen); |
|
|
|
|
|
|
|
|
|
for (int i = 0 ; i < countStrings ; i++) { |
|
|
|
|
pStrings[i] = strdupReadString(p); |
|
|
|
|
appendPrintBuf("%s%s,", printBuf, pStrings[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
removeLastChar; |
|
|
|
|
closeRequest; |
|
|
|
|
printRequest(pRI->token, pRI->pCI->requestNumber); |
|
|
|
|
|
|
|
|
|
rism.message.gsmMessage = pStrings; |
|
|
|
|
s_callbacks.onRequest(pRI->pCI->requestNumber, &rism, |
|
|
|
|
sizeof(RIL_RadioTechnologyFamily)+sizeof(uint8_t)+sizeof(int32_t) |
|
|
|
|
+datalen, pRI); |
|
|
|
|
|
|
|
|
|
if (pStrings != NULL) { |
|
|
|
|
for (int i = 0 ; i < countStrings ; i++) { |
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memsetString (pStrings[i]); |
|
|
|
|
#endif |
|
|
|
|
free(pStrings[i]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memset(pStrings, 0, datalen); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memset(&rism, 0, sizeof(rism)); |
|
|
|
|
#endif |
|
|
|
|
return; |
|
|
|
|
invalid: |
|
|
|
|
ALOGE("dispatchImsGsmSms invalid block"); |
|
|
|
|
invalidCommandBlock(pRI); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchImsSms(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
int32_t t; |
|
|
|
|
status_t status = p.readInt32(&t); |
|
|
|
|
RIL_RadioTechnologyFamily format; |
|
|
|
|
uint8_t retry; |
|
|
|
|
int32_t messageRef; |
|
|
|
|
|
|
|
|
|
ALOGD("dispatchImsSms"); |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
format = (RIL_RadioTechnologyFamily) t; |
|
|
|
|
|
|
|
|
|
// read retry field
|
|
|
|
|
status = p.read(&retry,sizeof(retry)); |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
// read messageRef field
|
|
|
|
|
status = p.read(&messageRef,sizeof(messageRef)); |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (RADIO_TECH_3GPP == format) { |
|
|
|
|
dispatchImsGsmSms(p, pRI, retry, messageRef); |
|
|
|
|
} else if (RADIO_TECH_3GPP2 == format) { |
|
|
|
|
dispatchImsCdmaSms(p, pRI, retry, messageRef); |
|
|
|
|
} else { |
|
|
|
|
ALOGE("requestImsSendSMS invalid format value =%d", format); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
invalid: |
|
|
|
|
invalidCommandBlock(pRI); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
dispatchCdmaSmsAck(Parcel &p, RequestInfo *pRI) { |
|
|
|
|
RIL_CDMA_SMS_Ack rcsa; |
|
|
|
@ -1336,6 +1494,56 @@ static void dispatchCdmaSubscriptionSource(Parcel& p, RequestInfo *pRI) { |
|
|
|
|
RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &cdmaSubscriptionSource, sizeof(int)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void dispatchSetInitialAttachApn(Parcel &p, RequestInfo *pRI) |
|
|
|
|
{ |
|
|
|
|
RIL_InitialAttachApn pf; |
|
|
|
|
int32_t t; |
|
|
|
|
status_t status; |
|
|
|
|
|
|
|
|
|
memset(&pf, 0, sizeof(pf)); |
|
|
|
|
|
|
|
|
|
pf.apn = strdupReadString(p); |
|
|
|
|
pf.protocol = strdupReadString(p); |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
pf.authtype = (int) t; |
|
|
|
|
|
|
|
|
|
pf.username = strdupReadString(p); |
|
|
|
|
pf.password = strdupReadString(p); |
|
|
|
|
|
|
|
|
|
startRequest; |
|
|
|
|
appendPrintBuf("%sapn=%s, protocol=%s, auth_type=%d, username=%s, password=%s", |
|
|
|
|
printBuf, pf.apn, pf.protocol, pf.auth_type, pf.username, pf.password); |
|
|
|
|
closeRequest; |
|
|
|
|
printRequest(pRI->token, pRI->pCI->requestNumber); |
|
|
|
|
|
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
s_callbacks.onRequest(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI); |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memsetString(pf.apn); |
|
|
|
|
memsetString(pf.protocol); |
|
|
|
|
memsetString(pf.username); |
|
|
|
|
memsetString(pf.password); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
free(pf.apn); |
|
|
|
|
free(pf.protocol); |
|
|
|
|
free(pf.username); |
|
|
|
|
free(pf.password); |
|
|
|
|
|
|
|
|
|
#ifdef MEMSET_FREED |
|
|
|
|
memset(&pf, 0, sizeof(pf)); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
invalid: |
|
|
|
|
invalidCommandBlock(pRI); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
blockingWrite(int fd, const void *buffer, size_t len) { |
|
|
|
|
size_t writeOffset = 0; |
|
|
|
@ -3749,6 +3957,9 @@ requestToString(int request) { |
|
|
|
|
case RIL_REQUEST_VOICE_RADIO_TECH: return "VOICE_RADIO_TECH"; |
|
|
|
|
case RIL_REQUEST_GET_CELL_INFO_LIST: return"GET_CELL_INFO_LIST"; |
|
|
|
|
case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: return"SET_UNSOL_CELL_INFO_LIST_RATE"; |
|
|
|
|
case RIL_REQUEST_SET_INITIAL_ATTACH_APN: return "RIL_REQUEST_SET_INITIAL_ATTACH_APN"; |
|
|
|
|
case RIL_REQUEST_IMS_REGISTRATION_STATE: return "IMS_REGISTRATION_STATE"; |
|
|
|
|
case RIL_REQUEST_IMS_SEND_SMS: return "IMS_SEND_SMS"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: return "UNSOL_RESPONSE_RADIO_STATE_CHANGED"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED: return "UNSOL_RESPONSE_CALL_STATE_CHANGED"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED"; |
|
|
|
@ -3785,6 +3996,7 @@ requestToString(int request) { |
|
|
|
|
case RIL_UNSOL_RIL_CONNECTED: return "UNSOL_RIL_CONNECTED"; |
|
|
|
|
case RIL_UNSOL_VOICE_RADIO_TECH_CHANGED: return "UNSOL_VOICE_RADIO_TECH_CHANGED"; |
|
|
|
|
case RIL_UNSOL_CELL_INFO_LIST: return "UNSOL_CELL_INFO_LIST"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: return "RESPONSE_IMS_NETWORK_STATE_CHANGED"; |
|
|
|
|
case RIL_UNSOL_STK_SEND_SMS_RESULT: return "RIL_UNSOL_STK_SEND_SMS_RESULT"; |
|
|
|
|
default: return "<unknown request>"; |
|
|
|
|
} |
|
|
|
|