|
|
|
@ -118,9 +118,6 @@ namespace android { |
|
|
|
|
#define appendPrintBuf(x...) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#define MAX_RIL_SOL RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE |
|
|
|
|
#define MAX_RIL_UNSOL RIL_UNSOL_CELL_INFO_LIST |
|
|
|
|
|
|
|
|
|
enum WakeType {DONT_WAKE, WAKE_PARTIAL}; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
@ -171,6 +168,8 @@ extern "C" const char * rilSocketIdToString(RIL_SOCKET_ID socket_id); |
|
|
|
|
extern "C" |
|
|
|
|
char rild[MAX_SOCKET_NAME_LENGTH] = SOCKET_NAME_RIL; |
|
|
|
|
|
|
|
|
|
#define RIL_VENDOR_COMMANDS_OFFSET 10000 |
|
|
|
|
|
|
|
|
|
/*******************************************************************/ |
|
|
|
|
|
|
|
|
|
RIL_RadioFunctions s_callbacks = {0, NULL, NULL, NULL, NULL, NULL}; |
|
|
|
@ -228,8 +227,10 @@ static RequestInfo *s_pendingRequests_socket4 = NULL; |
|
|
|
|
static struct ril_event s_wake_timeout_event; |
|
|
|
|
static struct ril_event s_debug_event; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const struct timeval TIMEVAL_WAKE_TIMEOUT = {1,0}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static pthread_mutex_t s_startupMutex = PTHREAD_MUTEX_INITIALIZER; |
|
|
|
|
static pthread_cond_t s_startupCond = PTHREAD_COND_INITIALIZER; |
|
|
|
|
|
|
|
|
@ -279,6 +280,7 @@ static void dispatchNVWriteItem(Parcel &p, RequestInfo *pRI); |
|
|
|
|
static void dispatchUiccSubscripton(Parcel &p, RequestInfo *pRI); |
|
|
|
|
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 responseStrings(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseStringsNetworks(Parcel &p, void *response, size_t responselen); |
|
|
|
@ -307,17 +309,21 @@ static int responseSimRefresh(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseCellInfoList(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseHardwareConfig(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseDcRtInfo(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseRadioCapability(Parcel &p, void *response, size_t responselen); |
|
|
|
|
static int responseSSData(Parcel &p, void *response, size_t responselen); |
|
|
|
|
|
|
|
|
|
static int decodeVoiceRadioTechnology (RIL_RadioState radioState); |
|
|
|
|
static int decodeCdmaSubscriptionSource (RIL_RadioState radioState); |
|
|
|
|
static RIL_RadioState processRadioState(RIL_RadioState newRadioState, RIL_SOCKET_ID socket_id); |
|
|
|
|
static RIL_RadioState processRadioState(RIL_RadioState newRadioState); |
|
|
|
|
|
|
|
|
|
static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType); |
|
|
|
|
|
|
|
|
|
#ifdef RIL_SHLIB |
|
|
|
|
#if defined(ANDROID_MULTI_SIM) |
|
|
|
|
extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, void *data, |
|
|
|
|
size_t datalen, RIL_SOCKET_ID socket_id); |
|
|
|
|
#else |
|
|
|
|
extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
extern "C" void RIL_onUnsolicitedResponse(int unsolResponse, void *data, |
|
|
|
|
size_t datalen); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
@ -341,10 +347,18 @@ static CommandInfo s_commands[] = { |
|
|
|
|
#include "ril_commands.h" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static CommandInfo s_commands_v[] = { |
|
|
|
|
#include "ril_commands_vendor.h" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static UnsolResponseInfo s_unsolResponses[] = { |
|
|
|
|
#include "ril_unsol_commands.h" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static UnsolResponseInfo s_unsolResponses_v[] = { |
|
|
|
|
#include "ril_unsol_commands_vendor.h" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
/* For older RILs that do not support new commands RIL_REQUEST_VOICE_RADIO_TECH and
|
|
|
|
|
RIL_UNSOL_VOICE_RADIO_TECH_CHANGED messages, decode the voice radio tech from |
|
|
|
|
radio state message and store it. Every time there is a change in Radio State |
|
|
|
@ -384,6 +398,26 @@ strdupReadString(Parcel &p) { |
|
|
|
|
return strndup16to8(s16, stringlen); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static status_t |
|
|
|
|
readStringFromParcelInplace(Parcel &p, char *str, size_t maxLen) { |
|
|
|
|
size_t s16Len; |
|
|
|
|
const char16_t *s16; |
|
|
|
|
|
|
|
|
|
s16 = p.readString16Inplace(&s16Len); |
|
|
|
|
if (s16 == NULL) { |
|
|
|
|
return NO_MEMORY; |
|
|
|
|
} |
|
|
|
|
size_t strLen = strnlen16to8(s16, s16Len); |
|
|
|
|
if ((strLen + 1) > maxLen) { |
|
|
|
|
return NO_MEMORY; |
|
|
|
|
} |
|
|
|
|
if (strncpy16to8(str, s16, strLen) == NULL) { |
|
|
|
|
return NO_MEMORY; |
|
|
|
|
} else { |
|
|
|
|
return NO_ERROR; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void writeStringToParcel(Parcel &p, const char *s) { |
|
|
|
|
char16_t *s16; |
|
|
|
|
size_t s16_len; |
|
|
|
@ -433,11 +467,9 @@ issueLocalRequest(int request, void *data, int len, RIL_SOCKET_ID socket_id) { |
|
|
|
|
pRI->local = 1; |
|
|
|
|
pRI->token = 0xffffffff; // token is not used in this context
|
|
|
|
|
|
|
|
|
|
/* Hack to include Samsung requests */ |
|
|
|
|
if (request > 10000) { |
|
|
|
|
int index = request - 10000 + MAX_RIL_SOL; |
|
|
|
|
RLOGD("SAMSUNG: request=%d, index=%d", request, index); |
|
|
|
|
pRI->pCI = &(s_commands[index]); |
|
|
|
|
/* Check vendor commands */ |
|
|
|
|
if (request > RIL_VENDOR_COMMANDS_OFFSET) { |
|
|
|
|
pRI->pCI = &(s_commands_v[request - RIL_VENDOR_COMMANDS_OFFSET]); |
|
|
|
|
} else { |
|
|
|
|
pRI->pCI = &(s_commands[request]); |
|
|
|
|
} |
|
|
|
@ -457,15 +489,15 @@ issueLocalRequest(int request, void *data, int len, RIL_SOCKET_ID socket_id) { |
|
|
|
|
CALL_ONREQUEST(request, data, len, pRI, pRI->socket_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
processCommandBuffer(void *buffer, size_t buflen, RIL_SOCKET_ID socket_id) { |
|
|
|
|
|
|
|
|
|
Parcel p; |
|
|
|
|
status_t status; |
|
|
|
|
int32_t request; |
|
|
|
|
int32_t token; |
|
|
|
|
RequestInfo *pRI; |
|
|
|
|
|
|
|
|
|
int ret; |
|
|
|
|
/* Hook for current context */ |
|
|
|
|
/* pendingRequestsMutextHook refer to &s_pendingRequestsMutex */ |
|
|
|
@ -479,8 +511,6 @@ processCommandBuffer(void *buffer, size_t buflen, RIL_SOCKET_ID socket_id) { |
|
|
|
|
status = p.readInt32(&request); |
|
|
|
|
status = p.readInt32 (&token); |
|
|
|
|
|
|
|
|
|
RLOGD("SOCKET %s REQUEST: %s length:%d", rilSocketIdToString(socket_id), requestToString(request), buflen); |
|
|
|
|
|
|
|
|
|
#if (SIM_COUNT >= 2) |
|
|
|
|
if (socket_id == RIL_SOCKET_2) { |
|
|
|
|
pendingRequestsMutexHook = &s_pendingRequestsMutex_socket2; |
|
|
|
@ -505,9 +535,20 @@ processCommandBuffer(void *buffer, size_t buflen, RIL_SOCKET_ID socket_id) { |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (request < 1 || request >= (int32_t)NUM_ELEMS(s_commands)) { |
|
|
|
|
Parcel pErr; |
|
|
|
|
CommandInfo *pCI = NULL; |
|
|
|
|
if (request > RIL_VENDOR_COMMANDS_OFFSET) { |
|
|
|
|
int index = request - RIL_VENDOR_COMMANDS_OFFSET; |
|
|
|
|
RLOGD("processCommandBuffer: samsung request=%d, index=%d", |
|
|
|
|
request, index); |
|
|
|
|
if (index < (int32_t)NUM_ELEMS(s_commands_v)) |
|
|
|
|
pCI = &(s_commands_v[index]); |
|
|
|
|
} else { |
|
|
|
|
if (request < (int32_t)NUM_ELEMS(s_commands)) |
|
|
|
|
pCI = &(s_commands[request]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pCI == NULL) { |
|
|
|
|
Parcel pErr; |
|
|
|
|
RLOGE("unsupported request code %d token %d", request, token); |
|
|
|
|
// FIXME this should perhaps return a response
|
|
|
|
|
pErr.writeInt32 (RESPONSE_SOLICITED); |
|
|
|
@ -521,17 +562,7 @@ processCommandBuffer(void *buffer, size_t buflen, RIL_SOCKET_ID socket_id) { |
|
|
|
|
pRI = (RequestInfo *)calloc(1, sizeof(RequestInfo)); |
|
|
|
|
|
|
|
|
|
pRI->token = token; |
|
|
|
|
|
|
|
|
|
/* Hack to include Samsung requests */ |
|
|
|
|
if (request > 10000) { |
|
|
|
|
int index = request - 10000 + MAX_RIL_SOL; |
|
|
|
|
RLOGD("processCommandBuffer: samsung request=%d, index=%d", |
|
|
|
|
request, index); |
|
|
|
|
pRI->pCI = &(s_commands[index]); |
|
|
|
|
} else { |
|
|
|
|
pRI->pCI = &(s_commands[request]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pRI->pCI = pCI; |
|
|
|
|
pRI->socket_id = socket_id; |
|
|
|
|
|
|
|
|
|
ret = pthread_mutex_lock(pendingRequestsMutexHook); |
|
|
|
@ -1026,6 +1057,7 @@ invalid: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Callee expects const RIL_CallForwardInfo * |
|
|
|
|
* Payload is: |
|
|
|
@ -2005,6 +2037,67 @@ invalid: |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void dispatchRadioCapability(Parcel &p, RequestInfo *pRI){ |
|
|
|
|
RIL_RadioCapability rc; |
|
|
|
|
int32_t t; |
|
|
|
|
status_t status; |
|
|
|
|
|
|
|
|
|
memset (&rc, 0, sizeof(RIL_RadioCapability)); |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
rc.version = (int)t; |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
rc.session= (int)t; |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
rc.phase= (int)t; |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
rc.rat = (int)t; |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = readStringFromParcelInplace(p, rc.logicalModemUuid, sizeof(rc.logicalModemUuid)); |
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status = p.readInt32(&t); |
|
|
|
|
rc.status = (int)t; |
|
|
|
|
|
|
|
|
|
if (status != NO_ERROR) { |
|
|
|
|
goto invalid; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startRequest; |
|
|
|
|
appendPrintBuf("%s [version:%d, session:%d, phase:%d, rat:%d, \
|
|
|
|
|
logicalModemUuid:%s, status:%d", printBuf, rc.version, rc.session |
|
|
|
|
rc.phase, rc.rat, rc.logicalModemUuid, rc.session); |
|
|
|
|
|
|
|
|
|
closeRequest; |
|
|
|
|
printRequest(pRI->token, pRI->pCI->requestNumber); |
|
|
|
|
|
|
|
|
|
CALL_ONREQUEST(pRI->pCI->requestNumber, |
|
|
|
|
&rc, |
|
|
|
|
sizeof(RIL_RadioCapability), |
|
|
|
|
pRI, pRI->socket_id); |
|
|
|
|
return; |
|
|
|
|
invalid: |
|
|
|
|
invalidCommandBlock(pRI); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int |
|
|
|
|
blockingWrite(int fd, const void *buffer, size_t len) { |
|
|
|
|
size_t writeOffset = 0; |
|
|
|
@ -2062,6 +2155,13 @@ sendResponseRaw (const void *data, size_t dataSize, RIL_SOCKET_ID socket_id) { |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (dataSize > MAX_COMMAND_BYTES) { |
|
|
|
|
RLOGE("RIL: packet larger than %u (%u)", |
|
|
|
|
MAX_COMMAND_BYTES, (unsigned int )dataSize); |
|
|
|
|
|
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pthread_mutex_lock(writeMutexHook); |
|
|
|
|
|
|
|
|
|
header = htonl(dataSize); |
|
|
|
@ -2174,6 +2274,7 @@ static int responseStrings(Parcel &p, void *response, size_t responselen, bool n |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NULL strings are accepted |
|
|
|
|
* FIXME currently ignores responselen |
|
|
|
@ -2395,36 +2496,86 @@ static int responseDataCallListV6(Parcel &p, void *response, size_t responselen) |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int responseDataCallListV9(Parcel &p, void *response, size_t responselen) |
|
|
|
|
{ |
|
|
|
|
if (response == NULL && responselen != 0) { |
|
|
|
|
RLOGE("invalid response: NULL"); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { |
|
|
|
|
RLOGE("responseDataCallListV9: invalid response length %d expected multiple of %d", |
|
|
|
|
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Write version
|
|
|
|
|
p.writeInt32(10); |
|
|
|
|
|
|
|
|
|
int num = responselen / sizeof(RIL_Data_Call_Response_v9); |
|
|
|
|
p.writeInt32(num); |
|
|
|
|
|
|
|
|
|
RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; |
|
|
|
|
startResponse; |
|
|
|
|
int i; |
|
|
|
|
for (i = 0; i < num; i++) { |
|
|
|
|
p.writeInt32((int)p_cur[i].status); |
|
|
|
|
p.writeInt32(p_cur[i].suggestedRetryTime); |
|
|
|
|
p.writeInt32(p_cur[i].cid); |
|
|
|
|
p.writeInt32(p_cur[i].active); |
|
|
|
|
writeStringToParcel(p, p_cur[i].type); |
|
|
|
|
writeStringToParcel(p, p_cur[i].ifname); |
|
|
|
|
writeStringToParcel(p, p_cur[i].addresses); |
|
|
|
|
writeStringToParcel(p, p_cur[i].dnses); |
|
|
|
|
writeStringToParcel(p, p_cur[i].gateways); |
|
|
|
|
writeStringToParcel(p, p_cur[i].pcscf); |
|
|
|
|
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, |
|
|
|
|
p_cur[i].status, |
|
|
|
|
p_cur[i].suggestedRetryTime, |
|
|
|
|
p_cur[i].cid, |
|
|
|
|
(p_cur[i].active==0)?"down":"up", |
|
|
|
|
(char*)p_cur[i].type, |
|
|
|
|
(char*)p_cur[i].ifname, |
|
|
|
|
(char*)p_cur[i].addresses, |
|
|
|
|
(char*)p_cur[i].dnses, |
|
|
|
|
(char*)p_cur[i].gateways, |
|
|
|
|
(char*)p_cur[i].pcscf); |
|
|
|
|
} |
|
|
|
|
removeLastChar; |
|
|
|
|
closeResponse; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int responseDataCallList(Parcel &p, void *response, size_t responselen) |
|
|
|
|
{ |
|
|
|
|
if (s_callbacks.version < 5) { |
|
|
|
|
RLOGD("responseDataCallList: v4"); |
|
|
|
|
return responseDataCallListV4(p, response, responselen); |
|
|
|
|
} else if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { |
|
|
|
|
return responseDataCallListV6(p, response, responselen); |
|
|
|
|
} else if (responselen % sizeof(RIL_Data_Call_Response_v9) == 0) { |
|
|
|
|
return responseDataCallListV9(p, response, responselen); |
|
|
|
|
} else { |
|
|
|
|
if (response == NULL && responselen != 0) { |
|
|
|
|
RLOGE("invalid response: NULL"); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Support v6 or v9 with new rils
|
|
|
|
|
if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { |
|
|
|
|
RLOGD("responseDataCallList: v6"); |
|
|
|
|
return responseDataCallListV6(p, response, responselen); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { |
|
|
|
|
RLOGE("responseDataCallList: invalid response length %d expected multiple of %d", |
|
|
|
|
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); |
|
|
|
|
if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) { |
|
|
|
|
RLOGE("invalid response length %d expected multiple of %d", |
|
|
|
|
(int)responselen, (int)sizeof(RIL_Data_Call_Response_v11)); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Write version
|
|
|
|
|
p.writeInt32(10); |
|
|
|
|
p.writeInt32(11); |
|
|
|
|
|
|
|
|
|
int num = responselen / sizeof(RIL_Data_Call_Response_v9); |
|
|
|
|
int num = responselen / sizeof(RIL_Data_Call_Response_v11); |
|
|
|
|
p.writeInt32(num); |
|
|
|
|
|
|
|
|
|
RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; |
|
|
|
|
RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response; |
|
|
|
|
startResponse; |
|
|
|
|
int i; |
|
|
|
|
for (i = 0; i < num; i++) { |
|
|
|
@ -2438,7 +2589,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) |
|
|
|
|
writeStringToParcel(p, p_cur[i].dnses); |
|
|
|
|
writeStringToParcel(p, p_cur[i].gateways); |
|
|
|
|
writeStringToParcel(p, p_cur[i].pcscf); |
|
|
|
|
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, |
|
|
|
|
p.writeInt32(p_cur[i].mtu); |
|
|
|
|
appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],", printBuf, |
|
|
|
|
p_cur[i].status, |
|
|
|
|
p_cur[i].suggestedRetryTime, |
|
|
|
|
p_cur[i].cid, |
|
|
|
@ -2448,7 +2600,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) |
|
|
|
|
(char*)p_cur[i].addresses, |
|
|
|
|
(char*)p_cur[i].dnses, |
|
|
|
|
(char*)p_cur[i].gateways, |
|
|
|
|
(char*)p_cur[i].pcscf); |
|
|
|
|
(char*)p_cur[i].pcscf, |
|
|
|
|
p_cur[i].mtu); |
|
|
|
|
} |
|
|
|
|
removeLastChar; |
|
|
|
|
closeResponse; |
|
|
|
@ -3191,6 +3344,118 @@ static int responseHardwareConfig(Parcel &p, void *response, size_t responselen) |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int responseRadioCapability(Parcel &p, void *response, size_t responselen) { |
|
|
|
|
if (response == NULL) { |
|
|
|
|
RLOGE("invalid response: NULL"); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (responselen != sizeof (RIL_RadioCapability) ) { |
|
|
|
|
RLOGE("invalid response length was %d expected %d", |
|
|
|
|
(int)responselen, (int)sizeof (RIL_SIM_IO_Response)); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RIL_RadioCapability *p_cur = (RIL_RadioCapability *) response; |
|
|
|
|
p.writeInt32(p_cur->version); |
|
|
|
|
p.writeInt32(p_cur->session); |
|
|
|
|
p.writeInt32(p_cur->phase); |
|
|
|
|
p.writeInt32(p_cur->rat); |
|
|
|
|
writeStringToParcel(p, p_cur->logicalModemUuid); |
|
|
|
|
p.writeInt32(p_cur->status); |
|
|
|
|
|
|
|
|
|
startResponse; |
|
|
|
|
appendPrintBuf("%s[version=%d,session=%d,phase=%d,\
|
|
|
|
|
rat=%s,logicalModemUuid=%s,status=%d]", |
|
|
|
|
printBuf, |
|
|
|
|
p_cur->version, |
|
|
|
|
p_cur->session, |
|
|
|
|
p_cur->phase, |
|
|
|
|
p_cur->rat, |
|
|
|
|
p_cur->logicalModemUuid, |
|
|
|
|
p_cur->status); |
|
|
|
|
closeResponse; |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int responseSSData(Parcel &p, void *response, size_t responselen) { |
|
|
|
|
RLOGD("In responseSSData"); |
|
|
|
|
int num; |
|
|
|
|
|
|
|
|
|
if (response == NULL && responselen != 0) { |
|
|
|
|
RLOGE("invalid response length was %d expected %d", |
|
|
|
|
(int)responselen, (int)sizeof (RIL_SIM_IO_Response)); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (responselen != sizeof(RIL_StkCcUnsolSsResponse)) { |
|
|
|
|
RLOGE("invalid response length %d, expected %d", |
|
|
|
|
(int)responselen, (int)sizeof(RIL_StkCcUnsolSsResponse)); |
|
|
|
|
return RIL_ERRNO_INVALID_RESPONSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
startResponse; |
|
|
|
|
RIL_StkCcUnsolSsResponse *p_cur = (RIL_StkCcUnsolSsResponse *) response; |
|
|
|
|
p.writeInt32(p_cur->serviceType); |
|
|
|
|
p.writeInt32(p_cur->requestType); |
|
|
|
|
p.writeInt32(p_cur->teleserviceType); |
|
|
|
|
p.writeInt32(p_cur->serviceClass); |
|
|
|
|
p.writeInt32(p_cur->result); |
|
|
|
|
|
|
|
|
|
if (isServiceTypeCfQuery(p_cur->serviceType, p_cur->requestType)) { |
|
|
|
|
RLOGD("responseSSData CF type, num of Cf elements %d", p_cur->cfData.numValidIndexes); |
|
|
|
|
if (p_cur->cfData.numValidIndexes > NUM_SERVICE_CLASSES) { |
|
|
|
|
RLOGE("numValidIndexes is greater than max value %d, " |
|
|
|
|
"truncating it to max value", NUM_SERVICE_CLASSES); |
|
|
|
|
p_cur->cfData.numValidIndexes = NUM_SERVICE_CLASSES; |
|
|
|
|
} |
|
|
|
|
/* number of call info's */ |
|
|
|
|
p.writeInt32(p_cur->cfData.numValidIndexes); |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < p_cur->cfData.numValidIndexes; i++) { |
|
|
|
|
RIL_CallForwardInfo cf = p_cur->cfData.cfInfo[i]; |
|
|
|
|
|
|
|
|
|
p.writeInt32(cf.status); |
|
|
|
|
p.writeInt32(cf.reason); |
|
|
|
|
p.writeInt32(cf.serviceClass); |
|
|
|
|
p.writeInt32(cf.toa); |
|
|
|
|
writeStringToParcel(p, cf.number); |
|
|
|
|
p.writeInt32(cf.timeSeconds); |
|
|
|
|
appendPrintBuf("%s[%s,reason=%d,cls=%d,toa=%d,%s,tout=%d],", printBuf, |
|
|
|
|
(cf.status==1)?"enable":"disable", cf.reason, cf.serviceClass, cf.toa, |
|
|
|
|
(char*)cf.number, cf.timeSeconds); |
|
|
|
|
RLOGD("Data: %d,reason=%d,cls=%d,toa=%d,num=%s,tout=%d],", cf.status, |
|
|
|
|
cf.reason, cf.serviceClass, cf.toa, (char*)cf.number, cf.timeSeconds); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
p.writeInt32 (SS_INFO_MAX); |
|
|
|
|
|
|
|
|
|
/* each int*/ |
|
|
|
|
for (int i = 0; i < SS_INFO_MAX; i++) { |
|
|
|
|
appendPrintBuf("%s%d,", printBuf, p_cur->ssInfo[i]); |
|
|
|
|
RLOGD("Data: %d",p_cur->ssInfo[i]); |
|
|
|
|
p.writeInt32(p_cur->ssInfo[i]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
removeLastChar; |
|
|
|
|
closeResponse; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool isServiceTypeCfQuery(RIL_SsServiceType serType, RIL_SsRequestType reqType) { |
|
|
|
|
if ((reqType == SS_INTERROGATION) && |
|
|
|
|
(serType == SS_CFU || |
|
|
|
|
serType == SS_CF_BUSY || |
|
|
|
|
serType == SS_CF_NO_REPLY || |
|
|
|
|
serType == SS_CF_NOT_REACHABLE || |
|
|
|
|
serType == SS_CF_ALL || |
|
|
|
|
serType == SS_CF_ALL_CONDITIONAL)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void triggerEvLoop() { |
|
|
|
|
int ret; |
|
|
|
|
if (!pthread_equal(pthread_self(), s_tid_dispatch)) { |
|
|
|
@ -3506,6 +3771,7 @@ static void processCommandsCallback(int fd, short flags, void *param) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void onNewCommandConnect(RIL_SOCKET_ID socket_id) { |
|
|
|
|
// Inform we are connected and the ril version
|
|
|
|
|
int rilVer = s_callbacks.version; |
|
|
|
@ -3590,7 +3856,7 @@ static void listenCallback (int fd, short flags, void *param) { |
|
|
|
|
RLOGD("Error on getsockopt() errno: %d", errno); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( !is_phone_socket ) { |
|
|
|
|
if (!is_phone_socket) { |
|
|
|
|
RLOGE("RILD must accept socket from %s", p_info->processName); |
|
|
|
|
|
|
|
|
|
close(fdCommand); |
|
|
|
@ -3721,7 +3987,7 @@ static void debugCallback (int fd, short flags, void *param) { |
|
|
|
|
data = 0; |
|
|
|
|
issueLocalRequest(RIL_REQUEST_RADIO_POWER, &data, sizeof(int), socket_id); |
|
|
|
|
// Close the socket
|
|
|
|
|
if (socket_id == RIL_SOCKET_1 && s_ril_param_socket.fdCommand > 0) { |
|
|
|
|
if (socket_id == RIL_SOCKET_1 && s_ril_param_socket.fdCommand > 0) { |
|
|
|
|
close(s_ril_param_socket.fdCommand); |
|
|
|
|
s_ril_param_socket.fdCommand = -1; |
|
|
|
|
} |
|
|
|
@ -4024,6 +4290,7 @@ RIL_register (const RIL_RadioFunctions *callbacks) { |
|
|
|
|
}; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s_registerCalled = 1; |
|
|
|
|
|
|
|
|
|
RLOGI("s_registerCalled flag set, %d", s_started); |
|
|
|
@ -4033,11 +4300,20 @@ RIL_register (const RIL_RadioFunctions *callbacks) { |
|
|
|
|
assert(i == s_commands[i].requestNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < (int)NUM_ELEMS(s_commands_v); i++) { |
|
|
|
|
assert(i + RIL_VENDOR_COMMANDS_OFFSET == s_commands[i].requestNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) { |
|
|
|
|
assert(i + RIL_UNSOL_RESPONSE_BASE |
|
|
|
|
== s_unsolResponses[i].requestNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses_v); i++) { |
|
|
|
|
assert(i + RIL_UNSOL_RESPONSE_BASE + RIL_VENDOR_COMMANDS_OFFSET |
|
|
|
|
== s_unsolResponses[i].requestNumber); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// New rild impl calls RIL_startEventLoop() first
|
|
|
|
|
// old standalone impl wants it here.
|
|
|
|
|
|
|
|
|
@ -4150,7 +4426,6 @@ checkAndDequeueRequestInfo(struct RequestInfo *pRI) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" void |
|
|
|
|
RIL_onRequestComplete(RIL_Token t, RIL_Errno e, void *response, size_t responselen) { |
|
|
|
|
RequestInfo *pRI; |
|
|
|
@ -4230,6 +4505,7 @@ done: |
|
|
|
|
free(pRI); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void |
|
|
|
|
grabPartialWakeLock() { |
|
|
|
|
acquire_wake_lock(PARTIAL_WAKE_LOCK, ANDROID_WAKE_LOCK_NAME); |
|
|
|
@ -4336,7 +4612,7 @@ static bool is3gpp2(int radioTech) { |
|
|
|
|
* returned when telephony framework requests them |
|
|
|
|
*/ |
|
|
|
|
static RIL_RadioState |
|
|
|
|
processRadioState(RIL_RadioState newRadioState, RIL_SOCKET_ID socket_id __unused) { |
|
|
|
|
processRadioState(RIL_RadioState newRadioState, RIL_SOCKET_ID socket_id) { |
|
|
|
|
|
|
|
|
|
if((newRadioState > RADIO_STATE_UNAVAILABLE) && (newRadioState < RADIO_STATE_ON)) { |
|
|
|
|
int newVoiceRadioTech; |
|
|
|
@ -4372,22 +4648,23 @@ processRadioState(RIL_RadioState newRadioState, RIL_SOCKET_ID socket_id __unused |
|
|
|
|
return newRadioState; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(ANDROID_MULTI_SIM) |
|
|
|
|
extern "C" |
|
|
|
|
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
void RIL_onUnsolicitedResponse(int unsolResponse, void *data, |
|
|
|
|
size_t datalen, RIL_SOCKET_ID socket_id) |
|
|
|
|
#else |
|
|
|
|
extern "C" |
|
|
|
|
void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
void RIL_onUnsolicitedResponse(int unsolResponse, void *data, |
|
|
|
|
size_t datalen) |
|
|
|
|
#endif |
|
|
|
|
{ |
|
|
|
|
int unsolResponseIndex; |
|
|
|
|
int ret; |
|
|
|
|
int64_t timeReceived = 0; |
|
|
|
|
bool shouldScheduleTimeout = false; |
|
|
|
|
RIL_RadioState newState; |
|
|
|
|
RIL_SOCKET_ID soc_id = RIL_SOCKET_1; |
|
|
|
|
UnsolResponseInfo *pRI = NULL; |
|
|
|
|
|
|
|
|
|
#if defined(ANDROID_MULTI_SIM) |
|
|
|
|
soc_id = socket_id; |
|
|
|
@ -4400,10 +4677,21 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; |
|
|
|
|
/* Hack to include Samsung responses */ |
|
|
|
|
if (unsolResponse > RIL_VENDOR_COMMANDS_OFFSET + RIL_UNSOL_RESPONSE_BASE) { |
|
|
|
|
int index = unsolResponse - RIL_VENDOR_COMMANDS_OFFSET - RIL_UNSOL_RESPONSE_BASE; |
|
|
|
|
|
|
|
|
|
RLOGD("SAMSUNG: unsolResponse=%d, unsolResponseIndex=%d", unsolResponse, index); |
|
|
|
|
|
|
|
|
|
if ((unsolResponseIndex < 0) |
|
|
|
|
|| (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) { |
|
|
|
|
if (index < (int32_t)NUM_ELEMS(s_unsolResponses_v)) |
|
|
|
|
pRI = &s_unsolResponses_v[index]; |
|
|
|
|
} else { |
|
|
|
|
int index = unsolResponse - RIL_UNSOL_RESPONSE_BASE; |
|
|
|
|
if (index < (int32_t)NUM_ELEMS(s_unsolResponses)) |
|
|
|
|
pRI = &s_unsolResponses[index]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (pRI == NULL || pRI->responseFunction == NULL) { |
|
|
|
|
RLOGE("unsupported unsolicited response code %d", unsolResponse); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -4411,7 +4699,7 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
// Grab a wake lock if needed for this reponse,
|
|
|
|
|
// as we exit we'll either release it immediately
|
|
|
|
|
// or set a timer to release it later.
|
|
|
|
|
switch (s_unsolResponses[unsolResponseIndex].wakeType) { |
|
|
|
|
switch (pRI->wakeType) { |
|
|
|
|
case WAKE_PARTIAL: |
|
|
|
|
grabPartialWakeLock(); |
|
|
|
|
shouldScheduleTimeout = true; |
|
|
|
@ -4439,8 +4727,8 @@ void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, |
|
|
|
|
p.writeInt32 (RESPONSE_UNSOLICITED); |
|
|
|
|
p.writeInt32 (unsolResponse); |
|
|
|
|
|
|
|
|
|
ret = s_unsolResponses[unsolResponseIndex] |
|
|
|
|
.responseFunction(p, const_cast<void*>(data), datalen); |
|
|
|
|
ret = pRI->responseFunction(p, const_cast<void*>(data), datalen); |
|
|
|
|
|
|
|
|
|
if (ret != 0) { |
|
|
|
|
// Problem with the response. Don't continue;
|
|
|
|
|
goto error_exit; |
|
|
|
@ -4729,6 +5017,8 @@ requestToString(int request) { |
|
|
|
|
case RIL_REQUEST_SIM_OPEN_CHANNEL: return "SIM_OPEN_CHANNEL"; |
|
|
|
|
case RIL_REQUEST_SIM_CLOSE_CHANNEL: return "SIM_CLOSE_CHANNEL"; |
|
|
|
|
case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: return "SIM_TRANSMIT_APDU_CHANNEL"; |
|
|
|
|
case RIL_REQUEST_GET_RADIO_CAPABILITY: return "RIL_REQUEST_GET_RADIO_CAPABILITY"; |
|
|
|
|
case RIL_REQUEST_SET_RADIO_CAPABILITY: return "RIL_REQUEST_SET_RADIO_CAPABILITY"; |
|
|
|
|
case RIL_REQUEST_SET_UICC_SUBSCRIPTION: return "SET_UICC_SUBSCRIPTION"; |
|
|
|
|
case RIL_REQUEST_ALLOW_DATA: return "ALLOW_DATA"; |
|
|
|
|
case RIL_REQUEST_GET_HARDWARE_CONFIG: return "GET_HARDWARE_CONFIG"; |
|
|
|
@ -4746,13 +5036,14 @@ requestToString(int request) { |
|
|
|
|
case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST(obsolete)"; |
|
|
|
|
case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED"; |
|
|
|
|
case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH"; |
|
|
|
|
case RIL_UNSOL_DATA_CALL_LIST_CHANGED: return "UNSOL_DATA_CALL_LIST_CHANGED"; |
|
|
|
|
case RIL_UNSOL_SUPP_SVC_NOTIFICATION: return "UNSOL_SUPP_SVC_NOTIFICATION"; |
|
|
|
|
case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END"; |
|
|
|
|
case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND"; |
|
|
|
|
case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY"; |
|
|
|
|
case RIL_UNSOL_STK_CALL_SETUP: return "UNSOL_STK_CALL_SETUP"; |
|
|
|
|
case RIL_UNSOL_SIM_SMS_STORAGE_FULL: return "UNSOL_SIM_SMS_STORAGE_FUL"; |
|
|
|
|
case RIL_UNSOL_SIM_REFRESH: return "UNSOL_SIM_REFRESH"; |
|
|
|
|
case RIL_UNSOL_DATA_CALL_LIST_CHANGED: return "UNSOL_DATA_CALL_LIST_CHANGED"; |
|
|
|
|
case RIL_UNSOL_CALL_RING: return "UNSOL_CALL_RING"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED: return "UNSOL_RESPONSE_SIM_STATUS_CHANGED"; |
|
|
|
|
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS: return "UNSOL_NEW_CDMA_SMS"; |
|
|
|
@ -4777,6 +5068,9 @@ requestToString(int request) { |
|
|
|
|
case RIL_UNSOL_SRVCC_STATE_NOTIFY: return "UNSOL_SRVCC_STATE_NOTIFY"; |
|
|
|
|
case RIL_UNSOL_HARDWARE_CONFIG_CHANGED: return "HARDWARE_CONFIG_CHANGED"; |
|
|
|
|
case RIL_UNSOL_DC_RT_INFO_CHANGED: return "UNSOL_DC_RT_INFO_CHANGED"; |
|
|
|
|
case RIL_UNSOL_RADIO_CAPABILITY: return "UNSOL_RADIO_CAPABILITY"; |
|
|
|
|
case RIL_UNSOL_ON_SS: return "UNSOL_ON_SS"; |
|
|
|
|
case RIL_UNSOL_STK_CC_ALPHA_NOTIFY: return "UNSOL_STK_CC_ALPHA_NOTIFY"; |
|
|
|
|
case RIL_REQUEST_SHUTDOWN: return "SHUTDOWN"; |
|
|
|
|
default: return "<unknown request>"; |
|
|
|
|
} |
|
|
|
|