radio: 1.4: legacy: Initial wrapper (original)
Change-Id: I214d413590378f88187766313bafcff7237637e6
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 <regex>
+#include <vector>
+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<V1_4::CellInfo> Create1_4CellInfoList(const hidl_vec<V1_0::CellInfo>& cellInfo) {
+ hidl_vec<V1_4::CellInfo> 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<V1_4::CellInfo> Create1_4CellInfoList(const hidl_vec<V1_2::CellInfo>& cellInfo) {
+ hidl_vec<V1_4::CellInfo> 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<hidl_string> 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<hidl_string> 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 <android/hardware/radio/1.4/IRadioResponse.h>
+#include <android/hardware/radio/1.4/IRadio.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+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<android::hardware::radio::V1_4::CellInfo> Create1_4CellInfoList(const hidl_vec<android::hardware::radio::V1_0::CellInfo>& cellInfo);
+hidl_vec<android::hardware::radio::V1_4::CellInfo> Create1_4CellInfoList(const hidl_vec<android::hardware::radio::V1_2::CellInfo>& 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 <vector>
+#include <string>
+
+#include <android-base/logging.h>
+
+#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<V1_0::IRadio> realRadio) : mRealRadio(realRadio) {}
+
+// Methods from ::android::hardware::radio::V1_0::IRadio follow.
+Return<void> Radio::setResponseFunctions(const sp<V1_0::IRadioResponse>& radioResponse,
+ const sp<V1_0::IRadioIndication>& radioIndication) {
+ mRadioResponse->mRealRadioResponse = V1_4::IRadioResponse::castFrom(radioResponse);
+ mRadioIndication->mRealRadioIndication = V1_4::IRadioIndication::castFrom(radioIndication);
+ WRAP_V1_0_CALL(setResponseFunctions, mRadioResponse, mRadioIndication);
+}
+
+Return<void> Radio::getIccCardStatus(int32_t serial) {
+ WRAP_V1_0_CALL(getIccCardStatus, serial);
+}
+
+Return<void> Radio::supplyIccPinForApp(int32_t serial, const hidl_string& pin,
+ const hidl_string& aid) {
+ WRAP_V1_0_CALL(supplyIccPinForApp, serial, pin, aid);
+}
+
+Return<void> 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<void> Radio::supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
+ const hidl_string& aid) {
+ WRAP_V1_0_CALL(supplyIccPin2ForApp, serial, pin2, aid);
+}
+
+Return<void> 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<void> 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<void> 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<void> Radio::supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) {
+ WRAP_V1_0_CALL(supplyNetworkDepersonalization, serial, netPin);
+}
+
+Return<void> Radio::getCurrentCalls(int32_t serial) {
+ WRAP_V1_0_CALL(getCurrentCalls, serial);
+}
+
+Return<void> Radio::dial(int32_t serial, const V1_0::Dial& dialInfo) {
+ WRAP_V1_0_CALL(dial, serial, dialInfo);
+}
+
+Return<void> Radio::getImsiForApp(int32_t serial, const hidl_string& aid) {
+ WRAP_V1_0_CALL(getImsiForApp, serial, aid);
+}
+
+Return<void> Radio::hangup(int32_t serial, int32_t gsmIndex) {
+ WRAP_V1_0_CALL(hangup, serial, gsmIndex);
+}
+
+Return<void> Radio::hangupWaitingOrBackground(int32_t serial) {
+ WRAP_V1_0_CALL(hangupWaitingOrBackground, serial);
+}
+
+Return<void> Radio::hangupForegroundResumeBackground(int32_t serial) {
+ WRAP_V1_0_CALL(hangupForegroundResumeBackground, serial);
+}
+
+Return<void> Radio::switchWaitingOrHoldingAndActive(int32_t serial) {
+ WRAP_V1_0_CALL(switchWaitingOrHoldingAndActive, serial);
+}
+
+Return<void> Radio::conference(int32_t serial) {
+ WRAP_V1_0_CALL(conference, serial);
+}
+
+Return<void> Radio::rejectCall(int32_t serial) {
+ WRAP_V1_0_CALL(rejectCall, serial);
+}
+
+Return<void> Radio::getLastCallFailCause(int32_t serial) {
+ WRAP_V1_0_CALL(getLastCallFailCause, serial);
+}
+
+Return<void> Radio::getSignalStrength(int32_t serial) {
+ WRAP_V1_0_CALL(getSignalStrength, serial);
+}
+
+Return<void> Radio::getVoiceRegistrationState(int32_t serial) {
+ WRAP_V1_0_CALL(getVoiceRegistrationState, serial);
+}
+
+Return<void> Radio::getDataRegistrationState(int32_t serial) {
+ WRAP_V1_0_CALL(getDataRegistrationState, serial);
+}
+
+Return<void> Radio::getOperator(int32_t serial) {
+ WRAP_V1_0_CALL(getOperator, serial);
+}
+
+Return<void> Radio::setRadioPower(int32_t serial, bool on) {
+ WRAP_V1_0_CALL(setRadioPower, serial, on);
+}
+
+Return<void> Radio::sendDtmf(int32_t serial, const hidl_string& s) {
+ WRAP_V1_0_CALL(sendDtmf, serial, s);
+}
+
+Return<void> Radio::sendSms(int32_t serial, const V1_0::GsmSmsMessage& message) {
+ WRAP_V1_0_CALL(sendSms, serial, message);
+}
+
+Return<void> Radio::sendSMSExpectMore(int32_t serial, const V1_0::GsmSmsMessage& message) {
+ WRAP_V1_0_CALL(sendSMSExpectMore, serial, message);
+}
+
+Return<void> 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<void> Radio::iccIOForApp(int32_t serial, const V1_0::IccIo& iccIo) {
+ WRAP_V1_0_CALL(iccIOForApp, serial, iccIo);
+}
+
+Return<void> Radio::sendUssd(int32_t serial, const hidl_string& ussd) {
+ WRAP_V1_0_CALL(sendUssd, serial, ussd);
+}
+
+Return<void> Radio::cancelPendingUssd(int32_t serial) {
+ WRAP_V1_0_CALL(cancelPendingUssd, serial);
+}
+
+Return<void> Radio::getClir(int32_t serial) {
+ WRAP_V1_0_CALL(getClir, serial);
+}
+
+Return<void> Radio::setClir(int32_t serial, int32_t status) {
+ WRAP_V1_0_CALL(setClir, serial, status);
+}
+
+Return<void> Radio::getCallForwardStatus(int32_t serial, const V1_0::CallForwardInfo& callInfo) {
+ WRAP_V1_0_CALL(getCallForwardStatus, serial, callInfo);
+}
+
+Return<void> Radio::setCallForward(int32_t serial, const V1_0::CallForwardInfo& callInfo) {
+ WRAP_V1_0_CALL(setCallForward, serial, callInfo);
+}
+
+Return<void> Radio::getCallWaiting(int32_t serial, int32_t serviceClass) {
+ WRAP_V1_0_CALL(getCallWaiting, serial, serviceClass);
+}
+
+Return<void> Radio::setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) {
+ WRAP_V1_0_CALL(setCallWaiting, serial, enable, serviceClass);
+}
+
+Return<void> Radio::acknowledgeLastIncomingGsmSms(int32_t serial, bool success,
+ V1_0::SmsAcknowledgeFailCause cause) {
+ WRAP_V1_0_CALL(acknowledgeLastIncomingGsmSms, serial, success, cause);
+}
+
+Return<void> Radio::acceptCall(int32_t serial) {
+ WRAP_V1_0_CALL(acceptCall, serial);
+}
+
+Return<void> Radio::deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) {
+ WRAP_V1_0_CALL(deactivateDataCall, serial, cid, reasonRadioShutDown);
+}
+
+Return<void> 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<void> 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<void> 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<void> Radio::getNetworkSelectionMode(int32_t serial) {
+ WRAP_V1_0_CALL(getNetworkSelectionMode, serial);
+}
+
+Return<void> Radio::setNetworkSelectionModeAutomatic(int32_t serial) {
+ WRAP_V1_0_CALL(setNetworkSelectionModeAutomatic, serial);
+}
+
+Return<void> Radio::setNetworkSelectionModeManual(int32_t serial,
+ const hidl_string& operatorNumeric) {
+ WRAP_V1_0_CALL(setNetworkSelectionModeManual, serial, operatorNumeric);
+}
+
+Return<void> Radio::getAvailableNetworks(int32_t serial) {
+ WRAP_V1_0_CALL(getAvailableNetworks, serial);
+}
+
+Return<void> Radio::startDtmf(int32_t serial, const hidl_string& s) {
+ WRAP_V1_0_CALL(startDtmf, serial, s);
+}
+
+Return<void> Radio::stopDtmf(int32_t serial) {
+ WRAP_V1_0_CALL(stopDtmf, serial);
+}
+
+Return<void> Radio::getBasebandVersion(int32_t serial) {
+ WRAP_V1_0_CALL(getBasebandVersion, serial);
+}
+
+Return<void> Radio::separateConnection(int32_t serial, int32_t gsmIndex) {
+ WRAP_V1_0_CALL(separateConnection, serial, gsmIndex);
+}
+
+Return<void> Radio::setMute(int32_t serial, bool enable) {
+ WRAP_V1_0_CALL(setMute, serial, enable);
+}
+
+Return<void> Radio::getMute(int32_t serial) {
+ WRAP_V1_0_CALL(getMute, serial);
+}
+
+Return<void> Radio::getClip(int32_t serial) {
+ WRAP_V1_0_CALL(getClip, serial);
+}
+
+Return<void> Radio::getDataCallList(int32_t serial) {
+ WRAP_V1_0_CALL(getDataCallList, serial);
+}
+
+Return<void> Radio::setSuppServiceNotifications(int32_t serial, bool enable) {
+ WRAP_V1_0_CALL(setSuppServiceNotifications, serial, enable);
+}
+
+Return<void> Radio::writeSmsToSim(int32_t serial, const V1_0::SmsWriteArgs& smsWriteArgs) {
+ WRAP_V1_0_CALL(writeSmsToSim, serial, smsWriteArgs);
+}
+
+Return<void> Radio::deleteSmsOnSim(int32_t serial, int32_t index) {
+ WRAP_V1_0_CALL(deleteSmsOnSim, serial, index);
+}
+
+Return<void> Radio::setBandMode(int32_t serial, V1_0::RadioBandMode mode) {
+ WRAP_V1_0_CALL(setBandMode, serial, mode);
+}
+
+Return<void> Radio::getAvailableBandModes(int32_t serial) {
+ WRAP_V1_0_CALL(getAvailableBandModes, serial);
+}
+
+Return<void> Radio::sendEnvelope(int32_t serial, const hidl_string& command) {
+ WRAP_V1_0_CALL(sendEnvelope, serial, command);
+}
+
+Return<void> Radio::sendTerminalResponseToSim(int32_t serial, const hidl_string& commandResponse) {
+ WRAP_V1_0_CALL(sendTerminalResponseToSim, serial, commandResponse);
+}
+
+Return<void> Radio::handleStkCallSetupRequestFromSim(int32_t serial, bool accept) {
+ WRAP_V1_0_CALL(handleStkCallSetupRequestFromSim, serial, accept);
+}
+
+Return<void> Radio::explicitCallTransfer(int32_t serial) {
+ WRAP_V1_0_CALL(explicitCallTransfer, serial);
+}
+
+Return<void> Radio::setPreferredNetworkType(int32_t serial, V1_0::PreferredNetworkType nwType) {
+ WRAP_V1_0_CALL(setPreferredNetworkType, serial, nwType);
+}
+
+Return<void> Radio::getPreferredNetworkType(int32_t serial) {
+ WRAP_V1_0_CALL(getPreferredNetworkType, serial);
+}
+
+Return<void> Radio::getNeighboringCids(int32_t serial) {
+ WRAP_V1_0_CALL(getNeighboringCids, serial);
+}
+
+Return<void> Radio::setLocationUpdates(int32_t serial, bool enable) {
+ WRAP_V1_0_CALL(setLocationUpdates, serial, enable);
+}
+
+Return<void> Radio::setCdmaSubscriptionSource(int32_t serial,
+ V1_0::CdmaSubscriptionSource cdmaSub) {
+ WRAP_V1_0_CALL(setCdmaSubscriptionSource, serial, cdmaSub);
+}
+
+Return<void> Radio::setCdmaRoamingPreference(int32_t serial, V1_0::CdmaRoamingType type) {
+ WRAP_V1_0_CALL(setCdmaRoamingPreference, serial, type);
+}
+
+Return<void> Radio::getCdmaRoamingPreference(int32_t serial) {
+ WRAP_V1_0_CALL(getCdmaRoamingPreference, serial);
+}
+
+Return<void> Radio::setTTYMode(int32_t serial, V1_0::TtyMode mode) {
+ WRAP_V1_0_CALL(setTTYMode, serial, mode);
+}
+
+Return<void> Radio::getTTYMode(int32_t serial) {
+ WRAP_V1_0_CALL(getTTYMode, serial);
+}
+
+Return<void> Radio::setPreferredVoicePrivacy(int32_t serial, bool enable) {
+ WRAP_V1_0_CALL(setPreferredVoicePrivacy, serial, enable);
+}
+
+Return<void> Radio::getPreferredVoicePrivacy(int32_t serial) {
+ WRAP_V1_0_CALL(getPreferredVoicePrivacy, serial);
+}
+
+Return<void> Radio::sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) {
+ WRAP_V1_0_CALL(sendCDMAFeatureCode, serial, featureCode);
+}
+
+Return<void> 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<void> Radio::sendCdmaSms(int32_t serial, const V1_0::CdmaSmsMessage& sms) {
+ WRAP_V1_0_CALL(sendCdmaSms, serial, sms);
+}
+
+Return<void> Radio::acknowledgeLastIncomingCdmaSms(int32_t serial, const V1_0::CdmaSmsAck& smsAck) {
+ WRAP_V1_0_CALL(acknowledgeLastIncomingCdmaSms, serial, smsAck);
+}
+
+Return<void> Radio::getGsmBroadcastConfig(int32_t serial) {
+ WRAP_V1_0_CALL(getGsmBroadcastConfig, serial);
+}
+
+Return<void> Radio::setGsmBroadcastConfig(
+ int32_t serial, const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& configInfo) {
+ WRAP_V1_0_CALL(setGsmBroadcastConfig, serial, configInfo);
+}
+
+Return<void> Radio::setGsmBroadcastActivation(int32_t serial, bool activate) {
+ WRAP_V1_0_CALL(setGsmBroadcastActivation, serial, activate);
+}
+
+Return<void> Radio::getCdmaBroadcastConfig(int32_t serial) {
+ WRAP_V1_0_CALL(getCdmaBroadcastConfig, serial);
+}
+
+Return<void> Radio::setCdmaBroadcastConfig(
+ int32_t serial, const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configInfo) {
+ WRAP_V1_0_CALL(setCdmaBroadcastConfig, serial, configInfo);
+}
+
+Return<void> Radio::setCdmaBroadcastActivation(int32_t serial, bool activate) {
+ WRAP_V1_0_CALL(setCdmaBroadcastActivation, serial, activate);
+}
+
+Return<void> Radio::getCDMASubscription(int32_t serial) {
+ WRAP_V1_0_CALL(getCDMASubscription, serial);
+}
+
+Return<void> Radio::writeSmsToRuim(int32_t serial, const V1_0::CdmaSmsWriteArgs& cdmaSms) {
+ WRAP_V1_0_CALL(writeSmsToRuim, serial, cdmaSms);
+}
+
+Return<void> Radio::deleteSmsOnRuim(int32_t serial, int32_t index) {
+ WRAP_V1_0_CALL(deleteSmsOnRuim, serial, index);
+}
+
+Return<void> Radio::getDeviceIdentity(int32_t serial) {
+ WRAP_V1_0_CALL(getDeviceIdentity, serial);
+}
+
+Return<void> Radio::exitEmergencyCallbackMode(int32_t serial) {
+ WRAP_V1_0_CALL(exitEmergencyCallbackMode, serial);
+}
+
+Return<void> Radio::getSmscAddress(int32_t serial) {
+ WRAP_V1_0_CALL(getSmscAddress, serial);
+}
+
+Return<void> Radio::setSmscAddress(int32_t serial, const hidl_string& smsc) {
+ WRAP_V1_0_CALL(setSmscAddress, serial, smsc);
+}
+
+Return<void> Radio::reportSmsMemoryStatus(int32_t serial, bool available) {
+ WRAP_V1_0_CALL(reportSmsMemoryStatus, serial, available);
+}
+
+Return<void> Radio::reportStkServiceIsRunning(int32_t serial) {
+ WRAP_V1_0_CALL(reportStkServiceIsRunning, serial);
+}
+
+Return<void> Radio::getCdmaSubscriptionSource(int32_t serial) {
+ WRAP_V1_0_CALL(getCdmaSubscriptionSource, serial);
+}
+
+Return<void> Radio::requestIsimAuthentication(int32_t serial, const hidl_string& challenge) {
+ WRAP_V1_0_CALL(requestIsimAuthentication, serial, challenge);
+}
+
+Return<void> Radio::acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
+ const hidl_string& ackPdu) {
+ WRAP_V1_0_CALL(acknowledgeIncomingGsmSmsWithPdu, serial, success, ackPdu);
+}
+
+Return<void> Radio::sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) {
+ WRAP_V1_0_CALL(sendEnvelopeWithStatus, serial, contents);
+}
+
+Return<void> Radio::getVoiceRadioTechnology(int32_t serial) {
+ WRAP_V1_0_CALL(getVoiceRadioTechnology, serial);
+}
+
+Return<void> Radio::getCellInfoList(int32_t serial) {
+ WRAP_V1_0_CALL(getCellInfoList, serial);
+}
+
+Return<void> Radio::setCellInfoListRate(int32_t serial, int32_t rate) {
+ WRAP_V1_0_CALL(setCellInfoListRate, serial, rate);
+}
+
+Return<void> Radio::setInitialAttachApn(int32_t serial,
+ const V1_0::DataProfileInfo& dataProfileInfo,
+ bool modemCognitive, bool isRoaming) {
+ WRAP_V1_0_CALL(setInitialAttachApn, serial, dataProfileInfo, modemCognitive, isRoaming);
+}
+
+Return<void> Radio::getImsRegistrationState(int32_t serial) {
+ WRAP_V1_0_CALL(getImsRegistrationState, serial);
+}
+
+Return<void> Radio::sendImsSms(int32_t serial, const V1_0::ImsSmsMessage& message) {
+ WRAP_V1_0_CALL(sendImsSms, serial, message);
+}
+
+Return<void> Radio::iccTransmitApduBasicChannel(int32_t serial, const V1_0::SimApdu& message) {
+ WRAP_V1_0_CALL(iccTransmitApduBasicChannel, serial, message);
+}
+
+Return<void> Radio::iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) {
+ WRAP_V1_0_CALL(iccOpenLogicalChannel, serial, aid, p2);
+}
+
+Return<void> Radio::iccCloseLogicalChannel(int32_t serial, int32_t channelId) {
+ WRAP_V1_0_CALL(iccCloseLogicalChannel, serial, channelId);
+}
+
+Return<void> Radio::iccTransmitApduLogicalChannel(int32_t serial, const V1_0::SimApdu& message) {
+ WRAP_V1_0_CALL(iccTransmitApduLogicalChannel, serial, message);
+}
+
+Return<void> Radio::nvReadItem(int32_t serial, V1_0::NvItem itemId) {
+ WRAP_V1_0_CALL(nvReadItem, serial, itemId);
+}
+
+Return<void> Radio::nvWriteItem(int32_t serial, const V1_0::NvWriteItem& item) {
+ WRAP_V1_0_CALL(nvWriteItem, serial, item);
+}
+
+Return<void> Radio::nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) {
+ WRAP_V1_0_CALL(nvWriteCdmaPrl, serial, prl);
+}
+
+Return<void> Radio::nvResetConfig(int32_t serial, V1_0::ResetNvType resetType) {
+ WRAP_V1_0_CALL(nvResetConfig, serial, resetType);
+}
+
+Return<void> Radio::setUiccSubscription(int32_t serial, const V1_0::SelectUiccSub& uiccSub) {
+ WRAP_V1_0_CALL(setUiccSubscription, serial, uiccSub);
+}
+
+Return<void> Radio::setDataAllowed(int32_t serial, bool allow) {
+ WRAP_V1_0_CALL(setDataAllowed, serial, allow);
+}
+
+Return<void> Radio::getHardwareConfig(int32_t serial) {
+ WRAP_V1_0_CALL(getHardwareConfig, serial);
+}
+
+Return<void> 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<void> Radio::setDataProfile(int32_t serial, const hidl_vec<V1_0::DataProfileInfo>& profiles,
+ bool isRoaming) {
+ WRAP_V1_0_CALL(setDataProfile, serial, profiles, isRoaming);
+}
+
+Return<void> Radio::requestShutdown(int32_t serial) {
+ WRAP_V1_0_CALL(requestShutdown, serial);
+}
+
+Return<void> Radio::getRadioCapability(int32_t serial) {
+ WRAP_V1_0_CALL(getRadioCapability, serial);
+}
+
+Return<void> Radio::setRadioCapability(int32_t serial, const V1_0::RadioCapability& rc) {
+ WRAP_V1_0_CALL(setRadioCapability, serial, rc);
+}
+
+Return<void> Radio::startLceService(int32_t serial, int32_t reportInterval, bool pullMode) {
+ WRAP_V1_0_CALL(startLceService, serial, reportInterval, pullMode);
+}
+
+Return<void> Radio::stopLceService(int32_t serial) {
+ WRAP_V1_0_CALL(stopLceService, serial);
+}
+
+Return<void> Radio::pullLceData(int32_t serial) {
+ WRAP_V1_0_CALL(pullLceData, serial);
+}
+
+Return<void> Radio::getModemActivityInfo(int32_t serial) {
+ WRAP_V1_0_CALL(getModemActivityInfo, serial);
+}
+
+Return<void> Radio::setAllowedCarriers(int32_t serial, bool allAllowed,
+ const V1_0::CarrierRestrictions& carriers) {
+ WRAP_V1_0_CALL(setAllowedCarriers, serial, allAllowed, carriers);
+}
+
+Return<void> Radio::getAllowedCarriers(int32_t serial) {
+ WRAP_V1_0_CALL(getAllowedCarriers, serial);
+}
+
+Return<void> Radio::sendDeviceState(int32_t serial, V1_0::DeviceStateType deviceStateType,
+ bool state) {
+ WRAP_V1_0_CALL(sendDeviceState, serial, deviceStateType, state);
+}
+
+Return<void> Radio::setIndicationFilter(int32_t serial,
+ hidl_bitfield<V1_0::IndicationFilter> indicationFilter) {
+ WRAP_V1_0_CALL(setIndicationFilter, serial, indicationFilter);
+}
+
+Return<void> Radio::setSimCardPower(int32_t serial, bool powerUp) {
+ WRAP_V1_0_CALL(setSimCardPower, serial, powerUp);
+}
+
+Return<void> Radio::responseAcknowledgement() {
+ WRAP_V1_0_CALL(responseAcknowledgement);
+}
+
+// Methods from ::android::hardware::radio::V1_1::IRadio follow.
+Return<void> Radio::setCarrierInfoForImsiEncryption(
+ int32_t serial, const V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) {
+ MAYBE_WRAP_V1_1_CALL(setCarrierInfoForImsiEncryption, serial, imsiEncryptionInfo);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> 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<void> Radio::startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) {
+ MAYBE_WRAP_V1_1_CALL(startNetworkScan, serial, request);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> Radio::stopNetworkScan(int32_t serial) {
+ MAYBE_WRAP_V1_1_CALL(stopNetworkScan, serial);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> Radio::startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) {
+ MAYBE_WRAP_V1_1_CALL(startKeepalive, serial, keepalive);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> 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<void> 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<void> Radio::setIndicationFilter_1_2(
+ int32_t serial, hidl_bitfield<V1_2::IndicationFilter> indicationFilter) {
+ MAYBE_WRAP_V1_2_CALL(setIndicationFilter_1_2, serial, indicationFilter);
+ WRAP_V1_0_CALL(setIndicationFilter, serial, indicationFilter & V1_0::IndicationFilter::ALL);
+}
+
+Return<void> Radio::setSignalStrengthReportingCriteria(int32_t serial, int32_t hysteresisMs,
+ int32_t hysteresisDb,
+ const hidl_vec<int32_t>& thresholdsDbm,
+ V1_2::AccessNetwork accessNetwork) {
+ MAYBE_WRAP_V1_2_CALL(setSignalStrengthReportingCriteria, serial, hysteresisMs, hysteresisDb,
+ thresholdsDbm, accessNetwork);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> Radio::setLinkCapacityReportingCriteria(
+ int32_t serial, int32_t hysteresisMs, int32_t hysteresisDlKbps, int32_t hysteresisUlKbps,
+ const hidl_vec<int32_t>& thresholdsDownlinkKbps,
+ const hidl_vec<int32_t>& thresholdsUplinkKbps, V1_2::AccessNetwork accessNetwork) {
+ MAYBE_WRAP_V1_2_CALL(setLinkCapacityReportingCriteria, serial, hysteresisMs, hysteresisDlKbps,
+ hysteresisUlKbps, thresholdsDownlinkKbps, thresholdsUplinkKbps,
+ accessNetwork);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> 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<hidl_string>& addresses,
+ const hidl_vec<hidl_string>& dnses) {
+ MAYBE_WRAP_V1_2_CALL(setupDataCall_1_2, serial, accessNetwork, dataProfileInfo, modemCognitive,
+ roamingAllowed, isRoaming, reason, addresses, dnses);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> 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<void> Radio::setSystemSelectionChannels(
+ int32_t serial, bool specifyChannels,
+ const hidl_vec<V1_1::RadioAccessSpecifier>& specifiers) {
+ MAYBE_WRAP_V1_3_CALL(setSystemSelectionChannels, serial, specifyChannels, specifiers);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> Radio::enableModem(int32_t serial, bool on) {
+ MAYBE_WRAP_V1_3_CALL(enableModem, serial, on);
+
+ // TODO implement
+ return Void();
+}
+
+Return<void> 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<void> 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<hidl_string>& addresses,
+ const hidl_vec<hidl_string>& 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<void> 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<void> Radio::setDataProfile_1_4(int32_t serial,
+ const hidl_vec<V1_4::DataProfileInfo>& profiles) {
+ MAYBE_WRAP_V1_4_CALL(setDataProfile_1_4, serial, profiles);
+
+ std::vector<V1_0::DataProfileInfo> 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<void> Radio::emergencyDial(int32_t serial, const V1_0::Dial& dialInfo,
+ hidl_bitfield<V1_4::EmergencyServiceCategory> categories,
+ const hidl_vec<hidl_string>& 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<void> 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<void> Radio::getPreferredNetworkTypeBitmap(int32_t serial) {
+ MAYBE_WRAP_V1_4_CALL(getPreferredNetworkTypeBitmap, serial);
+
+ WRAP_V1_0_CALL(getPreferredNetworkType, serial);
+}
+
+Return<void> Radio::setPreferredNetworkTypeBitmap(
+ int32_t serial, hidl_bitfield<V1_4::RadioAccessFamily> 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<void> 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<void> Radio::getAllowedCarriers_1_4(int32_t serial) {
+ MAYBE_WRAP_V1_4_CALL(getAllowedCarriers_1_4, serial);
+ WRAP_V1_0_CALL(getAllowedCarriers, serial);
+}
+
+Return<void> Radio::getSignalStrength_1_4(int32_t serial) {
+ MAYBE_WRAP_V1_4_CALL(getSignalStrength_1_4, serial);
+ WRAP_V1_0_CALL(getSignalStrength, serial);
+}
+
+sp<V1_1::IRadio> Radio::getRealRadio_V1_1() {
+ return V1_1::IRadio::castFrom(mRealRadio).withDefault(nullptr);
+}
+
+sp<V1_2::IRadio> Radio::getRealRadio_V1_2() {
+ return V1_2::IRadio::castFrom(mRealRadio).withDefault(nullptr);
+}
+
+sp<V1_3::IRadio> Radio::getRealRadio_V1_3() {
+ return V1_3::IRadio::castFrom(mRealRadio).withDefault(nullptr);
+}
+
+sp<V1_4::IRadio> 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 <android/hardware/radio/1.4/IRadio.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+#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<V1_0::IRadio> realRadio);
+
+ // Methods from ::android::hardware::radio::V1_0::IRadio follow.
+ Return<void> setResponseFunctions(const sp<V1_0::IRadioResponse>& radioResponse,
+ const sp<V1_0::IRadioIndication>& radioIndication) override;
+ Return<void> getIccCardStatus(int32_t serial) override;
+ Return<void> supplyIccPinForApp(int32_t serial, const hidl_string& pin,
+ const hidl_string& aid) override;
+ Return<void> supplyIccPukForApp(int32_t serial, const hidl_string& puk, const hidl_string& pin,
+ const hidl_string& aid) override;
+ Return<void> supplyIccPin2ForApp(int32_t serial, const hidl_string& pin2,
+ const hidl_string& aid) override;
+ Return<void> supplyIccPuk2ForApp(int32_t serial, const hidl_string& puk2,
+ const hidl_string& pin2, const hidl_string& aid) override;
+ Return<void> changeIccPinForApp(int32_t serial, const hidl_string& oldPin,
+ const hidl_string& newPin, const hidl_string& aid) override;
+ Return<void> changeIccPin2ForApp(int32_t serial, const hidl_string& oldPin2,
+ const hidl_string& newPin2, const hidl_string& aid) override;
+ Return<void> supplyNetworkDepersonalization(int32_t serial, const hidl_string& netPin) override;
+ Return<void> getCurrentCalls(int32_t serial) override;
+ Return<void> dial(int32_t serial, const V1_0::Dial& dialInfo) override;
+ Return<void> getImsiForApp(int32_t serial, const hidl_string& aid) override;
+ Return<void> hangup(int32_t serial, int32_t gsmIndex) override;
+ Return<void> hangupWaitingOrBackground(int32_t serial) override;
+ Return<void> hangupForegroundResumeBackground(int32_t serial) override;
+ Return<void> switchWaitingOrHoldingAndActive(int32_t serial) override;
+ Return<void> conference(int32_t serial) override;
+ Return<void> rejectCall(int32_t serial) override;
+ Return<void> getLastCallFailCause(int32_t serial) override;
+ Return<void> getSignalStrength(int32_t serial) override;
+ Return<void> getVoiceRegistrationState(int32_t serial) override;
+ Return<void> getDataRegistrationState(int32_t serial) override;
+ Return<void> getOperator(int32_t serial) override;
+ Return<void> setRadioPower(int32_t serial, bool on) override;
+ Return<void> sendDtmf(int32_t serial, const hidl_string& s) override;
+ Return<void> sendSms(int32_t serial, const V1_0::GsmSmsMessage& message) override;
+ Return<void> sendSMSExpectMore(int32_t serial, const V1_0::GsmSmsMessage& message) override;
+ Return<void> setupDataCall(int32_t serial, V1_0::RadioTechnology radioTechnology,
+ const V1_0::DataProfileInfo& dataProfileInfo, bool modemCognitive,
+ bool roamingAllowed, bool isRoaming) override;
+ Return<void> iccIOForApp(int32_t serial, const V1_0::IccIo& iccIo) override;
+ Return<void> sendUssd(int32_t serial, const hidl_string& ussd) override;
+ Return<void> cancelPendingUssd(int32_t serial) override;
+ Return<void> getClir(int32_t serial) override;
+ Return<void> setClir(int32_t serial, int32_t status) override;
+ Return<void> getCallForwardStatus(int32_t serial,
+ const V1_0::CallForwardInfo& callInfo) override;
+ Return<void> setCallForward(int32_t serial, const V1_0::CallForwardInfo& callInfo) override;
+ Return<void> getCallWaiting(int32_t serial, int32_t serviceClass) override;
+ Return<void> setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override;
+ Return<void> acknowledgeLastIncomingGsmSms(int32_t serial, bool success,
+ V1_0::SmsAcknowledgeFailCause cause) override;
+ Return<void> acceptCall(int32_t serial) override;
+ Return<void> deactivateDataCall(int32_t serial, int32_t cid, bool reasonRadioShutDown) override;
+ Return<void> getFacilityLockForApp(int32_t serial, const hidl_string& facility,
+ const hidl_string& password, int32_t serviceClass,
+ const hidl_string& appId) override;
+ Return<void> setFacilityLockForApp(int32_t serial, const hidl_string& facility, bool lockState,
+ const hidl_string& password, int32_t serviceClass,
+ const hidl_string& appId) override;
+ Return<void> setBarringPassword(int32_t serial, const hidl_string& facility,
+ const hidl_string& oldPassword,
+ const hidl_string& newPassword) override;
+ Return<void> getNetworkSelectionMode(int32_t serial) override;
+ Return<void> setNetworkSelectionModeAutomatic(int32_t serial) override;
+ Return<void> setNetworkSelectionModeManual(int32_t serial,
+ const hidl_string& operatorNumeric) override;
+ Return<void> getAvailableNetworks(int32_t serial) override;
+ Return<void> startDtmf(int32_t serial, const hidl_string& s) override;
+ Return<void> stopDtmf(int32_t serial) override;
+ Return<void> getBasebandVersion(int32_t serial) override;
+ Return<void> separateConnection(int32_t serial, int32_t gsmIndex) override;
+ Return<void> setMute(int32_t serial, bool enable) override;
+ Return<void> getMute(int32_t serial) override;
+ Return<void> getClip(int32_t serial) override;
+ Return<void> getDataCallList(int32_t serial) override;
+ Return<void> setSuppServiceNotifications(int32_t serial, bool enable) override;
+ Return<void> writeSmsToSim(int32_t serial, const V1_0::SmsWriteArgs& smsWriteArgs) override;
+ Return<void> deleteSmsOnSim(int32_t serial, int32_t index) override;
+ Return<void> setBandMode(int32_t serial, V1_0::RadioBandMode mode) override;
+ Return<void> getAvailableBandModes(int32_t serial) override;
+ Return<void> sendEnvelope(int32_t serial, const hidl_string& command) override;
+ Return<void> sendTerminalResponseToSim(int32_t serial,
+ const hidl_string& commandResponse) override;
+ Return<void> handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override;
+ Return<void> explicitCallTransfer(int32_t serial) override;
+ Return<void> setPreferredNetworkType(int32_t serial,
+ V1_0::PreferredNetworkType nwType) override;
+ Return<void> getPreferredNetworkType(int32_t serial) override;
+ Return<void> getNeighboringCids(int32_t serial) override;
+ Return<void> setLocationUpdates(int32_t serial, bool enable) override;
+ Return<void> setCdmaSubscriptionSource(int32_t serial,
+ V1_0::CdmaSubscriptionSource cdmaSub) override;
+ Return<void> setCdmaRoamingPreference(int32_t serial, V1_0::CdmaRoamingType type) override;
+ Return<void> getCdmaRoamingPreference(int32_t serial) override;
+ Return<void> setTTYMode(int32_t serial, V1_0::TtyMode mode) override;
+ Return<void> getTTYMode(int32_t serial) override;
+ Return<void> setPreferredVoicePrivacy(int32_t serial, bool enable) override;
+ Return<void> getPreferredVoicePrivacy(int32_t serial) override;
+ Return<void> sendCDMAFeatureCode(int32_t serial, const hidl_string& featureCode) override;
+ Return<void> sendBurstDtmf(int32_t serial, const hidl_string& dtmf, int32_t on,
+ int32_t off) override;
+ Return<void> sendCdmaSms(int32_t serial, const V1_0::CdmaSmsMessage& sms) override;
+ Return<void> acknowledgeLastIncomingCdmaSms(int32_t serial,
+ const V1_0::CdmaSmsAck& smsAck) override;
+ Return<void> getGsmBroadcastConfig(int32_t serial) override;
+ Return<void> setGsmBroadcastConfig(
+ int32_t serial, const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& configInfo) override;
+ Return<void> setGsmBroadcastActivation(int32_t serial, bool activate) override;
+ Return<void> getCdmaBroadcastConfig(int32_t serial) override;
+ Return<void> setCdmaBroadcastConfig(
+ int32_t serial, const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configInfo) override;
+ Return<void> setCdmaBroadcastActivation(int32_t serial, bool activate) override;
+ Return<void> getCDMASubscription(int32_t serial) override;
+ Return<void> writeSmsToRuim(int32_t serial, const V1_0::CdmaSmsWriteArgs& cdmaSms) override;
+ Return<void> deleteSmsOnRuim(int32_t serial, int32_t index) override;
+ Return<void> getDeviceIdentity(int32_t serial) override;
+ Return<void> exitEmergencyCallbackMode(int32_t serial) override;
+ Return<void> getSmscAddress(int32_t serial) override;
+ Return<void> setSmscAddress(int32_t serial, const hidl_string& smsc) override;
+ Return<void> reportSmsMemoryStatus(int32_t serial, bool available) override;
+ Return<void> reportStkServiceIsRunning(int32_t serial) override;
+ Return<void> getCdmaSubscriptionSource(int32_t serial) override;
+ Return<void> requestIsimAuthentication(int32_t serial, const hidl_string& challenge) override;
+ Return<void> acknowledgeIncomingGsmSmsWithPdu(int32_t serial, bool success,
+ const hidl_string& ackPdu) override;
+ Return<void> sendEnvelopeWithStatus(int32_t serial, const hidl_string& contents) override;
+ Return<void> getVoiceRadioTechnology(int32_t serial) override;
+ Return<void> getCellInfoList(int32_t serial) override;
+ Return<void> setCellInfoListRate(int32_t serial, int32_t rate) override;
+ Return<void> setInitialAttachApn(int32_t serial, const V1_0::DataProfileInfo& dataProfileInfo,
+ bool modemCognitive, bool isRoaming) override;
+ Return<void> getImsRegistrationState(int32_t serial) override;
+ Return<void> sendImsSms(int32_t serial, const V1_0::ImsSmsMessage& message) override;
+ Return<void> iccTransmitApduBasicChannel(int32_t serial, const V1_0::SimApdu& message) override;
+ Return<void> iccOpenLogicalChannel(int32_t serial, const hidl_string& aid, int32_t p2) override;
+ Return<void> iccCloseLogicalChannel(int32_t serial, int32_t channelId) override;
+ Return<void> iccTransmitApduLogicalChannel(int32_t serial,
+ const V1_0::SimApdu& message) override;
+ Return<void> nvReadItem(int32_t serial, V1_0::NvItem itemId) override;
+ Return<void> nvWriteItem(int32_t serial, const V1_0::NvWriteItem& item) override;
+ Return<void> nvWriteCdmaPrl(int32_t serial, const hidl_vec<uint8_t>& prl) override;
+ Return<void> nvResetConfig(int32_t serial, V1_0::ResetNvType resetType) override;
+ Return<void> setUiccSubscription(int32_t serial, const V1_0::SelectUiccSub& uiccSub) override;
+ Return<void> setDataAllowed(int32_t serial, bool allow) override;
+ Return<void> getHardwareConfig(int32_t serial) override;
+ Return<void> requestIccSimAuthentication(int32_t serial, int32_t authContext,
+ const hidl_string& authData,
+ const hidl_string& aid) override;
+ Return<void> setDataProfile(int32_t serial, const hidl_vec<V1_0::DataProfileInfo>& profiles,
+ bool isRoaming) override;
+ Return<void> requestShutdown(int32_t serial) override;
+ Return<void> getRadioCapability(int32_t serial) override;
+ Return<void> setRadioCapability(int32_t serial, const V1_0::RadioCapability& rc) override;
+ Return<void> startLceService(int32_t serial, int32_t reportInterval, bool pullMode) override;
+ Return<void> stopLceService(int32_t serial) override;
+ Return<void> pullLceData(int32_t serial) override;
+ Return<void> getModemActivityInfo(int32_t serial) override;
+ Return<void> setAllowedCarriers(int32_t serial, bool allAllowed,
+ const V1_0::CarrierRestrictions& carriers) override;
+ Return<void> getAllowedCarriers(int32_t serial) override;
+ Return<void> sendDeviceState(int32_t serial, V1_0::DeviceStateType deviceStateType,
+ bool state) override;
+ Return<void> setIndicationFilter(
+ int32_t serial, hidl_bitfield<V1_0::IndicationFilter> indicationFilter) override;
+ Return<void> setSimCardPower(int32_t serial, bool powerUp) override;
+ Return<void> responseAcknowledgement() override;
+
+ // Methods from ::android::hardware::radio::V1_1::IRadio follow.
+ Return<void> setCarrierInfoForImsiEncryption(
+ int32_t serial, const V1_1::ImsiEncryptionInfo& imsiEncryptionInfo) override;
+ Return<void> setSimCardPower_1_1(int32_t serial, V1_1::CardPowerState powerUp) override;
+ Return<void> startNetworkScan(int32_t serial, const V1_1::NetworkScanRequest& request) override;
+ Return<void> stopNetworkScan(int32_t serial) override;
+ Return<void> startKeepalive(int32_t serial, const V1_1::KeepaliveRequest& keepalive) override;
+ Return<void> stopKeepalive(int32_t serial, int32_t sessionHandle) override;
+
+ // Methods from ::android::hardware::radio::V1_2::IRadio follow.
+ Return<void> startNetworkScan_1_2(int32_t serial,
+ const V1_2::NetworkScanRequest& request) override;
+ Return<void> setIndicationFilter_1_2(
+ int32_t serial, hidl_bitfield<V1_2::IndicationFilter> indicationFilter) override;
+ Return<void> setSignalStrengthReportingCriteria(int32_t serial, int32_t hysteresisMs,
+ int32_t hysteresisDb,
+ const hidl_vec<int32_t>& thresholdsDbm,
+ V1_2::AccessNetwork accessNetwork) override;
+ Return<void> setLinkCapacityReportingCriteria(int32_t serial, int32_t hysteresisMs,
+ int32_t hysteresisDlKbps,
+ int32_t hysteresisUlKbps,
+ const hidl_vec<int32_t>& thresholdsDownlinkKbps,
+ const hidl_vec<int32_t>& thresholdsUplinkKbps,
+ V1_2::AccessNetwork accessNetwork) override;
+ Return<void> 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<hidl_string>& addresses,
+ const hidl_vec<hidl_string>& dnses) override;
+ Return<void> deactivateDataCall_1_2(int32_t serial, int32_t cid,
+ V1_2::DataRequestReason reason) override;
+
+ // Methods from ::android::hardware::radio::V1_3::IRadio follow.
+ Return<void> setSystemSelectionChannels(
+ int32_t serial, bool specifyChannels,
+ const hidl_vec<V1_1::RadioAccessSpecifier>& specifiers) override;
+ Return<void> enableModem(int32_t serial, bool on) override;
+ Return<void> getModemStackStatus(int32_t serial) override;
+
+ // Methods from ::android::hardware::radio::V1_4::IRadio follow.
+ Return<void> setupDataCall_1_4(int32_t serial, V1_4::AccessNetwork accessNetwork,
+ const V1_4::DataProfileInfo& dataProfileInfo,
+ bool roamingAllowed, V1_2::DataRequestReason reason,
+ const hidl_vec<hidl_string>& addresses,
+ const hidl_vec<hidl_string>& dnses) override;
+ Return<void> setInitialAttachApn_1_4(int32_t serial,
+ const V1_4::DataProfileInfo& dataProfileInfo) override;
+ Return<void> setDataProfile_1_4(int32_t serial,
+ const hidl_vec<V1_4::DataProfileInfo>& profiles) override;
+ Return<void> emergencyDial(int32_t serial, const V1_0::Dial& dialInfo,
+ hidl_bitfield<V1_4::EmergencyServiceCategory> categories,
+ const hidl_vec<hidl_string>& urns,
+ V1_4::EmergencyCallRouting routing, bool hasKnownUserIntentEmergency,
+ bool isTesting) override;
+ Return<void> startNetworkScan_1_4(int32_t serial,
+ const V1_2::NetworkScanRequest& request) override;
+ Return<void> getPreferredNetworkTypeBitmap(int32_t serial) override;
+ Return<void> setPreferredNetworkTypeBitmap(
+ int32_t serial, hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) override;
+ Return<void> setAllowedCarriers_1_4(int32_t serial,
+ const V1_4::CarrierRestrictionsWithPriority& carriers,
+ V1_4::SimLockMultiSimPolicy multiSimPolicy) override;
+ Return<void> getAllowedCarriers_1_4(int32_t serial) override;
+ Return<void> getSignalStrength_1_4(int32_t serial) override;
+
+ private:
+ sp<V1_0::IRadio> mRealRadio;
+ sp<RadioResponse> mRadioResponse = new RadioResponse();
+ sp<RadioIndication> mRadioIndication = new RadioIndication();
+
+ sp<V1_1::IRadio> getRealRadio_V1_1();
+ sp<V1_2::IRadio> getRealRadio_V1_2();
+ sp<V1_3::IRadio> getRealRadio_V1_3();
+ sp<V1_4::IRadio> 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<void> RadioIndication::radioStateChanged(V1_0::RadioIndicationType type,
+ V1_0::RadioState radioState) {
+ return mRealRadioIndication->radioStateChanged(type, radioState);
+}
+
+Return<void> RadioIndication::callStateChanged(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->callStateChanged(type);
+}
+
+Return<void> RadioIndication::networkStateChanged(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->networkStateChanged(type);
+}
+
+Return<void> RadioIndication::newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) {
+ return mRealRadioIndication->newSms(type, pdu);
+}
+
+Return<void> RadioIndication::newSmsStatusReport(V1_0::RadioIndicationType type,
+ const hidl_vec<uint8_t>& pdu) {
+ return mRealRadioIndication->newSmsStatusReport(type, pdu);
+}
+
+Return<void> RadioIndication::newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) {
+ return mRealRadioIndication->newSmsOnSim(type, recordNumber);
+}
+
+Return<void> RadioIndication::onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
+ const hidl_string& msg) {
+ return mRealRadioIndication->onUssd(type, modeType, msg);
+}
+
+Return<void> RadioIndication::nitzTimeReceived(V1_0::RadioIndicationType type,
+ const hidl_string& nitzTime, uint64_t receivedTime) {
+ return mRealRadioIndication->nitzTimeReceived(type, nitzTime, receivedTime);
+}
+
+Return<void> RadioIndication::currentSignalStrength(V1_0::RadioIndicationType type,
+ const V1_0::SignalStrength& signalStrength) {
+ return mRealRadioIndication->currentSignalStrength_1_4(type, Create1_4SignalStrength(signalStrength));
+}
+
+Return<void> RadioIndication::dataCallListChanged(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_0::SetupDataCallResult>& dcList) {
+ hidl_vec<V1_4::SetupDataCallResult> 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<void> RadioIndication::suppSvcNotify(V1_0::RadioIndicationType type,
+ const V1_0::SuppSvcNotification& suppSvc) {
+ return mRealRadioIndication->suppSvcNotify(type, suppSvc);
+}
+
+Return<void> RadioIndication::stkSessionEnd(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->stkSessionEnd(type);
+}
+
+Return<void> RadioIndication::stkProactiveCommand(V1_0::RadioIndicationType type,
+ const hidl_string& cmd) {
+ return mRealRadioIndication->stkProactiveCommand(type, cmd);
+}
+
+Return<void> RadioIndication::stkEventNotify(V1_0::RadioIndicationType type,
+ const hidl_string& cmd) {
+ return mRealRadioIndication->stkEventNotify(type, cmd);
+}
+
+Return<void> RadioIndication::stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) {
+ return mRealRadioIndication->stkCallSetup(type, timeout);
+}
+
+Return<void> RadioIndication::simSmsStorageFull(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->simSmsStorageFull(type);
+}
+
+Return<void> RadioIndication::simRefresh(V1_0::RadioIndicationType type,
+ const V1_0::SimRefreshResult& refreshResult) {
+ return mRealRadioIndication->simRefresh(type, refreshResult);
+}
+
+Return<void> RadioIndication::callRing(V1_0::RadioIndicationType type, bool isGsm,
+ const V1_0::CdmaSignalInfoRecord& record) {
+ return mRealRadioIndication->callRing(type, isGsm, record);
+}
+
+Return<void> RadioIndication::simStatusChanged(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->simStatusChanged(type);
+}
+
+Return<void> RadioIndication::cdmaNewSms(V1_0::RadioIndicationType type,
+ const V1_0::CdmaSmsMessage& msg) {
+ return mRealRadioIndication->cdmaNewSms(type, msg);
+}
+
+Return<void> RadioIndication::newBroadcastSms(V1_0::RadioIndicationType type,
+ const hidl_vec<uint8_t>& data) {
+ return mRealRadioIndication->newBroadcastSms(type, data);
+}
+
+Return<void> RadioIndication::cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->cdmaRuimSmsStorageFull(type);
+}
+
+Return<void> RadioIndication::restrictedStateChanged(V1_0::RadioIndicationType type,
+ V1_0::PhoneRestrictedState state) {
+ return mRealRadioIndication->restrictedStateChanged(type, state);
+}
+
+Return<void> RadioIndication::enterEmergencyCallbackMode(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->enterEmergencyCallbackMode(type);
+}
+
+Return<void> RadioIndication::cdmaCallWaiting(V1_0::RadioIndicationType type,
+ const V1_0::CdmaCallWaiting& callWaitingRecord) {
+ return mRealRadioIndication->cdmaCallWaiting(type, callWaitingRecord);
+}
+
+Return<void> RadioIndication::cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
+ V1_0::CdmaOtaProvisionStatus status) {
+ return mRealRadioIndication->cdmaOtaProvisionStatus(type, status);
+}
+
+Return<void> RadioIndication::cdmaInfoRec(V1_0::RadioIndicationType type,
+ const V1_0::CdmaInformationRecords& records) {
+ return mRealRadioIndication->cdmaInfoRec(type, records);
+}
+
+Return<void> RadioIndication::indicateRingbackTone(V1_0::RadioIndicationType type, bool start) {
+ return mRealRadioIndication->indicateRingbackTone(type, start);
+}
+
+Return<void> RadioIndication::resendIncallMute(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->resendIncallMute(type);
+}
+
+Return<void> RadioIndication::cdmaSubscriptionSourceChanged(
+ V1_0::RadioIndicationType type, V1_0::CdmaSubscriptionSource cdmaSource) {
+ return mRealRadioIndication->cdmaSubscriptionSourceChanged(type, cdmaSource);
+}
+
+Return<void> RadioIndication::cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) {
+ return mRealRadioIndication->cdmaPrlChanged(type, version);
+}
+
+Return<void> RadioIndication::exitEmergencyCallbackMode(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->exitEmergencyCallbackMode(type);
+}
+
+Return<void> RadioIndication::rilConnected(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->rilConnected(type);
+}
+
+Return<void> RadioIndication::voiceRadioTechChanged(V1_0::RadioIndicationType type,
+ V1_0::RadioTechnology rat) {
+ return mRealRadioIndication->voiceRadioTechChanged(type, rat);
+}
+
+Return<void> RadioIndication::cellInfoList(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::CellInfo>& records) {
+ return mRealRadioIndication->cellInfoList_1_4(type, Create1_4CellInfoList(records));
+}
+
+Return<void> RadioIndication::imsNetworkStateChanged(V1_0::RadioIndicationType type) {
+ return mRealRadioIndication->imsNetworkStateChanged(type);
+}
+
+Return<void> RadioIndication::subscriptionStatusChanged(V1_0::RadioIndicationType type,
+ bool activate) {
+ return mRealRadioIndication->subscriptionStatusChanged(type, activate);
+}
+
+Return<void> RadioIndication::srvccStateNotify(V1_0::RadioIndicationType type,
+ V1_0::SrvccState state) {
+ return mRealRadioIndication->srvccStateNotify(type, state);
+}
+
+Return<void> RadioIndication::hardwareConfigChanged(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::HardwareConfig>& configs) {
+ return mRealRadioIndication->hardwareConfigChanged(type, configs);
+}
+
+Return<void> RadioIndication::radioCapabilityIndication(V1_0::RadioIndicationType type,
+ const V1_0::RadioCapability& rc) {
+ return mRealRadioIndication->radioCapabilityIndication(type, rc);
+}
+
+Return<void> RadioIndication::onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
+ const V1_0::StkCcUnsolSsResult& ss) {
+ return mRealRadioIndication->onSupplementaryServiceIndication(type, ss);
+}
+
+Return<void> RadioIndication::stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
+ const hidl_string& alpha) {
+ return mRealRadioIndication->stkCallControlAlphaNotify(type, alpha);
+}
+
+Return<void> RadioIndication::lceData(V1_0::RadioIndicationType type,
+ const V1_0::LceDataInfo& lce) {
+ return mRealRadioIndication->lceData(type, lce);
+}
+
+Return<void> RadioIndication::pcoData(V1_0::RadioIndicationType type,
+ const V1_0::PcoDataInfo& pco) {
+ return mRealRadioIndication->pcoData(type, pco);
+}
+
+Return<void> 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<void> RadioIndication::carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) {
+ return mRealRadioIndication->carrierInfoForImsiEncryption(info);
+}
+
+Return<void> 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<void> 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<void> 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<void> RadioIndication::cellInfoList_1_2(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_2::CellInfo>& records) {
+ return mRealRadioIndication->cellInfoList_1_4(type, Create1_4CellInfoList(records));
+}
+
+Return<void> RadioIndication::currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
+ const V1_2::LinkCapacityEstimate& lce) {
+ return mRealRadioIndication->currentLinkCapacityEstimate(type, lce);
+}
+
+Return<void> RadioIndication::currentPhysicalChannelConfigs(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_2::PhysicalChannelConfig>& configs) {
+ hidl_vec<V1_4::PhysicalChannelConfig> 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<void> 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<void> RadioIndication::currentEmergencyNumberList(
+ V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::EmergencyNumber>& emergencyNumberList) {
+ return mRealRadioIndication->currentEmergencyNumberList(type, emergencyNumberList);
+}
+
+Return<void> RadioIndication::cellInfoList_1_4(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::CellInfo>& records) {
+ return mRealRadioIndication->cellInfoList_1_4(type, records);
+}
+
+Return<void> RadioIndication::networkScanResult_1_4(V1_0::RadioIndicationType type,
+ const V1_4::NetworkScanResult& result) {
+ return mRealRadioIndication->networkScanResult_1_4(type, result);
+}
+
+Return<void> RadioIndication::currentPhysicalChannelConfigs_1_4(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_4::PhysicalChannelConfig>& configs) {
+ return mRealRadioIndication->currentPhysicalChannelConfigs_1_4(type, configs);
+}
+
+Return<void> RadioIndication::dataCallListChanged_1_4(
+ V1_0::RadioIndicationType type, const hidl_vec<V1_4::SetupDataCallResult>& dcList) {
+ return mRealRadioIndication->dataCallListChanged_1_4(type, dcList);
+}
+
+Return<void> 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 <android/hardware/radio/1.4/IRadioIndication.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.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 RadioIndication : public V1_4::IRadioIndication {
+ sp<V1_4::IRadioIndication> mRealRadioIndication;
+ // Methods from ::android::hardware::radio::V1_0::IRadioIndication follow.
+ Return<void> radioStateChanged(V1_0::RadioIndicationType type,
+ V1_0::RadioState radioState) override;
+ Return<void> callStateChanged(V1_0::RadioIndicationType type) override;
+ Return<void> networkStateChanged(V1_0::RadioIndicationType type) override;
+ Return<void> newSms(V1_0::RadioIndicationType type, const hidl_vec<uint8_t>& pdu) override;
+ Return<void> newSmsStatusReport(V1_0::RadioIndicationType type,
+ const hidl_vec<uint8_t>& pdu) override;
+ Return<void> newSmsOnSim(V1_0::RadioIndicationType type, int32_t recordNumber) override;
+ Return<void> onUssd(V1_0::RadioIndicationType type, V1_0::UssdModeType modeType,
+ const hidl_string& msg) override;
+ Return<void> nitzTimeReceived(V1_0::RadioIndicationType type, const hidl_string& nitzTime,
+ uint64_t receivedTime) override;
+ Return<void> currentSignalStrength(V1_0::RadioIndicationType type,
+ const V1_0::SignalStrength& signalStrength) override;
+ Return<void> dataCallListChanged(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::SetupDataCallResult>& dcList) override;
+ Return<void> suppSvcNotify(V1_0::RadioIndicationType type,
+ const V1_0::SuppSvcNotification& suppSvc) override;
+ Return<void> stkSessionEnd(V1_0::RadioIndicationType type) override;
+ Return<void> stkProactiveCommand(V1_0::RadioIndicationType type,
+ const hidl_string& cmd) override;
+ Return<void> stkEventNotify(V1_0::RadioIndicationType type, const hidl_string& cmd) override;
+ Return<void> stkCallSetup(V1_0::RadioIndicationType type, int64_t timeout) override;
+ Return<void> simSmsStorageFull(V1_0::RadioIndicationType type) override;
+ Return<void> simRefresh(V1_0::RadioIndicationType type,
+ const V1_0::SimRefreshResult& refreshResult) override;
+ Return<void> callRing(V1_0::RadioIndicationType type, bool isGsm,
+ const V1_0::CdmaSignalInfoRecord& record) override;
+ Return<void> simStatusChanged(V1_0::RadioIndicationType type) override;
+ Return<void> cdmaNewSms(V1_0::RadioIndicationType type,
+ const V1_0::CdmaSmsMessage& msg) override;
+ Return<void> newBroadcastSms(V1_0::RadioIndicationType type,
+ const hidl_vec<uint8_t>& data) override;
+ Return<void> cdmaRuimSmsStorageFull(V1_0::RadioIndicationType type) override;
+ Return<void> restrictedStateChanged(V1_0::RadioIndicationType type,
+ V1_0::PhoneRestrictedState state) override;
+ Return<void> enterEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
+ Return<void> cdmaCallWaiting(V1_0::RadioIndicationType type,
+ const V1_0::CdmaCallWaiting& callWaitingRecord) override;
+ Return<void> cdmaOtaProvisionStatus(V1_0::RadioIndicationType type,
+ V1_0::CdmaOtaProvisionStatus status) override;
+ Return<void> cdmaInfoRec(V1_0::RadioIndicationType type,
+ const V1_0::CdmaInformationRecords& records) override;
+ Return<void> indicateRingbackTone(V1_0::RadioIndicationType type, bool start) override;
+ Return<void> resendIncallMute(V1_0::RadioIndicationType type) override;
+ Return<void> cdmaSubscriptionSourceChanged(V1_0::RadioIndicationType type,
+ V1_0::CdmaSubscriptionSource cdmaSource) override;
+ Return<void> cdmaPrlChanged(V1_0::RadioIndicationType type, int32_t version) override;
+ Return<void> exitEmergencyCallbackMode(V1_0::RadioIndicationType type) override;
+ Return<void> rilConnected(V1_0::RadioIndicationType type) override;
+ Return<void> voiceRadioTechChanged(V1_0::RadioIndicationType type,
+ V1_0::RadioTechnology rat) override;
+ Return<void> cellInfoList(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::CellInfo>& records) override;
+ Return<void> imsNetworkStateChanged(V1_0::RadioIndicationType type) override;
+ Return<void> subscriptionStatusChanged(V1_0::RadioIndicationType type, bool activate) override;
+ Return<void> srvccStateNotify(V1_0::RadioIndicationType type, V1_0::SrvccState state) override;
+ Return<void> hardwareConfigChanged(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_0::HardwareConfig>& configs) override;
+ Return<void> radioCapabilityIndication(V1_0::RadioIndicationType type,
+ const V1_0::RadioCapability& rc) override;
+ Return<void> onSupplementaryServiceIndication(V1_0::RadioIndicationType type,
+ const V1_0::StkCcUnsolSsResult& ss) override;
+ Return<void> stkCallControlAlphaNotify(V1_0::RadioIndicationType type,
+ const hidl_string& alpha) override;
+ Return<void> lceData(V1_0::RadioIndicationType type, const V1_0::LceDataInfo& lce) override;
+ Return<void> pcoData(V1_0::RadioIndicationType type, const V1_0::PcoDataInfo& pco) override;
+ Return<void> modemReset(V1_0::RadioIndicationType type, const hidl_string& reason) override;
+
+ // Methods from ::android::hardware::radio::V1_1::IRadioIndication follow.
+ Return<void> carrierInfoForImsiEncryption(V1_0::RadioIndicationType info) override;
+ Return<void> networkScanResult(V1_0::RadioIndicationType type,
+ const V1_1::NetworkScanResult& result) override;
+ Return<void> keepaliveStatus(V1_0::RadioIndicationType type,
+ const V1_1::KeepaliveStatus& status) override;
+
+ // Methods from ::android::hardware::radio::V1_2::IRadioIndication follow.
+ Return<void> networkScanResult_1_2(V1_0::RadioIndicationType type,
+ const V1_2::NetworkScanResult& result) override;
+ Return<void> cellInfoList_1_2(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_2::CellInfo>& records) override;
+ Return<void> currentLinkCapacityEstimate(V1_0::RadioIndicationType type,
+ const V1_2::LinkCapacityEstimate& lce) override;
+ Return<void> currentPhysicalChannelConfigs(
+ V1_0::RadioIndicationType type,
+ const hidl_vec<V1_2::PhysicalChannelConfig>& configs) override;
+ Return<void> currentSignalStrength_1_2(V1_0::RadioIndicationType type,
+ const V1_2::SignalStrength& signalStrength) override;
+
+ // Methods from ::android::hardware::radio::V1_4::IRadioIndication follow.
+ Return<void> currentEmergencyNumberList(
+ V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::EmergencyNumber>& emergencyNumberList) override;
+ Return<void> cellInfoList_1_4(V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::CellInfo>& records) override;
+ Return<void> networkScanResult_1_4(V1_0::RadioIndicationType type,
+ const V1_4::NetworkScanResult& result) override;
+ Return<void> currentPhysicalChannelConfigs_1_4(
+ V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::PhysicalChannelConfig>& configs) override;
+ Return<void> dataCallListChanged_1_4(
+ V1_0::RadioIndicationType type,
+ const hidl_vec<V1_4::SetupDataCallResult>& dcList) override;
+ Return<void> 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<string>
+
+namespace android::hardware::radio::implementation {
+
+// Methods from ::android::hardware::radio::V1_0::IRadioResponse follow.
+Return<void> 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<void> RadioResponse::supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->supplyIccPinForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->supplyIccPukForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->supplyIccPin2ForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->supplyIccPuk2ForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->changeIccPinForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) {
+ return mRealRadioResponse->changeIccPin2ForAppResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::supplyNetworkDepersonalizationResponse(
+ const V1_0::RadioResponseInfo& info, int32_t remainingRetries) {
+ return mRealRadioResponse->supplyNetworkDepersonalizationResponse(info, remainingRetries);
+}
+
+Return<void> RadioResponse::getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::Call>& calls) {
+ hidl_vec<V1_2::Call> 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<void> RadioResponse::dialResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->dialResponse(info);
+}
+
+Return<void> RadioResponse::getIMSIForAppResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& imsi) {
+ return mRealRadioResponse->getIMSIForAppResponse(info, imsi);
+}
+
+Return<void> RadioResponse::hangupConnectionResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->hangupConnectionResponse(info);
+}
+
+Return<void> RadioResponse::hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->hangupWaitingOrBackgroundResponse(info);
+}
+
+Return<void> RadioResponse::hangupForegroundResumeBackgroundResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->hangupForegroundResumeBackgroundResponse(info);
+}
+
+Return<void> RadioResponse::switchWaitingOrHoldingAndActiveResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->switchWaitingOrHoldingAndActiveResponse(info);
+}
+
+Return<void> RadioResponse::conferenceResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->conferenceResponse(info);
+}
+
+Return<void> RadioResponse::rejectCallResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->rejectCallResponse(info);
+}
+
+Return<void> RadioResponse::getLastCallFailCauseResponse(
+ const V1_0::RadioResponseInfo& info, const V1_0::LastCallFailCauseInfo& failCauseinfo) {
+ return mRealRadioResponse->getLastCallFailCauseResponse(info, failCauseinfo);
+}
+
+Return<void> 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<void> 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<void> 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<void> 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<void> RadioResponse::setRadioPowerResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setRadioPowerResponse(info);
+}
+
+Return<void> RadioResponse::sendDtmfResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendDtmfResponse(info);
+}
+
+Return<void> RadioResponse::sendSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) {
+ return mRealRadioResponse->sendSmsResponse(info, sms);
+}
+
+Return<void> RadioResponse::sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) {
+ return mRealRadioResponse->sendSMSExpectMoreResponse(info, sms);
+}
+
+Return<void> RadioResponse::setupDataCallResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SetupDataCallResult& dcResponse) {
+ return mRealRadioResponse->setupDataCallResponse_1_4(info, Create1_4SetupDataCallResult(dcResponse));
+}
+
+Return<void> RadioResponse::iccIOForAppResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& iccIo) {
+ return mRealRadioResponse->iccIOForAppResponse(info, iccIo);
+}
+
+Return<void> RadioResponse::sendUssdResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendUssdResponse(info);
+}
+
+Return<void> RadioResponse::cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->cancelPendingUssdResponse(info);
+}
+
+Return<void> RadioResponse::getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n,
+ int32_t m) {
+ return mRealRadioResponse->getClirResponse(info, n, m);
+}
+
+Return<void> RadioResponse::setClirResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setClirResponse(info);
+}
+
+Return<void> RadioResponse::getCallForwardStatusResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CallForwardInfo>& callForwardInfos) {
+ return mRealRadioResponse->getCallForwardStatusResponse(info, callForwardInfos);
+}
+
+Return<void> RadioResponse::setCallForwardResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCallForwardResponse(info);
+}
+
+Return<void> RadioResponse::getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable,
+ int32_t serviceClass) {
+ return mRealRadioResponse->getCallWaitingResponse(info, enable, serviceClass);
+}
+
+Return<void> RadioResponse::setCallWaitingResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCallWaitingResponse(info);
+}
+
+Return<void> RadioResponse::acknowledgeLastIncomingGsmSmsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->acknowledgeLastIncomingGsmSmsResponse(info);
+}
+
+Return<void> RadioResponse::acceptCallResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->acceptCallResponse(info);
+}
+
+Return<void> RadioResponse::deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->deactivateDataCallResponse(info);
+}
+
+Return<void> RadioResponse::getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t response) {
+ return mRealRadioResponse->getFacilityLockForAppResponse(info, response);
+}
+
+Return<void> RadioResponse::setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t retry) {
+ return mRealRadioResponse->setFacilityLockForAppResponse(info, retry);
+}
+
+Return<void> RadioResponse::setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setBarringPasswordResponse(info);
+}
+
+Return<void> RadioResponse::getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
+ bool manual) {
+ return mRealRadioResponse->getNetworkSelectionModeResponse(info, manual);
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeAutomaticResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setNetworkSelectionModeAutomaticResponse(info);
+}
+
+Return<void> RadioResponse::setNetworkSelectionModeManualResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setNetworkSelectionModeManualResponse(info);
+}
+
+Return<void> RadioResponse::getAvailableNetworksResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::OperatorInfo>& networkInfos) {
+ return mRealRadioResponse->getAvailableNetworksResponse(info, networkInfos);
+}
+
+Return<void> RadioResponse::startDtmfResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->startDtmfResponse(info);
+}
+
+Return<void> RadioResponse::stopDtmfResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->stopDtmfResponse(info);
+}
+
+Return<void> RadioResponse::getBasebandVersionResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& version) {
+ return mRealRadioResponse->getBasebandVersionResponse(info, version);
+}
+
+Return<void> RadioResponse::separateConnectionResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->separateConnectionResponse(info);
+}
+
+Return<void> RadioResponse::setMuteResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setMuteResponse(info);
+}
+
+Return<void> RadioResponse::getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) {
+ return mRealRadioResponse->getMuteResponse(info, enable);
+}
+
+Return<void> RadioResponse::getClipResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::ClipStatus status) {
+ return mRealRadioResponse->getClipResponse(info, status);
+}
+
+Return<void> RadioResponse::getDataCallListResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::SetupDataCallResult>& dcResponse) {
+ hidl_vec<V1_4::SetupDataCallResult> 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<void> RadioResponse::setSuppServiceNotificationsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSuppServiceNotificationsResponse(info);
+}
+
+Return<void> RadioResponse::writeSmsToSimResponse(const V1_0::RadioResponseInfo& info,
+ int32_t index) {
+ return mRealRadioResponse->writeSmsToSimResponse(info, index);
+}
+
+Return<void> RadioResponse::deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->deleteSmsOnSimResponse(info);
+}
+
+Return<void> RadioResponse::setBandModeResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setBandModeResponse(info);
+}
+
+Return<void> RadioResponse::getAvailableBandModesResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::RadioBandMode>& bandModes) {
+ return mRealRadioResponse->getAvailableBandModesResponse(info, bandModes);
+}
+
+Return<void> RadioResponse::sendEnvelopeResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& commandResponse) {
+ return mRealRadioResponse->sendEnvelopeResponse(info, commandResponse);
+}
+
+Return<void> RadioResponse::sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendTerminalResponseToSimResponse(info);
+}
+
+Return<void> RadioResponse::handleStkCallSetupRequestFromSimResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->handleStkCallSetupRequestFromSimResponse(info);
+}
+
+Return<void> RadioResponse::explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->explicitCallTransferResponse(info);
+}
+
+Return<void> RadioResponse::setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setPreferredNetworkTypeBitmapResponse(info);
+}
+
+Return<void> RadioResponse::getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::PreferredNetworkType nwType) {
+ hidl_bitfield<V1_4::RadioAccessFamily> 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<void> RadioResponse::getNeighboringCidsResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::NeighboringCell>& cells) {
+ return mRealRadioResponse->getNeighboringCidsResponse(info, cells);
+}
+
+Return<void> RadioResponse::setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setLocationUpdatesResponse(info);
+}
+
+Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCdmaSubscriptionSourceResponse(info);
+}
+
+Return<void> RadioResponse::setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCdmaRoamingPreferenceResponse(info);
+}
+
+Return<void> RadioResponse::getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::CdmaRoamingType type) {
+ return mRealRadioResponse->getCdmaRoamingPreferenceResponse(info, type);
+}
+
+Return<void> RadioResponse::setTTYModeResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setTTYModeResponse(info);
+}
+
+Return<void> RadioResponse::getTTYModeResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::TtyMode mode) {
+ return mRealRadioResponse->getTTYModeResponse(info, mode);
+}
+
+Return<void> RadioResponse::setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setPreferredVoicePrivacyResponse(info);
+}
+
+Return<void> RadioResponse::getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info,
+ bool enable) {
+ return mRealRadioResponse->getPreferredVoicePrivacyResponse(info, enable);
+}
+
+Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendCDMAFeatureCodeResponse(info);
+}
+
+Return<void> RadioResponse::sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendBurstDtmfResponse(info);
+}
+
+Return<void> RadioResponse::sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) {
+ return mRealRadioResponse->sendCdmaSmsResponse(info, sms);
+}
+
+Return<void> RadioResponse::acknowledgeLastIncomingCdmaSmsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->acknowledgeLastIncomingCdmaSmsResponse(info);
+}
+
+Return<void> RadioResponse::getGsmBroadcastConfigResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& configs) {
+ return mRealRadioResponse->getGsmBroadcastConfigResponse(info, configs);
+}
+
+Return<void> RadioResponse::setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setGsmBroadcastConfigResponse(info);
+}
+
+Return<void> RadioResponse::setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setGsmBroadcastActivationResponse(info);
+}
+
+Return<void> RadioResponse::getCdmaBroadcastConfigResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configs) {
+ return mRealRadioResponse->getCdmaBroadcastConfigResponse(info, configs);
+}
+
+Return<void> RadioResponse::setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCdmaBroadcastConfigResponse(info);
+}
+
+Return<void> RadioResponse::setCdmaBroadcastActivationResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCdmaBroadcastActivationResponse(info);
+}
+
+Return<void> 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<void> RadioResponse::writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info,
+ uint32_t index) {
+ return mRealRadioResponse->writeSmsToRuimResponse(info, index);
+}
+
+Return<void> RadioResponse::deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->deleteSmsOnRuimResponse(info);
+}
+
+Return<void> 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<void> RadioResponse::exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->exitEmergencyCallbackModeResponse(info);
+}
+
+Return<void> RadioResponse::getSmscAddressResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& smsc) {
+ return mRealRadioResponse->getSmscAddressResponse(info, smsc);
+}
+
+Return<void> RadioResponse::setSmscAddressResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSmscAddressResponse(info);
+}
+
+Return<void> RadioResponse::reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->reportSmsMemoryStatusResponse(info);
+}
+
+Return<void> RadioResponse::reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->reportStkServiceIsRunningResponse(info);
+}
+
+Return<void> RadioResponse::getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::CdmaSubscriptionSource source) {
+ return mRealRadioResponse->getCdmaSubscriptionSourceResponse(info, source);
+}
+
+Return<void> RadioResponse::requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& response) {
+ return mRealRadioResponse->requestIsimAuthenticationResponse(info, response);
+}
+
+Return<void> RadioResponse::acknowledgeIncomingGsmSmsWithPduResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->acknowledgeIncomingGsmSmsWithPduResponse(info);
+}
+
+Return<void> RadioResponse::sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& iccIo) {
+ return mRealRadioResponse->sendEnvelopeWithStatusResponse(info, iccIo);
+}
+
+Return<void> RadioResponse::getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::RadioTechnology rat) {
+ return mRealRadioResponse->getVoiceRadioTechnologyResponse(info, rat);
+}
+
+Return<void> RadioResponse::getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CellInfo>& cellInfo) {
+ return mRealRadioResponse->getCellInfoListResponse_1_4(info, Create1_4CellInfoList(cellInfo));
+}
+
+Return<void> RadioResponse::setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCellInfoListRateResponse(info);
+}
+
+Return<void> RadioResponse::setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setInitialAttachApnResponse(info);
+}
+
+Return<void> RadioResponse::getImsRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
+ bool isRegistered,
+ V1_0::RadioTechnologyFamily ratFamily) {
+ return mRealRadioResponse->getImsRegistrationStateResponse(info, isRegistered, ratFamily);
+}
+
+Return<void> RadioResponse::sendImsSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) {
+ return mRealRadioResponse->sendImsSmsResponse(info, sms);
+}
+
+Return<void> RadioResponse::iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& result) {
+ return mRealRadioResponse->iccTransmitApduBasicChannelResponse(info, result);
+}
+
+Return<void> RadioResponse::iccOpenLogicalChannelResponse(const V1_0::RadioResponseInfo& info,
+ int32_t channelId,
+ const hidl_vec<int8_t>& selectResponse) {
+ return mRealRadioResponse->iccOpenLogicalChannelResponse(info, channelId, selectResponse);
+}
+
+Return<void> RadioResponse::iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->iccCloseLogicalChannelResponse(info);
+}
+
+Return<void> RadioResponse::iccTransmitApduLogicalChannelResponse(
+ const V1_0::RadioResponseInfo& info, const V1_0::IccIoResult& result) {
+ return mRealRadioResponse->iccTransmitApduLogicalChannelResponse(info, result);
+}
+
+Return<void> RadioResponse::nvReadItemResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& result) {
+ return mRealRadioResponse->nvReadItemResponse(info, result);
+}
+
+Return<void> RadioResponse::nvWriteItemResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->nvWriteItemResponse(info);
+}
+
+Return<void> RadioResponse::nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->nvWriteCdmaPrlResponse(info);
+}
+
+Return<void> RadioResponse::nvResetConfigResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->nvResetConfigResponse(info);
+}
+
+Return<void> RadioResponse::setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setUiccSubscriptionResponse(info);
+}
+
+Return<void> RadioResponse::setDataAllowedResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setDataAllowedResponse(info);
+}
+
+Return<void> RadioResponse::getHardwareConfigResponse(
+ const V1_0::RadioResponseInfo& info, const hidl_vec<V1_0::HardwareConfig>& config) {
+ return mRealRadioResponse->getHardwareConfigResponse(info, config);
+}
+
+Return<void> RadioResponse::requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& result) {
+ return mRealRadioResponse->requestIccSimAuthenticationResponse(info, result);
+}
+
+Return<void> RadioResponse::setDataProfileResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setDataProfileResponse(info);
+}
+
+Return<void> RadioResponse::requestShutdownResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->requestShutdownResponse(info);
+}
+
+Return<void> RadioResponse::getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::RadioCapability& rc) {
+ return mRealRadioResponse->getRadioCapabilityResponse(info, rc);
+}
+
+Return<void> RadioResponse::setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::RadioCapability& rc) {
+ return mRealRadioResponse->setRadioCapabilityResponse(info, rc);
+}
+
+Return<void> RadioResponse::startLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo& statusInfo) {
+ return mRealRadioResponse->startLceServiceResponse(info, statusInfo);
+}
+
+Return<void> RadioResponse::stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo& statusInfo) {
+ return mRealRadioResponse->stopLceServiceResponse(info, statusInfo);
+}
+
+Return<void> RadioResponse::pullLceDataResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceDataInfo& lceInfo) {
+ return mRealRadioResponse->pullLceDataResponse(info, lceInfo);
+}
+
+Return<void> RadioResponse::getModemActivityInfoResponse(
+ const V1_0::RadioResponseInfo& info, const V1_0::ActivityStatsInfo& activityInfo) {
+ return mRealRadioResponse->getModemActivityInfoResponse(info, activityInfo);
+}
+
+Return<void> RadioResponse::setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info,
+ int32_t /* numAllowed */) {
+ return mRealRadioResponse->setAllowedCarriersResponse_1_4(info);
+}
+
+Return<void> 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<void> RadioResponse::sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->sendDeviceStateResponse(info);
+}
+
+Return<void> RadioResponse::setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setIndicationFilterResponse(info);
+}
+
+Return<void> RadioResponse::setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSimCardPowerResponse_1_1(info);
+}
+
+Return<void> RadioResponse::acknowledgeRequest(int32_t serial) {
+ return mRealRadioResponse->acknowledgeRequest(serial);
+}
+
+// Methods from ::android::hardware::radio::V1_1::IRadioResponse follow.
+Return<void> RadioResponse::setCarrierInfoForImsiEncryptionResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setCarrierInfoForImsiEncryptionResponse(info);
+}
+
+Return<void> RadioResponse::setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSimCardPowerResponse_1_1(info);
+}
+
+Return<void> RadioResponse::startNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->startNetworkScanResponse_1_4(info);
+}
+
+
+Return<void> RadioResponse::stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->stopNetworkScanResponse(info);
+}
+
+Return<void> RadioResponse::startKeepaliveResponse(const V1_0::RadioResponseInfo& info,
+ const V1_1::KeepaliveStatus& status) {
+ return mRealRadioResponse->startKeepaliveResponse(info, status);
+}
+
+Return<void> RadioResponse::stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->stopKeepaliveResponse(info);
+}
+
+// Methods from ::android::hardware::radio::V1_2::IRadioResponse follow.
+Return<void> RadioResponse::getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_2::CellInfo>& cellInfo) {
+ return mRealRadioResponse->getCellInfoListResponse_1_4(info, Create1_4CellInfoList(cellInfo));
+}
+
+Return<void> RadioResponse::getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const V1_2::CardStatus& cardStatus) {
+ return mRealRadioResponse->getIccCardStatusResponse_1_4(info, {cardStatus, hidl_string("")});
+}
+
+Return<void> RadioResponse::setSignalStrengthReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSignalStrengthReportingCriteriaResponse(info);
+}
+
+Return<void> RadioResponse::setLinkCapacityReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setLinkCapacityReportingCriteriaResponse(info);
+}
+
+Return<void> RadioResponse::getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_2::Call>& calls) {
+ return mRealRadioResponse->getCurrentCallsResponse_1_2(info, calls);
+}
+
+Return<void> RadioResponse::getSignalStrengthResponse_1_2(
+ const V1_0::RadioResponseInfo& info, const V1_2::SignalStrength& signalStrength) {
+ return mRealRadioResponse->getSignalStrengthResponse_1_4(info, Create1_4SignalStrength(signalStrength));
+}
+
+Return<void> RadioResponse::getVoiceRegistrationStateResponse_1_2(
+ const V1_0::RadioResponseInfo& info, const V1_2::VoiceRegStateResult& voiceRegResponse) {
+ return mRealRadioResponse->getVoiceRegistrationStateResponse_1_2(info, voiceRegResponse);
+}
+
+Return<void> 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<void> RadioResponse::setSystemSelectionChannelsResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setSystemSelectionChannelsResponse(info);
+}
+
+Return<void> RadioResponse::enableModemResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->enableModemResponse(info);
+}
+
+Return<void> RadioResponse::getModemStackStatusResponse(const V1_0::RadioResponseInfo& info,
+ bool isEnabled) {
+ return mRealRadioResponse->getModemStackStatusResponse(info, isEnabled);
+}
+
+// Methods from ::android::hardware::radio::V1_4::IRadioResponse follow.
+Return<void> RadioResponse::emergencyDialResponse(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->emergencyDialResponse(info);
+}
+
+Return<void> RadioResponse::startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->startNetworkScanResponse_1_4(info);
+}
+
+Return<void> RadioResponse::getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_4::CellInfo>& cellInfo) {
+ return mRealRadioResponse->getCellInfoListResponse_1_4(info, cellInfo);
+}
+
+Return<void> RadioResponse::getDataRegistrationStateResponse_1_4(
+ const V1_0::RadioResponseInfo& info, const V1_4::DataRegStateResult& dataRegResponse) {
+ return mRealRadioResponse->getDataRegistrationStateResponse_1_4(info, dataRegResponse);
+}
+
+Return<void> RadioResponse::getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const V1_4::CardStatus& cardStatus) {
+ return mRealRadioResponse->getIccCardStatusResponse_1_4(info, cardStatus);
+}
+
+Return<void> RadioResponse::getPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info, hidl_bitfield<V1_4::RadioAccessFamily> networkTypeBitmap) {
+ return mRealRadioResponse->getPreferredNetworkTypeBitmapResponse(info, networkTypeBitmap);
+}
+
+Return<void> RadioResponse::setPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setPreferredNetworkTypeBitmapResponse(info);
+}
+
+Return<void> RadioResponse::getDataCallListResponse_1_4(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_4::SetupDataCallResult>& dcResponse) {
+ return mRealRadioResponse->getDataCallListResponse_1_4(info, dcResponse);
+}
+
+Return<void> RadioResponse::setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const V1_4::SetupDataCallResult& dcResponse) {
+ return mRealRadioResponse->setupDataCallResponse_1_4(info, dcResponse);
+}
+
+Return<void> RadioResponse::setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) {
+ return mRealRadioResponse->setAllowedCarriersResponse_1_4(info);
+}
+
+Return<void> 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<void> 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 <android/hardware/radio/1.4/IRadioResponse.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.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 RadioResponse : public V1_4::IRadioResponse {
+ sp<V1_4::IRadioResponse> mRealRadioResponse;
+ V1_0::RadioTechnology mRat = V1_0::RadioTechnology::UNKNOWN;
+ bool mDataRoaming = false;
+ // Methods from ::android::hardware::radio::V1_0::IRadioResponse follow.
+ Return<void> getIccCardStatusResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::CardStatus& cardStatus) override;
+ Return<void> supplyIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> supplyIccPukForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> supplyIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> supplyIccPuk2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> changeIccPinForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> changeIccPin2ForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> supplyNetworkDepersonalizationResponse(const V1_0::RadioResponseInfo& info,
+ int32_t remainingRetries) override;
+ Return<void> getCurrentCallsResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::Call>& calls) override;
+ Return<void> dialResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getIMSIForAppResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& imsi) override;
+ Return<void> hangupConnectionResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> hangupWaitingOrBackgroundResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> hangupForegroundResumeBackgroundResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> switchWaitingOrHoldingAndActiveResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> conferenceResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> rejectCallResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getLastCallFailCauseResponse(
+ const V1_0::RadioResponseInfo& info,
+ const V1_0::LastCallFailCauseInfo& failCauseinfo) override;
+ Return<void> getSignalStrengthResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SignalStrength& sigStrength) override;
+ Return<void> getVoiceRegistrationStateResponse(
+ const V1_0::RadioResponseInfo& info,
+ const V1_0::VoiceRegStateResult& voiceRegResponse) override;
+ Return<void> getDataRegistrationStateResponse(
+ const V1_0::RadioResponseInfo& info,
+ const V1_0::DataRegStateResult& dataRegResponse) override;
+ Return<void> getOperatorResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& longName, const hidl_string& shortName,
+ const hidl_string& numeric) override;
+ Return<void> setRadioPowerResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> sendDtmfResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> sendSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) override;
+ Return<void> sendSMSExpectMoreResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) override;
+ Return<void> setupDataCallResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SetupDataCallResult& dcResponse) override;
+ Return<void> iccIOForAppResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& iccIo) override;
+ Return<void> sendUssdResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> cancelPendingUssdResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getClirResponse(const V1_0::RadioResponseInfo& info, int32_t n,
+ int32_t m) override;
+ Return<void> setClirResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCallForwardStatusResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CallForwardInfo>& callForwardInfos) override;
+ Return<void> setCallForwardResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCallWaitingResponse(const V1_0::RadioResponseInfo& info, bool enable,
+ int32_t serviceClass) override;
+ Return<void> setCallWaitingResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> acknowledgeLastIncomingGsmSmsResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> acceptCallResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> deactivateDataCallResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t response) override;
+ Return<void> setFacilityLockForAppResponse(const V1_0::RadioResponseInfo& info,
+ int32_t retry) override;
+ Return<void> setBarringPasswordResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getNetworkSelectionModeResponse(const V1_0::RadioResponseInfo& info,
+ bool manual) override;
+ Return<void> setNetworkSelectionModeAutomaticResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> setNetworkSelectionModeManualResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> getAvailableNetworksResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::OperatorInfo>& networkInfos) override;
+ Return<void> startDtmfResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> stopDtmfResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getBasebandVersionResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& version) override;
+ Return<void> separateConnectionResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setMuteResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getMuteResponse(const V1_0::RadioResponseInfo& info, bool enable) override;
+ Return<void> getClipResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::ClipStatus status) override;
+ Return<void> getDataCallListResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::SetupDataCallResult>& dcResponse) override;
+ Return<void> setSuppServiceNotificationsResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> writeSmsToSimResponse(const V1_0::RadioResponseInfo& info, int32_t index) override;
+ Return<void> deleteSmsOnSimResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setBandModeResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getAvailableBandModesResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::RadioBandMode>& bandModes) override;
+ Return<void> sendEnvelopeResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& commandResponse) override;
+ Return<void> sendTerminalResponseToSimResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> handleStkCallSetupRequestFromSimResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> explicitCallTransferResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getPreferredNetworkTypeResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::PreferredNetworkType nwType) override;
+ Return<void> getNeighboringCidsResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::NeighboringCell>& cells) override;
+ Return<void> setLocationUpdatesResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCdmaRoamingPreferenceResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::CdmaRoamingType type) override;
+ Return<void> setTTYModeResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getTTYModeResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::TtyMode mode) override;
+ Return<void> setPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getPreferredVoicePrivacyResponse(const V1_0::RadioResponseInfo& info,
+ bool enable) override;
+ Return<void> sendCDMAFeatureCodeResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> sendBurstDtmfResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> sendCdmaSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) override;
+ Return<void> acknowledgeLastIncomingCdmaSmsResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> getGsmBroadcastConfigResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::GsmBroadcastSmsConfigInfo>& configs) override;
+ Return<void> setGsmBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setGsmBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCdmaBroadcastConfigResponse(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CdmaBroadcastSmsConfigInfo>& configs) override;
+ Return<void> setCdmaBroadcastConfigResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setCdmaBroadcastActivationResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> 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<void> writeSmsToRuimResponse(const V1_0::RadioResponseInfo& info,
+ uint32_t index) override;
+ Return<void> deleteSmsOnRuimResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getDeviceIdentityResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& imei, const hidl_string& imeisv,
+ const hidl_string& esn,
+ const hidl_string& meid) override;
+ Return<void> exitEmergencyCallbackModeResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getSmscAddressResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& smsc) override;
+ Return<void> setSmscAddressResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> reportSmsMemoryStatusResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> reportStkServiceIsRunningResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCdmaSubscriptionSourceResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::CdmaSubscriptionSource source) override;
+ Return<void> requestIsimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& response) override;
+ Return<void> acknowledgeIncomingGsmSmsWithPduResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> sendEnvelopeWithStatusResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& iccIo) override;
+ Return<void> getVoiceRadioTechnologyResponse(const V1_0::RadioResponseInfo& info,
+ V1_0::RadioTechnology rat) override;
+ Return<void> getCellInfoListResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::CellInfo>& cellInfo) override;
+ Return<void> setCellInfoListRateResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setInitialAttachApnResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getImsRegistrationStateResponse(const V1_0::RadioResponseInfo& info,
+ bool isRegistered,
+ V1_0::RadioTechnologyFamily ratFamily) override;
+ Return<void> sendImsSmsResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::SendSmsResult& sms) override;
+ Return<void> iccTransmitApduBasicChannelResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& result) override;
+ Return<void> iccOpenLogicalChannelResponse(const V1_0::RadioResponseInfo& info,
+ int32_t channelId,
+ const hidl_vec<int8_t>& selectResponse) override;
+ Return<void> iccCloseLogicalChannelResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> iccTransmitApduLogicalChannelResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& result) override;
+ Return<void> nvReadItemResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_string& result) override;
+ Return<void> nvWriteItemResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> nvWriteCdmaPrlResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> nvResetConfigResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setUiccSubscriptionResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setDataAllowedResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getHardwareConfigResponse(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_0::HardwareConfig>& config) override;
+ Return<void> requestIccSimAuthenticationResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::IccIoResult& result) override;
+ Return<void> setDataProfileResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> requestShutdownResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::RadioCapability& rc) override;
+ Return<void> setRadioCapabilityResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::RadioCapability& rc) override;
+ Return<void> startLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo& statusInfo) override;
+ Return<void> stopLceServiceResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceStatusInfo& statusInfo) override;
+ Return<void> pullLceDataResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::LceDataInfo& lceInfo) override;
+ Return<void> getModemActivityInfoResponse(const V1_0::RadioResponseInfo& info,
+ const V1_0::ActivityStatsInfo& activityInfo) override;
+ Return<void> setAllowedCarriersResponse(const V1_0::RadioResponseInfo& info,
+ int32_t numAllowed) override;
+ Return<void> getAllowedCarriersResponse(const V1_0::RadioResponseInfo& info, bool allAllowed,
+ const V1_0::CarrierRestrictions& carriers) override;
+ Return<void> sendDeviceStateResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setIndicationFilterResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> setSimCardPowerResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> acknowledgeRequest(int32_t serial) override;
+
+ // Methods from ::android::hardware::radio::V1_1::IRadioResponse follow.
+ Return<void> setCarrierInfoForImsiEncryptionResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> setSimCardPowerResponse_1_1(const V1_0::RadioResponseInfo& info) override;
+ Return<void> startNetworkScanResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> stopNetworkScanResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> startKeepaliveResponse(const V1_0::RadioResponseInfo& info,
+ const V1_1::KeepaliveStatus& status) override;
+ Return<void> stopKeepaliveResponse(const V1_0::RadioResponseInfo& info) override;
+
+ // Methods from ::android::hardware::radio::V1_2::IRadioResponse follow.
+ Return<void> getCellInfoListResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_2::CellInfo>& cellInfo) override;
+ Return<void> getIccCardStatusResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const V1_2::CardStatus& cardStatus) override;
+ Return<void> setSignalStrengthReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> setLinkCapacityReportingCriteriaResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCurrentCallsResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_2::Call>& calls) override;
+ Return<void> getSignalStrengthResponse_1_2(const V1_0::RadioResponseInfo& info,
+ const V1_2::SignalStrength& signalStrength) override;
+ Return<void> getVoiceRegistrationStateResponse_1_2(
+ const V1_0::RadioResponseInfo& info,
+ const V1_2::VoiceRegStateResult& voiceRegResponse) override;
+ Return<void> getDataRegistrationStateResponse_1_2(
+ const V1_0::RadioResponseInfo& info,
+ const V1_2::DataRegStateResult& dataRegResponse) override;
+
+ // Methods from ::android::hardware::radio::V1_3::IRadioResponse follow.
+ Return<void> setSystemSelectionChannelsResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> enableModemResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getModemStackStatusResponse(const V1_0::RadioResponseInfo& info,
+ bool isEnabled) override;
+
+ // Methods from ::android::hardware::radio::V1_4::IRadioResponse follow.
+ Return<void> emergencyDialResponse(const V1_0::RadioResponseInfo& info) override;
+ Return<void> startNetworkScanResponse_1_4(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getCellInfoListResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_4::CellInfo>& cellInfo) override;
+ Return<void> getDataRegistrationStateResponse_1_4(
+ const V1_0::RadioResponseInfo& info,
+ const V1_4::DataRegStateResult& dataRegResponse) override;
+ Return<void> getIccCardStatusResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const V1_4::CardStatus& cardStatus) override;
+ Return<void> getPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info,
+ hidl_bitfield<V1_0::RadioAccessFamily> networkTypeBitmap) override;
+ Return<void> setPreferredNetworkTypeBitmapResponse(
+ const V1_0::RadioResponseInfo& info) override;
+ Return<void> getDataCallListResponse_1_4(
+ const V1_0::RadioResponseInfo& info,
+ const hidl_vec<V1_4::SetupDataCallResult>& dcResponse) override;
+ Return<void> setupDataCallResponse_1_4(const V1_0::RadioResponseInfo& info,
+ const V1_4::SetupDataCallResult& dcResponse) override;
+ Return<void> setAllowedCarriersResponse_1_4(const V1_0::RadioResponseInfo& info) override;
+ Return<void> getAllowedCarriersResponse_1_4(
+ const V1_0::RadioResponseInfo& info,
+ const V1_4::CarrierRestrictionsWithPriority& carriers,
+ V1_4::SimLockMultiSimPolicy multiSimPolicy) override;
+ Return<void> 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 <android-base/logging.h>
+#include <android/hidl/manager/1.2/IServiceManager.h>
+
+namespace android::hardware::hidl_utils {
+
+class HalDeathRecipient : public hidl_death_recipient {
+ void serviceDied(uint64_t /* cookie */, const wp<hidl::base::V1_0::IBase>& /* who */) override {
+ LOG(FATAL) << "One of the linked HALs died. Restarting...";
+ }
+};
+
+static const auto gHalDeathRecipient = sp<HalDeathRecipient>::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<hidl_string> listManifestByInterface(const char* descriptor) {
+ auto manager = hidl::manager::V1_2::IServiceManager::getService();
+ hidl_vec<hidl_string> 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 <android/hidl/base/1.0/IBase.h>
+
+#include <functional>
+
+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<ISomeInterface> iface;
+ * hidlObject->someMethod(arg1, arg2, hidl_utils::fill(&result, &iface)).assertOk();
+ * // use result and iface
+ */
+template <typename... T>
+struct fill : public std::function<void(const T&...)> {
+ /**
+ * 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<T*...> mTargets;
+
+ template <int Pos, typename First>
+ inline void copy(const First& first) {
+ *std::get<Pos>(mTargets) = first;
+ }
+
+ template <int Pos, typename First, typename... Rest>
+ inline void copy(const First& first, const Rest&... rest) {
+ *std::get<Pos>(mTargets) = first;
+ copy<Pos + 1, Rest...>(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<hidl::base::V1_0::IBase> hal);
+
+/**
+ * List HAL instances of a given interface.
+ *
+ * \descriptor HIDL HAL descriptor
+ */
+hidl_vec<hidl_string> 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 <android-base/logging.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include "Radio.h"
+#include "hidl-utils.h"
+
+#include <map>
+
+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<int, sp<V1_4::IRadio>> slotIdToRadio;
+
+ for (int slotId = 1; slotId <= MAX_SLOT_ID; slotId++) {
+ sp<V1_0::IRadio> 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;
+}