From 0b534a8050d65bba1412b13d4db9ac5a4fbe6891 Mon Sep 17 00:00:00 2001 From: Derek Date: Fri, 26 Apr 2024 23:07:16 -0600 Subject: [PATCH] radio: 1.4: legacy: Initial wrapper (original) Change-Id: I214d413590378f88187766313bafcff7237637e6 --- radio/1.4/legacy/Android.bp | 32 + radio/1.4/legacy/Helpers.cpp | 184 ++++ radio/1.4/legacy/Helpers.h | 29 + radio/1.4/legacy/Radio.cpp | 984 ++++++++++++++++++ radio/1.4/legacy/Radio.h | 273 +++++ radio/1.4/legacy/RadioIndication.cpp | 314 ++++++ radio/1.4/legacy/RadioIndication.h | 133 +++ radio/1.4/legacy/RadioResponse.cpp | 906 ++++++++++++++++ radio/1.4/legacy/RadioResponse.h | 311 ++++++ ...droid.hardware.radio@1.4-service.legacy.rc | 9 + radio/1.4/legacy/hidl-utils.cpp | 46 + radio/1.4/legacy/hidl-utils.h | 78 ++ radio/1.4/legacy/service.cpp | 68 ++ 13 files changed, 3367 insertions(+) create mode 100644 radio/1.4/legacy/Android.bp create mode 100644 radio/1.4/legacy/Helpers.cpp create mode 100644 radio/1.4/legacy/Helpers.h create mode 100644 radio/1.4/legacy/Radio.cpp create mode 100644 radio/1.4/legacy/Radio.h create mode 100644 radio/1.4/legacy/RadioIndication.cpp create mode 100644 radio/1.4/legacy/RadioIndication.h create mode 100644 radio/1.4/legacy/RadioResponse.cpp create mode 100644 radio/1.4/legacy/RadioResponse.h create mode 100644 radio/1.4/legacy/android.hardware.radio@1.4-service.legacy.rc create mode 100644 radio/1.4/legacy/hidl-utils.cpp create mode 100644 radio/1.4/legacy/hidl-utils.h create mode 100644 radio/1.4/legacy/service.cpp diff --git a/radio/1.4/legacy/Android.bp b/radio/1.4/legacy/Android.bp new file mode 100644 index 0000000..8d2894e --- /dev/null +++ b/radio/1.4/legacy/Android.bp @@ -0,0 +1,32 @@ +// +// Copyright (C) 2024 The LineageOS Project +// +// SPDX-License-Identifier: Apache-2.0 +// + +cc_binary { + name: "android.hardware.radio@1.4-service.legacy", + owner: "lineage", + relative_install_path: "hw", + vendor: true, + init_rc: ["android.hardware.radio@1.4-service.legacy.rc"], + srcs: [ + "Radio.cpp", + "RadioIndication.cpp", + "RadioResponse.cpp", + "service.cpp", + "Helpers.cpp", + "hidl-utils.cpp", + ], + shared_libs: [ + "libbase", + "libhidlbase", + "libutils", + "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", + "android.hardware.radio@1.3", + "android.hardware.radio@1.4", + "android.hidl.safe_union@1.0", + ], +} diff --git a/radio/1.4/legacy/Helpers.cpp b/radio/1.4/legacy/Helpers.cpp new file mode 100644 index 0000000..76c1f32 --- /dev/null +++ b/radio/1.4/legacy/Helpers.cpp @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "Helpers.h" +#include +#include +using namespace android::hardware::radio; + +V1_4::SignalStrength Create1_4SignalStrength(const V1_0::SignalStrength& sigStrength){ + + V1_4::SignalStrength newSigStrength = {}; + newSigStrength.gsm = sigStrength.gw; + newSigStrength.cdma = sigStrength.cdma; + newSigStrength.evdo = sigStrength.evdo; + newSigStrength.lte = sigStrength.lte; + + newSigStrength.tdscdma.signalStrength = INT_MAX; + newSigStrength.tdscdma.bitErrorRate = INT_MAX; + newSigStrength.tdscdma.rscp = sigStrength.tdScdma.rscp != INT_MAX ? + -sigStrength.tdScdma.rscp + 120 : INT_MAX; + + newSigStrength.wcdma.base.signalStrength = INT_MAX; + newSigStrength.wcdma.base.bitErrorRate = INT_MAX; + newSigStrength.wcdma.rscp = INT_MAX; + newSigStrength.wcdma.ecno = INT_MAX; + + newSigStrength.nr.ssRsrp = INT_MAX; + newSigStrength.nr.ssRsrq = INT_MAX; + newSigStrength.nr.ssSinr = INT_MAX; + newSigStrength.nr.csiRsrp = INT_MAX; + newSigStrength.nr.csiRsrq = INT_MAX; + newSigStrength.nr.csiSinr = INT_MAX; + + return newSigStrength; +} + +V1_4::SignalStrength Create1_4SignalStrength(const V1_2::SignalStrength& sigStrength){ + + V1_4::SignalStrength newSigStrength = {}; + newSigStrength.gsm = sigStrength.gsm; + newSigStrength.cdma = sigStrength.cdma; + newSigStrength.evdo = sigStrength.evdo; + newSigStrength.lte = sigStrength.lte; + newSigStrength.wcdma = sigStrength.wcdma; + + newSigStrength.tdscdma.signalStrength = INT_MAX; + newSigStrength.tdscdma.bitErrorRate = INT_MAX; + newSigStrength.tdscdma.rscp = sigStrength.tdScdma.rscp != INT_MAX ? + -sigStrength.tdScdma.rscp + 120 : INT_MAX; + + newSigStrength.nr.ssRsrp = INT_MAX; + newSigStrength.nr.ssRsrq = INT_MAX; + newSigStrength.nr.ssSinr = INT_MAX; + newSigStrength.nr.csiRsrp = INT_MAX; + newSigStrength.nr.csiRsrq = INT_MAX; + newSigStrength.nr.csiSinr = INT_MAX; + + return newSigStrength; +} + +hidl_vec Create1_4CellInfoList(const hidl_vec& cellInfo) { + hidl_vec newCI; + newCI.resize(cellInfo.size()); + + for(int x = 0; x < cellInfo.size(); ++x){ + newCI[x].isRegistered = cellInfo[x].registered; + newCI[x].connectionStatus = (V1_2::CellConnectionStatus) INT_MAX; + if(cellInfo[x].gsm.size() == 1){ + V1_2::CellInfoGsm GsmInfo = {}; + GsmInfo.cellIdentityGsm.base = cellInfo[x].gsm[0].cellIdentityGsm; + GsmInfo.signalStrengthGsm = cellInfo[x].gsm[0].signalStrengthGsm; + newCI[x].info.gsm(GsmInfo); + } + else if(cellInfo[x].cdma.size() == 1){ + V1_2::CellInfoCdma CdmaInfo = {}; + CdmaInfo.cellIdentityCdma.base = cellInfo[x].cdma[0].cellIdentityCdma; + CdmaInfo.signalStrengthCdma = cellInfo[x].cdma[0].signalStrengthCdma; + CdmaInfo.signalStrengthEvdo = cellInfo[x].cdma[0].signalStrengthEvdo; + newCI[x].info.cdma(CdmaInfo); + } + else if(cellInfo[x].lte.size() == 1){ + V1_4::CellInfoLte LteInfo = {}; + LteInfo.base.cellIdentityLte.base = cellInfo[x].lte[0].cellIdentityLte; + LteInfo.base.cellIdentityLte.bandwidth = INT_MAX; + LteInfo.cellConfig.isEndcAvailable = false; + LteInfo.base.signalStrengthLte = cellInfo[x].lte[0].signalStrengthLte; + newCI[x].info.lte(LteInfo); + } + else if(cellInfo[x].wcdma.size() == 1){ + V1_2::CellInfoWcdma WcdmaInfo = {}; + WcdmaInfo.cellIdentityWcdma.base = cellInfo[x].wcdma[0].cellIdentityWcdma; + WcdmaInfo.signalStrengthWcdma.base = cellInfo[x].wcdma[0].signalStrengthWcdma; + WcdmaInfo.signalStrengthWcdma.rscp = INT_MAX; + WcdmaInfo.signalStrengthWcdma.ecno = INT_MAX; + newCI[x].info.wcdma(WcdmaInfo); + } + else if(cellInfo[x].tdscdma.size() == 1){ + V1_2::CellInfoTdscdma TdscdmaInfo = {}; + TdscdmaInfo.cellIdentityTdscdma.base = cellInfo[x].tdscdma[0].cellIdentityTdscdma; + TdscdmaInfo.cellIdentityTdscdma.uarfcn = INT_MAX; + TdscdmaInfo.signalStrengthTdscdma.signalStrength = INT_MAX; + TdscdmaInfo.signalStrengthTdscdma.bitErrorRate = INT_MAX; + TdscdmaInfo.signalStrengthTdscdma.rscp = cellInfo[x].tdscdma[0].signalStrengthTdscdma.rscp != INT_MAX ? + -cellInfo[x].tdscdma[0].signalStrengthTdscdma.rscp + 120 : INT_MAX; + newCI[x].info.tdscdma(TdscdmaInfo); + } + } + + return newCI; +} + +hidl_vec Create1_4CellInfoList(const hidl_vec& cellInfo) { + hidl_vec newCI; + newCI.resize(cellInfo.size()); + + for(int x = 0; x < cellInfo.size(); ++x){ + newCI[x].isRegistered = cellInfo[x].registered; + newCI[x].connectionStatus = cellInfo[x].connectionStatus; + if(cellInfo[x].gsm.size() == 1) + newCI[x].info.gsm(cellInfo[x].gsm[0]); + + else if(cellInfo[x].cdma.size() == 1) + newCI[x].info.cdma(cellInfo[x].cdma[0]); + + else if(cellInfo[x].lte.size() == 1){ + V1_4::CellInfoLte LteInfo = {}; + LteInfo.base = cellInfo[x].lte[0]; + LteInfo.cellConfig.isEndcAvailable = false; + newCI[x].info.lte(LteInfo); + } + else if(cellInfo[x].wcdma.size() == 1) + newCI[x].info.wcdma(cellInfo[x].wcdma[0]); + + else if(cellInfo[x].tdscdma.size() == 1) + newCI[x].info.tdscdma(cellInfo[x].tdscdma[0]); + } + + return newCI; +} + +hidl_vec DelimitedStrToVec(std::string delimitedStr){ + std::regex rgx("\\s+"); + std::sregex_token_iterator iter(delimitedStr.begin(), delimitedStr.end(), rgx, -1); + std::sregex_token_iterator end; + + std::vector tokens; + for ( ; iter != end; ++iter) + tokens.push_back(hidl_string(*iter)); + + return hidl_vec(tokens); +} + +V1_4::SetupDataCallResult Create1_4SetupDataCallResult(const V1_0::SetupDataCallResult& dcResponse){ + V1_4::SetupDataCallResult newDCR = {}; + newDCR.cause = (V1_4::DataCallFailCause) dcResponse.status; + newDCR.suggestedRetryTime = dcResponse.suggestedRetryTime; + newDCR.cid = dcResponse.cid; + newDCR.active = (V1_4::DataConnActiveStatus) dcResponse.active; + newDCR.ifname = dcResponse.ifname; + newDCR.mtu = dcResponse.mtu; + newDCR.addresses = DelimitedStrToVec(dcResponse.addresses); + newDCR.dnses = DelimitedStrToVec(dcResponse.dnses); + newDCR.gateways = DelimitedStrToVec(dcResponse.gateways); + newDCR.pcscf = DelimitedStrToVec(dcResponse.pcscf); + if(dcResponse.type == std::string("IP")) + newDCR.type= V1_4::PdpProtocolType::IP; + else if(dcResponse.type == std::string("IPV6")) + newDCR.type= V1_4::PdpProtocolType::IPV6; + else if(dcResponse.type == std::string("IPV4V6")) + newDCR.type= V1_4::PdpProtocolType::IPV4V6; + else if(dcResponse.type == std::string("PPP")) + newDCR.type= V1_4::PdpProtocolType::PPP; + else if(dcResponse.type == std::string("NON-IP")) + newDCR.type= V1_4::PdpProtocolType::NON_IP; + else if(dcResponse.type == std::string("UNSTRUCTURED")) + newDCR.type= V1_4::PdpProtocolType::UNSTRUCTURED; + else + newDCR.type= V1_4::PdpProtocolType::UNKNOWN; + + return newDCR; +} diff --git a/radio/1.4/legacy/Helpers.h b/radio/1.4/legacy/Helpers.h new file mode 100644 index 0000000..3a7a93d --- /dev/null +++ b/radio/1.4/legacy/Helpers.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once +#include +#include +#include +#include + +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +#define GSMBITS (V1_0::RadioAccessFamily::GSM | V1_0::RadioAccessFamily::GPRS | V1_0::RadioAccessFamily::EDGE) +#define CDMABITS (V1_0::RadioAccessFamily::IS95A | V1_0::RadioAccessFamily::IS95B | V1_0::RadioAccessFamily::ONE_X_RTT) +#define EVDOBITS (V1_0::RadioAccessFamily::EVDO_0 | V1_0::RadioAccessFamily::EVDO_A | V1_0::RadioAccessFamily::EVDO_B | V1_0::RadioAccessFamily::EHRPD) +#define WCDMABITS (V1_0::RadioAccessFamily::HSUPA | V1_0::RadioAccessFamily::HSDPA | V1_0::RadioAccessFamily::HSPA | V1_0::RadioAccessFamily::HSPAP | V1_0::RadioAccessFamily::UMTS) +#define LTEBITS (V1_0::RadioAccessFamily::LTE | V1_0::RadioAccessFamily::LTE_CA) +#define TDSCDMABIT ((int) V1_0::RadioAccessFamily::TD_SCDMA) + +android::hardware::radio::V1_4::SignalStrength Create1_4SignalStrength(const android::hardware::radio::V1_0::SignalStrength& sigStrength); +android::hardware::radio::V1_4::SignalStrength Create1_4SignalStrength(const android::hardware::radio::V1_2::SignalStrength& sigStrength); +hidl_vec Create1_4CellInfoList(const hidl_vec& cellInfo); +hidl_vec Create1_4CellInfoList(const hidl_vec& cellInfo); +android::hardware::radio::V1_4::SetupDataCallResult Create1_4SetupDataCallResult(const android::hardware::radio::V1_0::SetupDataCallResult& dcResponse); diff --git a/radio/1.4/legacy/Radio.cpp b/radio/1.4/legacy/Radio.cpp new file mode 100644 index 0000000..4af7e35 --- /dev/null +++ b/radio/1.4/legacy/Radio.cpp @@ -0,0 +1,984 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define LOG_TAG "android.hardware.radio@1.4-service.legacy" + +#include "Radio.h" +#include "Helpers.h" +#include +#include + +#include + +#define WRAP_V1_0_CALL(method, ...) \ + do { \ + auto realRadio = mRealRadio; \ + if (realRadio != nullptr) { \ + return realRadio->method(__VA_ARGS__); \ + } \ + return Status::fromExceptionCode(Status::Exception::EX_ILLEGAL_STATE); \ + } while (0) + +#define MAYBE_WRAP_V1_1_CALL(method, ...) \ + do { \ + auto realRadio_V1_1 = getRealRadio_V1_1(); \ + if (realRadio_V1_1 != nullptr) { \ + return realRadio_V1_1->method(__VA_ARGS__); \ + } \ + } while (0) + +#define MAYBE_WRAP_V1_2_CALL(method, ...) \ + do { \ + auto realRadio_V1_2 = getRealRadio_V1_2(); \ + if (realRadio_V1_2 != nullptr) { \ + return realRadio_V1_2->method(__VA_ARGS__); \ + } \ + } while (0) + +#define MAYBE_WRAP_V1_3_CALL(method, ...) \ + do { \ + auto realRadio_V1_3 = getRealRadio_V1_3(); \ + if (realRadio_V1_3 != nullptr) { \ + return realRadio_V1_3->method(__VA_ARGS__); \ + } \ + } while (0) + +#define MAYBE_WRAP_V1_4_CALL(method, ...) \ + do { \ + auto realRadio_V1_4 = getRealRadio_V1_4(); \ + if (realRadio_V1_4 != nullptr) { \ + LOG(WARNING) << "Using wrapper when not needed"; \ + return realRadio_V1_4->method(__VA_ARGS__); \ + } \ + } while (0) + +namespace android::hardware::radio::implementation { + +Radio::Radio(sp realRadio) : mRealRadio(realRadio) {} + +// Methods from ::android::hardware::radio::V1_0::IRadio follow. +Return Radio::setResponseFunctions(const sp& radioResponse, + const sp& radioIndication) { + mRadioResponse->mRealRadioResponse = V1_4::IRadioResponse::castFrom(radioResponse); + mRadioIndication->mRealRadioIndication = V1_4::IRadioIndication::castFrom(radioIndication); + WRAP_V1_0_CALL(setResponseFunctions, mRadioResponse, mRadioIndication); +} + +Return Radio::getIccCardStatus(int32_t serial) { + WRAP_V1_0_CALL(getIccCardStatus, serial); +} + +Return Radio::supplyIccPinForApp(int32_t serial, const hidl_string& pin, + const hidl_string& aid) { + WRAP_V1_0_CALL(supplyIccPinForApp, serial, pin, aid); +} + +Return Radio::supplyIccPukForApp(int32_t serial, const hidl_string& puk, + const hidl_string& pin, const hidl_string& aid) { + WRAP_V1_0_CALL(supplyIccPukForApp, serial, puk, pin, aid); +} + +Return Radio::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, + const hidl_string& aid) { + WRAP_V1_0_CALL(supplyIccPin2ForApp, serial, pin2, aid); +} + +Return Radio::supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, + const hidl_string& pin2, const hidl_string& aid) { + WRAP_V1_0_CALL(supplyIccPuk2ForApp, serial, puk2, pin2, aid); +} + +Return Radio::changeIccPinForApp(int32_t serial, const hidl_string& oldPin, + const hidl_string& newPin, const hidl_string& aid) { + WRAP_V1_0_CALL(changeIccPinForApp, serial, oldPin, newPin, aid); +} + +Return Radio::changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, + const hidl_string& newPin2, const hidl_string& aid) { + WRAP_V1_0_CALL(changeIccPin2ForApp, serial, oldPin2, newPin2, aid); +} + +Return Radio::supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) { + WRAP_V1_0_CALL(supplyNetworkDepersonalization, serial, netPin); +} + +Return Radio::getCurrentCalls(int32_t serial) { + WRAP_V1_0_CALL(getCurrentCalls, serial); +} + +Return Radio::dial(int32_t serial, const V1_0::Dial& dialInfo) { + WRAP_V1_0_CALL(dial, serial, dialInfo); +} + +Return Radio::getImsiForApp(int32_t serial, const hidl_string& aid) { + WRAP_V1_0_CALL(getImsiForApp, serial, aid); +} + +Return Radio::hangup(int32_t serial, int32_t gsmIndex) { + WRAP_V1_0_CALL(hangup, serial, gsmIndex); +} + +Return Radio::hangupWaitingOrBackground(int32_t serial) { + WRAP_V1_0_CALL(hangupWaitingOrBackground, serial); +} + +Return Radio::hangupForegroundResumeBackground(int32_t serial) { + WRAP_V1_0_CALL(hangupForegroundResumeBackground, serial); +} + +Return Radio::switchWaitingOrHoldingAndActive(int32_t serial) { + WRAP_V1_0_CALL(switchWaitingOrHoldingAndActive, serial); +} + +Return Radio::conference(int32_t serial) { + WRAP_V1_0_CALL(conference, serial); +} + +Return Radio::rejectCall(int32_t serial) { + WRAP_V1_0_CALL(rejectCall, serial); +} + +Return Radio::getLastCallFailCause(int32_t serial) { + WRAP_V1_0_CALL(getLastCallFailCause, serial); +} + +Return Radio::getSignalStrength(int32_t serial) { + WRAP_V1_0_CALL(getSignalStrength, serial); +} + +Return Radio::getVoiceRegistrationState(int32_t serial) { + WRAP_V1_0_CALL(getVoiceRegistrationState, serial); +} + +Return Radio::getDataRegistrationState(int32_t serial) { + WRAP_V1_0_CALL(getDataRegistrationState, serial); +} + +Return Radio::getOperator(int32_t serial) { + WRAP_V1_0_CALL(getOperator, serial); +} + +Return Radio::setRadioPower(int32_t serial, bool on) { + WRAP_V1_0_CALL(setRadioPower, serial, on); +} + +Return Radio::sendDtmf(int32_t serial, const hidl_string& s) { + WRAP_V1_0_CALL(sendDtmf, serial, s); +} + +Return Radio::sendSms(int32_t serial, const V1_0::GsmSmsMessage& message) { + WRAP_V1_0_CALL(sendSms, serial, message); +} + +Return Radio::sendSMSExpectMore(int32_t serial, const V1_0::GsmSmsMessage& message) { + WRAP_V1_0_CALL(sendSMSExpectMore, serial, message); +} + +Return Radio::setupDataCall(int32_t serial, V1_0::RadioTechnology radioTechnology, + const V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive, + bool roamingAllowed, bool isRoaming) { + WRAP_V1_0_CALL(setupDataCall, serial, radioTechnology, dataProfileInfo, modemCognitive, + roamingAllowed, isRoaming); +} + +Return Radio::iccIOForApp(int32_t serial, const V1_0::IccIo& iccIo) { + WRAP_V1_0_CALL(iccIOForApp, serial, iccIo); +} + +Return Radio::sendUssd(int32_t serial, const hidl_string& ussd) { + WRAP_V1_0_CALL(sendUssd, serial, ussd); +} + +Return Radio::cancelPendingUssd(int32_t serial) { + WRAP_V1_0_CALL(cancelPendingUssd, serial); +} + +Return Radio::getClir(int32_t serial) { + WRAP_V1_0_CALL(getClir, serial); +} + +Return Radio::setClir(int32_t serial, int32_t status) { + WRAP_V1_0_CALL(setClir, serial, status); +} + +Return Radio::getCallForwardStatus(int32_t serial, const V1_0::CallForwardInfo& callInfo) { + WRAP_V1_0_CALL(getCallForwardStatus, serial, callInfo); +} + +Return Radio::setCallForward(int32_t serial, const V1_0::CallForwardInfo& callInfo) { + WRAP_V1_0_CALL(setCallForward, serial, callInfo); +} + +Return Radio::getCallWaiting(int32_t serial, int32_t serviceClass) { + WRAP_V1_0_CALL(getCallWaiting, serial, serviceClass); +} + +Return Radio::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) { + WRAP_V1_0_CALL(setCallWaiting, serial, enable, serviceClass); +} + +Return Radio::acknowledgeLastIncomingGsmSms(int32_t serial, bool success, + V1_0::SmsAcknowledgeFailCause cause) { + WRAP_V1_0_CALL(acknowledgeLastIncomingGsmSms, serial, success, cause); +} + +Return Radio::acceptCall(int32_t serial) { + WRAP_V1_0_CALL(acceptCall, serial); +} + +Return Radio::deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) { + WRAP_V1_0_CALL(deactivateDataCall, serial, cid, reasonRadioShutDown); +} + +Return Radio::getFacilityLockForApp(int32_t serial, const hidl_string& facility, + const hidl_string& password, int32_t serviceClass, + const hidl_string& appId) { + WRAP_V1_0_CALL(getFacilityLockForApp, serial, facility, password, serviceClass, appId); +} + +Return Radio::setFacilityLockForApp(int32_t serial, const hidl_string& facility, + bool lockState, const hidl_string& password, + int32_t serviceClass, const hidl_string& appId) { + WRAP_V1_0_CALL(setFacilityLockForApp, serial, facility, lockState, password, serviceClass, + appId); +} + +Return Radio::setBarringPassword(int32_t serial, const hidl_string& facility, + const hidl_string& oldPassword, + const hidl_string& newPassword) { + WRAP_V1_0_CALL(setBarringPassword, serial, facility, oldPassword, newPassword); +} + +Return Radio::getNetworkSelectionMode(int32_t serial) { + WRAP_V1_0_CALL(getNetworkSelectionMode, serial); +} + +Return Radio::setNetworkSelectionModeAutomatic(int32_t serial) { + WRAP_V1_0_CALL(setNetworkSelectionModeAutomatic, serial); +} + +Return Radio::setNetworkSelectionModeManual(int32_t serial, + const hidl_string& operatorNumeric) { + WRAP_V1_0_CALL(setNetworkSelectionModeManual, serial, operatorNumeric); +} + +Return Radio::getAvailableNetworks(int32_t serial) { + WRAP_V1_0_CALL(getAvailableNetworks, serial); +} + +Return Radio::startDtmf(int32_t serial, const hidl_string& s) { + WRAP_V1_0_CALL(startDtmf, serial, s); +} + +Return Radio::stopDtmf(int32_t serial) { + WRAP_V1_0_CALL(stopDtmf, serial); +} + +Return Radio::getBasebandVersion(int32_t serial) { + WRAP_V1_0_CALL(getBasebandVersion, serial); +} + +Return Radio::separateConnection(int32_t serial, int32_t gsmIndex) { + WRAP_V1_0_CALL(separateConnection, serial, gsmIndex); +} + +Return Radio::setMute(int32_t serial, bool enable) { + WRAP_V1_0_CALL(setMute, serial, enable); +} + +Return Radio::getMute(int32_t serial) { + WRAP_V1_0_CALL(getMute, serial); +} + +Return Radio::getClip(int32_t serial) { + WRAP_V1_0_CALL(getClip, serial); +} + +Return Radio::getDataCallList(int32_t serial) { + WRAP_V1_0_CALL(getDataCallList, serial); +} + +Return Radio::setSuppServiceNotifications(int32_t serial, bool enable) { + WRAP_V1_0_CALL(setSuppServiceNotifications, serial, enable); +} + +Return Radio::writeSmsToSim(int32_t serial, const V1_0::SmsWriteArgs& smsWriteArgs) { + WRAP_V1_0_CALL(writeSmsToSim, serial, smsWriteArgs); +} + +Return Radio::deleteSmsOnSim(int32_t serial, int32_t index) { + WRAP_V1_0_CALL(deleteSmsOnSim, serial, index); +} + +Return Radio::setBandMode(int32_t serial, V1_0::RadioBandMode mode) { + WRAP_V1_0_CALL(setBandMode, serial, mode); +} + +Return Radio::getAvailableBandModes(int32_t serial) { + WRAP_V1_0_CALL(getAvailableBandModes, serial); +} + +Return Radio::sendEnvelope(int32_t serial, const hidl_string& command) { + WRAP_V1_0_CALL(sendEnvelope, serial, command); +} + +Return Radio::sendTerminalResponseToSim(int32_t serial, const hidl_string& commandResponse) { + WRAP_V1_0_CALL(sendTerminalResponseToSim, serial, commandResponse); +} + +Return Radio::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) { + WRAP_V1_0_CALL(handleStkCallSetupRequestFromSim, serial, accept); +} + +Return Radio::explicitCallTransfer(int32_t serial) { + WRAP_V1_0_CALL(explicitCallTransfer, serial); +} + +Return Radio::setPreferredNetworkType(int32_t serial, V1_0::PreferredNetworkType nwType) { + WRAP_V1_0_CALL(setPreferredNetworkType, serial, nwType); +} + +Return Radio::getPreferredNetworkType(int32_t serial) { + WRAP_V1_0_CALL(getPreferredNetworkType, serial); +} + +Return Radio::getNeighboringCids(int32_t serial) { + WRAP_V1_0_CALL(getNeighboringCids, serial); +} + +Return Radio::setLocationUpdates(int32_t serial, bool enable) { + WRAP_V1_0_CALL(setLocationUpdates, serial, enable); +} + +Return Radio::setCdmaSubscriptionSource(int32_t serial, + V1_0::CdmaSubscriptionSource cdmaSub) { + WRAP_V1_0_CALL(setCdmaSubscriptionSource, serial, cdmaSub); +} + +Return Radio::setCdmaRoamingPreference(int32_t serial, V1_0::CdmaRoamingType type) { + WRAP_V1_0_CALL(setCdmaRoamingPreference, serial, type); +} + +Return Radio::getCdmaRoamingPreference(int32_t serial) { + WRAP_V1_0_CALL(getCdmaRoamingPreference, serial); +} + +Return Radio::setTTYMode(int32_t serial, V1_0::TtyMode mode) { + WRAP_V1_0_CALL(setTTYMode, serial, mode); +} + +Return Radio::getTTYMode(int32_t serial) { + WRAP_V1_0_CALL(getTTYMode, serial); +} + +Return Radio::setPreferredVoicePrivacy(int32_t serial, bool enable) { + WRAP_V1_0_CALL(setPreferredVoicePrivacy, serial, enable); +} + +Return Radio::getPreferredVoicePrivacy(int32_t serial) { + WRAP_V1_0_CALL(getPreferredVoicePrivacy, serial); +} + +Return Radio::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) { + WRAP_V1_0_CALL(sendCDMAFeatureCode, serial, featureCode); +} + +Return Radio::sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, + int32_t off) { + WRAP_V1_0_CALL(sendBurstDtmf, serial, dtmf, on, off); +} + +Return Radio::sendCdmaSms(int32_t serial, const V1_0::CdmaSmsMessage& sms) { + WRAP_V1_0_CALL(sendCdmaSms, serial, sms); +} + +Return Radio::acknowledgeLastIncomingCdmaSms(int32_t serial, const V1_0::CdmaSmsAck& smsAck) { + WRAP_V1_0_CALL(acknowledgeLastIncomingCdmaSms, serial, smsAck); +} + +Return Radio::getGsmBroadcastConfig(int32_t serial) { + WRAP_V1_0_CALL(getGsmBroadcastConfig, serial); +} + +Return Radio::setGsmBroadcastConfig( + int32_t serial, const hidl_vec& configInfo) { + WRAP_V1_0_CALL(setGsmBroadcastConfig, serial, configInfo); +} + +Return Radio::setGsmBroadcastActivation(int32_t serial, bool activate) { + WRAP_V1_0_CALL(setGsmBroadcastActivation, serial, activate); +} + +Return Radio::getCdmaBroadcastConfig(int32_t serial) { + WRAP_V1_0_CALL(getCdmaBroadcastConfig, serial); +} + +Return Radio::setCdmaBroadcastConfig( + int32_t serial, const hidl_vec& configInfo) { + WRAP_V1_0_CALL(setCdmaBroadcastConfig, serial, configInfo); +} + +Return Radio::setCdmaBroadcastActivation(int32_t serial, bool activate) { + WRAP_V1_0_CALL(setCdmaBroadcastActivation, serial, activate); +} + +Return Radio::getCDMASubscription(int32_t serial) { + WRAP_V1_0_CALL(getCDMASubscription, serial); +} + +Return Radio::writeSmsToRuim(int32_t serial, const V1_0::CdmaSmsWriteArgs& cdmaSms) { + WRAP_V1_0_CALL(writeSmsToRuim, serial, cdmaSms); +} + +Return Radio::deleteSmsOnRuim(int32_t serial, int32_t index) { + WRAP_V1_0_CALL(deleteSmsOnRuim, serial, index); +} + +Return Radio::getDeviceIdentity(int32_t serial) { + WRAP_V1_0_CALL(getDeviceIdentity, serial); +} + +Return Radio::exitEmergencyCallbackMode(int32_t serial) { + WRAP_V1_0_CALL(exitEmergencyCallbackMode, serial); +} + +Return Radio::getSmscAddress(int32_t serial) { + WRAP_V1_0_CALL(getSmscAddress, serial); +} + +Return Radio::setSmscAddress(int32_t serial, const hidl_string& smsc) { + WRAP_V1_0_CALL(setSmscAddress, serial, smsc); +} + +Return Radio::reportSmsMemoryStatus(int32_t serial, bool available) { + WRAP_V1_0_CALL(reportSmsMemoryStatus, serial, available); +} + +Return Radio::reportStkServiceIsRunning(int32_t serial) { + WRAP_V1_0_CALL(reportStkServiceIsRunning, serial); +} + +Return Radio::getCdmaSubscriptionSource(int32_t serial) { + WRAP_V1_0_CALL(getCdmaSubscriptionSource, serial); +} + +Return Radio::requestIsimAuthentication(int32_t serial, const hidl_string& challenge) { + WRAP_V1_0_CALL(requestIsimAuthentication, serial, challenge); +} + +Return Radio::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, + const hidl_string& ackPdu) { + WRAP_V1_0_CALL(acknowledgeIncomingGsmSmsWithPdu, serial, success, ackPdu); +} + +Return Radio::sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) { + WRAP_V1_0_CALL(sendEnvelopeWithStatus, serial, contents); +} + +Return Radio::getVoiceRadioTechnology(int32_t serial) { + WRAP_V1_0_CALL(getVoiceRadioTechnology, serial); +} + +Return Radio::getCellInfoList(int32_t serial) { + WRAP_V1_0_CALL(getCellInfoList, serial); +} + +Return Radio::setCellInfoListRate(int32_t serial, int32_t rate) { + WRAP_V1_0_CALL(setCellInfoListRate, serial, rate); +} + +Return Radio::setInitialAttachApn(int32_t serial, + const V1_0::DataProfileInfo& dataProfileInfo, + bool modemCognitive, bool isRoaming) { + WRAP_V1_0_CALL(setInitialAttachApn, serial, dataProfileInfo, modemCognitive, isRoaming); +} + +Return Radio::getImsRegistrationState(int32_t serial) { + WRAP_V1_0_CALL(getImsRegistrationState, serial); +} + +Return Radio::sendImsSms(int32_t serial, const V1_0::ImsSmsMessage& message) { + WRAP_V1_0_CALL(sendImsSms, serial, message); +} + +Return Radio::iccTransmitApduBasicChannel(int32_t serial, const V1_0::SimApdu& message) { + WRAP_V1_0_CALL(iccTransmitApduBasicChannel, serial, message); +} + +Return Radio::iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) { + WRAP_V1_0_CALL(iccOpenLogicalChannel, serial, aid, p2); +} + +Return Radio::iccCloseLogicalChannel(int32_t serial, int32_t channelId) { + WRAP_V1_0_CALL(iccCloseLogicalChannel, serial, channelId); +} + +Return Radio::iccTransmitApduLogicalChannel(int32_t serial, const V1_0::SimApdu& message) { + WRAP_V1_0_CALL(iccTransmitApduLogicalChannel, serial, message); +} + +Return Radio::nvReadItem(int32_t serial, V1_0::NvItem itemId) { + WRAP_V1_0_CALL(nvReadItem, serial, itemId); +} + +Return Radio::nvWriteItem(int32_t serial, const V1_0::NvWriteItem& item) { + WRAP_V1_0_CALL(nvWriteItem, serial, item); +} + +Return Radio::nvWriteCdmaPrl(int32_t serial, const hidl_vec& prl) { + WRAP_V1_0_CALL(nvWriteCdmaPrl, serial, prl); +} + +Return Radio::nvResetConfig(int32_t serial, V1_0::ResetNvType resetType) { + WRAP_V1_0_CALL(nvResetConfig, serial, resetType); +} + +Return Radio::setUiccSubscription(int32_t serial, const V1_0::SelectUiccSub& uiccSub) { + WRAP_V1_0_CALL(setUiccSubscription, serial, uiccSub); +} + +Return Radio::setDataAllowed(int32_t serial, bool allow) { + WRAP_V1_0_CALL(setDataAllowed, serial, allow); +} + +Return Radio::getHardwareConfig(int32_t serial) { + WRAP_V1_0_CALL(getHardwareConfig, serial); +} + +Return Radio::requestIccSimAuthentication(int32_t serial, int32_t authContext, + const hidl_string& authData, + const hidl_string& aid) { + WRAP_V1_0_CALL(requestIccSimAuthentication, serial, authContext, authData, aid); +} + +Return Radio::setDataProfile(int32_t serial, const hidl_vec& profiles, + bool isRoaming) { + WRAP_V1_0_CALL(setDataProfile, serial, profiles, isRoaming); +} + +Return Radio::requestShutdown(int32_t serial) { + WRAP_V1_0_CALL(requestShutdown, serial); +} + +Return Radio::getRadioCapability(int32_t serial) { + WRAP_V1_0_CALL(getRadioCapability, serial); +} + +Return Radio::setRadioCapability(int32_t serial, const V1_0::RadioCapability& rc) { + WRAP_V1_0_CALL(setRadioCapability, serial, rc); +} + +Return Radio::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) { + WRAP_V1_0_CALL(startLceService, serial, reportInterval, pullMode); +} + +Return Radio::stopLceService(int32_t serial) { + WRAP_V1_0_CALL(stopLceService, serial); +} + +Return Radio::pullLceData(int32_t serial) { + WRAP_V1_0_CALL(pullLceData, serial); +} + +Return Radio::getModemActivityInfo(int32_t serial) { + WRAP_V1_0_CALL(getModemActivityInfo, serial); +} + +Return Radio::setAllowedCarriers(int32_t serial, bool allAllowed, + const V1_0::CarrierRestrictions& carriers) { + WRAP_V1_0_CALL(setAllowedCarriers, serial, allAllowed, carriers); +} + +Return Radio::getAllowedCarriers(int32_t serial) { + WRAP_V1_0_CALL(getAllowedCarriers, serial); +} + +Return Radio::sendDeviceState(int32_t serial, V1_0::DeviceStateType deviceStateType, + bool state) { + WRAP_V1_0_CALL(sendDeviceState, serial, deviceStateType, state); +} + +Return Radio::setIndicationFilter(int32_t serial, + hidl_bitfield indicationFilter) { + WRAP_V1_0_CALL(setIndicationFilter, serial, indicationFilter); +} + +Return Radio::setSimCardPower(int32_t serial, bool powerUp) { + WRAP_V1_0_CALL(setSimCardPower, serial, powerUp); +} + +Return Radio::responseAcknowledgement() { + WRAP_V1_0_CALL(responseAcknowledgement); +} + +// Methods from ::android::hardware::radio::V1_1::IRadio follow. +Return Radio::setCarrierInfoForImsiEncryption( + int32_t serial, const V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) { + MAYBE_WRAP_V1_1_CALL(setCarrierInfoForImsiEncryption, serial, imsiEncryptionInfo); + + // TODO implement + return Void(); +} + +Return Radio::setSimCardPower_1_1(int32_t serial, V1_1::CardPowerState powerUp) { + MAYBE_WRAP_V1_1_CALL(setSimCardPower_1_1, serial, powerUp); + + if(powerUp != V1_1::CardPowerState::POWER_UP_PASS_THROUGH) + WRAP_V1_0_CALL(setSimCardPower, serial, (bool) powerUp); + + return Void(); +} + +Return Radio::startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) { + MAYBE_WRAP_V1_1_CALL(startNetworkScan, serial, request); + + // TODO implement + return Void(); +} + +Return Radio::stopNetworkScan(int32_t serial) { + MAYBE_WRAP_V1_1_CALL(stopNetworkScan, serial); + + // TODO implement + return Void(); +} + +Return Radio::startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) { + MAYBE_WRAP_V1_1_CALL(startKeepalive, serial, keepalive); + + // TODO implement + return Void(); +} + +Return Radio::stopKeepalive(int32_t serial, int32_t sessionHandle) { + MAYBE_WRAP_V1_1_CALL(stopKeepalive, serial, sessionHandle); + + // TODO implement + return Void(); +} + +// Methods from ::android::hardware::radio::V1_2::IRadio follow. +Return Radio::startNetworkScan_1_2(int32_t serial, const V1_2::NetworkScanRequest& request) { + MAYBE_WRAP_V1_2_CALL(startNetworkScan_1_2, serial, request); + + // TODO implement + return Void(); +} + +Return Radio::setIndicationFilter_1_2( + int32_t serial, hidl_bitfield indicationFilter) { + MAYBE_WRAP_V1_2_CALL(setIndicationFilter_1_2, serial, indicationFilter); + WRAP_V1_0_CALL(setIndicationFilter, serial, indicationFilter & V1_0::IndicationFilter::ALL); +} + +Return Radio::setSignalStrengthReportingCriteria(int32_t serial, int32_t hysteresisMs, + int32_t hysteresisDb, + const hidl_vec& thresholdsDbm, + V1_2::AccessNetwork accessNetwork) { + MAYBE_WRAP_V1_2_CALL(setSignalStrengthReportingCriteria, serial, hysteresisMs, hysteresisDb, + thresholdsDbm, accessNetwork); + + // TODO implement + return Void(); +} + +Return Radio::setLinkCapacityReportingCriteria( + int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps, + const hidl_vec& thresholdsDownlinkKbps, + const hidl_vec& thresholdsUplinkKbps, V1_2::AccessNetwork accessNetwork) { + MAYBE_WRAP_V1_2_CALL(setLinkCapacityReportingCriteria, serial, hysteresisMs, hysteresisDlKbps, + hysteresisUlKbps, thresholdsDownlinkKbps, thresholdsUplinkKbps, + accessNetwork); + + // TODO implement + return Void(); +} + +Return Radio::setupDataCall_1_2(int32_t serial, V1_2::AccessNetwork accessNetwork, + const V1_0::DataProfileInfo& dataProfileInfo, + bool modemCognitive, bool roamingAllowed, bool isRoaming, + V1_2::DataRequestReason reason, + const hidl_vec& addresses, + const hidl_vec& dnses) { + MAYBE_WRAP_V1_2_CALL(setupDataCall_1_2, serial, accessNetwork, dataProfileInfo, modemCognitive, + roamingAllowed, isRoaming, reason, addresses, dnses); + + // TODO implement + return Void(); +} + +Return Radio::deactivateDataCall_1_2(int32_t serial, int32_t cid, + V1_2::DataRequestReason reason) { + MAYBE_WRAP_V1_2_CALL(deactivateDataCall_1_2, serial, cid, reason); + WRAP_V1_0_CALL(deactivateDataCall, serial, cid, reason == V1_2::DataRequestReason::SHUTDOWN); +} + +// Methods from ::android::hardware::radio::V1_3::IRadio follow. +Return Radio::setSystemSelectionChannels( + int32_t serial, bool specifyChannels, + const hidl_vec& specifiers) { + MAYBE_WRAP_V1_3_CALL(setSystemSelectionChannels, serial, specifyChannels, specifiers); + + // TODO implement + return Void(); +} + +Return Radio::enableModem(int32_t serial, bool on) { + MAYBE_WRAP_V1_3_CALL(enableModem, serial, on); + + // TODO implement + return Void(); +} + +Return Radio::getModemStackStatus(int32_t serial) { + MAYBE_WRAP_V1_3_CALL(getModemStackStatus, serial); + + // TODO implement + return Void(); +} + +hidl_string getProtocolStringFromInt(const V1_4::PdpProtocolType protocol){ + const hidl_string protocolStrings[] = {hidl_string("IP"), hidl_string("IPV6"), hidl_string("IPV4V6"), hidl_string("PPP"), + hidl_string("NON-IP"), hidl_string("UNSTRUCTURED")}; + + if(protocol >= V1_4::PdpProtocolType::IP && protocol <= V1_4::PdpProtocolType::UNSTRUCTURED) + return protocolStrings[(int)protocol]; + + return hidl_string(""); +} + +V1_0::DataProfileInfo Get1_0DataProfileInfo(const V1_4::DataProfileInfo& dataProfileInfo){ + V1_0::DataProfileInfo legacyProfile = {}; + legacyProfile.profileId = dataProfileInfo.profileId; + legacyProfile.apn = dataProfileInfo.apn; + legacyProfile.protocol = getProtocolStringFromInt(dataProfileInfo.protocol); + legacyProfile.roamingProtocol = getProtocolStringFromInt(dataProfileInfo.roamingProtocol); + legacyProfile.authType = dataProfileInfo.authType; + legacyProfile.user = dataProfileInfo.user; + legacyProfile.password = dataProfileInfo.password; + legacyProfile.type = dataProfileInfo.type; + legacyProfile.maxConnsTime = dataProfileInfo.maxConnsTime; + legacyProfile.maxConns = dataProfileInfo.maxConns; + legacyProfile.waitTime = dataProfileInfo.waitTime; + legacyProfile.enabled = dataProfileInfo.enabled; + legacyProfile.supportedApnTypesBitmap = dataProfileInfo.supportedApnTypesBitmap; + legacyProfile.bearerBitmap = dataProfileInfo.bearerBitmap; + legacyProfile.mtu = dataProfileInfo.mtu; + legacyProfile.mvnoType = V1_0::MvnoType::NONE; + + return legacyProfile; +} + +// Methods from ::android::hardware::radio::V1_4::IRadio follow. +Return Radio::setupDataCall_1_4(int32_t serial, V1_4::AccessNetwork accessNetwork, + const V1_4::DataProfileInfo& dataProfileInfo, + bool roamingAllowed, V1_2::DataRequestReason reason, + const hidl_vec& addresses, + const hidl_vec& dnses) { + MAYBE_WRAP_V1_4_CALL(setupDataCall_1_4, serial, accessNetwork, dataProfileInfo, roamingAllowed, + reason, addresses, dnses); + + MAYBE_WRAP_V1_2_CALL(setupDataCall_1_2, serial, (V1_2::AccessNetwork) accessNetwork, Get1_0DataProfileInfo(dataProfileInfo), + dataProfileInfo.persistent, roamingAllowed, mRadioResponse->mDataRoaming, reason, addresses, dnses); + + WRAP_V1_0_CALL(setupDataCall, serial, mRadioResponse->mRat, Get1_0DataProfileInfo(dataProfileInfo), + dataProfileInfo.persistent, roamingAllowed, mRadioResponse->mDataRoaming); +} + +Return Radio::setInitialAttachApn_1_4(int32_t serial, + const V1_4::DataProfileInfo& dataProfileInfo) { + MAYBE_WRAP_V1_4_CALL(setInitialAttachApn_1_4, serial, dataProfileInfo); + + WRAP_V1_0_CALL(setInitialAttachApn, serial, Get1_0DataProfileInfo(dataProfileInfo), + dataProfileInfo.persistent, mRadioResponse->mDataRoaming); +} + +Return Radio::setDataProfile_1_4(int32_t serial, + const hidl_vec& profiles) { + MAYBE_WRAP_V1_4_CALL(setDataProfile_1_4, serial, profiles); + + std::vector legacyProfiles; + for(const V1_4::DataProfileInfo &profile : profiles){ + if(profile.persistent) + legacyProfiles.push_back(Get1_0DataProfileInfo(profile)); + } + + if(legacyProfiles.size()) + WRAP_V1_0_CALL(setDataProfile, serial, hidl_vec(legacyProfiles), mRadioResponse->mDataRoaming); + + return Void(); +} + +Return Radio::emergencyDial(int32_t serial, const V1_0::Dial& dialInfo, + hidl_bitfield categories, + const hidl_vec& urns, + V1_4::EmergencyCallRouting routing, + bool hasKnownUserIntentEmergency, bool isTesting) { + MAYBE_WRAP_V1_4_CALL(emergencyDial, serial, dialInfo, categories, urns, routing, + hasKnownUserIntentEmergency, isTesting); + + // TODO implement + return Void(); +} + +Return Radio::startNetworkScan_1_4(int32_t serial, const V1_2::NetworkScanRequest& request) { + MAYBE_WRAP_V1_4_CALL(startNetworkScan_1_4, serial, request); + MAYBE_WRAP_V1_2_CALL(startNetworkScan_1_2, serial, request); + + V1_1::NetworkScanRequest legacyRequest = {}; + legacyRequest.type = request.type; + legacyRequest.interval = request.interval; + legacyRequest.specifiers = request.specifiers; + + MAYBE_WRAP_V1_1_CALL(startNetworkScan, serial, legacyRequest); + // TODO implement + return Void(); +} + +Return Radio::getPreferredNetworkTypeBitmap(int32_t serial) { + MAYBE_WRAP_V1_4_CALL(getPreferredNetworkTypeBitmap, serial); + + WRAP_V1_0_CALL(getPreferredNetworkType, serial); +} + +Return Radio::setPreferredNetworkTypeBitmap( + int32_t serial, hidl_bitfield networkTypeBitmap) { + MAYBE_WRAP_V1_4_CALL(setPreferredNetworkTypeBitmap, serial, networkTypeBitmap); + + if(networkTypeBitmap & GSMBITS) + networkTypeBitmap |= GSMBITS; + if(networkTypeBitmap & CDMABITS) + networkTypeBitmap |= CDMABITS; + if(networkTypeBitmap & EVDOBITS) + networkTypeBitmap |= EVDOBITS; + if(networkTypeBitmap & WCDMABITS) + networkTypeBitmap |= WCDMABITS; + if(networkTypeBitmap & LTEBITS) + networkTypeBitmap |= LTEBITS; + + V1_0::PreferredNetworkType nwType; + switch(networkTypeBitmap){ + case (GSMBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::GSM_WCDMA_AUTO; + break; + case GSMBITS: + nwType = V1_0::PreferredNetworkType::GSM_ONLY; + break; + case WCDMABITS: + nwType = V1_0::PreferredNetworkType::WCDMA; + break; + case (CDMABITS | EVDOBITS): + nwType = V1_0::PreferredNetworkType::CDMA_EVDO_AUTO; + break; + case CDMABITS: + nwType = V1_0::PreferredNetworkType::CDMA_ONLY; + break; + case EVDOBITS: + nwType = V1_0::PreferredNetworkType::EVDO_ONLY; + break; + case (GSMBITS | WCDMABITS | CDMABITS | EVDOBITS): + nwType = V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO; + break; + case (LTEBITS | CDMABITS | EVDOBITS): + nwType = V1_0::PreferredNetworkType::LTE_CDMA_EVDO; + break; + case (LTEBITS | GSMBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::LTE_GSM_WCDMA; + break; + case (LTEBITS | CDMABITS | EVDOBITS | GSMBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA; + break; + case LTEBITS: + nwType = V1_0::PreferredNetworkType::LTE_ONLY; + break; + case (LTEBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::LTE_WCDMA; + break; + case TDSCDMABIT: + nwType = V1_0::PreferredNetworkType::TD_SCDMA_ONLY; + break; + case (TDSCDMABIT | WCDMABITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_WCDMA; + break; + case (TDSCDMABIT | LTEBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_LTE; + break; + case (TDSCDMABIT | GSMBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_GSM; + break; + case (TDSCDMABIT | GSMBITS | LTEBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE; + break; + case (TDSCDMABIT | GSMBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA; + break; + case (TDSCDMABIT | WCDMABITS | LTEBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE; + break; + case (TDSCDMABIT | GSMBITS | WCDMABITS | LTEBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE; + break; + case (TDSCDMABIT | GSMBITS | WCDMABITS | CDMABITS | EVDOBITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO; + break; + case (TDSCDMABIT | LTEBITS | CDMABITS | EVDOBITS | GSMBITS | WCDMABITS): + nwType = V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA; + break; + default: + nwType = V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA; + } + WRAP_V1_0_CALL(setPreferredNetworkType, serial, nwType); +} + +Return Radio::setAllowedCarriers_1_4(int32_t serial, + const V1_4::CarrierRestrictionsWithPriority& carriers, + V1_4::SimLockMultiSimPolicy multiSimPolicy) { + MAYBE_WRAP_V1_4_CALL(setAllowedCarriers_1_4, serial, carriers, multiSimPolicy); + + bool isAllCarriersAllowed = carriers.allowedCarriers.size() == 0 && + carriers.excludedCarriers.size() == 0 && !carriers.allowedCarriersPrioritized; + + bool supported = (isAllCarriersAllowed + || (carriers.excludedCarriers.size() == 0 + && carriers.allowedCarriersPrioritized)) + && multiSimPolicy == V1_4::SimLockMultiSimPolicy::NO_MULTISIM_POLICY; + + if(supported){ + V1_0::CarrierRestrictions legacyCarriers = {}; + legacyCarriers.allowedCarriers = carriers.allowedCarriers; + WRAP_V1_0_CALL(setAllowedCarriers, serial, isAllCarriersAllowed, legacyCarriers); + } + + return Void(); +} + +Return Radio::getAllowedCarriers_1_4(int32_t serial) { + MAYBE_WRAP_V1_4_CALL(getAllowedCarriers_1_4, serial); + WRAP_V1_0_CALL(getAllowedCarriers, serial); +} + +Return Radio::getSignalStrength_1_4(int32_t serial) { + MAYBE_WRAP_V1_4_CALL(getSignalStrength_1_4, serial); + WRAP_V1_0_CALL(getSignalStrength, serial); +} + +sp Radio::getRealRadio_V1_1() { + return V1_1::IRadio::castFrom(mRealRadio).withDefault(nullptr); +} + +sp Radio::getRealRadio_V1_2() { + return V1_2::IRadio::castFrom(mRealRadio).withDefault(nullptr); +} + +sp Radio::getRealRadio_V1_3() { + return V1_3::IRadio::castFrom(mRealRadio).withDefault(nullptr); +} + +sp Radio::getRealRadio_V1_4() { + return V1_4::IRadio::castFrom(mRealRadio).withDefault(nullptr); +} + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/Radio.h b/radio/1.4/legacy/Radio.h new file mode 100644 index 0000000..f79096b --- /dev/null +++ b/radio/1.4/legacy/Radio.h @@ -0,0 +1,273 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include + +#include "RadioIndication.h" +#include "RadioResponse.h" + +namespace android::hardware::radio::implementation { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct Radio : public V1_4::IRadio { + public: + Radio(sp realRadio); + + // Methods from ::android::hardware::radio::V1_0::IRadio follow. + Return setResponseFunctions(const sp& radioResponse, + const sp& radioIndication) override; + Return getIccCardStatus(int32_t serial) override; + Return supplyIccPinForApp(int32_t serial, const hidl_string& pin, + const hidl_string& aid) override; + Return supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin, + const hidl_string& aid) override; + Return supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2, + const hidl_string& aid) override; + Return supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2, + const hidl_string& pin2, const hidl_string& aid) override; + Return changeIccPinForApp(int32_t serial, const hidl_string& oldPin, + const hidl_string& newPin, const hidl_string& aid) override; + Return changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2, + const hidl_string& newPin2, const hidl_string& aid) override; + Return supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override; + Return getCurrentCalls(int32_t serial) override; + Return dial(int32_t serial, const V1_0::Dial& dialInfo) override; + Return getImsiForApp(int32_t serial, const hidl_string& aid) override; + Return hangup(int32_t serial, int32_t gsmIndex) override; + Return hangupWaitingOrBackground(int32_t serial) override; + Return hangupForegroundResumeBackground(int32_t serial) override; + Return switchWaitingOrHoldingAndActive(int32_t serial) override; + Return conference(int32_t serial) override; + Return rejectCall(int32_t serial) override; + Return getLastCallFailCause(int32_t serial) override; + Return getSignalStrength(int32_t serial) override; + Return getVoiceRegistrationState(int32_t serial) override; + Return getDataRegistrationState(int32_t serial) override; + Return getOperator(int32_t serial) override; + Return setRadioPower(int32_t serial, bool on) override; + Return sendDtmf(int32_t serial, const hidl_string& s) override; + Return sendSms(int32_t serial, const V1_0::GsmSmsMessage& message) override; + Return sendSMSExpectMore(int32_t serial, const V1_0::GsmSmsMessage& message) override; + Return setupDataCall(int32_t serial, V1_0::RadioTechnology radioTechnology, + const V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive, + bool roamingAllowed, bool isRoaming) override; + Return iccIOForApp(int32_t serial, const V1_0::IccIo& iccIo) override; + Return sendUssd(int32_t serial, const hidl_string& ussd) override; + Return cancelPendingUssd(int32_t serial) override; + Return getClir(int32_t serial) override; + Return setClir(int32_t serial, int32_t status) override; + Return getCallForwardStatus(int32_t serial, + const V1_0::CallForwardInfo& callInfo) override; + Return setCallForward(int32_t serial, const V1_0::CallForwardInfo& callInfo) override; + Return getCallWaiting(int32_t serial, int32_t serviceClass) override; + Return setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override; + Return acknowledgeLastIncomingGsmSms(int32_t serial, bool success, + V1_0::SmsAcknowledgeFailCause cause) override; + Return acceptCall(int32_t serial) override; + Return deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override; + Return getFacilityLockForApp(int32_t serial, const hidl_string& facility, + const hidl_string& password, int32_t serviceClass, + const hidl_string& appId) override; + Return setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState, + const hidl_string& password, int32_t serviceClass, + const hidl_string& appId) override; + Return setBarringPassword(int32_t serial, const hidl_string& facility, + const hidl_string& oldPassword, + const hidl_string& newPassword) override; + Return getNetworkSelectionMode(int32_t serial) override; + Return setNetworkSelectionModeAutomatic(int32_t serial) override; + Return setNetworkSelectionModeManual(int32_t serial, + const hidl_string& operatorNumeric) override; + Return getAvailableNetworks(int32_t serial) override; + Return startDtmf(int32_t serial, const hidl_string& s) override; + Return stopDtmf(int32_t serial) override; + Return getBasebandVersion(int32_t serial) override; + Return separateConnection(int32_t serial, int32_t gsmIndex) override; + Return setMute(int32_t serial, bool enable) override; + Return getMute(int32_t serial) override; + Return getClip(int32_t serial) override; + Return getDataCallList(int32_t serial) override; + Return setSuppServiceNotifications(int32_t serial, bool enable) override; + Return writeSmsToSim(int32_t serial, const V1_0::SmsWriteArgs& smsWriteArgs) override; + Return deleteSmsOnSim(int32_t serial, int32_t index) override; + Return setBandMode(int32_t serial, V1_0::RadioBandMode mode) override; + Return getAvailableBandModes(int32_t serial) override; + Return sendEnvelope(int32_t serial, const hidl_string& command) override; + Return sendTerminalResponseToSim(int32_t serial, + const hidl_string& commandResponse) override; + Return handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override; + Return explicitCallTransfer(int32_t serial) override; + Return setPreferredNetworkType(int32_t serial, + V1_0::PreferredNetworkType nwType) override; + Return getPreferredNetworkType(int32_t serial) override; + Return getNeighboringCids(int32_t serial) override; + Return setLocationUpdates(int32_t serial, bool enable) override; + Return setCdmaSubscriptionSource(int32_t serial, + V1_0::CdmaSubscriptionSource cdmaSub) override; + Return setCdmaRoamingPreference(int32_t serial, V1_0::CdmaRoamingType type) override; + Return getCdmaRoamingPreference(int32_t serial) override; + Return setTTYMode(int32_t serial, V1_0::TtyMode mode) override; + Return getTTYMode(int32_t serial) override; + Return setPreferredVoicePrivacy(int32_t serial, bool enable) override; + Return getPreferredVoicePrivacy(int32_t serial) override; + Return sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override; + Return sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on, + int32_t off) override; + Return sendCdmaSms(int32_t serial, const V1_0::CdmaSmsMessage& sms) override; + Return acknowledgeLastIncomingCdmaSms(int32_t serial, + const V1_0::CdmaSmsAck& smsAck) override; + Return getGsmBroadcastConfig(int32_t serial) override; + Return setGsmBroadcastConfig( + int32_t serial, const hidl_vec& configInfo) override; + Return setGsmBroadcastActivation(int32_t serial, bool activate) override; + Return getCdmaBroadcastConfig(int32_t serial) override; + Return setCdmaBroadcastConfig( + int32_t serial, const hidl_vec& configInfo) override; + Return setCdmaBroadcastActivation(int32_t serial, bool activate) override; + Return getCDMASubscription(int32_t serial) override; + Return writeSmsToRuim(int32_t serial, const V1_0::CdmaSmsWriteArgs& cdmaSms) override; + Return deleteSmsOnRuim(int32_t serial, int32_t index) override; + Return getDeviceIdentity(int32_t serial) override; + Return exitEmergencyCallbackMode(int32_t serial) override; + Return getSmscAddress(int32_t serial) override; + Return setSmscAddress(int32_t serial, const hidl_string& smsc) override; + Return reportSmsMemoryStatus(int32_t serial, bool available) override; + Return reportStkServiceIsRunning(int32_t serial) override; + Return getCdmaSubscriptionSource(int32_t serial) override; + Return requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override; + Return acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success, + const hidl_string& ackPdu) override; + Return sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override; + Return getVoiceRadioTechnology(int32_t serial) override; + Return getCellInfoList(int32_t serial) override; + Return setCellInfoListRate(int32_t serial, int32_t rate) override; + Return setInitialAttachApn(int32_t serial, const V1_0::DataProfileInfo& dataProfileInfo, + bool modemCognitive, bool isRoaming) override; + Return getImsRegistrationState(int32_t serial) override; + Return sendImsSms(int32_t serial, const V1_0::ImsSmsMessage& message) override; + Return iccTransmitApduBasicChannel(int32_t serial, const V1_0::SimApdu& message) override; + Return iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override; + Return iccCloseLogicalChannel(int32_t serial, int32_t channelId) override; + Return iccTransmitApduLogicalChannel(int32_t serial, + const V1_0::SimApdu& message) override; + Return nvReadItem(int32_t serial, V1_0::NvItem itemId) override; + Return nvWriteItem(int32_t serial, const V1_0::NvWriteItem& item) override; + Return nvWriteCdmaPrl(int32_t serial, const hidl_vec& prl) override; + Return nvResetConfig(int32_t serial, V1_0::ResetNvType resetType) override; + Return setUiccSubscription(int32_t serial, const V1_0::SelectUiccSub& uiccSub) override; + Return setDataAllowed(int32_t serial, bool allow) override; + Return getHardwareConfig(int32_t serial) override; + Return requestIccSimAuthentication(int32_t serial, int32_t authContext, + const hidl_string& authData, + const hidl_string& aid) override; + Return setDataProfile(int32_t serial, const hidl_vec& profiles, + bool isRoaming) override; + Return requestShutdown(int32_t serial) override; + Return getRadioCapability(int32_t serial) override; + Return setRadioCapability(int32_t serial, const V1_0::RadioCapability& rc) override; + Return startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override; + Return stopLceService(int32_t serial) override; + Return pullLceData(int32_t serial) override; + Return getModemActivityInfo(int32_t serial) override; + Return setAllowedCarriers(int32_t serial, bool allAllowed, + const V1_0::CarrierRestrictions& carriers) override; + Return getAllowedCarriers(int32_t serial) override; + Return sendDeviceState(int32_t serial, V1_0::DeviceStateType deviceStateType, + bool state) override; + Return setIndicationFilter( + int32_t serial, hidl_bitfield indicationFilter) override; + Return setSimCardPower(int32_t serial, bool powerUp) override; + Return responseAcknowledgement() override; + + // Methods from ::android::hardware::radio::V1_1::IRadio follow. + Return setCarrierInfoForImsiEncryption( + int32_t serial, const V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override; + Return setSimCardPower_1_1(int32_t serial, V1_1::CardPowerState powerUp) override; + Return startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) override; + Return stopNetworkScan(int32_t serial) override; + Return startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) override; + Return stopKeepalive(int32_t serial, int32_t sessionHandle) override; + + // Methods from ::android::hardware::radio::V1_2::IRadio follow. + Return startNetworkScan_1_2(int32_t serial, + const V1_2::NetworkScanRequest& request) override; + Return setIndicationFilter_1_2( + int32_t serial, hidl_bitfield indicationFilter) override; + Return setSignalStrengthReportingCriteria(int32_t serial, int32_t hysteresisMs, + int32_t hysteresisDb, + const hidl_vec& thresholdsDbm, + V1_2::AccessNetwork accessNetwork) override; + Return setLinkCapacityReportingCriteria(int32_t serial, int32_t hysteresisMs, + int32_t hysteresisDlKbps, + int32_t hysteresisUlKbps, + const hidl_vec& thresholdsDownlinkKbps, + const hidl_vec& thresholdsUplinkKbps, + V1_2::AccessNetwork accessNetwork) override; + Return setupDataCall_1_2(int32_t serial, V1_2::AccessNetwork accessNetwork, + const V1_0::DataProfileInfo& dataProfileInfo, + bool modemCognitive, bool roamingAllowed, bool isRoaming, + V1_2::DataRequestReason reason, + const hidl_vec& addresses, + const hidl_vec& dnses) override; + Return deactivateDataCall_1_2(int32_t serial, int32_t cid, + V1_2::DataRequestReason reason) override; + + // Methods from ::android::hardware::radio::V1_3::IRadio follow. + Return setSystemSelectionChannels( + int32_t serial, bool specifyChannels, + const hidl_vec& specifiers) override; + Return enableModem(int32_t serial, bool on) override; + Return getModemStackStatus(int32_t serial) override; + + // Methods from ::android::hardware::radio::V1_4::IRadio follow. + Return setupDataCall_1_4(int32_t serial, V1_4::AccessNetwork accessNetwork, + const V1_4::DataProfileInfo& dataProfileInfo, + bool roamingAllowed, V1_2::DataRequestReason reason, + const hidl_vec& addresses, + const hidl_vec& dnses) override; + Return setInitialAttachApn_1_4(int32_t serial, + const V1_4::DataProfileInfo& dataProfileInfo) override; + Return setDataProfile_1_4(int32_t serial, + const hidl_vec& profiles) override; + Return emergencyDial(int32_t serial, const V1_0::Dial& dialInfo, + hidl_bitfield categories, + const hidl_vec& urns, + V1_4::EmergencyCallRouting routing, bool hasKnownUserIntentEmergency, + bool isTesting) override; + Return startNetworkScan_1_4(int32_t serial, + const V1_2::NetworkScanRequest& request) override; + Return getPreferredNetworkTypeBitmap(int32_t serial) override; + Return setPreferredNetworkTypeBitmap( + int32_t serial, hidl_bitfield networkTypeBitmap) override; + Return setAllowedCarriers_1_4(int32_t serial, + const V1_4::CarrierRestrictionsWithPriority& carriers, + V1_4::SimLockMultiSimPolicy multiSimPolicy) override; + Return getAllowedCarriers_1_4(int32_t serial) override; + Return getSignalStrength_1_4(int32_t serial) override; + + private: + sp mRealRadio; + sp mRadioResponse = new RadioResponse(); + sp mRadioIndication = new RadioIndication(); + + sp getRealRadio_V1_1(); + sp getRealRadio_V1_2(); + sp getRealRadio_V1_3(); + sp getRealRadio_V1_4(); +}; + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/RadioIndication.cpp b/radio/1.4/legacy/RadioIndication.cpp new file mode 100644 index 0000000..202b180 --- /dev/null +++ b/radio/1.4/legacy/RadioIndication.cpp @@ -0,0 +1,314 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "RadioIndication.h" +#include "Helpers.h" + +namespace android::hardware::radio::implementation { + +// Methods from ::android::hardware::radio::V1_0::IRadioIndication follow. +Return RadioIndication::radioStateChanged(V1_0::RadioIndicationType type, + V1_0::RadioState radioState) { + return mRealRadioIndication->radioStateChanged(type, radioState); +} + +Return RadioIndication::callStateChanged(V1_0::RadioIndicationType type) { + return mRealRadioIndication->callStateChanged(type); +} + +Return RadioIndication::networkStateChanged(V1_0::RadioIndicationType type) { + return mRealRadioIndication->networkStateChanged(type); +} + +Return RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec& pdu) { + return mRealRadioIndication->newSms(type, pdu); +} + +Return RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type, + const hidl_vec& pdu) { + return mRealRadioIndication->newSmsStatusReport(type, pdu); +} + +Return RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) { + return mRealRadioIndication->newSmsOnSim(type, recordNumber); +} + +Return RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType, + const hidl_string& msg) { + return mRealRadioIndication->onUssd(type, modeType, msg); +} + +Return RadioIndication::nitzTimeReceived(V1_0::RadioIndicationType type, + const hidl_string& nitzTime, uint64_t receivedTime) { + return mRealRadioIndication->nitzTimeReceived(type, nitzTime, receivedTime); +} + +Return RadioIndication::currentSignalStrength(V1_0::RadioIndicationType type, + const V1_0::SignalStrength& signalStrength) { + return mRealRadioIndication->currentSignalStrength_1_4(type, Create1_4SignalStrength(signalStrength)); +} + +Return RadioIndication::dataCallListChanged( + V1_0::RadioIndicationType type, const hidl_vec& dcList) { + hidl_vec newDcList; + newDcList.resize(dcList.size()); + for(int x = 0; x < dcList.size(); ++x) + newDcList[x] = Create1_4SetupDataCallResult(dcList[x]); + return mRealRadioIndication->dataCallListChanged_1_4(type, newDcList); +} + +Return RadioIndication::suppSvcNotify(V1_0::RadioIndicationType type, + const V1_0::SuppSvcNotification& suppSvc) { + return mRealRadioIndication->suppSvcNotify(type, suppSvc); +} + +Return RadioIndication::stkSessionEnd(V1_0::RadioIndicationType type) { + return mRealRadioIndication->stkSessionEnd(type); +} + +Return RadioIndication::stkProactiveCommand(V1_0::RadioIndicationType type, + const hidl_string& cmd) { + return mRealRadioIndication->stkProactiveCommand(type, cmd); +} + +Return RadioIndication::stkEventNotify(V1_0::RadioIndicationType type, + const hidl_string& cmd) { + return mRealRadioIndication->stkEventNotify(type, cmd); +} + +Return RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) { + return mRealRadioIndication->stkCallSetup(type, timeout); +} + +Return RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) { + return mRealRadioIndication->simSmsStorageFull(type); +} + +Return RadioIndication::simRefresh(V1_0::RadioIndicationType type, + const V1_0::SimRefreshResult& refreshResult) { + return mRealRadioIndication->simRefresh(type, refreshResult); +} + +Return RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm, + const V1_0::CdmaSignalInfoRecord& record) { + return mRealRadioIndication->callRing(type, isGsm, record); +} + +Return RadioIndication::simStatusChanged(V1_0::RadioIndicationType type) { + return mRealRadioIndication->simStatusChanged(type); +} + +Return RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type, + const V1_0::CdmaSmsMessage& msg) { + return mRealRadioIndication->cdmaNewSms(type, msg); +} + +Return RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type, + const hidl_vec& data) { + return mRealRadioIndication->newBroadcastSms(type, data); +} + +Return RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) { + return mRealRadioIndication->cdmaRuimSmsStorageFull(type); +} + +Return RadioIndication::restrictedStateChanged(V1_0::RadioIndicationType type, + V1_0::PhoneRestrictedState state) { + return mRealRadioIndication->restrictedStateChanged(type, state); +} + +Return RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) { + return mRealRadioIndication->enterEmergencyCallbackMode(type); +} + +Return RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type, + const V1_0::CdmaCallWaiting& callWaitingRecord) { + return mRealRadioIndication->cdmaCallWaiting(type, callWaitingRecord); +} + +Return RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type, + V1_0::CdmaOtaProvisionStatus status) { + return mRealRadioIndication->cdmaOtaProvisionStatus(type, status); +} + +Return RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type, + const V1_0::CdmaInformationRecords& records) { + return mRealRadioIndication->cdmaInfoRec(type, records); +} + +Return RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) { + return mRealRadioIndication->indicateRingbackTone(type, start); +} + +Return RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) { + return mRealRadioIndication->resendIncallMute(type); +} + +Return RadioIndication::cdmaSubscriptionSourceChanged( + V1_0::RadioIndicationType type, V1_0::CdmaSubscriptionSource cdmaSource) { + return mRealRadioIndication->cdmaSubscriptionSourceChanged(type, cdmaSource); +} + +Return RadioIndication::cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) { + return mRealRadioIndication->cdmaPrlChanged(type, version); +} + +Return RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) { + return mRealRadioIndication->exitEmergencyCallbackMode(type); +} + +Return RadioIndication::rilConnected(V1_0::RadioIndicationType type) { + return mRealRadioIndication->rilConnected(type); +} + +Return RadioIndication::voiceRadioTechChanged(V1_0::RadioIndicationType type, + V1_0::RadioTechnology rat) { + return mRealRadioIndication->voiceRadioTechChanged(type, rat); +} + +Return RadioIndication::cellInfoList(V1_0::RadioIndicationType type, + const hidl_vec& records) { + return mRealRadioIndication->cellInfoList_1_4(type, Create1_4CellInfoList(records)); +} + +Return RadioIndication::imsNetworkStateChanged(V1_0::RadioIndicationType type) { + return mRealRadioIndication->imsNetworkStateChanged(type); +} + +Return RadioIndication::subscriptionStatusChanged(V1_0::RadioIndicationType type, + bool activate) { + return mRealRadioIndication->subscriptionStatusChanged(type, activate); +} + +Return RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type, + V1_0::SrvccState state) { + return mRealRadioIndication->srvccStateNotify(type, state); +} + +Return RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type, + const hidl_vec& configs) { + return mRealRadioIndication->hardwareConfigChanged(type, configs); +} + +Return RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type, + const V1_0::RadioCapability& rc) { + return mRealRadioIndication->radioCapabilityIndication(type, rc); +} + +Return RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type, + const V1_0::StkCcUnsolSsResult& ss) { + return mRealRadioIndication->onSupplementaryServiceIndication(type, ss); +} + +Return RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type, + const hidl_string& alpha) { + return mRealRadioIndication->stkCallControlAlphaNotify(type, alpha); +} + +Return RadioIndication::lceData(V1_0::RadioIndicationType type, + const V1_0::LceDataInfo& lce) { + return mRealRadioIndication->lceData(type, lce); +} + +Return RadioIndication::pcoData(V1_0::RadioIndicationType type, + const V1_0::PcoDataInfo& pco) { + return mRealRadioIndication->pcoData(type, pco); +} + +Return RadioIndication::modemReset(V1_0::RadioIndicationType type, + const hidl_string& reason) { + return mRealRadioIndication->modemReset(type, reason); +} + +// Methods from ::android::hardware::radio::V1_1::IRadioIndication follow. +Return RadioIndication::carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) { + return mRealRadioIndication->carrierInfoForImsiEncryption(info); +} + +Return RadioIndication::networkScanResult(V1_0::RadioIndicationType type, + const V1_1::NetworkScanResult& result) { + V1_4::NetworkScanResult newNSR = {}; + newNSR.status = result.status; + newNSR.error = result.error; + newNSR.networkInfos = Create1_4CellInfoList(result.networkInfos); + return mRealRadioIndication->networkScanResult_1_4(type, newNSR); +} + +Return RadioIndication::keepaliveStatus(V1_0::RadioIndicationType type, + const V1_1::KeepaliveStatus& status) { + return mRealRadioIndication->keepaliveStatus(type, status); +} + +// Methods from ::android::hardware::radio::V1_2::IRadioIndication follow. +Return RadioIndication::networkScanResult_1_2(V1_0::RadioIndicationType type, + const V1_2::NetworkScanResult& result) { + V1_4::NetworkScanResult newNSR = {}; + newNSR.status = result.status; + newNSR.error = result.error; + newNSR.networkInfos = Create1_4CellInfoList(result.networkInfos); + return mRealRadioIndication->networkScanResult_1_4(type, newNSR); +} + +Return RadioIndication::cellInfoList_1_2(V1_0::RadioIndicationType type, + const hidl_vec& records) { + return mRealRadioIndication->cellInfoList_1_4(type, Create1_4CellInfoList(records)); +} + +Return RadioIndication::currentLinkCapacityEstimate(V1_0::RadioIndicationType type, + const V1_2::LinkCapacityEstimate& lce) { + return mRealRadioIndication->currentLinkCapacityEstimate(type, lce); +} + +Return RadioIndication::currentPhysicalChannelConfigs( + V1_0::RadioIndicationType type, const hidl_vec& configs) { + hidl_vec newConfigs; + newConfigs.resize(configs.size()); + for(int x = 0; x < configs.size(); ++x){ + newConfigs[x].base = configs[x]; + newConfigs[x].rat = V1_4::RadioTechnology::UNKNOWN; + newConfigs[x].physicalCellId = -1; + } + return mRealRadioIndication->currentPhysicalChannelConfigs_1_4(type, newConfigs); +} + +Return RadioIndication::currentSignalStrength_1_2( + V1_0::RadioIndicationType type, const V1_2::SignalStrength& signalStrength) { + return mRealRadioIndication->currentSignalStrength_1_4(type, Create1_4SignalStrength(signalStrength)); +} + +// Methods from ::android::hardware::radio::V1_4::IRadioIndication follow. +Return RadioIndication::currentEmergencyNumberList( + V1_0::RadioIndicationType type, + const hidl_vec& emergencyNumberList) { + return mRealRadioIndication->currentEmergencyNumberList(type, emergencyNumberList); +} + +Return RadioIndication::cellInfoList_1_4(V1_0::RadioIndicationType type, + const hidl_vec& records) { + return mRealRadioIndication->cellInfoList_1_4(type, records); +} + +Return RadioIndication::networkScanResult_1_4(V1_0::RadioIndicationType type, + const V1_4::NetworkScanResult& result) { + return mRealRadioIndication->networkScanResult_1_4(type, result); +} + +Return RadioIndication::currentPhysicalChannelConfigs_1_4( + V1_0::RadioIndicationType type, const hidl_vec& configs) { + return mRealRadioIndication->currentPhysicalChannelConfigs_1_4(type, configs); +} + +Return RadioIndication::dataCallListChanged_1_4( + V1_0::RadioIndicationType type, const hidl_vec& dcList) { + return mRealRadioIndication->dataCallListChanged_1_4(type, dcList); +} + +Return RadioIndication::currentSignalStrength_1_4( + V1_0::RadioIndicationType type, const V1_4::SignalStrength& signalStrength) { + return mRealRadioIndication->currentSignalStrength_1_4(type, signalStrength); +} + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/RadioIndication.h b/radio/1.4/legacy/RadioIndication.h new file mode 100644 index 0000000..41cc5e6 --- /dev/null +++ b/radio/1.4/legacy/RadioIndication.h @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include + +namespace android::hardware::radio::implementation { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct RadioIndication : public V1_4::IRadioIndication { + sp mRealRadioIndication; + // Methods from ::android::hardware::radio::V1_0::IRadioIndication follow. + Return radioStateChanged(V1_0::RadioIndicationType type, + V1_0::RadioState radioState) override; + Return callStateChanged(V1_0::RadioIndicationType type) override; + Return networkStateChanged(V1_0::RadioIndicationType type) override; + Return newSms(V1_0::RadioIndicationType type, const hidl_vec& pdu) override; + Return newSmsStatusReport(V1_0::RadioIndicationType type, + const hidl_vec& pdu) override; + Return newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) override; + Return onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType, + const hidl_string& msg) override; + Return nitzTimeReceived(V1_0::RadioIndicationType type, const hidl_string& nitzTime, + uint64_t receivedTime) override; + Return currentSignalStrength(V1_0::RadioIndicationType type, + const V1_0::SignalStrength& signalStrength) override; + Return dataCallListChanged(V1_0::RadioIndicationType type, + const hidl_vec& dcList) override; + Return suppSvcNotify(V1_0::RadioIndicationType type, + const V1_0::SuppSvcNotification& suppSvc) override; + Return stkSessionEnd(V1_0::RadioIndicationType type) override; + Return stkProactiveCommand(V1_0::RadioIndicationType type, + const hidl_string& cmd) override; + Return stkEventNotify(V1_0::RadioIndicationType type, const hidl_string& cmd) override; + Return stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) override; + Return simSmsStorageFull(V1_0::RadioIndicationType type) override; + Return simRefresh(V1_0::RadioIndicationType type, + const V1_0::SimRefreshResult& refreshResult) override; + Return callRing(V1_0::RadioIndicationType type, bool isGsm, + const V1_0::CdmaSignalInfoRecord& record) override; + Return simStatusChanged(V1_0::RadioIndicationType type) override; + Return cdmaNewSms(V1_0::RadioIndicationType type, + const V1_0::CdmaSmsMessage& msg) override; + Return newBroadcastSms(V1_0::RadioIndicationType type, + const hidl_vec& data) override; + Return cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) override; + Return restrictedStateChanged(V1_0::RadioIndicationType type, + V1_0::PhoneRestrictedState state) override; + Return enterEmergencyCallbackMode(V1_0::RadioIndicationType type) override; + Return cdmaCallWaiting(V1_0::RadioIndicationType type, + const V1_0::CdmaCallWaiting& callWaitingRecord) override; + Return cdmaOtaProvisionStatus(V1_0::RadioIndicationType type, + V1_0::CdmaOtaProvisionStatus status) override; + Return cdmaInfoRec(V1_0::RadioIndicationType type, + const V1_0::CdmaInformationRecords& records) override; + Return indicateRingbackTone(V1_0::RadioIndicationType type, bool start) override; + Return resendIncallMute(V1_0::RadioIndicationType type) override; + Return cdmaSubscriptionSourceChanged(V1_0::RadioIndicationType type, + V1_0::CdmaSubscriptionSource cdmaSource) override; + Return cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) override; + Return exitEmergencyCallbackMode(V1_0::RadioIndicationType type) override; + Return rilConnected(V1_0::RadioIndicationType type) override; + Return voiceRadioTechChanged(V1_0::RadioIndicationType type, + V1_0::RadioTechnology rat) override; + Return cellInfoList(V1_0::RadioIndicationType type, + const hidl_vec& records) override; + Return imsNetworkStateChanged(V1_0::RadioIndicationType type) override; + Return subscriptionStatusChanged(V1_0::RadioIndicationType type, bool activate) override; + Return srvccStateNotify(V1_0::RadioIndicationType type, V1_0::SrvccState state) override; + Return hardwareConfigChanged(V1_0::RadioIndicationType type, + const hidl_vec& configs) override; + Return radioCapabilityIndication(V1_0::RadioIndicationType type, + const V1_0::RadioCapability& rc) override; + Return onSupplementaryServiceIndication(V1_0::RadioIndicationType type, + const V1_0::StkCcUnsolSsResult& ss) override; + Return stkCallControlAlphaNotify(V1_0::RadioIndicationType type, + const hidl_string& alpha) override; + Return lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo& lce) override; + Return pcoData(V1_0::RadioIndicationType type, const V1_0::PcoDataInfo& pco) override; + Return modemReset(V1_0::RadioIndicationType type, const hidl_string& reason) override; + + // Methods from ::android::hardware::radio::V1_1::IRadioIndication follow. + Return carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) override; + Return networkScanResult(V1_0::RadioIndicationType type, + const V1_1::NetworkScanResult& result) override; + Return keepaliveStatus(V1_0::RadioIndicationType type, + const V1_1::KeepaliveStatus& status) override; + + // Methods from ::android::hardware::radio::V1_2::IRadioIndication follow. + Return networkScanResult_1_2(V1_0::RadioIndicationType type, + const V1_2::NetworkScanResult& result) override; + Return cellInfoList_1_2(V1_0::RadioIndicationType type, + const hidl_vec& records) override; + Return currentLinkCapacityEstimate(V1_0::RadioIndicationType type, + const V1_2::LinkCapacityEstimate& lce) override; + Return currentPhysicalChannelConfigs( + V1_0::RadioIndicationType type, + const hidl_vec& configs) override; + Return currentSignalStrength_1_2(V1_0::RadioIndicationType type, + const V1_2::SignalStrength& signalStrength) override; + + // Methods from ::android::hardware::radio::V1_4::IRadioIndication follow. + Return currentEmergencyNumberList( + V1_0::RadioIndicationType type, + const hidl_vec& emergencyNumberList) override; + Return cellInfoList_1_4(V1_0::RadioIndicationType type, + const hidl_vec& records) override; + Return networkScanResult_1_4(V1_0::RadioIndicationType type, + const V1_4::NetworkScanResult& result) override; + Return currentPhysicalChannelConfigs_1_4( + V1_0::RadioIndicationType type, + const hidl_vec& configs) override; + Return dataCallListChanged_1_4( + V1_0::RadioIndicationType type, + const hidl_vec& dcList) override; + Return currentSignalStrength_1_4(V1_0::RadioIndicationType type, + const V1_4::SignalStrength& signalStrength) override; +}; + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/RadioResponse.cpp b/radio/1.4/legacy/RadioResponse.cpp new file mode 100644 index 0000000..3190c9d --- /dev/null +++ b/radio/1.4/legacy/RadioResponse.cpp @@ -0,0 +1,906 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "RadioResponse.h" +#include "Helpers.h" +#include + +namespace android::hardware::radio::implementation { + +// Methods from ::android::hardware::radio::V1_0::IRadioResponse follow. +Return RadioResponse::getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, + const V1_0::CardStatus& cardStatus) { + V1_4::CardStatus newCS = {}; + newCS.base.base = cardStatus; + newCS.base.physicalSlotId = -1; + newCS.base.iccid = hidl_string(" "); + return mRealRadioResponse->getIccCardStatusResponse_1_4(info, newCS); +} + +Return RadioResponse::supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->supplyIccPinForAppResponse(info, remainingRetries); +} + +Return RadioResponse::supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->supplyIccPukForAppResponse(info, remainingRetries); +} + +Return RadioResponse::supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->supplyIccPin2ForAppResponse(info, remainingRetries); +} + +Return RadioResponse::supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->supplyIccPuk2ForAppResponse(info, remainingRetries); +} + +Return RadioResponse::changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->changeIccPinForAppResponse(info, remainingRetries); +} + +Return RadioResponse::changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) { + return mRealRadioResponse->changeIccPin2ForAppResponse(info, remainingRetries); +} + +Return RadioResponse::supplyNetworkDepersonalizationResponse( + const V1_0::RadioResponseInfo& info, int32_t remainingRetries) { + return mRealRadioResponse->supplyNetworkDepersonalizationResponse(info, remainingRetries); +} + +Return RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& calls) { + hidl_vec newCalls; + newCalls.resize(calls.size()); + + for(int x = 0; x < calls.size(); ++x){ + newCalls[x].base = calls[x]; + newCalls[x].audioQuality = V1_2::AudioQuality::UNSPECIFIED; + } + return mRealRadioResponse->getCurrentCallsResponse_1_2(info, newCalls); +} + +Return RadioResponse::dialResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->dialResponse(info); +} + +Return RadioResponse::getIMSIForAppResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& imsi) { + return mRealRadioResponse->getIMSIForAppResponse(info, imsi); +} + +Return RadioResponse::hangupConnectionResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->hangupConnectionResponse(info); +} + +Return RadioResponse::hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->hangupWaitingOrBackgroundResponse(info); +} + +Return RadioResponse::hangupForegroundResumeBackgroundResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->hangupForegroundResumeBackgroundResponse(info); +} + +Return RadioResponse::switchWaitingOrHoldingAndActiveResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->switchWaitingOrHoldingAndActiveResponse(info); +} + +Return RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->conferenceResponse(info); +} + +Return RadioResponse::rejectCallResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->rejectCallResponse(info); +} + +Return RadioResponse::getLastCallFailCauseResponse( + const V1_0::RadioResponseInfo& info, const V1_0::LastCallFailCauseInfo& failCauseinfo) { + return mRealRadioResponse->getLastCallFailCauseResponse(info, failCauseinfo); +} + +Return RadioResponse::getSignalStrengthResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SignalStrength& sigStrength) { + return mRealRadioResponse->getSignalStrengthResponse_1_4(info, Create1_4SignalStrength(sigStrength)); +} + +void Init1_2CellIdentity(const V1_0::CellIdentity& legacyCI, V1_2::CellIdentity& newCI) { + if(legacyCI.cellIdentityGsm.size() == 1){ + newCI.cellIdentityGsm.resize(1); + newCI.cellIdentityGsm[0].base = legacyCI.cellIdentityGsm[0]; + } + else if(legacyCI.cellIdentityCdma.size() == 1){ + newCI.cellIdentityCdma.resize(1); + newCI.cellIdentityCdma[0].base = legacyCI.cellIdentityCdma[0]; + } + else if(legacyCI.cellIdentityLte.size() == 1){ + newCI.cellIdentityLte.resize(1); + newCI.cellIdentityLte[0].base = legacyCI.cellIdentityLte[0]; + newCI.cellIdentityLte[0].bandwidth = INT_MAX; + } + else if(legacyCI.cellIdentityWcdma.size() == 1){ + newCI.cellIdentityWcdma.resize(1); + newCI.cellIdentityWcdma[0].base = legacyCI.cellIdentityWcdma[0]; + } + else if(legacyCI.cellIdentityTdscdma.size() == 1){ + newCI.cellIdentityTdscdma.resize(1); + newCI.cellIdentityTdscdma[0].base = legacyCI.cellIdentityTdscdma[0]; + newCI.cellIdentityTdscdma[0].uarfcn = INT_MAX; + } +} + +Return RadioResponse::getVoiceRegistrationStateResponse( + const V1_0::RadioResponseInfo& info, const V1_0::VoiceRegStateResult& voiceRegResponse) { + V1_2::VoiceRegStateResult newVRR = {}; + newVRR.regState = voiceRegResponse.regState; + newVRR.rat = voiceRegResponse.rat; + newVRR.cssSupported = voiceRegResponse.cssSupported; + newVRR.roamingIndicator = voiceRegResponse.roamingIndicator; + newVRR.systemIsInPrl = voiceRegResponse.systemIsInPrl; + newVRR.defaultRoamingIndicator = voiceRegResponse.defaultRoamingIndicator; + newVRR.reasonForDenial = voiceRegResponse.reasonForDenial; + Init1_2CellIdentity(voiceRegResponse.cellIdentity, newVRR.cellIdentity); + + return mRealRadioResponse->getVoiceRegistrationStateResponse_1_2(info, newVRR); +} + +Return RadioResponse::getDataRegistrationStateResponse( + const V1_0::RadioResponseInfo& info, const V1_0::DataRegStateResult& dataRegResponse) { + mDataRoaming = (dataRegResponse.regState == V1_0::RegState::REG_ROAMING); + mRat = (V1_0::RadioTechnology) dataRegResponse.rat; + + V1_4::DataRegStateResult newDRR = {}; + newDRR.base.regState = dataRegResponse.regState; + newDRR.base.rat = dataRegResponse.rat; + newDRR.base.reasonDataDenied = dataRegResponse.reasonDataDenied; + newDRR.base.maxDataCalls = dataRegResponse.maxDataCalls; + Init1_2CellIdentity(dataRegResponse.cellIdentity, newDRR.base.cellIdentity); + + return mRealRadioResponse->getDataRegistrationStateResponse_1_4(info, newDRR); +} + +Return RadioResponse::getOperatorResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& longName, + const hidl_string& shortName, + const hidl_string& numeric) { + return mRealRadioResponse->getOperatorResponse(info, longName, shortName, numeric); +} + +Return RadioResponse::setRadioPowerResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setRadioPowerResponse(info); +} + +Return RadioResponse::sendDtmfResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendDtmfResponse(info); +} + +Return RadioResponse::sendSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) { + return mRealRadioResponse->sendSmsResponse(info, sms); +} + +Return RadioResponse::sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) { + return mRealRadioResponse->sendSMSExpectMoreResponse(info, sms); +} + +Return RadioResponse::setupDataCallResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SetupDataCallResult& dcResponse) { + return mRealRadioResponse->setupDataCallResponse_1_4(info, Create1_4SetupDataCallResult(dcResponse)); +} + +Return RadioResponse::iccIOForAppResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& iccIo) { + return mRealRadioResponse->iccIOForAppResponse(info, iccIo); +} + +Return RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendUssdResponse(info); +} + +Return RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->cancelPendingUssdResponse(info); +} + +Return RadioResponse::getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n, + int32_t m) { + return mRealRadioResponse->getClirResponse(info, n, m); +} + +Return RadioResponse::setClirResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setClirResponse(info); +} + +Return RadioResponse::getCallForwardStatusResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& callForwardInfos) { + return mRealRadioResponse->getCallForwardStatusResponse(info, callForwardInfos); +} + +Return RadioResponse::setCallForwardResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCallForwardResponse(info); +} + +Return RadioResponse::getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable, + int32_t serviceClass) { + return mRealRadioResponse->getCallWaitingResponse(info, enable, serviceClass); +} + +Return RadioResponse::setCallWaitingResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCallWaitingResponse(info); +} + +Return RadioResponse::acknowledgeLastIncomingGsmSmsResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->acknowledgeLastIncomingGsmSmsResponse(info); +} + +Return RadioResponse::acceptCallResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->acceptCallResponse(info); +} + +Return RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->deactivateDataCallResponse(info); +} + +Return RadioResponse::getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t response) { + return mRealRadioResponse->getFacilityLockForAppResponse(info, response); +} + +Return RadioResponse::setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t retry) { + return mRealRadioResponse->setFacilityLockForAppResponse(info, retry); +} + +Return RadioResponse::setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setBarringPasswordResponse(info); +} + +Return RadioResponse::getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info, + bool manual) { + return mRealRadioResponse->getNetworkSelectionModeResponse(info, manual); +} + +Return RadioResponse::setNetworkSelectionModeAutomaticResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setNetworkSelectionModeAutomaticResponse(info); +} + +Return RadioResponse::setNetworkSelectionModeManualResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setNetworkSelectionModeManualResponse(info); +} + +Return RadioResponse::getAvailableNetworksResponse( + const V1_0::RadioResponseInfo& info, const hidl_vec& networkInfos) { + return mRealRadioResponse->getAvailableNetworksResponse(info, networkInfos); +} + +Return RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->startDtmfResponse(info); +} + +Return RadioResponse::stopDtmfResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->stopDtmfResponse(info); +} + +Return RadioResponse::getBasebandVersionResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& version) { + return mRealRadioResponse->getBasebandVersionResponse(info, version); +} + +Return RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->separateConnectionResponse(info); +} + +Return RadioResponse::setMuteResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setMuteResponse(info); +} + +Return RadioResponse::getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) { + return mRealRadioResponse->getMuteResponse(info, enable); +} + +Return RadioResponse::getClipResponse(const V1_0::RadioResponseInfo& info, + V1_0::ClipStatus status) { + return mRealRadioResponse->getClipResponse(info, status); +} + +Return RadioResponse::getDataCallListResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& dcResponse) { + hidl_vec newResponse; + newResponse.resize(dcResponse.size()); + + for(int x = 0; x < dcResponse.size(); ++x) + newResponse[x] = Create1_4SetupDataCallResult(dcResponse[x]); + + return mRealRadioResponse->getDataCallListResponse_1_4(info, newResponse); +} + +Return RadioResponse::setSuppServiceNotificationsResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSuppServiceNotificationsResponse(info); +} + +Return RadioResponse::writeSmsToSimResponse(const V1_0::RadioResponseInfo& info, + int32_t index) { + return mRealRadioResponse->writeSmsToSimResponse(info, index); +} + +Return RadioResponse::deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->deleteSmsOnSimResponse(info); +} + +Return RadioResponse::setBandModeResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setBandModeResponse(info); +} + +Return RadioResponse::getAvailableBandModesResponse( + const V1_0::RadioResponseInfo& info, const hidl_vec& bandModes) { + return mRealRadioResponse->getAvailableBandModesResponse(info, bandModes); +} + +Return RadioResponse::sendEnvelopeResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& commandResponse) { + return mRealRadioResponse->sendEnvelopeResponse(info, commandResponse); +} + +Return RadioResponse::sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendTerminalResponseToSimResponse(info); +} + +Return RadioResponse::handleStkCallSetupRequestFromSimResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->handleStkCallSetupRequestFromSimResponse(info); +} + +Return RadioResponse::explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->explicitCallTransferResponse(info); +} + +Return RadioResponse::setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setPreferredNetworkTypeBitmapResponse(info); +} + +Return RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info, + V1_0::PreferredNetworkType nwType) { + hidl_bitfield nwTypeBitmap = 0; + switch(nwType){ + case V1_0::PreferredNetworkType::GSM_WCDMA: + case V1_0::PreferredNetworkType::GSM_WCDMA_AUTO: + nwTypeBitmap = GSMBITS | WCDMABITS; + break; + case V1_0::PreferredNetworkType::GSM_ONLY: + nwTypeBitmap = GSMBITS; + break; + case V1_0::PreferredNetworkType::WCDMA: + nwTypeBitmap = WCDMABITS; + break; + case V1_0::PreferredNetworkType::CDMA_EVDO_AUTO: + nwTypeBitmap = CDMABITS | EVDOBITS; + break; + case V1_0::PreferredNetworkType::CDMA_ONLY: + nwTypeBitmap = CDMABITS; + break; + case V1_0::PreferredNetworkType::EVDO_ONLY: + nwTypeBitmap = EVDOBITS; + break; + case V1_0::PreferredNetworkType::GSM_WCDMA_CDMA_EVDO_AUTO: + nwTypeBitmap = GSMBITS | WCDMABITS | CDMABITS | EVDOBITS; + break; + case V1_0::PreferredNetworkType::LTE_CDMA_EVDO: + nwTypeBitmap = LTEBITS | CDMABITS | EVDOBITS; + break; + case V1_0::PreferredNetworkType::LTE_GSM_WCDMA: + nwTypeBitmap = LTEBITS | GSMBITS | WCDMABITS; + break; + case V1_0::PreferredNetworkType::LTE_CMDA_EVDO_GSM_WCDMA: + nwTypeBitmap = LTEBITS | CDMABITS | EVDOBITS | GSMBITS | WCDMABITS; + break; + case V1_0::PreferredNetworkType::LTE_ONLY: + nwTypeBitmap = LTEBITS; + break; + case V1_0::PreferredNetworkType::LTE_WCDMA: + nwTypeBitmap = LTEBITS | WCDMABITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_ONLY: + nwTypeBitmap = TDSCDMABIT; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA: + nwTypeBitmap = TDSCDMABIT | WCDMABITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_LTE: + nwTypeBitmap = TDSCDMABIT | LTEBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_GSM: + nwTypeBitmap = TDSCDMABIT | GSMBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_GSM_LTE: + nwTypeBitmap = TDSCDMABIT | GSMBITS | LTEBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA: + nwTypeBitmap = TDSCDMABIT | GSMBITS | WCDMABITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_WCDMA_LTE: + nwTypeBitmap = TDSCDMABIT | WCDMABITS | LTEBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_LTE: + nwTypeBitmap = TDSCDMABIT | GSMBITS | WCDMABITS | LTEBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_GSM_WCDMA_CDMA_EVDO_AUTO: + nwTypeBitmap = TDSCDMABIT | GSMBITS | WCDMABITS | CDMABITS | EVDOBITS; + break; + case V1_0::PreferredNetworkType::TD_SCDMA_LTE_CDMA_EVDO_GSM_WCDMA: + nwTypeBitmap = TDSCDMABIT | LTEBITS | CDMABITS | EVDOBITS | GSMBITS | WCDMABITS; + break; + } + return mRealRadioResponse->getPreferredNetworkTypeBitmapResponse(info, nwTypeBitmap); +} + +Return RadioResponse::getNeighboringCidsResponse( + const V1_0::RadioResponseInfo& info, const hidl_vec& cells) { + return mRealRadioResponse->getNeighboringCidsResponse(info, cells); +} + +Return RadioResponse::setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setLocationUpdatesResponse(info); +} + +Return RadioResponse::setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCdmaSubscriptionSourceResponse(info); +} + +Return RadioResponse::setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCdmaRoamingPreferenceResponse(info); +} + +Return RadioResponse::getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info, + V1_0::CdmaRoamingType type) { + return mRealRadioResponse->getCdmaRoamingPreferenceResponse(info, type); +} + +Return RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setTTYModeResponse(info); +} + +Return RadioResponse::getTTYModeResponse(const V1_0::RadioResponseInfo& info, + V1_0::TtyMode mode) { + return mRealRadioResponse->getTTYModeResponse(info, mode); +} + +Return RadioResponse::setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setPreferredVoicePrivacyResponse(info); +} + +Return RadioResponse::getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info, + bool enable) { + return mRealRadioResponse->getPreferredVoicePrivacyResponse(info, enable); +} + +Return RadioResponse::sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendCDMAFeatureCodeResponse(info); +} + +Return RadioResponse::sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendBurstDtmfResponse(info); +} + +Return RadioResponse::sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) { + return mRealRadioResponse->sendCdmaSmsResponse(info, sms); +} + +Return RadioResponse::acknowledgeLastIncomingCdmaSmsResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->acknowledgeLastIncomingCdmaSmsResponse(info); +} + +Return RadioResponse::getGsmBroadcastConfigResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& configs) { + return mRealRadioResponse->getGsmBroadcastConfigResponse(info, configs); +} + +Return RadioResponse::setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setGsmBroadcastConfigResponse(info); +} + +Return RadioResponse::setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setGsmBroadcastActivationResponse(info); +} + +Return RadioResponse::getCdmaBroadcastConfigResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& configs) { + return mRealRadioResponse->getCdmaBroadcastConfigResponse(info, configs); +} + +Return RadioResponse::setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCdmaBroadcastConfigResponse(info); +} + +Return RadioResponse::setCdmaBroadcastActivationResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCdmaBroadcastActivationResponse(info); +} + +Return RadioResponse::getCDMASubscriptionResponse( + const V1_0::RadioResponseInfo& info, const hidl_string& mdn, const hidl_string& hSid, + const hidl_string& hNid, const hidl_string& min, const hidl_string& prl) { + return mRealRadioResponse->getCDMASubscriptionResponse(info, mdn, hSid, hNid, min, prl); +} + +Return RadioResponse::writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info, + uint32_t index) { + return mRealRadioResponse->writeSmsToRuimResponse(info, index); +} + +Return RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->deleteSmsOnRuimResponse(info); +} + +Return RadioResponse::getDeviceIdentityResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& imei, + const hidl_string& imeisv, + const hidl_string& esn, + const hidl_string& meid) { + return mRealRadioResponse->getDeviceIdentityResponse(info, imei, imeisv, esn, meid); +} + +Return RadioResponse::exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->exitEmergencyCallbackModeResponse(info); +} + +Return RadioResponse::getSmscAddressResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& smsc) { + return mRealRadioResponse->getSmscAddressResponse(info, smsc); +} + +Return RadioResponse::setSmscAddressResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSmscAddressResponse(info); +} + +Return RadioResponse::reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->reportSmsMemoryStatusResponse(info); +} + +Return RadioResponse::reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->reportStkServiceIsRunningResponse(info); +} + +Return RadioResponse::getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info, + V1_0::CdmaSubscriptionSource source) { + return mRealRadioResponse->getCdmaSubscriptionSourceResponse(info, source); +} + +Return RadioResponse::requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& response) { + return mRealRadioResponse->requestIsimAuthenticationResponse(info, response); +} + +Return RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->acknowledgeIncomingGsmSmsWithPduResponse(info); +} + +Return RadioResponse::sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& iccIo) { + return mRealRadioResponse->sendEnvelopeWithStatusResponse(info, iccIo); +} + +Return RadioResponse::getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info, + V1_0::RadioTechnology rat) { + return mRealRadioResponse->getVoiceRadioTechnologyResponse(info, rat); +} + +Return RadioResponse::getCellInfoListResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) { + return mRealRadioResponse->getCellInfoListResponse_1_4(info, Create1_4CellInfoList(cellInfo)); +} + +Return RadioResponse::setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCellInfoListRateResponse(info); +} + +Return RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setInitialAttachApnResponse(info); +} + +Return RadioResponse::getImsRegistrationStateResponse(const V1_0::RadioResponseInfo& info, + bool isRegistered, + V1_0::RadioTechnologyFamily ratFamily) { + return mRealRadioResponse->getImsRegistrationStateResponse(info, isRegistered, ratFamily); +} + +Return RadioResponse::sendImsSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) { + return mRealRadioResponse->sendImsSmsResponse(info, sms); +} + +Return RadioResponse::iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& result) { + return mRealRadioResponse->iccTransmitApduBasicChannelResponse(info, result); +} + +Return RadioResponse::iccOpenLogicalChannelResponse(const V1_0::RadioResponseInfo& info, + int32_t channelId, + const hidl_vec& selectResponse) { + return mRealRadioResponse->iccOpenLogicalChannelResponse(info, channelId, selectResponse); +} + +Return RadioResponse::iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->iccCloseLogicalChannelResponse(info); +} + +Return RadioResponse::iccTransmitApduLogicalChannelResponse( + const V1_0::RadioResponseInfo& info, const V1_0::IccIoResult& result) { + return mRealRadioResponse->iccTransmitApduLogicalChannelResponse(info, result); +} + +Return RadioResponse::nvReadItemResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& result) { + return mRealRadioResponse->nvReadItemResponse(info, result); +} + +Return RadioResponse::nvWriteItemResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->nvWriteItemResponse(info); +} + +Return RadioResponse::nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->nvWriteCdmaPrlResponse(info); +} + +Return RadioResponse::nvResetConfigResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->nvResetConfigResponse(info); +} + +Return RadioResponse::setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setUiccSubscriptionResponse(info); +} + +Return RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setDataAllowedResponse(info); +} + +Return RadioResponse::getHardwareConfigResponse( + const V1_0::RadioResponseInfo& info, const hidl_vec& config) { + return mRealRadioResponse->getHardwareConfigResponse(info, config); +} + +Return RadioResponse::requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& result) { + return mRealRadioResponse->requestIccSimAuthenticationResponse(info, result); +} + +Return RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setDataProfileResponse(info); +} + +Return RadioResponse::requestShutdownResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->requestShutdownResponse(info); +} + +Return RadioResponse::getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info, + const V1_0::RadioCapability& rc) { + return mRealRadioResponse->getRadioCapabilityResponse(info, rc); +} + +Return RadioResponse::setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info, + const V1_0::RadioCapability& rc) { + return mRealRadioResponse->setRadioCapabilityResponse(info, rc); +} + +Return RadioResponse::startLceServiceResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceStatusInfo& statusInfo) { + return mRealRadioResponse->startLceServiceResponse(info, statusInfo); +} + +Return RadioResponse::stopLceServiceResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceStatusInfo& statusInfo) { + return mRealRadioResponse->stopLceServiceResponse(info, statusInfo); +} + +Return RadioResponse::pullLceDataResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceDataInfo& lceInfo) { + return mRealRadioResponse->pullLceDataResponse(info, lceInfo); +} + +Return RadioResponse::getModemActivityInfoResponse( + const V1_0::RadioResponseInfo& info, const V1_0::ActivityStatsInfo& activityInfo) { + return mRealRadioResponse->getModemActivityInfoResponse(info, activityInfo); +} + +Return RadioResponse::setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, + int32_t /* numAllowed */) { + return mRealRadioResponse->setAllowedCarriersResponse_1_4(info); +} + +Return RadioResponse::getAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, + bool allAllowed, + const V1_0::CarrierRestrictions& carriers) { + V1_4::CarrierRestrictionsWithPriority newCarriers = {}; + if(allAllowed){ + newCarriers.allowedCarriersPrioritized = false; + return mRealRadioResponse->getAllowedCarriersResponse_1_4(info, newCarriers, V1_4::SimLockMultiSimPolicy::NO_MULTISIM_POLICY); + } + + newCarriers.allowedCarriers = carriers.allowedCarriers; + newCarriers.excludedCarriers = carriers.excludedCarriers; + newCarriers.allowedCarriersPrioritized = true; + return mRealRadioResponse->getAllowedCarriersResponse_1_4(info, newCarriers, V1_4::SimLockMultiSimPolicy::NO_MULTISIM_POLICY); +} + +Return RadioResponse::sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->sendDeviceStateResponse(info); +} + +Return RadioResponse::setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setIndicationFilterResponse(info); +} + +Return RadioResponse::setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSimCardPowerResponse_1_1(info); +} + +Return RadioResponse::acknowledgeRequest(int32_t serial) { + return mRealRadioResponse->acknowledgeRequest(serial); +} + +// Methods from ::android::hardware::radio::V1_1::IRadioResponse follow. +Return RadioResponse::setCarrierInfoForImsiEncryptionResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setCarrierInfoForImsiEncryptionResponse(info); +} + +Return RadioResponse::setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSimCardPowerResponse_1_1(info); +} + +Return RadioResponse::startNetworkScanResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->startNetworkScanResponse_1_4(info); +} + + +Return RadioResponse::stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->stopNetworkScanResponse(info); +} + +Return RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info, + const V1_1::KeepaliveStatus& status) { + return mRealRadioResponse->startKeepaliveResponse(info, status); +} + +Return RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->stopKeepaliveResponse(info); +} + +// Methods from ::android::hardware::radio::V1_2::IRadioResponse follow. +Return RadioResponse::getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) { + return mRealRadioResponse->getCellInfoListResponse_1_4(info, Create1_4CellInfoList(cellInfo)); +} + +Return RadioResponse::getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info, + const V1_2::CardStatus& cardStatus) { + return mRealRadioResponse->getIccCardStatusResponse_1_4(info, {cardStatus, hidl_string("")}); +} + +Return RadioResponse::setSignalStrengthReportingCriteriaResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSignalStrengthReportingCriteriaResponse(info); +} + +Return RadioResponse::setLinkCapacityReportingCriteriaResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setLinkCapacityReportingCriteriaResponse(info); +} + +Return RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info, + const hidl_vec& calls) { + return mRealRadioResponse->getCurrentCallsResponse_1_2(info, calls); +} + +Return RadioResponse::getSignalStrengthResponse_1_2( + const V1_0::RadioResponseInfo& info, const V1_2::SignalStrength& signalStrength) { + return mRealRadioResponse->getSignalStrengthResponse_1_4(info, Create1_4SignalStrength(signalStrength)); +} + +Return RadioResponse::getVoiceRegistrationStateResponse_1_2( + const V1_0::RadioResponseInfo& info, const V1_2::VoiceRegStateResult& voiceRegResponse) { + return mRealRadioResponse->getVoiceRegistrationStateResponse_1_2(info, voiceRegResponse); +} + +Return RadioResponse::getDataRegistrationStateResponse_1_2( + const V1_0::RadioResponseInfo& info, const V1_2::DataRegStateResult& dataRegResponse) { + mDataRoaming = (dataRegResponse.regState == V1_0::RegState::REG_ROAMING); + V1_4::DataRegStateResult newDRR = {}; + newDRR.base = dataRegResponse; + return mRealRadioResponse->getDataRegistrationStateResponse_1_4(info, newDRR); +} + +// Methods from ::android::hardware::radio::V1_3::IRadioResponse follow. +Return RadioResponse::setSystemSelectionChannelsResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setSystemSelectionChannelsResponse(info); +} + +Return RadioResponse::enableModemResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->enableModemResponse(info); +} + +Return RadioResponse::getModemStackStatusResponse(const V1_0::RadioResponseInfo& info, + bool isEnabled) { + return mRealRadioResponse->getModemStackStatusResponse(info, isEnabled); +} + +// Methods from ::android::hardware::radio::V1_4::IRadioResponse follow. +Return RadioResponse::emergencyDialResponse(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->emergencyDialResponse(info); +} + +Return RadioResponse::startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->startNetworkScanResponse_1_4(info); +} + +Return RadioResponse::getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) { + return mRealRadioResponse->getCellInfoListResponse_1_4(info, cellInfo); +} + +Return RadioResponse::getDataRegistrationStateResponse_1_4( + const V1_0::RadioResponseInfo& info, const V1_4::DataRegStateResult& dataRegResponse) { + return mRealRadioResponse->getDataRegistrationStateResponse_1_4(info, dataRegResponse); +} + +Return RadioResponse::getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info, + const V1_4::CardStatus& cardStatus) { + return mRealRadioResponse->getIccCardStatusResponse_1_4(info, cardStatus); +} + +Return RadioResponse::getPreferredNetworkTypeBitmapResponse( + const V1_0::RadioResponseInfo& info, hidl_bitfield networkTypeBitmap) { + return mRealRadioResponse->getPreferredNetworkTypeBitmapResponse(info, networkTypeBitmap); +} + +Return RadioResponse::setPreferredNetworkTypeBitmapResponse( + const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setPreferredNetworkTypeBitmapResponse(info); +} + +Return RadioResponse::getDataCallListResponse_1_4( + const V1_0::RadioResponseInfo& info, + const hidl_vec& dcResponse) { + return mRealRadioResponse->getDataCallListResponse_1_4(info, dcResponse); +} + +Return RadioResponse::setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info, + const V1_4::SetupDataCallResult& dcResponse) { + return mRealRadioResponse->setupDataCallResponse_1_4(info, dcResponse); +} + +Return RadioResponse::setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) { + return mRealRadioResponse->setAllowedCarriersResponse_1_4(info); +} + +Return RadioResponse::getAllowedCarriersResponse_1_4( + const V1_0::RadioResponseInfo& info, const V1_4::CarrierRestrictionsWithPriority& carriers, + V1_4::SimLockMultiSimPolicy multiSimPolicy) { + return mRealRadioResponse->getAllowedCarriersResponse_1_4(info, carriers, multiSimPolicy); +} + +Return RadioResponse::getSignalStrengthResponse_1_4( + const V1_0::RadioResponseInfo& info, const V1_4::SignalStrength& signalStrength) { + return mRealRadioResponse->getSignalStrengthResponse_1_4(info, signalStrength); +} + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/RadioResponse.h b/radio/1.4/legacy/RadioResponse.h new file mode 100644 index 0000000..aecd38d --- /dev/null +++ b/radio/1.4/legacy/RadioResponse.h @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include +#include + +namespace android::hardware::radio::implementation { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +struct RadioResponse : public V1_4::IRadioResponse { + sp mRealRadioResponse; + V1_0::RadioTechnology mRat = V1_0::RadioTechnology::UNKNOWN; + bool mDataRoaming = false; + // Methods from ::android::hardware::radio::V1_0::IRadioResponse follow. + Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, + const V1_0::CardStatus& cardStatus) override; + Return supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return supplyNetworkDepersonalizationResponse(const V1_0::RadioResponseInfo& info, + int32_t remainingRetries) override; + Return getCurrentCallsResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& calls) override; + Return dialResponse(const V1_0::RadioResponseInfo& info) override; + Return getIMSIForAppResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& imsi) override; + Return hangupConnectionResponse(const V1_0::RadioResponseInfo& info) override; + Return hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) override; + Return hangupForegroundResumeBackgroundResponse( + const V1_0::RadioResponseInfo& info) override; + Return switchWaitingOrHoldingAndActiveResponse( + const V1_0::RadioResponseInfo& info) override; + Return conferenceResponse(const V1_0::RadioResponseInfo& info) override; + Return rejectCallResponse(const V1_0::RadioResponseInfo& info) override; + Return getLastCallFailCauseResponse( + const V1_0::RadioResponseInfo& info, + const V1_0::LastCallFailCauseInfo& failCauseinfo) override; + Return getSignalStrengthResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SignalStrength& sigStrength) override; + Return getVoiceRegistrationStateResponse( + const V1_0::RadioResponseInfo& info, + const V1_0::VoiceRegStateResult& voiceRegResponse) override; + Return getDataRegistrationStateResponse( + const V1_0::RadioResponseInfo& info, + const V1_0::DataRegStateResult& dataRegResponse) override; + Return getOperatorResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& longName, const hidl_string& shortName, + const hidl_string& numeric) override; + Return setRadioPowerResponse(const V1_0::RadioResponseInfo& info) override; + Return sendDtmfResponse(const V1_0::RadioResponseInfo& info) override; + Return sendSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) override; + Return sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) override; + Return setupDataCallResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SetupDataCallResult& dcResponse) override; + Return iccIOForAppResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& iccIo) override; + Return sendUssdResponse(const V1_0::RadioResponseInfo& info) override; + Return cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) override; + Return getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n, + int32_t m) override; + Return setClirResponse(const V1_0::RadioResponseInfo& info) override; + Return getCallForwardStatusResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& callForwardInfos) override; + Return setCallForwardResponse(const V1_0::RadioResponseInfo& info) override; + Return getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable, + int32_t serviceClass) override; + Return setCallWaitingResponse(const V1_0::RadioResponseInfo& info) override; + Return acknowledgeLastIncomingGsmSmsResponse( + const V1_0::RadioResponseInfo& info) override; + Return acceptCallResponse(const V1_0::RadioResponseInfo& info) override; + Return deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) override; + Return getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t response) override; + Return setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info, + int32_t retry) override; + Return setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) override; + Return getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info, + bool manual) override; + Return setNetworkSelectionModeAutomaticResponse( + const V1_0::RadioResponseInfo& info) override; + Return setNetworkSelectionModeManualResponse( + const V1_0::RadioResponseInfo& info) override; + Return getAvailableNetworksResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& networkInfos) override; + Return startDtmfResponse(const V1_0::RadioResponseInfo& info) override; + Return stopDtmfResponse(const V1_0::RadioResponseInfo& info) override; + Return getBasebandVersionResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& version) override; + Return separateConnectionResponse(const V1_0::RadioResponseInfo& info) override; + Return setMuteResponse(const V1_0::RadioResponseInfo& info) override; + Return getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) override; + Return getClipResponse(const V1_0::RadioResponseInfo& info, + V1_0::ClipStatus status) override; + Return getDataCallListResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& dcResponse) override; + Return setSuppServiceNotificationsResponse(const V1_0::RadioResponseInfo& info) override; + Return writeSmsToSimResponse(const V1_0::RadioResponseInfo& info, int32_t index) override; + Return deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) override; + Return setBandModeResponse(const V1_0::RadioResponseInfo& info) override; + Return getAvailableBandModesResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& bandModes) override; + Return sendEnvelopeResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& commandResponse) override; + Return sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) override; + Return handleStkCallSetupRequestFromSimResponse( + const V1_0::RadioResponseInfo& info) override; + Return explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) override; + Return setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) override; + Return getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info, + V1_0::PreferredNetworkType nwType) override; + Return getNeighboringCidsResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& cells) override; + Return setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) override; + Return setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) override; + Return setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) override; + Return getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info, + V1_0::CdmaRoamingType type) override; + Return setTTYModeResponse(const V1_0::RadioResponseInfo& info) override; + Return getTTYModeResponse(const V1_0::RadioResponseInfo& info, + V1_0::TtyMode mode) override; + Return setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) override; + Return getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info, + bool enable) override; + Return sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) override; + Return sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) override; + Return sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) override; + Return acknowledgeLastIncomingCdmaSmsResponse( + const V1_0::RadioResponseInfo& info) override; + Return getGsmBroadcastConfigResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& configs) override; + Return setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override; + Return setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override; + Return getCdmaBroadcastConfigResponse( + const V1_0::RadioResponseInfo& info, + const hidl_vec& configs) override; + Return setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override; + Return setCdmaBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override; + Return getCDMASubscriptionResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& mdn, const hidl_string& hSid, + const hidl_string& hNid, const hidl_string& min, + const hidl_string& prl) override; + Return writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info, + uint32_t index) override; + Return deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) override; + Return getDeviceIdentityResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& imei, const hidl_string& imeisv, + const hidl_string& esn, + const hidl_string& meid) override; + Return exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) override; + Return getSmscAddressResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& smsc) override; + Return setSmscAddressResponse(const V1_0::RadioResponseInfo& info) override; + Return reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) override; + Return reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) override; + Return getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info, + V1_0::CdmaSubscriptionSource source) override; + Return requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& response) override; + Return acknowledgeIncomingGsmSmsWithPduResponse( + const V1_0::RadioResponseInfo& info) override; + Return sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& iccIo) override; + Return getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info, + V1_0::RadioTechnology rat) override; + Return getCellInfoListResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) override; + Return setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) override; + Return setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) override; + Return getImsRegistrationStateResponse(const V1_0::RadioResponseInfo& info, + bool isRegistered, + V1_0::RadioTechnologyFamily ratFamily) override; + Return sendImsSmsResponse(const V1_0::RadioResponseInfo& info, + const V1_0::SendSmsResult& sms) override; + Return iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& result) override; + Return iccOpenLogicalChannelResponse(const V1_0::RadioResponseInfo& info, + int32_t channelId, + const hidl_vec& selectResponse) override; + Return iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) override; + Return iccTransmitApduLogicalChannelResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& result) override; + Return nvReadItemResponse(const V1_0::RadioResponseInfo& info, + const hidl_string& result) override; + Return nvWriteItemResponse(const V1_0::RadioResponseInfo& info) override; + Return nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) override; + Return nvResetConfigResponse(const V1_0::RadioResponseInfo& info) override; + Return setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) override; + Return setDataAllowedResponse(const V1_0::RadioResponseInfo& info) override; + Return getHardwareConfigResponse(const V1_0::RadioResponseInfo& info, + const hidl_vec& config) override; + Return requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info, + const V1_0::IccIoResult& result) override; + Return setDataProfileResponse(const V1_0::RadioResponseInfo& info) override; + Return requestShutdownResponse(const V1_0::RadioResponseInfo& info) override; + Return getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info, + const V1_0::RadioCapability& rc) override; + Return setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info, + const V1_0::RadioCapability& rc) override; + Return startLceServiceResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceStatusInfo& statusInfo) override; + Return stopLceServiceResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceStatusInfo& statusInfo) override; + Return pullLceDataResponse(const V1_0::RadioResponseInfo& info, + const V1_0::LceDataInfo& lceInfo) override; + Return getModemActivityInfoResponse(const V1_0::RadioResponseInfo& info, + const V1_0::ActivityStatsInfo& activityInfo) override; + Return setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, + int32_t numAllowed) override; + Return getAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, bool allAllowed, + const V1_0::CarrierRestrictions& carriers) override; + Return sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) override; + Return setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) override; + Return setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) override; + Return acknowledgeRequest(int32_t serial) override; + + // Methods from ::android::hardware::radio::V1_1::IRadioResponse follow. + Return setCarrierInfoForImsiEncryptionResponse( + const V1_0::RadioResponseInfo& info) override; + Return setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) override; + Return startNetworkScanResponse(const V1_0::RadioResponseInfo& info) override; + Return stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) override; + Return startKeepaliveResponse(const V1_0::RadioResponseInfo& info, + const V1_1::KeepaliveStatus& status) override; + Return stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) override; + + // Methods from ::android::hardware::radio::V1_2::IRadioResponse follow. + Return getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) override; + Return getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info, + const V1_2::CardStatus& cardStatus) override; + Return setSignalStrengthReportingCriteriaResponse( + const V1_0::RadioResponseInfo& info) override; + Return setLinkCapacityReportingCriteriaResponse( + const V1_0::RadioResponseInfo& info) override; + Return getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info, + const hidl_vec& calls) override; + Return getSignalStrengthResponse_1_2(const V1_0::RadioResponseInfo& info, + const V1_2::SignalStrength& signalStrength) override; + Return getVoiceRegistrationStateResponse_1_2( + const V1_0::RadioResponseInfo& info, + const V1_2::VoiceRegStateResult& voiceRegResponse) override; + Return getDataRegistrationStateResponse_1_2( + const V1_0::RadioResponseInfo& info, + const V1_2::DataRegStateResult& dataRegResponse) override; + + // Methods from ::android::hardware::radio::V1_3::IRadioResponse follow. + Return setSystemSelectionChannelsResponse(const V1_0::RadioResponseInfo& info) override; + Return enableModemResponse(const V1_0::RadioResponseInfo& info) override; + Return getModemStackStatusResponse(const V1_0::RadioResponseInfo& info, + bool isEnabled) override; + + // Methods from ::android::hardware::radio::V1_4::IRadioResponse follow. + Return emergencyDialResponse(const V1_0::RadioResponseInfo& info) override; + Return startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) override; + Return getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info, + const hidl_vec& cellInfo) override; + Return getDataRegistrationStateResponse_1_4( + const V1_0::RadioResponseInfo& info, + const V1_4::DataRegStateResult& dataRegResponse) override; + Return getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info, + const V1_4::CardStatus& cardStatus) override; + Return getPreferredNetworkTypeBitmapResponse( + const V1_0::RadioResponseInfo& info, + hidl_bitfield networkTypeBitmap) override; + Return setPreferredNetworkTypeBitmapResponse( + const V1_0::RadioResponseInfo& info) override; + Return getDataCallListResponse_1_4( + const V1_0::RadioResponseInfo& info, + const hidl_vec& dcResponse) override; + Return setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info, + const V1_4::SetupDataCallResult& dcResponse) override; + Return setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) override; + Return getAllowedCarriersResponse_1_4( + const V1_0::RadioResponseInfo& info, + const V1_4::CarrierRestrictionsWithPriority& carriers, + V1_4::SimLockMultiSimPolicy multiSimPolicy) override; + Return getSignalStrengthResponse_1_4(const V1_0::RadioResponseInfo& info, + const V1_4::SignalStrength& signalStrength) override; +}; + +} // namespace android::hardware::radio::implementation diff --git a/radio/1.4/legacy/android.hardware.radio@1.4-service.legacy.rc b/radio/1.4/legacy/android.hardware.radio@1.4-service.legacy.rc new file mode 100644 index 0000000..c3b2060 --- /dev/null +++ b/radio/1.4/legacy/android.hardware.radio@1.4-service.legacy.rc @@ -0,0 +1,9 @@ +service vendor.radio-1-4-legacy /vendor/bin/hw/android.hardware.radio@1.4-service.legacy + interface android.hardware.radio@1.0::IRadio default + interface android.hardware.radio@1.1::IRadio default + interface android.hardware.radio@1.2::IRadio default + interface android.hardware.radio@1.3::IRadio default + interface android.hardware.radio@1.4::IRadio default + class hal + user system + group system diff --git a/radio/1.4/legacy/hidl-utils.cpp b/radio/1.4/legacy/hidl-utils.cpp new file mode 100644 index 0000000..fc0d54d --- /dev/null +++ b/radio/1.4/legacy/hidl-utils.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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. + */ + +#include "hidl-utils.h" + +#include +#include + +namespace android::hardware::hidl_utils { + +class HalDeathRecipient : public hidl_death_recipient { + void serviceDied(uint64_t /* cookie */, const wp& /* who */) override { + LOG(FATAL) << "One of the linked HALs died. Restarting..."; + } +}; + +static const auto gHalDeathRecipient = sp::make(); + +void linkDeathToDeath(sp<::android::hidl::base::V1_0::IBase> hal) { + const auto linkStatus = hal->linkToDeath(gHalDeathRecipient, 0); + CHECK(linkStatus.withDefault(false)) << "Failed to link to HAL death"; +} + +hidl_vec listManifestByInterface(const char* descriptor) { + auto manager = hidl::manager::V1_2::IServiceManager::getService(); + hidl_vec services; + manager->listManifestByInterface(descriptor, hidl_utils::fill(&services)); + CHECK_GT(services.size(), 0u) << "No " << descriptor + << " services in manifest (missing privileges?)" << std::endl; + return services; +} + +} // namespace android::hardware::hidl_utils diff --git a/radio/1.4/legacy/hidl-utils.h b/radio/1.4/legacy/hidl-utils.h new file mode 100644 index 0000000..be3386f --- /dev/null +++ b/radio/1.4/legacy/hidl-utils.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once + +#include + +#include + +namespace android::hardware::hidl_utils { + +/** + * Helper functor to fetch results from multi-return HIDL calls. + * It's meant to be used in place of _hidl_cb callbacks. + * + * Please note extracting these return variables outside of the callback scope requires making + * a copy of each return variable. This may be costly for frequently called HIDL methods with + * non-negligible return object size. Please be cautious about performance when using this. + * + * Example usage: + * Result result; + * sp iface; + * hidlObject->someMethod(arg1, arg2, hidl_utils::fill(&result, &iface)).assertOk(); + * // use result and iface + */ +template +struct fill : public std::function { + /** + * Create _hidl_cb functor that copies the call arguments to specified pointers. + * + * \param args... Targets to copy the call arguments to + */ + fill(T*... args) : mTargets(args...) {} + + void operator()(const T&... args) { copy<0, T...>(args...); } + + private: + std::tuple mTargets; + + template + inline void copy(const First& first) { + *std::get(mTargets) = first; + } + + template + inline void copy(const First& first, const Rest&... rest) { + *std::get(mTargets) = first; + copy(rest...); + } +}; + +/** + * Link to a given HALs death and restart the current process in such a case. + * \param hal HAL to which death to link + */ +void linkDeathToDeath(sp hal); + +/** + * List HAL instances of a given interface. + * + * \descriptor HIDL HAL descriptor + */ +hidl_vec listManifestByInterface(const char* descriptor); + +} // namespace android::hardware::hidl_utils diff --git a/radio/1.4/legacy/service.cpp b/radio/1.4/legacy/service.cpp new file mode 100644 index 0000000..460abbd --- /dev/null +++ b/radio/1.4/legacy/service.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define LOG_TAG "android.hardware.radio@1.4-service.legacy" + +#include +#include + +#include "Radio.h" +#include "hidl-utils.h" + +#include + +using namespace android::hardware::radio; +using namespace android::hardware::hidl_utils; + +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +using android::hardware::radio::implementation::Radio; + +using android::OK; +using android::sp; +using android::status_t; + +#define MAX_SLOT_ID 4 + +int main() { + // Note: Starts from slot 1 + std::map> slotIdToRadio; + + for (int slotId = 1; slotId <= MAX_SLOT_ID; slotId++) { + sp realRadio = V1_0::IRadio::getService("slot" + std::to_string(slotId)); + if (realRadio == nullptr) { + LOG(INFO) << "Cannot get radio service for slot " << slotId; + + if (slotId == 1) { + LOG(ERROR) << "Cannot get radio service for slot 1."; + return 1; + } + + break; + } + + slotIdToRadio[slotId] = new Radio(realRadio); + linkDeathToDeath(realRadio); + } + + configureRpcThreadpool(1, true); + + for (auto const& [slotId, radio] : slotIdToRadio) { + status_t status = radio->registerAsService("slot" + std::to_string(slotId)); + if (status != OK) { + LOG(ERROR) << "Cannot register Radio HAL service for slot " << slotId; + return 1; + } + } + + LOG(INFO) << "Radio HAL service ready."; + + joinRpcThreadpool(); + + LOG(INFO) << "Radio HAL service failed to join thread pool."; + return 1; +}