using ::android::hardware::hidl_string;
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_array;
+using ::android::hardware::radio::V1_1::NetworkScanRequest;
+using ::android::hardware::radio::V1_1::KeepaliveRequest;
using ::android::hardware::Void;
using android::CommandInfo;
using android::RequestInfo;
#define ATOI_NULL_HANDLED(x) (x ? atoi(x) : -1)
#define ATOI_NULL_HANDLED_DEF(x, defaultVal) (x ? atoi(x) : defaultVal)
+#if defined(ANDROID_MULTI_SIM)
+#define CALL_ONREQUEST(a, b, c, d, e) \
+ s_vendorFunctions->onRequest((a), (b), (c), (d), ((RIL_SOCKET_ID)(e)))
+#define CALL_ONSTATEREQUEST(a) s_vendorFunctions->onStateRequest((RIL_SOCKET_ID)(a))
+#else
+#define CALL_ONREQUEST(a, b, c, d, e) s_vendorFunctions->onRequest((a), (b), (c), (d))
+#define CALL_ONSTATEREQUEST(a) s_vendorFunctions->onStateRequest()
+#endif
+
RIL_RadioFunctions *s_vendorFunctions = NULL;
static CommandInfo *s_commands;
Return<void> getAvailableNetworks(int32_t serial);
+ Return<void> startNetworkScan(int32_t serial, const NetworkScanRequest& request);
+
+ Return<void> stopNetworkScan(int32_t serial);
+
Return<void> startDtmf(int32_t serial,
const ::android::hardware::hidl_string& s);
Return<void> setIndicationFilter(int32_t serial, int32_t indicationFilter);
+ Return<void> startKeepalive(int32_t serial, const KeepaliveRequest& keepalive);
+
+ Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle);
+
Return<void> setSimCardPower(int32_t serial, bool powerUp);
Return<void> setSimCardPower_1_1(int32_t serial,
const ::android::hardware::radio::V1_1::CardPowerState state);
Return<void> responseAcknowledgement();
Return<void> setCarrierInfoForImsiEncryption(int32_t serial,
- const ::android::hardware::hidl_vec<uint8_t>& carrierKey,
- const hidl_string& keyIdentifier);
+ const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& message);
void checkReturnStatus(Return<void>& ret);
};
if (pRI == NULL) {
return false;
}
- s_vendorFunctions->onRequest(request, NULL, 0, pRI);
+ CALL_ONREQUEST(request, NULL, 0, pRI, slotId);
return true;
}
return false;
}
- s_vendorFunctions->onRequest(request, pString, sizeof(char *), pRI);
+ CALL_ONREQUEST(request, pString, sizeof(char *), pRI, slotId);
memsetAndFreeStrings(1, pString);
return true;
}
va_end(ap);
- s_vendorFunctions->onRequest(request, pStrings, countStrings * sizeof(char *), pRI);
+ CALL_ONREQUEST(request, pStrings, countStrings * sizeof(char *), pRI, slotId);
if (pStrings != NULL) {
for (int i = 0 ; i < countStrings ; i++) {
}
}
- s_vendorFunctions->onRequest(request, pStrings, countStrings * sizeof(char *), pRI);
+ CALL_ONREQUEST(request, pStrings, countStrings * sizeof(char *), pRI, slotId);
if (pStrings != NULL) {
for (int i = 0 ; i < countStrings ; i++) {
}
va_end(ap);
- s_vendorFunctions->onRequest(request, pInts, countInts * sizeof(int), pRI);
+ CALL_ONREQUEST(request, pInts, countInts * sizeof(int), pRI, slotId);
if (pInts != NULL) {
#ifdef MEMSET_FREED
return false;
}
- s_vendorFunctions->onRequest(request, &cf, sizeof(cf), pRI);
+ CALL_ONREQUEST(request, &cf, sizeof(cf), pRI, slotId);
memsetAndFreeStrings(1, cf.number);
const uint8_t *uData = rawBytes.data();
- s_vendorFunctions->onRequest(request, (void *) uData, rawBytes.size(), pRI);
+ CALL_ONREQUEST(request, (void *) uData, rawBytes.size(), pRI, slotId);
return true;
}
return false;
}
- s_vendorFunctions->onRequest(request, &apdu, sizeof(apdu), pRI);
+ CALL_ONREQUEST(request, &apdu, sizeof(apdu), pRI, slotId);
memsetAndFreeStrings(1, apdu.data);
dial.uusInfo = &uusInfo;
}
- s_vendorFunctions->onRequest(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI);
+ CALL_ONREQUEST(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI, mSlotId);
memsetAndFreeStrings(2, dial.address, uusInfo.uusData);
return Void();
}
- s_vendorFunctions->onRequest(RIL_REQUEST_SIM_IO, &rilIccIo, sizeof(rilIccIo), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_SIM_IO, &rilIccIo, sizeof(rilIccIo), pRI, mSlotId);
memsetAndFreeStrings(4, rilIccIo.path, rilIccIo.data, rilIccIo.pin2, rilIccIo.aidPtr);
RLOGD("setBarringPassword: serial %d", serial);
#endif
dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_BARRING_PASSWORD,
- 2, oldPassword.c_str(), newPassword.c_str());
+ 3, facility.c_str(), oldPassword.c_str(), newPassword.c_str());
return Void();
}
return Void();
}
+Return<void> RadioImpl::startNetworkScan(int32_t serial, const NetworkScanRequest& request) {
+#if VDBG
+ RLOGD("startNetworkScan: serial %d", serial);
+#endif
+
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_START_NETWORK_SCAN);
+ if (pRI == NULL) {
+ return Void();
+ }
+
+ if (request.specifiers.size() > MAX_RADIO_ACCESS_NETWORKS) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+
+ RIL_NetworkScanRequest scan_request = {};
+
+ scan_request.type = (RIL_ScanType) request.type;
+ scan_request.interval = request.interval;
+ scan_request.specifiers_length = request.specifiers.size();
+ for (size_t i = 0; i < request.specifiers.size(); ++i) {
+ if (request.specifiers[i].geranBands.size() > MAX_BANDS ||
+ request.specifiers[i].utranBands.size() > MAX_BANDS ||
+ request.specifiers[i].eutranBands.size() > MAX_BANDS ||
+ request.specifiers[i].channels.size() > MAX_CHANNELS) {
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+ const ::android::hardware::radio::V1_1::RadioAccessSpecifier& ras_from =
+ request.specifiers[i];
+ RIL_RadioAccessSpecifier& ras_to = scan_request.specifiers[i];
+
+ ras_to.radio_access_network = (RIL_RadioAccessNetworks) ras_from.radioAccessNetwork;
+ ras_to.channels_length = ras_from.channels.size();
+
+ std::copy(ras_from.channels.begin(), ras_from.channels.end(), ras_to.channels);
+ const std::vector<uint32_t> * bands = nullptr;
+ switch (request.specifiers[i].radioAccessNetwork) {
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::GERAN:
+ ras_to.bands_length = ras_from.geranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.geranBands;
+ break;
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::UTRAN:
+ ras_to.bands_length = ras_from.utranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.utranBands;
+ break;
+ case ::android::hardware::radio::V1_1::RadioAccessNetworks::EUTRAN:
+ ras_to.bands_length = ras_from.eutranBands.size();
+ bands = (std::vector<uint32_t> *) &ras_from.eutranBands;
+ break;
+ default:
+ sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS);
+ return Void();
+ }
+ // safe to copy to geran_bands because it's a union member
+ std::memcpy(&ras_to.bands.geran_bands, bands, ras_to.bands_length * sizeof(uint32_t));
+ }
+
+ s_vendorFunctions->onRequest(
+ RIL_REQUEST_START_NETWORK_SCAN, &scan_request, sizeof(scan_request), pRI);
+
+ return Void();
+}
+
+Return<void> RadioImpl::stopNetworkScan(int32_t serial) {
+#if VDBG
+ RLOGD("stopNetworkScan: serial %d", serial);
+#endif
+ dispatchVoid(serial, mSlotId, RIL_REQUEST_STOP_NETWORK_SCAN);
+ return Void();
+}
+
Return<void> RadioImpl::startDtmf(int32_t serial, const hidl_string& s) {
#if VDBG
RLOGD("startDtmf: serial %d", serial);
return Void();
}
- s_vendorFunctions->onRequest(RIL_REQUEST_WRITE_SMS_TO_SIM, &args, sizeof(args), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_WRITE_SMS_TO_SIM, &args, sizeof(args), pRI, mSlotId);
memsetAndFreeStrings(2, args.smsc, args.pdu);
RIL_CDMA_SMS_Message rcsm = {};
constructCdmaSms(rcsm, sms);
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm), pRI, mSlotId);
return Void();
}
rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) smsAck.errorClass;
rcsa.uSMSCauseCode = smsAck.smsCauseCode;
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa), pRI, mSlotId);
return Void();
}
gsmBci[i].selected = BOOL_TO_INT(configInfo[i].selected);
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, gsmBciPtrs,
- num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, gsmBciPtrs,
+ num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), pRI, mSlotId);
return Void();
}
cdmaBci[i].selected = BOOL_TO_INT(configInfo[i].selected);
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, cdmaBciPtrs,
- num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, cdmaBciPtrs,
+ num * sizeof(RIL_CDMA_BroadcastSmsConfigInfo *), pRI, mSlotId);
return Void();
}
rcsw.status = (int) cdmaSms.status;
constructCdmaSms(rcsw.message, cdmaSms.message);
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rcsw, sizeof(rcsw), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsw, sizeof(rcsw), pRI, mSlotId);
return Void();
}
if (s_vendorFunctions->version <= 14) {
RIL_InitialAttachApn iaa = {};
- if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
- return Void();
+ if (dataProfileInfo.apn.size() == 0) {
+ iaa.apn = (char *) calloc(1, sizeof(char));
+ if (iaa.apn == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+ iaa.apn[0] = '\0';
+ } else {
+ if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
+ return Void();
+ }
}
const hidl_string &protocol =
return Void();
}
- s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI, mSlotId);
memsetAndFreeStrings(4, iaa.apn, iaa.protocol, iaa.username, iaa.password);
} else {
RIL_InitialAttachApn_v15 iaa = {};
- if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
- return Void();
+ if (dataProfileInfo.apn.size() == 0) {
+ iaa.apn = (char *) calloc(1, sizeof(char));
+ if (iaa.apn == NULL) {
+ RLOGE("Memory allocation failed for request %s",
+ requestToString(pRI->pCI->requestNumber));
+ sendErrorResponse(pRI, RIL_E_NO_MEMORY);
+ return Void();
+ }
+ iaa.apn[0] = '\0';
+ } else {
+ if (!copyHidlStringToRil(&iaa.apn, dataProfileInfo.apn, pRI)) {
+ return Void();
+ }
}
+
if (!copyHidlStringToRil(&iaa.protocol, dataProfileInfo.protocol, pRI)) {
memsetAndFreeStrings(1, iaa.apn);
return Void();
return Void();
}
- s_vendorFunctions->onRequest(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_SET_INITIAL_ATTACH_APN, &iaa, sizeof(iaa), pRI, mSlotId);
memsetAndFreeStrings(6, iaa.apn, iaa.protocol, iaa.roamingProtocol, iaa.username,
iaa.password, iaa.mvnoMatchData);
}
rism.message.gsmMessage = pStrings;
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) +
- sizeof(uint8_t) + sizeof(int32_t) + dataLen, pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) +
+ sizeof(uint8_t) + sizeof(int32_t) + dataLen, pRI, pRI->socket_id);
for (int i = 0 ; i < countStrings ; i++) {
memsetAndFreeStrings(1, pStrings[i]);
constructCdmaSms(rcsm, message.cdmaMessage[0]);
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) +
- sizeof(uint8_t) + sizeof(int32_t) + sizeof(rcsm), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rism, sizeof(RIL_RadioTechnologyFamily) +
+ sizeof(uint8_t) + sizeof(int32_t) + sizeof(rcsm), pRI, pRI->socket_id);
return true;
}
return Void();
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, ¶ms, sizeof(params), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, ¶ms, sizeof(params), pRI, mSlotId);
memsetAndFreeStrings(1, params.aidPtr);
}
RIL_NV_ReadItem nvri = {};
nvri.itemID = (RIL_NV_Item) itemId;
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &nvri, sizeof(nvri), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &nvri, sizeof(nvri), pRI, mSlotId);
return Void();
}
return Void();
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &nvwi, sizeof(nvwi), pRI, mSlotId);
memsetAndFreeStrings(1, nvwi.value);
return Void();
rilUiccSub.sub_type = (RIL_SubscriptionType) uiccSub.subType;
rilUiccSub.act_status = (RIL_UiccSubActStatus) uiccSub.actStatus;
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rilUiccSub, sizeof(rilUiccSub), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rilUiccSub, sizeof(rilUiccSub), pRI, mSlotId);
return Void();
}
return Void();
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &pf, sizeof(pf), pRI, mSlotId);
memsetAndFreeStrings(2, pf.authData, pf.aid);
return Void();
dataProfiles[i].enabled = BOOL_TO_INT(profiles[i].enabled);
}
- s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
- num * sizeof(RIL_DataProfileInfo *), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
+ num * sizeof(RIL_DataProfileInfo *), pRI, mSlotId);
freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 4,
&RIL_DataProfileInfo::apn, &RIL_DataProfileInfo::protocol,
pRI)) {
success = false;
}
-
if (success && !copyHidlStringToRil(&dataProfiles[i].mvnoMatchData,
profiles[i].mvnoMatchData, pRI)) {
success = false;
dataProfiles[i].mtu = profiles[i].mtu;
}
- s_vendorFunctions->onRequest(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
- num * sizeof(RIL_DataProfileInfo_v15 *), pRI);
+ CALL_ONREQUEST(RIL_REQUEST_SET_DATA_PROFILE, dataProfilePtrs,
+ num * sizeof(RIL_DataProfileInfo_v15 *), pRI, mSlotId);
freeSetDataProfileData(num, dataProfiles, dataProfilePtrs, 6,
&RIL_DataProfileInfo_v15::apn, &RIL_DataProfileInfo_v15::protocol,
rilRc.status = (int) rc.status;
strncpy(rilRc.logicalModemUuid, rc.logicalModemUuid.c_str(), MAX_UUID_LENGTH);
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &rilRc, sizeof(rilRc), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &rilRc, sizeof(rilRc), pRI, mSlotId);
return Void();
}
excludedCarriers[i].match_data = carriers.excludedCarriers[i].matchData.c_str();
}
- s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &cr, sizeof(RIL_CarrierRestrictions), pRI);
+ CALL_ONREQUEST(pRI->pCI->requestNumber, &cr, sizeof(RIL_CarrierRestrictions), pRI, mSlotId);
#ifdef MEMSET_FREED
memset(allowedCarriers, 0, cr.len_allowed_carriers * sizeof(RIL_Carrier));
}
Return<void> RadioImpl::setCarrierInfoForImsiEncryption(int32_t serial,
- const ::android::hardware::hidl_vec<uint8_t>& carrierKey,
- const hidl_string& keyIdentifier) {
+ const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& data) {
RLOGD("setCarrierInfoForImsiEncryption: serial %d", serial);
- dispatchRaw(serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, carrierKey);
+ RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION);
+ RIL_CarrierInfoForImsiEncryption imsiEncryption = {};
+
+ if (!copyHidlStringToRil(&imsiEncryption.mnc, data.mnc, pRI)) {
+ return Void();
+ }
+ if (!copyHidlStringToRil(&imsiEncryption.mcc, data.mcc, pRI)) {
+ memsetAndFreeStrings(1, imsiEncryption.mnc);
+ return Void();
+ }
+ if (!copyHidlStringToRil(&imsiEncryption.keyIdentifier, data.keyIdentifier, pRI)) {
+ memsetAndFreeStrings(2, imsiEncryption.mnc, imsiEncryption.mcc);
+ return Void();
+ }
+ int32_t lSize = data.carrierKey.size();
+ imsiEncryption.carrierKey = new uint8_t[lSize];
+ memcpy(imsiEncryption.carrierKey, data.carrierKey.data(), lSize);
+ imsiEncryption.expirationTime = data.expirationTime;
+ s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &imsiEncryption, sizeof(RIL_CarrierInfoForImsiEncryption), pRI);
+ delete(imsiEncryption.carrierKey);
+ return Void();
+}
+
+Return<void> RadioImpl::startKeepalive(int32_t serial, const KeepaliveRequest& keepalive) {
+ RLOGD("startKeepalive: serial %d", serial);
+ return Void();
+}
+
+Return<void> RadioImpl::stopKeepalive(int32_t serial, int32_t sessionHandle) {
+ RLOGD("stopKeepalive: serial %d", serial);
return Void();
}
+
/***************************************************************************************************
* RESPONSE FUNCTIONS
* Functions above are used for requests going from framework to vendor code. The ones below are
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
CardStatus cardStatus = {};
- if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)) {
+ RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
+ if (response == NULL || responseLen != sizeof(RIL_CardStatus_v6)
+ || p_cur->gsm_umts_subscription_app_index >= p_cur->num_applications
+ || p_cur->cdma_subscription_app_index >= p_cur->num_applications
+ || p_cur->ims_subscription_app_index >= p_cur->num_applications) {
RLOGE("getIccCardStatusResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
- RIL_CardStatus_v6 *p_cur = ((RIL_CardStatus_v6 *) response);
cardStatus.cardState = (CardState) p_cur->card_state;
cardStatus.universalPinState = (PinState) p_cur->universal_pin_state;
cardStatus.gsmUmtsSubscriptionAppIndex = p_cur->gsm_umts_subscription_app_index;
int ret = responseIntOrEmpty(responseInfo, serial, responseType, e, response, responseLen);
Return<void> retStatus = radioService[slotId]->mRadioResponse->
supplyIccPinForAppResponse(responseInfo, ret);
+ RLOGE("supplyIccPinForAppResponse: amit ret %d", ret);
radioService[slotId]->checkReturnStatus(retStatus);
} else {
RLOGE("supplyIccPinForAppResponse: radioService[%d]->mRadioResponse == NULL",
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<Call> calls;
- if (response == NULL || (responseLen % sizeof(RIL_Call *)) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || (responseLen % sizeof(RIL_Call *)) != 0) {
RLOGE("getCurrentCallsResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
return -1;
}
+int convertResponseHexStringEntryToInt(char **response, int index, int numStrings) {
+ const int hexBase = 16;
+ if ((response != NULL) && (numStrings > index) && (response[index] != NULL)) {
+ return strtol(response[index], NULL, hexBase);
+ }
+
+ return -1;
+}
+
+/* Fill Cell Identity info from Voice Registration State Response.
+ * This fucntion is applicable only for RIL Version < 15.
+ * Response is a "char **".
+ * First and Second entries are in hex string format
+ * and rest are integers represented in ascii format. */
void fillCellIdentityFromVoiceRegStateResponseString(CellIdentity &cellIdentity,
int numStrings, char** response) {
switch(rilCellIdentity.cellInfoType) {
case RIL_CELL_INFO_TYPE_GSM: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityGsm.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityGsm.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_WCDMA: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityWcdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityWcdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
rilCellIdentity.cellIdentityWcdma.psc =
convertResponseStringEntryToInt(response, 14, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityTdscdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityTdscdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
}
case RIL_CELL_INFO_TYPE_LTE:{
+ /* valid TAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityLte.tac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityLte.ci =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
fillCellIdentityResponse(cellIdentity, rilCellIdentity);
}
+/* Fill Cell Identity info from Data Registration State Response.
+ * This fucntion is applicable only for RIL Version < 15.
+ * Response is a "char **".
+ * First and Second entries are in hex string format
+ * and rest are integers represented in ascii format. */
void fillCellIdentityFromDataRegStateResponseString(CellIdentity &cellIdentity,
int numStrings, char** response) {
rilCellIdentity.cellInfoType = getCellInfoTypeRadioTechnology(response[3]);
switch(rilCellIdentity.cellInfoType) {
case RIL_CELL_INFO_TYPE_GSM: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityGsm.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityGsm.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_WCDMA: {
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityWcdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityWcdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_TD_SCDMA:{
+ /* valid LAC are hexstrings in the range 0x0000 - 0xffff */
rilCellIdentity.cellIdentityTdscdma.lac =
- convertResponseStringEntryToInt(response, 1, numStrings);
+ convertResponseHexStringEntryToInt(response, 1, numStrings);
+
+ /* valid CID are hexstrings in the range 0x00000000 - 0xffffffff */
rilCellIdentity.cellIdentityTdscdma.cid =
- convertResponseStringEntryToInt(response, 2, numStrings);
+ convertResponseHexStringEntryToInt(response, 2, numStrings);
break;
}
case RIL_CELL_INFO_TYPE_LTE: {
populateResponseInfo(responseInfo, serial, responseType, e);
SetupDataCallResult result = {};
- if (response == NULL || responseLen != sizeof(RIL_Data_Call_Response_v11)) {
- RLOGE("setupDataCallResponse: Invalid response");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response == NULL || (responseLen % sizeof(RIL_Data_Call_Response_v11)) != 0) {
+ if (response != NULL) {
+ RLOGE("setupDataCallResponse: Invalid response");
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
result.status = DataCallFailCause::ERROR_UNSPECIFIED;
result.type = hidl_string();
result.ifname = hidl_string();
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CallForwardInfo> callForwardInfos;
- if (response == NULL || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CallForwardInfo *) != 0) {
RLOGE("getCallForwardStatusResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<OperatorInfo> networks;
- if (response == NULL || responseLen % (4 * sizeof(char *))!= 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % (4 * sizeof(char *))!= 0) {
RLOGE("getAvailableNetworksResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<SetupDataCallResult> ret;
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("getDataCallListResponse: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
RadioResponseInfo responseInfo = {};
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<RadioBandMode> modes;
- if (response == NULL || responseLen % sizeof(int) != 0) {
+ if ((response == NULL && responseLen != 0)|| responseLen % sizeof(int) != 0) {
RLOGE("getAvailableBandModesResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<NeighboringCell> cells;
- if (response == NULL || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_NeighboringCell *) != 0) {
RLOGE("getNeighboringCidsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<GsmBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_GSM_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getGsmBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CdmaBroadcastSmsConfigInfo> configs;
- if (response == NULL || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CDMA_BroadcastSmsConfigInfo *) != 0) {
RLOGE("getCdmaBroadcastConfigResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<CellInfo> ret;
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("getCellInfoListResponse: Invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
int numInts = responseLen / sizeof(int);
if (response == NULL || responseLen % sizeof(int) != 0) {
RLOGE("iccOpenLogicalChannelResponse Invalid response: NULL");
- if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ if (response != NULL) {
+ if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
+ }
} else {
int *pInt = (int *) response;
channelId = pInt[0];
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<HardwareConfig> result;
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
return 0;
}
+int radio::startNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+#if VDBG
+ RLOGD("startNetworkScanResponse: serial %d", serial);
+#endif
+
+ if (radioService[slotId]->mRadioResponse != NULL) {
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus = radioResponseV1_1->startNetworkScanResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGD("startNetworkScanResponse: ret.isOK() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("startNetworkScanResponse: radioService[%d]->mRadioResponse == NULL", slotId);
+ }
+
+ return 0;
+}
+
+int radio::stopNetworkScanResponse(int slotId, int responseType, int serial, RIL_Errno e,
+ void *response, size_t responseLen) {
+#if VDBG
+ RLOGD("stopNetworkScanResponse: serial %d", serial);
+#endif
+
+ if (radioService[slotId]->mRadioResponse != NULL) {
+ RadioResponseInfo responseInfo = {};
+ populateResponseInfo(responseInfo, serial, responseType, e);
+ Return<sp<::android::hardware::radio::V1_1::IRadioResponse>> ret =
+ ::android::hardware::radio::V1_1::IRadioResponse::castFrom(
+ radioService[slotId]->mRadioResponse);
+ if (ret.isOk()) {
+ sp<::android::hardware::radio::V1_1::IRadioResponse> radioResponseV1_1 = ret;
+ Return<void> retStatus = radioResponseV1_1->stopNetworkScanResponse(responseInfo);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGD("stopNetworkScanResponse: ret.isOK() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("stopNetworkScanResponse: radioService[%d]->mRadioResponse == NULL", slotId);
+ }
+
+ return 0;
+}
+
int radio::sendRequestRawResponse(int slotId,
int responseType, int serial, RIL_Errno e,
void *response, size_t responseLen) {
populateResponseInfo(responseInfo, serial, responseType, e);
hidl_vec<hidl_string> data;
- if (response == NULL || responseLen % sizeof(char *) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(char *) != 0) {
RLOGE("sendRequestStringsResponse Invalid response: NULL");
if (e == RIL_E_SUCCESS) responseInfo.error = RadioError::INVALID_RESPONSE;
} else {
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- RadioState radioState = (RadioState) s_vendorFunctions->onStateRequest();
+ RadioState radioState =
+ (RadioState) CALL_ONSTATEREQUEST(slotId);
RLOGD("radioStateChangedInd: radioState %d", radioState);
Return<void> retStatus = radioService[slotId]->mRadioIndication->radioStateChanged(
convertIntToRadioIndicationType(indicationType), radioState);
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_Data_Call_Response_v11) != 0) {
RLOGE("dataCallListChangedInd: invalid response");
return 0;
}
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
+ if ((response == NULL && responseLen != 0) || responseLen % sizeof(RIL_CellInfo_v12) != 0) {
RLOGE("cellInfoListInd: invalid response");
return 0;
}
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {
if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
- if (response == NULL || responseLen % sizeof(RIL_HardwareConfig) != 0) {
+ if ((response == NULL && responseLen != 0)
+ || responseLen % sizeof(RIL_HardwareConfig) != 0) {
RLOGE("hardwareConfigChangedInd: invalid response");
return 0;
}
return 0;
}
+int radio::networkScanResultInd(int slotId,
+ int indicationType, int token, RIL_Errno e, void *response,
+ size_t responseLen) {
+#if VDBG
+ RLOGD("networkScanResultInd");
+#endif
+ if (radioService[slotId] != NULL && radioService[slotId]->mRadioIndication != NULL) {
+ if (response == NULL || responseLen == 0) {
+ RLOGE("networkScanResultInd: invalid response");
+ return 0;
+ }
+ RLOGD("networkScanResultInd");
+
+#if VDBG
+ RLOGD("networkScanResultInd");
+#endif
+
+ Return<sp<::android::hardware::radio::V1_1::IRadioIndication>> ret =
+ ::android::hardware::radio::V1_1::IRadioIndication::castFrom(
+ radioService[slotId]->mRadioIndication);
+ if (ret.isOk()) {
+ RIL_NetworkScanResult *networkScanResult = (RIL_NetworkScanResult *) response;
+
+ ::android::hardware::radio::V1_1::NetworkScanResult result;
+ result.status =
+ (::android::hardware::radio::V1_1::ScanStatus) networkScanResult->status;
+ result.error = (RadioError) e;
+ convertRilCellInfoListToHal(
+ networkScanResult->network_infos,
+ networkScanResult->network_infos_length * sizeof(RIL_CellInfo_v12),
+ result.networkInfos);
+
+ sp<::android::hardware::radio::V1_1::IRadioIndication> radioIndicationV1_1 = ret;
+ Return<void> retStatus = radioIndicationV1_1->networkScanResult(
+ convertIntToRadioIndicationType(indicationType), result);
+ radioService[slotId]->checkReturnStatus(retStatus);
+ } else {
+ RLOGE("networkScanResultInd: ret.isOk() == false for radioService[%d]", slotId);
+ }
+ } else {
+ RLOGE("networkScanResultInd: radioService[%d]->mRadioIndication == NULL", slotId);
+ }
+ return 0;
+}
+
int radio::carrierInfoForImsiEncryption(int slotId,
int indicationType, int token, RIL_Errno e, void *response,
size_t responseLen) {