HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Oreo
|
8.0.0_r4
下载
查看原文件
收藏
根目录
hardware
ril
libril
ril_service.cpp
/* * Copyright (c) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "RILC" #include
#include
#include
#include
#include
#include
#include
#include
#define INVALID_HEX_CHAR 16 // Enable verbose logging #define VDBG 0 using namespace android::hardware::radio::V1_0; using namespace android::hardware::radio::deprecated::V1_0; using ::android::hardware::configureRpcThreadpool; using ::android::hardware::joinRpcThreadpool; using ::android::hardware::Return; using ::android::hardware::hidl_string; using ::android::hardware::hidl_vec; using ::android::hardware::hidl_array; using ::android::hardware::Void; using android::CommandInfo; using android::RequestInfo; using android::requestToString; using android::sp; #define BOOL_TO_INT(x) (x ? 1 : 0) #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; struct RadioImpl; struct OemHookImpl; #if (SIM_COUNT >= 2) sp
radioService[SIM_COUNT]; sp
oemHookService[SIM_COUNT]; // counter used for synchronization. It is incremented every time response callbacks are updated. volatile int32_t mCounterRadio[SIM_COUNT]; volatile int32_t mCounterOemHook[SIM_COUNT]; #else sp
radioService[1]; sp
oemHookService[1]; // counter used for synchronization. It is incremented every time response callbacks are updated. volatile int32_t mCounterRadio[1]; volatile int32_t mCounterOemHook[1]; #endif static pthread_rwlock_t radioServiceRwlock = PTHREAD_RWLOCK_INITIALIZER; #if (SIM_COUNT >= 2) static pthread_rwlock_t radioServiceRwlock2 = PTHREAD_RWLOCK_INITIALIZER; #if (SIM_COUNT >= 3) static pthread_rwlock_t radioServiceRwlock3 = PTHREAD_RWLOCK_INITIALIZER; #if (SIM_COUNT >= 4) static pthread_rwlock_t radioServiceRwlock4 = PTHREAD_RWLOCK_INITIALIZER; #endif #endif #endif void convertRilHardwareConfigListToHal(void *response, size_t responseLen, hidl_vec
& records); void convertRilRadioCapabilityToHal(void *response, size_t responseLen, RadioCapability& rc); void convertRilLceDataInfoToHal(void *response, size_t responseLen, LceDataInfo& lce); void convertRilSignalStrengthToHal(void *response, size_t responseLen, SignalStrength& signalStrength); void convertRilDataCallToHal(RIL_Data_Call_Response_v11 *dcResponse, SetupDataCallResult& dcResult); void convertRilDataCallListToHal(void *response, size_t responseLen, hidl_vec
& dcResultList); void convertRilCellInfoListToHal(void *response, size_t responseLen, hidl_vec
& records); struct RadioImpl : public IRadio { int32_t mSlotId; sp
mRadioResponse; sp
mRadioIndication; Return
setResponseFunctions( const ::android::sp
& radioResponse, const ::android::sp
& radioIndication); Return
getIccCardStatus(int32_t serial); Return
supplyIccPinForApp(int32_t serial, const hidl_string& pin, const hidl_string& aid); Return
supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin, const hidl_string& aid); Return
supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, const hidl_string& aid); Return
supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, const hidl_string& pin2, const hidl_string& aid); Return
changeIccPinForApp(int32_t serial, const hidl_string& oldPin, const hidl_string& newPin, const hidl_string& aid); Return
changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, const hidl_string& newPin2, const hidl_string& aid); Return
supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin); Return
getCurrentCalls(int32_t serial); Return
dial(int32_t serial, const Dial& dialInfo); Return
getImsiForApp(int32_t serial, const ::android::hardware::hidl_string& aid); Return
hangup(int32_t serial, int32_t gsmIndex); Return
hangupWaitingOrBackground(int32_t serial); Return
hangupForegroundResumeBackground(int32_t serial); Return
switchWaitingOrHoldingAndActive(int32_t serial); Return
conference(int32_t serial); Return
rejectCall(int32_t serial); Return
getLastCallFailCause(int32_t serial); Return
getSignalStrength(int32_t serial); Return
getVoiceRegistrationState(int32_t serial); Return
getDataRegistrationState(int32_t serial); Return
getOperator(int32_t serial); Return
setRadioPower(int32_t serial, bool on); Return
sendDtmf(int32_t serial, const ::android::hardware::hidl_string& s); Return
sendSms(int32_t serial, const GsmSmsMessage& message); Return
sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message); Return
setupDataCall(int32_t serial, RadioTechnology radioTechnology, const DataProfileInfo& profileInfo, bool modemCognitive, bool roamingAllowed, bool isRoaming); Return
iccIOForApp(int32_t serial, const IccIo& iccIo); Return
sendUssd(int32_t serial, const ::android::hardware::hidl_string& ussd); Return
cancelPendingUssd(int32_t serial); Return
getClir(int32_t serial); Return
setClir(int32_t serial, int32_t status); Return
getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo); Return
setCallForward(int32_t serial, const CallForwardInfo& callInfo); Return
getCallWaiting(int32_t serial, int32_t serviceClass); Return
setCallWaiting(int32_t serial, bool enable, int32_t serviceClass); Return
acknowledgeLastIncomingGsmSms(int32_t serial, bool success, SmsAcknowledgeFailCause cause); Return
acceptCall(int32_t serial); Return
deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown); Return
getFacilityLockForApp(int32_t serial, const ::android::hardware::hidl_string& facility, const ::android::hardware::hidl_string& password, int32_t serviceClass, const ::android::hardware::hidl_string& appId); Return
setFacilityLockForApp(int32_t serial, const ::android::hardware::hidl_string& facility, bool lockState, const ::android::hardware::hidl_string& password, int32_t serviceClass, const ::android::hardware::hidl_string& appId); Return
setBarringPassword(int32_t serial, const ::android::hardware::hidl_string& facility, const ::android::hardware::hidl_string& oldPassword, const ::android::hardware::hidl_string& newPassword); Return
getNetworkSelectionMode(int32_t serial); Return
setNetworkSelectionModeAutomatic(int32_t serial); Return
setNetworkSelectionModeManual(int32_t serial, const ::android::hardware::hidl_string& operatorNumeric); Return
getAvailableNetworks(int32_t serial); Return
startDtmf(int32_t serial, const ::android::hardware::hidl_string& s); Return
stopDtmf(int32_t serial); Return
getBasebandVersion(int32_t serial); Return
separateConnection(int32_t serial, int32_t gsmIndex); Return
setMute(int32_t serial, bool enable); Return
getMute(int32_t serial); Return
getClip(int32_t serial); Return
getDataCallList(int32_t serial); Return
setSuppServiceNotifications(int32_t serial, bool enable); Return
writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWriteArgs); Return
deleteSmsOnSim(int32_t serial, int32_t index); Return
setBandMode(int32_t serial, RadioBandMode mode); Return
getAvailableBandModes(int32_t serial); Return
sendEnvelope(int32_t serial, const ::android::hardware::hidl_string& command); Return
sendTerminalResponseToSim(int32_t serial, const ::android::hardware::hidl_string& commandResponse); Return
handleStkCallSetupRequestFromSim(int32_t serial, bool accept); Return
explicitCallTransfer(int32_t serial); Return
setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType); Return
getPreferredNetworkType(int32_t serial); Return
getNeighboringCids(int32_t serial); Return
setLocationUpdates(int32_t serial, bool enable); Return
setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub); Return
setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type); Return
getCdmaRoamingPreference(int32_t serial); Return
setTTYMode(int32_t serial, TtyMode mode); Return
getTTYMode(int32_t serial); Return
setPreferredVoicePrivacy(int32_t serial, bool enable); Return
getPreferredVoicePrivacy(int32_t serial); Return
sendCDMAFeatureCode(int32_t serial, const ::android::hardware::hidl_string& featureCode); Return
sendBurstDtmf(int32_t serial, const ::android::hardware::hidl_string& dtmf, int32_t on, int32_t off); Return
sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms); Return
acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck); Return
getGsmBroadcastConfig(int32_t serial); Return
setGsmBroadcastConfig(int32_t serial, const hidl_vec
& configInfo); Return
setGsmBroadcastActivation(int32_t serial, bool activate); Return
getCdmaBroadcastConfig(int32_t serial); Return
setCdmaBroadcastConfig(int32_t serial, const hidl_vec
& configInfo); Return
setCdmaBroadcastActivation(int32_t serial, bool activate); Return
getCDMASubscription(int32_t serial); Return
writeSmsToRuim(int32_t serial, const CdmaSmsWriteArgs& cdmaSms); Return
deleteSmsOnRuim(int32_t serial, int32_t index); Return
getDeviceIdentity(int32_t serial); Return
exitEmergencyCallbackMode(int32_t serial); Return
getSmscAddress(int32_t serial); Return
setSmscAddress(int32_t serial, const ::android::hardware::hidl_string& smsc); Return
reportSmsMemoryStatus(int32_t serial, bool available); Return
reportStkServiceIsRunning(int32_t serial); Return
getCdmaSubscriptionSource(int32_t serial); Return
requestIsimAuthentication(int32_t serial, const ::android::hardware::hidl_string& challenge); Return
acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, const ::android::hardware::hidl_string& ackPdu); Return
sendEnvelopeWithStatus(int32_t serial, const ::android::hardware::hidl_string& contents); Return
getVoiceRadioTechnology(int32_t serial); Return
getCellInfoList(int32_t serial); Return
setCellInfoListRate(int32_t serial, int32_t rate); Return
setInitialAttachApn(int32_t serial, const DataProfileInfo& dataProfileInfo, bool modemCognitive, bool isRoaming); Return
getImsRegistrationState(int32_t serial); Return
sendImsSms(int32_t serial, const ImsSmsMessage& message); Return
iccTransmitApduBasicChannel(int32_t serial, const SimApdu& message); Return
iccOpenLogicalChannel(int32_t serial, const ::android::hardware::hidl_string& aid, int32_t p2); Return
iccCloseLogicalChannel(int32_t serial, int32_t channelId); Return
iccTransmitApduLogicalChannel(int32_t serial, const SimApdu& message); Return
nvReadItem(int32_t serial, NvItem itemId); Return
nvWriteItem(int32_t serial, const NvWriteItem& item); Return
nvWriteCdmaPrl(int32_t serial, const ::android::hardware::hidl_vec
& prl); Return
nvResetConfig(int32_t serial, ResetNvType resetType); Return
setUiccSubscription(int32_t serial, const SelectUiccSub& uiccSub); Return
setDataAllowed(int32_t serial, bool allow); Return
getHardwareConfig(int32_t serial); Return
requestIccSimAuthentication(int32_t serial, int32_t authContext, const ::android::hardware::hidl_string& authData, const ::android::hardware::hidl_string& aid); Return
setDataProfile(int32_t serial, const ::android::hardware::hidl_vec
& profiles, bool isRoaming); Return
requestShutdown(int32_t serial); Return
getRadioCapability(int32_t serial); Return
setRadioCapability(int32_t serial, const RadioCapability& rc); Return
startLceService(int32_t serial, int32_t reportInterval, bool pullMode); Return
stopLceService(int32_t serial); Return
pullLceData(int32_t serial); Return
getModemActivityInfo(int32_t serial); Return
setAllowedCarriers(int32_t serial, bool allAllowed, const CarrierRestrictions& carriers); Return
getAllowedCarriers(int32_t serial); Return
sendDeviceState(int32_t serial, DeviceStateType deviceStateType, bool state); Return
setIndicationFilter(int32_t serial, int32_t indicationFilter); Return
setSimCardPower(int32_t serial, bool powerUp); Return
responseAcknowledgement(); void checkReturnStatus(Return
& ret); }; struct OemHookImpl : public IOemHook { int32_t mSlotId; sp
mOemHookResponse; sp
mOemHookIndication; Return
setResponseFunctions( const ::android::sp
& oemHookResponse, const ::android::sp
& oemHookIndication); Return
sendRequestRaw(int32_t serial, const ::android::hardware::hidl_vec
& data); Return
sendRequestStrings(int32_t serial, const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& data); }; void memsetAndFreeStrings(int numPointers, ...) { va_list ap; va_start(ap, numPointers); for (int i = 0; i < numPointers; i++) { char *ptr = va_arg(ap, char *); if (ptr) { #ifdef MEMSET_FREED // TODO: Should pass in the maximum length of the string memsetString(ptr); #endif free(ptr); } } va_end(ap); } void sendErrorResponse(RequestInfo *pRI, RIL_Errno err) { pRI->pCI->responseFunction((int) pRI->socket_id, (int) RadioResponseType::SOLICITED, pRI->token, err, NULL, 0); } /** * Copies over src to dest. If memory allocation fails, responseFunction() is called for the * request with error RIL_E_NO_MEMORY. * Returns true on success, and false on failure. */ bool copyHidlStringToRil(char **dest, const hidl_string &src, RequestInfo *pRI) { size_t len = src.size(); if (len == 0) { *dest = NULL; return true; } *dest = (char *) calloc(len + 1, sizeof(char)); if (*dest == NULL) { RLOGE("Memory allocation failed for request %s", requestToString(pRI->pCI->requestNumber)); sendErrorResponse(pRI, RIL_E_NO_MEMORY); return false; } strncpy(*dest, src.c_str(), len + 1); return true; } hidl_string convertCharPtrToHidlString(const char *ptr) { hidl_string ret; if (ptr != NULL) { // TODO: replace this with strnlen ret.setToExternal(ptr, strlen(ptr)); } return ret; } bool dispatchVoid(int serial, int slotId, int request) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } CALL_ONREQUEST(request, NULL, 0, pRI, slotId); return true; } bool dispatchString(int serial, int slotId, int request, const char * str) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } char *pString; if (!copyHidlStringToRil(&pString, str, pRI)) { return false; } CALL_ONREQUEST(request, pString, sizeof(char *), pRI, slotId); memsetAndFreeStrings(1, pString); return true; } bool dispatchStrings(int serial, int slotId, int request, int countStrings, ...) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } char **pStrings; pStrings = (char **)calloc(countStrings, sizeof(char *)); if (pStrings == NULL) { RLOGE("Memory allocation failed for request %s", requestToString(request)); sendErrorResponse(pRI, RIL_E_NO_MEMORY); return false; } va_list ap; va_start(ap, countStrings); for (int i = 0; i < countStrings; i++) { const char* str = va_arg(ap, const char *); if (!copyHidlStringToRil(&pStrings[i], hidl_string(str), pRI)) { va_end(ap); for (int j = 0; j < i; j++) { memsetAndFreeStrings(1, pStrings[j]); } free(pStrings); return false; } } va_end(ap); CALL_ONREQUEST(request, pStrings, countStrings * sizeof(char *), pRI, slotId); if (pStrings != NULL) { for (int i = 0 ; i < countStrings ; i++) { memsetAndFreeStrings(1, pStrings[i]); } #ifdef MEMSET_FREED memset(pStrings, 0, countStrings * sizeof(char *)); #endif free(pStrings); } return true; } bool dispatchStrings(int serial, int slotId, int request, const hidl_vec
& data) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } int countStrings = data.size(); char **pStrings; pStrings = (char **)calloc(countStrings, sizeof(char *)); if (pStrings == NULL) { RLOGE("Memory allocation failed for request %s", requestToString(request)); sendErrorResponse(pRI, RIL_E_NO_MEMORY); return false; } for (int i = 0; i < countStrings; i++) { if (!copyHidlStringToRil(&pStrings[i], data[i], pRI)) { for (int j = 0; j < i; j++) { memsetAndFreeStrings(1, pStrings[j]); } free(pStrings); return false; } } CALL_ONREQUEST(request, pStrings, countStrings * sizeof(char *), pRI, slotId); if (pStrings != NULL) { for (int i = 0 ; i < countStrings ; i++) { memsetAndFreeStrings(1, pStrings[i]); } #ifdef MEMSET_FREED memset(pStrings, 0, countStrings * sizeof(char *)); #endif free(pStrings); } return true; } bool dispatchInts(int serial, int slotId, int request, int countInts, ...) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } int *pInts = (int *)calloc(countInts, sizeof(int)); if (pInts == NULL) { RLOGE("Memory allocation failed for request %s", requestToString(request)); sendErrorResponse(pRI, RIL_E_NO_MEMORY); return false; } va_list ap; va_start(ap, countInts); for (int i = 0; i < countInts; i++) { pInts[i] = va_arg(ap, int); } va_end(ap); CALL_ONREQUEST(request, pInts, countInts * sizeof(int), pRI, slotId); if (pInts != NULL) { #ifdef MEMSET_FREED memset(pInts, 0, countInts * sizeof(int)); #endif free(pInts); } return true; } bool dispatchCallForwardStatus(int serial, int slotId, int request, const CallForwardInfo& callInfo) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } RIL_CallForwardInfo cf; cf.status = (int) callInfo.status; cf.reason = callInfo.reason; cf.serviceClass = callInfo.serviceClass; cf.toa = callInfo.toa; cf.timeSeconds = callInfo.timeSeconds; if (!copyHidlStringToRil(&cf.number, callInfo.number, pRI)) { return false; } CALL_ONREQUEST(request, &cf, sizeof(cf), pRI, slotId); memsetAndFreeStrings(1, cf.number); return true; } bool dispatchRaw(int serial, int slotId, int request, const hidl_vec
& rawBytes) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } const uint8_t *uData = rawBytes.data(); CALL_ONREQUEST(request, (void *) uData, rawBytes.size(), pRI, slotId); return true; } bool dispatchIccApdu(int serial, int slotId, int request, const SimApdu& message) { RequestInfo *pRI = android::addRequestToList(serial, slotId, request); if (pRI == NULL) { return false; } RIL_SIM_APDU apdu = {}; apdu.sessionid = message.sessionId; apdu.cla = message.cla; apdu.instruction = message.instruction; apdu.p1 = message.p1; apdu.p2 = message.p2; apdu.p3 = message.p3; if (!copyHidlStringToRil(&apdu.data, message.data, pRI)) { return false; } CALL_ONREQUEST(request, &apdu, sizeof(apdu), pRI, slotId); memsetAndFreeStrings(1, apdu.data); return true; } void checkReturnStatus(int32_t slotId, Return
& ret, bool isRadioService) { if (ret.isOk() == false) { RLOGE("checkReturnStatus: unable to call response/indication callback"); // Remote process hosting the callbacks must be dead. Reset the callback objects; // there's no other recovery to be done here. When the client process is back up, it will // call setResponseFunctions() // Caller should already hold rdlock, release that first // note the current counter to avoid overwriting updates made by another thread before // write lock is acquired. int counter = isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId]; pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(slotId); int ret = pthread_rwlock_unlock(radioServiceRwlockPtr); assert(ret == 0); // acquire wrlock ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); assert(ret == 0); // make sure the counter value has not changed if (counter == (isRadioService ? mCounterRadio[slotId] : mCounterOemHook[slotId])) { if (isRadioService) { radioService[slotId]->mRadioResponse = NULL; radioService[slotId]->mRadioIndication = NULL; } else { oemHookService[slotId]->mOemHookResponse = NULL; oemHookService[slotId]->mOemHookIndication = NULL; } isRadioService ? mCounterRadio[slotId]++ : mCounterOemHook[slotId]++; } else { RLOGE("checkReturnStatus: not resetting responseFunctions as they likely " "got updated on another thread"); } // release wrlock ret = pthread_rwlock_unlock(radioServiceRwlockPtr); assert(ret == 0); // Reacquire rdlock ret = pthread_rwlock_rdlock(radioServiceRwlockPtr); assert(ret == 0); } } void RadioImpl::checkReturnStatus(Return
& ret) { ::checkReturnStatus(mSlotId, ret, true); } Return
RadioImpl::setResponseFunctions( const ::android::sp
& radioResponseParam, const ::android::sp
& radioIndicationParam) { RLOGD("setResponseFunctions"); pthread_rwlock_t *radioServiceRwlockPtr = radio::getRadioServiceRwlock(mSlotId); int ret = pthread_rwlock_wrlock(radioServiceRwlockPtr); assert(ret == 0); mRadioResponse = radioResponseParam; mRadioIndication = radioIndicationParam; mCounterRadio[mSlotId]++; ret = pthread_rwlock_unlock(radioServiceRwlockPtr); assert(ret == 0); // client is connected. Send initial indications. android::onNewCommandConnect((RIL_SOCKET_ID) mSlotId); return Void(); } Return
RadioImpl::getIccCardStatus(int32_t serial) { #if VDBG RLOGD("getIccCardStatus: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_SIM_STATUS); return Void(); } Return
RadioImpl::supplyIccPinForApp(int32_t serial, const hidl_string& pin, const hidl_string& aid) { #if VDBG RLOGD("supplyIccPinForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN, 2, pin.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin, const hidl_string& aid) { #if VDBG RLOGD("supplyIccPukForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK, 3, puk.c_str(), pin.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, const hidl_string& aid) { #if VDBG RLOGD("supplyIccPin2ForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PIN2, 2, pin2.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, const hidl_string& pin2, const hidl_string& aid) { #if VDBG RLOGD("supplyIccPuk2ForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_SIM_PUK2, 3, puk2.c_str(), pin2.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::changeIccPinForApp(int32_t serial, const hidl_string& oldPin, const hidl_string& newPin, const hidl_string& aid) { #if VDBG RLOGD("changeIccPinForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN, 3, oldPin.c_str(), newPin.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, const hidl_string& newPin2, const hidl_string& aid) { #if VDBG RLOGD("changeIccPin2ForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_SIM_PIN2, 3, oldPin2.c_str(), newPin2.c_str(), aid.c_str()); return Void(); } Return
RadioImpl::supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) { #if VDBG RLOGD("supplyNetworkDepersonalization: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION, 1, netPin.c_str()); return Void(); } Return
RadioImpl::getCurrentCalls(int32_t serial) { #if VDBG RLOGD("getCurrentCalls: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CURRENT_CALLS); return Void(); } Return
RadioImpl::dial(int32_t serial, const Dial& dialInfo) { #if VDBG RLOGD("dial: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_DIAL); if (pRI == NULL) { return Void(); } RIL_Dial dial = {}; RIL_UUS_Info uusInfo = {}; int32_t sizeOfDial = sizeof(dial); if (!copyHidlStringToRil(&dial.address, dialInfo.address, pRI)) { return Void(); } dial.clir = (int) dialInfo.clir; if (dialInfo.uusInfo.size() != 0) { uusInfo.uusType = (RIL_UUS_Type) dialInfo.uusInfo[0].uusType; uusInfo.uusDcs = (RIL_UUS_DCS) dialInfo.uusInfo[0].uusDcs; if (dialInfo.uusInfo[0].uusData.size() == 0) { uusInfo.uusData = NULL; uusInfo.uusLength = 0; } else { if (!copyHidlStringToRil(&uusInfo.uusData, dialInfo.uusInfo[0].uusData, pRI)) { memsetAndFreeStrings(1, dial.address); return Void(); } uusInfo.uusLength = dialInfo.uusInfo[0].uusData.size(); } dial.uusInfo = &uusInfo; } CALL_ONREQUEST(RIL_REQUEST_DIAL, &dial, sizeOfDial, pRI, mSlotId); memsetAndFreeStrings(2, dial.address, uusInfo.uusData); return Void(); } Return
RadioImpl::getImsiForApp(int32_t serial, const hidl_string& aid) { #if VDBG RLOGD("getImsiForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_GET_IMSI, 1, aid.c_str()); return Void(); } Return
RadioImpl::hangup(int32_t serial, int32_t gsmIndex) { #if VDBG RLOGD("hangup: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_HANGUP, 1, gsmIndex); return Void(); } Return
RadioImpl::hangupWaitingOrBackground(int32_t serial) { #if VDBG RLOGD("hangupWaitingOrBackground: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND); return Void(); } Return
RadioImpl::hangupForegroundResumeBackground(int32_t serial) { #if VDBG RLOGD("hangupForegroundResumeBackground: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND); return Void(); } Return
RadioImpl::switchWaitingOrHoldingAndActive(int32_t serial) { #if VDBG RLOGD("switchWaitingOrHoldingAndActive: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE); return Void(); } Return
RadioImpl::conference(int32_t serial) { #if VDBG RLOGD("conference: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_CONFERENCE); return Void(); } Return
RadioImpl::rejectCall(int32_t serial) { #if VDBG RLOGD("rejectCall: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_UDUB); return Void(); } Return
RadioImpl::getLastCallFailCause(int32_t serial) { #if VDBG RLOGD("getLastCallFailCause: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_LAST_CALL_FAIL_CAUSE); return Void(); } Return
RadioImpl::getSignalStrength(int32_t serial) { #if VDBG RLOGD("getSignalStrength: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_SIGNAL_STRENGTH); return Void(); } Return
RadioImpl::getVoiceRegistrationState(int32_t serial) { #if VDBG RLOGD("getVoiceRegistrationState: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_VOICE_REGISTRATION_STATE); return Void(); } Return
RadioImpl::getDataRegistrationState(int32_t serial) { #if VDBG RLOGD("getDataRegistrationState: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_REGISTRATION_STATE); return Void(); } Return
RadioImpl::getOperator(int32_t serial) { #if VDBG RLOGD("getOperator: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_OPERATOR); return Void(); } Return
RadioImpl::setRadioPower(int32_t serial, bool on) { RLOGD("setRadioPower: serial %d on %d", serial, on); dispatchInts(serial, mSlotId, RIL_REQUEST_RADIO_POWER, 1, BOOL_TO_INT(on)); return Void(); } Return
RadioImpl::sendDtmf(int32_t serial, const hidl_string& s) { #if VDBG RLOGD("sendDtmf: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_DTMF, s.c_str()); return Void(); } Return
RadioImpl::sendSms(int32_t serial, const GsmSmsMessage& message) { #if VDBG RLOGD("sendSms: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS, 2, message.smscPdu.c_str(), message.pdu.c_str()); return Void(); } Return
RadioImpl::sendSMSExpectMore(int32_t serial, const GsmSmsMessage& message) { #if VDBG RLOGD("sendSMSExpectMore: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_SEND_SMS_EXPECT_MORE, 2, message.smscPdu.c_str(), message.pdu.c_str()); return Void(); } static bool convertMvnoTypeToString(MvnoType type, char *&str) { switch (type) { case MvnoType::IMSI: str = (char *)"imsi"; return true; case MvnoType::GID: str = (char *)"gid"; return true; case MvnoType::SPN: str = (char *)"spn"; return true; case MvnoType::NONE: str = (char *)""; return true; } return false; } Return
RadioImpl::setupDataCall(int32_t serial, RadioTechnology radioTechnology, const DataProfileInfo& dataProfileInfo, bool modemCognitive, bool roamingAllowed, bool isRoaming) { #if VDBG RLOGD("setupDataCall: serial %d", serial); #endif if (s_vendorFunctions->version >= 4 && s_vendorFunctions->version <= 14) { const hidl_string &protocol = (isRoaming ? dataProfileInfo.roamingProtocol : dataProfileInfo.protocol); dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 7, std::to_string((int) radioTechnology + 2).c_str(), std::to_string((int) dataProfileInfo.profileId).c_str(), dataProfileInfo.apn.c_str(), dataProfileInfo.user.c_str(), dataProfileInfo.password.c_str(), std::to_string((int) dataProfileInfo.authType).c_str(), protocol.c_str()); } else if (s_vendorFunctions->version >= 15) { char *mvnoTypeStr = NULL; if (!convertMvnoTypeToString(dataProfileInfo.mvnoType, mvnoTypeStr)) { RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL); if (pRI != NULL) { sendErrorResponse(pRI, RIL_E_INVALID_ARGUMENTS); } return Void(); } dispatchStrings(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL, 15, std::to_string((int) radioTechnology + 2).c_str(), std::to_string((int) dataProfileInfo.profileId).c_str(), dataProfileInfo.apn.c_str(), dataProfileInfo.user.c_str(), dataProfileInfo.password.c_str(), std::to_string((int) dataProfileInfo.authType).c_str(), dataProfileInfo.protocol.c_str(), dataProfileInfo.roamingProtocol.c_str(), std::to_string(dataProfileInfo.supportedApnTypesBitmap).c_str(), std::to_string(dataProfileInfo.bearerBitmap).c_str(), modemCognitive ? "1" : "0", std::to_string(dataProfileInfo.mtu).c_str(), mvnoTypeStr, dataProfileInfo.mvnoMatchData.c_str(), roamingAllowed ? "1" : "0"); } else { RLOGE("Unsupported RIL version %d, min version expected 4", s_vendorFunctions->version); RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SETUP_DATA_CALL); if (pRI != NULL) { sendErrorResponse(pRI, RIL_E_REQUEST_NOT_SUPPORTED); } } return Void(); } Return
RadioImpl::iccIOForApp(int32_t serial, const IccIo& iccIo) { #if VDBG RLOGD("iccIOForApp: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SIM_IO); if (pRI == NULL) { return Void(); } RIL_SIM_IO_v6 rilIccIo = {}; rilIccIo.command = iccIo.command; rilIccIo.fileid = iccIo.fileId; if (!copyHidlStringToRil(&rilIccIo.path, iccIo.path, pRI)) { return Void(); } rilIccIo.p1 = iccIo.p1; rilIccIo.p2 = iccIo.p2; rilIccIo.p3 = iccIo.p3; if (!copyHidlStringToRil(&rilIccIo.data, iccIo.data, pRI)) { memsetAndFreeStrings(1, rilIccIo.path); return Void(); } if (!copyHidlStringToRil(&rilIccIo.pin2, iccIo.pin2, pRI)) { memsetAndFreeStrings(2, rilIccIo.path, rilIccIo.data); return Void(); } if (!copyHidlStringToRil(&rilIccIo.aidPtr, iccIo.aid, pRI)) { memsetAndFreeStrings(3, rilIccIo.path, rilIccIo.data, rilIccIo.pin2); return Void(); } CALL_ONREQUEST(RIL_REQUEST_SIM_IO, &rilIccIo, sizeof(rilIccIo), pRI, mSlotId); memsetAndFreeStrings(4, rilIccIo.path, rilIccIo.data, rilIccIo.pin2, rilIccIo.aidPtr); return Void(); } Return
RadioImpl::sendUssd(int32_t serial, const hidl_string& ussd) { #if VDBG RLOGD("sendUssd: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_SEND_USSD, ussd.c_str()); return Void(); } Return
RadioImpl::cancelPendingUssd(int32_t serial) { #if VDBG RLOGD("cancelPendingUssd: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_CANCEL_USSD); return Void(); } Return
RadioImpl::getClir(int32_t serial) { #if VDBG RLOGD("getClir: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_CLIR); return Void(); } Return
RadioImpl::setClir(int32_t serial, int32_t status) { #if VDBG RLOGD("setClir: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CLIR, 1, status); return Void(); } Return
RadioImpl::getCallForwardStatus(int32_t serial, const CallForwardInfo& callInfo) { #if VDBG RLOGD("getCallForwardStatus: serial %d", serial); #endif dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_QUERY_CALL_FORWARD_STATUS, callInfo); return Void(); } Return
RadioImpl::setCallForward(int32_t serial, const CallForwardInfo& callInfo) { #if VDBG RLOGD("setCallForward: serial %d", serial); #endif dispatchCallForwardStatus(serial, mSlotId, RIL_REQUEST_SET_CALL_FORWARD, callInfo); return Void(); } Return
RadioImpl::getCallWaiting(int32_t serial, int32_t serviceClass) { #if VDBG RLOGD("getCallWaiting: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_QUERY_CALL_WAITING, 1, serviceClass); return Void(); } Return
RadioImpl::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) { #if VDBG RLOGD("setCallWaiting: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_CALL_WAITING, 2, BOOL_TO_INT(enable), serviceClass); return Void(); } Return
RadioImpl::acknowledgeLastIncomingGsmSms(int32_t serial, bool success, SmsAcknowledgeFailCause cause) { #if VDBG RLOGD("acknowledgeLastIncomingGsmSms: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SMS_ACKNOWLEDGE, 2, BOOL_TO_INT(success), cause); return Void(); } Return
RadioImpl::acceptCall(int32_t serial) { #if VDBG RLOGD("acceptCall: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_ANSWER); return Void(); } Return
RadioImpl::deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) { #if VDBG RLOGD("deactivateDataCall: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_DEACTIVATE_DATA_CALL, 2, (std::to_string(cid)).c_str(), reasonRadioShutDown ? "1" : "0"); return Void(); } Return
RadioImpl::getFacilityLockForApp(int32_t serial, const hidl_string& facility, const hidl_string& password, int32_t serviceClass, const hidl_string& appId) { #if VDBG RLOGD("getFacilityLockForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_QUERY_FACILITY_LOCK, 4, facility.c_str(), password.c_str(), (std::to_string(serviceClass)).c_str(), appId.c_str()); return Void(); } Return
RadioImpl::setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState, const hidl_string& password, int32_t serviceClass, const hidl_string& appId) { #if VDBG RLOGD("setFacilityLockForApp: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_SET_FACILITY_LOCK, 5, facility.c_str(), lockState ? "1" : "0", password.c_str(), (std::to_string(serviceClass)).c_str(), appId.c_str() ); return Void(); } Return
RadioImpl::setBarringPassword(int32_t serial, const hidl_string& facility, const hidl_string& oldPassword, const hidl_string& newPassword) { #if VDBG RLOGD("setBarringPassword: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_CHANGE_BARRING_PASSWORD, 3, facility.c_str(), oldPassword.c_str(), newPassword.c_str()); return Void(); } Return
RadioImpl::getNetworkSelectionMode(int32_t serial) { #if VDBG RLOGD("getNetworkSelectionMode: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE); return Void(); } Return
RadioImpl::setNetworkSelectionModeAutomatic(int32_t serial) { #if VDBG RLOGD("setNetworkSelectionModeAutomatic: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC); return Void(); } Return
RadioImpl::setNetworkSelectionModeManual(int32_t serial, const hidl_string& operatorNumeric) { #if VDBG RLOGD("setNetworkSelectionModeManual: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL, operatorNumeric.c_str()); return Void(); } Return
RadioImpl::getAvailableNetworks(int32_t serial) { #if VDBG RLOGD("getAvailableNetworks: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_AVAILABLE_NETWORKS); return Void(); } Return
RadioImpl::startDtmf(int32_t serial, const hidl_string& s) { #if VDBG RLOGD("startDtmf: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_DTMF_START, s.c_str()); return Void(); } Return
RadioImpl::stopDtmf(int32_t serial) { #if VDBG RLOGD("stopDtmf: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_DTMF_STOP); return Void(); } Return
RadioImpl::getBasebandVersion(int32_t serial) { #if VDBG RLOGD("getBasebandVersion: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_BASEBAND_VERSION); return Void(); } Return
RadioImpl::separateConnection(int32_t serial, int32_t gsmIndex) { #if VDBG RLOGD("separateConnection: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SEPARATE_CONNECTION, 1, gsmIndex); return Void(); } Return
RadioImpl::setMute(int32_t serial, bool enable) { #if VDBG RLOGD("setMute: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_MUTE, 1, BOOL_TO_INT(enable)); return Void(); } Return
RadioImpl::getMute(int32_t serial) { #if VDBG RLOGD("getMute: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_MUTE); return Void(); } Return
RadioImpl::getClip(int32_t serial) { #if VDBG RLOGD("getClip: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_CLIP); return Void(); } Return
RadioImpl::getDataCallList(int32_t serial) { #if VDBG RLOGD("getDataCallList: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_DATA_CALL_LIST); return Void(); } Return
RadioImpl::setSuppServiceNotifications(int32_t serial, bool enable) { #if VDBG RLOGD("setSuppServiceNotifications: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION, 1, BOOL_TO_INT(enable)); return Void(); } Return
RadioImpl::writeSmsToSim(int32_t serial, const SmsWriteArgs& smsWriteArgs) { #if VDBG RLOGD("writeSmsToSim: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_WRITE_SMS_TO_SIM); if (pRI == NULL) { return Void(); } RIL_SMS_WriteArgs args; args.status = (int) smsWriteArgs.status; int len; if (!copyHidlStringToRil(&args.pdu, smsWriteArgs.pdu, pRI)) { return Void(); } if (!copyHidlStringToRil(&args.smsc, smsWriteArgs.smsc, pRI)) { memsetAndFreeStrings(1, args.pdu); return Void(); } CALL_ONREQUEST(RIL_REQUEST_WRITE_SMS_TO_SIM, &args, sizeof(args), pRI, mSlotId); memsetAndFreeStrings(2, args.smsc, args.pdu); return Void(); } Return
RadioImpl::deleteSmsOnSim(int32_t serial, int32_t index) { #if VDBG RLOGD("deleteSmsOnSim: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_DELETE_SMS_ON_SIM, 1, index); return Void(); } Return
RadioImpl::setBandMode(int32_t serial, RadioBandMode mode) { #if VDBG RLOGD("setBandMode: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_BAND_MODE, 1, mode); return Void(); } Return
RadioImpl::getAvailableBandModes(int32_t serial) { #if VDBG RLOGD("getAvailableBandModes: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE); return Void(); } Return
RadioImpl::sendEnvelope(int32_t serial, const hidl_string& command) { #if VDBG RLOGD("sendEnvelope: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND, command.c_str()); return Void(); } Return
RadioImpl::sendTerminalResponseToSim(int32_t serial, const hidl_string& commandResponse) { #if VDBG RLOGD("sendTerminalResponseToSim: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE, commandResponse.c_str()); return Void(); } Return
RadioImpl::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) { #if VDBG RLOGD("handleStkCallSetupRequestFromSim: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, 1, BOOL_TO_INT(accept)); return Void(); } Return
RadioImpl::explicitCallTransfer(int32_t serial) { #if VDBG RLOGD("explicitCallTransfer: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_EXPLICIT_CALL_TRANSFER); return Void(); } Return
RadioImpl::setPreferredNetworkType(int32_t serial, PreferredNetworkType nwType) { #if VDBG RLOGD("setPreferredNetworkType: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE, 1, nwType); return Void(); } Return
RadioImpl::getPreferredNetworkType(int32_t serial) { #if VDBG RLOGD("getPreferredNetworkType: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE); return Void(); } Return
RadioImpl::getNeighboringCids(int32_t serial) { #if VDBG RLOGD("getNeighboringCids: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GET_NEIGHBORING_CELL_IDS); return Void(); } Return
RadioImpl::setLocationUpdates(int32_t serial, bool enable) { #if VDBG RLOGD("setLocationUpdates: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_LOCATION_UPDATES, 1, BOOL_TO_INT(enable)); return Void(); } Return
RadioImpl::setCdmaSubscriptionSource(int32_t serial, CdmaSubscriptionSource cdmaSub) { #if VDBG RLOGD("setCdmaSubscriptionSource: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE, 1, cdmaSub); return Void(); } Return
RadioImpl::setCdmaRoamingPreference(int32_t serial, CdmaRoamingType type) { #if VDBG RLOGD("setCdmaRoamingPreference: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE, 1, type); return Void(); } Return
RadioImpl::getCdmaRoamingPreference(int32_t serial) { #if VDBG RLOGD("getCdmaRoamingPreference: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE); return Void(); } Return
RadioImpl::setTTYMode(int32_t serial, TtyMode mode) { #if VDBG RLOGD("setTTYMode: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_SET_TTY_MODE, 1, mode); return Void(); } Return
RadioImpl::getTTYMode(int32_t serial) { #if VDBG RLOGD("getTTYMode: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_QUERY_TTY_MODE); return Void(); } Return
RadioImpl::setPreferredVoicePrivacy(int32_t serial, bool enable) { #if VDBG RLOGD("setPreferredVoicePrivacy: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE, 1, BOOL_TO_INT(enable)); return Void(); } Return
RadioImpl::getPreferredVoicePrivacy(int32_t serial) { #if VDBG RLOGD("getPreferredVoicePrivacy: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE); return Void(); } Return
RadioImpl::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) { #if VDBG RLOGD("sendCDMAFeatureCode: serial %d", serial); #endif dispatchString(serial, mSlotId, RIL_REQUEST_CDMA_FLASH, featureCode.c_str()); return Void(); } Return
RadioImpl::sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, int32_t off) { #if VDBG RLOGD("sendBurstDtmf: serial %d", serial); #endif dispatchStrings(serial, mSlotId, RIL_REQUEST_CDMA_BURST_DTMF, 3, dtmf.c_str(), (std::to_string(on)).c_str(), (std::to_string(off)).c_str()); return Void(); } void constructCdmaSms(RIL_CDMA_SMS_Message &rcsm, const CdmaSmsMessage& sms) { rcsm.uTeleserviceID = sms.teleserviceId; rcsm.bIsServicePresent = BOOL_TO_INT(sms.isServicePresent); rcsm.uServicecategory = sms.serviceCategory; rcsm.sAddress.digit_mode = (RIL_CDMA_SMS_DigitMode) sms.address.digitMode; rcsm.sAddress.number_mode = (RIL_CDMA_SMS_NumberMode) sms.address.numberMode; rcsm.sAddress.number_type = (RIL_CDMA_SMS_NumberType) sms.address.numberType; rcsm.sAddress.number_plan = (RIL_CDMA_SMS_NumberPlan) sms.address.numberPlan; rcsm.sAddress.number_of_digits = sms.address.digits.size(); int digitLimit= MIN((rcsm.sAddress.number_of_digits), RIL_CDMA_SMS_ADDRESS_MAX); for (int i = 0; i < digitLimit; i++) { rcsm.sAddress.digits[i] = sms.address.digits[i]; } rcsm.sSubAddress.subaddressType = (RIL_CDMA_SMS_SubaddressType) sms.subAddress.subaddressType; rcsm.sSubAddress.odd = BOOL_TO_INT(sms.subAddress.odd); rcsm.sSubAddress.number_of_digits = sms.subAddress.digits.size(); digitLimit= MIN((rcsm.sSubAddress.number_of_digits), RIL_CDMA_SMS_SUBADDRESS_MAX); for (int i = 0; i < digitLimit; i++) { rcsm.sSubAddress.digits[i] = sms.subAddress.digits[i]; } rcsm.uBearerDataLen = sms.bearerData.size(); digitLimit= MIN((rcsm.uBearerDataLen), RIL_CDMA_SMS_BEARER_DATA_MAX); for (int i = 0; i < digitLimit; i++) { rcsm.aBearerData[i] = sms.bearerData[i]; } } Return
RadioImpl::sendCdmaSms(int32_t serial, const CdmaSmsMessage& sms) { #if VDBG RLOGD("sendCdmaSms: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CDMA_SEND_SMS); if (pRI == NULL) { return Void(); } RIL_CDMA_SMS_Message rcsm = {}; constructCdmaSms(rcsm, sms); CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsm, sizeof(rcsm), pRI, mSlotId); return Void(); } Return
RadioImpl::acknowledgeLastIncomingCdmaSms(int32_t serial, const CdmaSmsAck& smsAck) { #if VDBG RLOGD("acknowledgeLastIncomingCdmaSms: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE); if (pRI == NULL) { return Void(); } RIL_CDMA_SMS_Ack rcsa = {}; rcsa.uErrorClass = (RIL_CDMA_SMS_ErrorClass) smsAck.errorClass; rcsa.uSMSCauseCode = smsAck.smsCauseCode; CALL_ONREQUEST(pRI->pCI->requestNumber, &rcsa, sizeof(rcsa), pRI, mSlotId); return Void(); } Return
RadioImpl::getGsmBroadcastConfig(int32_t serial) { #if VDBG RLOGD("getGsmBroadcastConfig: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG); return Void(); } Return
RadioImpl::setGsmBroadcastConfig(int32_t serial, const hidl_vec
& configInfo) { #if VDBG RLOGD("setGsmBroadcastConfig: serial %d", serial); #endif RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG); if (pRI == NULL) { return Void(); } int num = configInfo.size(); RIL_GSM_BroadcastSmsConfigInfo gsmBci[num]; RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num]; for (int i = 0 ; i < num ; i++ ) { gsmBciPtrs[i] = &gsmBci[i]; gsmBci[i].fromServiceId = configInfo[i].fromServiceId; gsmBci[i].toServiceId = configInfo[i].toServiceId; gsmBci[i].fromCodeScheme = configInfo[i].fromCodeScheme; gsmBci[i].toCodeScheme = configInfo[i].toCodeScheme; gsmBci[i].selected = BOOL_TO_INT(configInfo[i].selected); } CALL_ONREQUEST(pRI->pCI->requestNumber, gsmBciPtrs, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), pRI, mSlotId); return Void(); } Return
RadioImpl::setGsmBroadcastActivation(int32_t serial, bool activate) { #if VDBG RLOGD("setGsmBroadcastActivation: serial %d", serial); #endif dispatchInts(serial, mSlotId, RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION, 1, BOOL_TO_INT(!activate)); return Void(); } Return
RadioImpl::getCdmaBroadcastConfig(int32_t serial) { #if VDBG RLOGD("getCdmaBroadcastConfig: serial %d", serial); #endif dispatchVoid(serial, mSlotId, RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG); return Void(); } Return
RadioImpl::setCdmaBroadcastConfig(int32_t serial, const hidl_vec