From: Tim Zimmermann Date: Mon, 11 Mar 2024 19:28:24 +0000 (+0100) Subject: samsung: Introduce sehradiomanager X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d6f5799cefc4d20a79e6105f85feb57b7c02975e;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git samsung: Introduce sehradiomanager * Allows us to finally have signal bar, LTE+ and 5G working with RIL stacks from stock Android S and up * Based on https://github.com/TrebleDroid/platform_frameworks_opt_telephony/commit/f0eecb08e457501b01672aeacf245c408e7eef05 Co-Authored-by: Pierre-Hugues Husson Change-Id: Iebc83397101fc5c2d0ca04b2c2ae961dee6e6910 --- diff --git a/interfaces/radio/2.0/Android.bp b/interfaces/radio/2.0/Android.bp new file mode 100644 index 0000000..b68f30d --- /dev/null +++ b/interfaces/radio/2.0/Android.bp @@ -0,0 +1,22 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "vendor.samsung.hardware.radio@2.0", + root: "vendor.samsung.hardware", + system_ext_specific: true, + srcs: [ + "types.hal", + "ISehRadio.hal", + "ISehRadioIndication.hal", + "ISehRadioResponse.hal", + ], + interfaces: [ + "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", + "android.hardware.radio@1.4", + "android.hidl.base@1.0", + "android.hidl.safe_union@1.0", + ], + gen_java: true, +} diff --git a/interfaces/radio/2.0/ISehRadio.hal b/interfaces/radio/2.0/ISehRadio.hal new file mode 100644 index 0000000..dad9699 --- /dev/null +++ b/interfaces/radio/2.0/ISehRadio.hal @@ -0,0 +1,89 @@ +package vendor.samsung.hardware.radio@2.0; + +import ISehRadioIndication; +import ISehRadioResponse; + +interface ISehRadio { + oneway setResponseFunction(ISehRadioResponse radioResponse, + ISehRadioIndication radioIndication); + + oneway getIccCardStatus(int32_t serial); + + supplyNetworkDepersonalization(); + + dial(); + + getCurrentCalls(); + + getImsRegistrationState(); + + getAvailableNetworks(); + + setImsCallList(); + + getPreferredNetworkList(); + + setPreferredNetworkList(); + + sendEncodedUssd(); + + getDisable2g(); + + setDisable2g(); + + getCnap(); + + getPhonebookStorageInfo(); + + getUsimPhonebookCapability(); + + setSimOnOff(); + + setSimInitEvent(); + + getSimLockInfo(); + + supplyIccPersonalization(); + + changeIccPersonalization(); + + sendCdmaSmsExpectMore(); + + getPhonebookEntry(); + + accessPhonebookEntry(); + + getCellBroadcastConfig(); + + emergencySearch(); + + emergencyControl(); + + getAtr(); + + sendSms(); + + sendSMSExpectMore(); + + sendCdmaSms(); + + sendImsSms(); + + getStoredMsgCountFromSim(); + + readSmsFromSim(); + + writeSmsToSim(); + + getCsgList(); + + selectCsgManual(); + + setDataAllowed(); + + setMobileDataSetting(); + + oneway sendRequestRaw(int32_t serial, vec data); + + sendRequestStrings(); +}; diff --git a/interfaces/radio/2.0/ISehRadioIndication.hal b/interfaces/radio/2.0/ISehRadioIndication.hal new file mode 100644 index 0000000..6e51ce0 --- /dev/null +++ b/interfaces/radio/2.0/ISehRadioIndication.hal @@ -0,0 +1,64 @@ +package vendor.samsung.hardware.radio@2.0; + +interface ISehRadioIndication { + oneway acbInfoChanged(int32_t type, vec acbInfo); + + oneway csFallback(int32_t type, int32_t state); + + oneway imsPreferenceChanged(int32_t type, vec imsPref); + + oneway voiceRadioBearerHandoverStatusChanged(int32_t type, int32_t state); + + oneway timerStatusChangedInd(int32_t type, vec eventNoti); + + oneway modemCapabilityIndication(int32_t type, vec data); + + oneway needTurnOnRadioIndication(int32_t type); + + oneway simPhonebookReadyIndication(int32_t type); + + oneway phonebookInitCompleteIndication(int32_t type); + + oneway deviceReadyNoti(int32_t type); + + oneway stkSmsSendResultIndication(int32_t type, int32_t result); + + oneway stkCallControlResultIndication(int32_t type, string cmd); + + oneway simSwapStateChangedIndication(int32_t type, int32_t state); + + oneway simCountMismatchedIndication(int32_t type, int32_t state); + + oneway simOnOffStateChangedNotify(int32_t type, int32_t mode); + + oneway releaseCompleteMessageIndication(int32_t type, SehSsReleaseComplete result); + + oneway sapNotify(int32_t type, vec data); + + oneway nrBearerAllocationChanged(int32_t type, int32_t status); + + oneway nrNetworkTypeAdded(int32_t type, int32_t status); + + oneway rrcStateChanged(int32_t type, SehRrcStateInfo state); + + oneway configModemCapabilityChangeNoti(int32_t type, + SehConfigModemCapability configModemCapa); + + /* + * needApnProfileIndication(string select) generates (SehApnProfile apnProf); + */ + needApnProfileIndication(string select); + + needSettingValueIndication(string key, string table) generates (int32_t xx); + + oneway execute(int32_t type, string cmd); + + /* + * Really not oneway + */ + signalLevelInfoChanged(int32_t type, SehSignalBar signalBarInfo); + + extendedRegistrationState(int32_t type, SehExtendedRegStateResult state); + + needPacketUsage(string iface) generates (int32_t error, SehPacketUsage usage); +}; diff --git a/interfaces/radio/2.0/ISehRadioResponse.hal b/interfaces/radio/2.0/ISehRadioResponse.hal new file mode 100644 index 0000000..41f3be7 --- /dev/null +++ b/interfaces/radio/2.0/ISehRadioResponse.hal @@ -0,0 +1,135 @@ +package vendor.samsung.hardware.radio@2.0; + +import android.hardware.radio@1.0::RadioResponseInfo; + +interface ISehRadioResponse { + /* + * getIccCardStatusResponse(RadioResponseInfo info, SehCardStatus cardStatus); + */ + oneway getIccCardStatusResponse(); + + /* + * (RadioResponseInfo info, int32_t remainingRetries); + */ + oneway supplyNetworkDepersonalizationResponse(RadioResponseInfo info); + + oneway dialResponse(RadioResponseInfo info); + + /* + * (RadioResponseInfo info, vec calls); + */ + oneway getCurrentCallsResponse(); + + /* + * (RadioResponseInfo info, vec networkInfos) + */ + oneway getImsRegistrationStateResponse(); + + oneway setImsCallListResponse(RadioResponseInfo info); + + /* + * RadioResponseInfo, vec infos + */ + oneway getPreferredNetworkListResponse(); + + oneway setPreferredNetworkListResponse(RadioResponseInfo info); + + oneway sendEncodedUssdResponse(RadioResponseInfo info); + + oneway getDisable2gResponse(RadioResponseInfo info, int32_t isDisable); + + oneway setDisable2gResponse(RadioResponseInfo info); + + oneway getCnapResponse(RadioResponseInfo info, int32_t m); + + /* + * RadioResponseInfo, SehPhonebookInfo + */ + oneway getPhonebookStorageInfoResponse(); + + oneway getUsimPhonebookCapabilityResponse(RadioResponseInfo info, + vec phonebookCapability); + + oneway setSimOnOffResponse(RadioResponseInfo info); + + oneway setSimInitEventResponse(RadioResponseInfo info); + + /* + * RadioResponseInfo info, SehSimLockInfo simLockInfo + */ + oneway getSimLockInfoResponse(); + + oneway supplyIccPersonalizationResponse(RadioResponseInfo info); + + oneway changeIccPersonalizationResponse(RadioResponseInfo info); + + /* + * RadioResponseInfo, SehSimPhonebookResponse + */ + oneway getPhonebookEntryResponse(); + + oneway accessPhonebookEntryResponse(RadioResponseInfo info, int32_t SimPhonmebookAccessResp); + + /* + * RadioResponseInfo, SehCbConfigArgs + */ + oneway getCellBroadcastConfigResponse(); + + oneway emergencySearchResponse(RadioResponseInfo info, int32_t respEmergencySearch); + + oneway emergencyControlResponse(RadioResponseInfo info); + + oneway getAtrResponse(RadioResponseInfo info, string atr); + + /* + * RadioResponseInfo, SehSendSmsResult + */ + oneway sendCdmaSmsExpectMoreResponse(); + + /* + * RadioResponseInfo, SehSendSmsResult + */ + oneway sendSmsResponse(); + + /* + * RadioResponseInfo, SehSendSmsResult + */ + oneway sendSMSExpectMoreResponse(); + + /* + * RadioResponseInfo, SehSendSmsResult + */ + oneway sendCdmaSmsResponse(); + + /* + * RadioResponseInfo, SehSendSmsResult + */ + oneway sendImsSmsResponse(); + + /* + * RadioResponseInfo, SehStoredMsgCount + */ + oneway getStoredMsgCountFromSimResponse(); + + /* + * RadioResponseInfo, SehSimMsgArgs + */ + oneway readSmsFromSimResponse(); + + oneway writeSmsToSimResponse(RadioResponseInfo info, int32_t index); + + oneway setDataAllowedResponse(RadioResponseInfo info); + + /* + * RadioResponseInfo, vec + */ + oneway getCsgListResponse(); + + oneway selectCsgManualResponse(RadioResponseInfo info); + + oneway setMobileDataSettingResponse(RadioResponseInfo info); + + oneway sendRequestRawResponse(RadioResponseInfo info, vec data); + + oneway sendRequestStringsResponse(RadioResponseInfo info, vec data); +}; diff --git a/interfaces/radio/2.0/types.hal b/interfaces/radio/2.0/types.hal new file mode 100644 index 0000000..9c44cd1 --- /dev/null +++ b/interfaces/radio/2.0/types.hal @@ -0,0 +1,125 @@ +package vendor.samsung.hardware.radio@2.0; + +import android.hardware.radio@1.4::RadioTechnology; +import android.hardware.radio@1.0::RegState; +import android.hardware.radio@1.0::AppStatus; +import android.hardware.radio@1.0::PinState; +import android.hardware.radio@1.0::CardState; + +enum SehCallType : uint32_t { + VOCIE = 0, + VS_TX = 1, + VS_RX = 2, + VT = 3, +}; + +struct SehCallDetails { + SehCallType callType; + + vec extras; +}; + +struct SehSsReleaseComplete { + uint32_t size; + + uint32_t dataLen; + + uint32_t params; + + uint32_t status; + + string data; +}; + +struct SehRrcStateInfo { + RadioTechnology rat; + + uint32_t state; +}; + +struct SehConfigModemCapability { + uint32_t supportCltcp; +}; + +enum SehSignalLevel : uint32_t { + NONE = 0, + POOR = 1, + MODERATE = 2, + GOOD = 3, + GREAT = 4, + EXCELLENT = 5, +}; + +struct SehSignalBar { + SehSignalLevel cdmaLevel; + + SehSignalLevel evdoLevel; + + SehSignalLevel gsmLevel; + + SehSignalLevel wcdmaLevel; + + SehSignalLevel tdscdmaLevel; + + SehSignalLevel lteLevel; + + SehSignalLevel nrLevel; +}; + +struct SehExtendedRegStateResult { + bool isValid; + + uint32_t snapshotStatus; + + RegState unprocessedDataRegState; + + uint32_t unprocessedDataRat; + + uint32_t mobileOptionalRat; + + uint32_t imsEmergencyCallBarring; + + RegState unprocessedVoiceRegState; + + bool isPsOnlyReg; +}; + +struct SehPacketUsage { + uint32_t rxBytes; + + uint32_t txBytes; +}; + +struct SehAppStatus { + AppStatus base; + + uint32_t pin1NumRetries; + + uint32_t puk1NumRetries; + + uint32_t pin2NumRetries; + + uint32_t puk2NumRetries; + + uint32_t persoUnblockRetries; +}; + +struct SehCardStatus { + CardState cardState; + + PinState universalPinState; + + uint32_t gsmUmtsSubscriptionAppIndex; + + uint32_t cdmaSubscriptionAppIndex; + + uint32_t imsSubscriptionAppIndex; + + vec applications; + + uint32_t physicalSlotId; + + string atr; + + string iccid; +}; diff --git a/interfaces/radio/2.1/Android.bp b/interfaces/radio/2.1/Android.bp new file mode 100644 index 0000000..86a8787 --- /dev/null +++ b/interfaces/radio/2.1/Android.bp @@ -0,0 +1,23 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "vendor.samsung.hardware.radio@2.1", + root: "vendor.samsung.hardware", + system_ext_specific: true, + srcs: [ + "types.hal", + "ISehRadio.hal", + "ISehRadioIndication.hal", + "ISehRadioResponse.hal", + ], + interfaces: [ + "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", + "android.hardware.radio@1.4", + "android.hidl.base@1.0", + "android.hidl.safe_union@1.0", + "vendor.samsung.hardware.radio@2.0", + ], + gen_java: true, +} diff --git a/interfaces/radio/2.1/ISehRadio.hal b/interfaces/radio/2.1/ISehRadio.hal new file mode 100644 index 0000000..95df8b3 --- /dev/null +++ b/interfaces/radio/2.1/ISehRadio.hal @@ -0,0 +1,12 @@ +package vendor.samsung.hardware.radio@2.1; + +import @2.0::ISehRadio; +import android.hardware.radio@1.0::RadioResponseInfo; + +interface ISehRadio extends @2.0::ISehRadio { + oneway setNrMode(int32_t serial, int32_t mode); + + oneway getNrMode(int32_t serial); + + oneway getNrIconType(int32_t serial); +}; diff --git a/interfaces/radio/2.1/ISehRadioIndication.hal b/interfaces/radio/2.1/ISehRadioIndication.hal new file mode 100644 index 0000000..f7296ff --- /dev/null +++ b/interfaces/radio/2.1/ISehRadioIndication.hal @@ -0,0 +1,8 @@ +package vendor.samsung.hardware.radio@2.1; + +import @2.0::ISehRadioIndication; +import android.hardware.radio@1.0::RadioResponseInfo; + +interface ISehRadioIndication extends @2.0::ISehRadioIndication { + oneway nrIconTypeChanged(uint32_t type, uint32_t nrIconType); +}; diff --git a/interfaces/radio/2.1/ISehRadioResponse.hal b/interfaces/radio/2.1/ISehRadioResponse.hal new file mode 100644 index 0000000..7ab9cca --- /dev/null +++ b/interfaces/radio/2.1/ISehRadioResponse.hal @@ -0,0 +1,14 @@ +package vendor.samsung.hardware.radio@2.1; + +import @2.0::ISehRadioResponse; +import android.hardware.radio@1.0::RadioResponseInfo; + +interface ISehRadioResponse extends @2.0::ISehRadioResponse { + oneway setNrModeResponse(RadioResponseInfo info); + + oneway getNrModeResponse(RadioResponseInfo info, uint32_t nrMode); + + oneway getNrIconResponse(RadioResponseInfo info, uint32_t nrIconType); + + oneway getIccCardStatusResponse_2_1(RadioResponseInfo info, SehCardStatus cardStatus); +}; diff --git a/interfaces/radio/2.1/types.hal b/interfaces/radio/2.1/types.hal new file mode 100644 index 0000000..03d410d --- /dev/null +++ b/interfaces/radio/2.1/types.hal @@ -0,0 +1,9 @@ +package vendor.samsung.hardware.radio@2.1; + +import @2.0::types; + +struct SehCardStatus { + vendor.samsung.hardware.radio@2.0::SehCardStatus base; + + string eid; +}; diff --git a/interfaces/radio/2.2/Android.bp b/interfaces/radio/2.2/Android.bp new file mode 100644 index 0000000..40cd58b --- /dev/null +++ b/interfaces/radio/2.2/Android.bp @@ -0,0 +1,24 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "vendor.samsung.hardware.radio@2.2", + root: "vendor.samsung.hardware", + system_ext_specific: true, + srcs: [ + "types.hal", + "ISehRadio.hal", + "ISehRadioIndication.hal", + "ISehRadioResponse.hal", + ], + interfaces: [ + "android.hardware.radio@1.0", + "android.hardware.radio@1.1", + "android.hardware.radio@1.2", + "android.hardware.radio@1.4", + "android.hidl.base@1.0", + "android.hidl.safe_union@1.0", + "vendor.samsung.hardware.radio@2.0", + "vendor.samsung.hardware.radio@2.1", + ], + gen_java: true, +} diff --git a/interfaces/radio/2.2/ISehRadio.hal b/interfaces/radio/2.2/ISehRadio.hal new file mode 100644 index 0000000..e65eab9 --- /dev/null +++ b/interfaces/radio/2.2/ISehRadio.hal @@ -0,0 +1,13 @@ +package vendor.samsung.hardware.radio@2.2; + +import @2.1::ISehRadio; +import android.hardware.radio@1.0::RadioResponseInfo; + +interface ISehRadio extends @2.1::ISehRadio { + oneway setNrMode_2_2(int32_t serial, int32_t mode, bool force); + + oneway getVendorSpecificConfiguration(int32_t serial); + + oneway setVendorSpecificConfiguration(int32_t serial, + vec configurations); +}; diff --git a/interfaces/radio/2.2/ISehRadioIndication.hal b/interfaces/radio/2.2/ISehRadioIndication.hal new file mode 100644 index 0000000..16021c6 --- /dev/null +++ b/interfaces/radio/2.2/ISehRadioIndication.hal @@ -0,0 +1,13 @@ +package vendor.samsung.hardware.radio@2.2; + +import @2.1::ISehRadioIndication; +import android.hardware.radio@1.0::RadioResponseInfo; +import @2.0::types; + +interface ISehRadioIndication extends @2.1::ISehRadioIndication { + oneway callDetailsChanged(uint32_t type, vec callDetails); + + oneway vendorConfigurationChanged(uint32_t type, vec configurations); + + oneway eriInfoReceived(uint32_t type, SehEriInfo eriInfo); +}; diff --git a/interfaces/radio/2.2/ISehRadioResponse.hal b/interfaces/radio/2.2/ISehRadioResponse.hal new file mode 100644 index 0000000..07d6159 --- /dev/null +++ b/interfaces/radio/2.2/ISehRadioResponse.hal @@ -0,0 +1,14 @@ +package vendor.samsung.hardware.radio@2.2; + +import @2.1::ISehRadioResponse; +import android.hardware.radio@1.0::RadioResponseInfo; +import @2.0::types; + +interface ISehRadioResponse extends @2.1::ISehRadioResponse { + oneway setNrModeResponse_2_2(RadioResponseInfo info); + + oneway getVendorSpecificConfigurationResponse(RadioResponseInfo info, + vec configurations); + + oneway setVendorSpecificConfigurationResponse(RadioResponseInfo info); +}; diff --git a/interfaces/radio/2.2/types.hal b/interfaces/radio/2.2/types.hal new file mode 100644 index 0000000..06c3519 --- /dev/null +++ b/interfaces/radio/2.2/types.hal @@ -0,0 +1,17 @@ +package vendor.samsung.hardware.radio@2.2; + +struct SehVendorConfiguration { + string name; + + string value; +}; + +struct SehEriInfo { + uint8_t roamingIndicator; + + uint8_t iconIndex; + + uint8_t iconMode; + + string eriText; +}; diff --git a/ril/sehradiomanager/Android.bp b/ril/sehradiomanager/Android.bp new file mode 100644 index 0000000..8ff0de2 --- /dev/null +++ b/ril/sehradiomanager/Android.bp @@ -0,0 +1,27 @@ +// +// Copyright (C) 2024 The LineageOS Project +// +// SPDX-License-Identifier: Apache-2.0 +// + +cc_binary { + name: "sehradiomanager", + vendor: true, + relative_install_path: "hw", + srcs: [ + "SehRadioIndication.cpp", + "SehRadioResponse.cpp", + "sehradiomanager.cpp", + ], + init_rc: ["sehradiomanager.rc"], + shared_libs: [ + "libbase", + "libbinder", + "libhidlbase", + "libutils", + "vendor.samsung.hardware.radio@2.0", + "vendor.samsung.hardware.radio@2.1", + "vendor.samsung.hardware.radio@2.2", + ], + cflags: ["-Wno-unused-parameter"], +} diff --git a/ril/sehradiomanager/SehRadioIndication.cpp b/ril/sehradiomanager/SehRadioIndication.cpp new file mode 100644 index 0000000..5be32d6 --- /dev/null +++ b/ril/sehradiomanager/SehRadioIndication.cpp @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define LOG_TAG "SehRadioIndication" + +//#define DEBUG + +#include "SehRadioIndication.h" + +#include + +namespace vendor { +namespace samsung { +namespace hardware { +namespace radio { +namespace V2_2 { +namespace implementation { + +using ::android::hardware::Void; + +void l(std::string line) { +#ifdef DEBUG + LOG(INFO) << line; +#endif +} + +Return SehRadioIndication::acbInfoChanged(int32_t type, const hidl_vec& acbInfo) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::csFallback(int32_t type, int32_t state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::imsPreferenceChanged(int32_t type, + const hidl_vec& imsPref) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::voiceRadioBearerHandoverStatusChanged(int32_t type, + int32_t state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::timerStatusChangedInd(int32_t type, + const hidl_vec& eventNoti) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::modemCapabilityIndication(int32_t type, + const hidl_vec& data) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::needTurnOnRadioIndication(int32_t type) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::simPhonebookReadyIndication(int32_t type) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::phonebookInitCompleteIndication(int32_t type) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::deviceReadyNoti(int32_t type) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::stkSmsSendResultIndication(int32_t type, int32_t result) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::stkCallControlResultIndication(int32_t type, + const hidl_string& cmd) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::simSwapStateChangedIndication(int32_t type, int32_t state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::simCountMismatchedIndication(int32_t type, int32_t state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::simOnOffStateChangedNotify(int32_t type, int32_t mode) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::releaseCompleteMessageIndication( + int32_t type, const V2_0::SehSsReleaseComplete& result) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::sapNotify(int32_t type, const hidl_vec& data) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::nrBearerAllocationChanged(int32_t type, int32_t status) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::nrNetworkTypeAdded(int32_t type, int32_t status) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::rrcStateChanged(int32_t type, const V2_0::SehRrcStateInfo& state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::configModemCapabilityChangeNoti( + int32_t type, const V2_0::SehConfigModemCapability& configModemCapa) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::needApnProfileIndication(const hidl_string& select) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::needSettingValueIndication(const hidl_string& key, + const hidl_string& table) { + l(__func__); + return -1; +} + +Return SehRadioIndication::execute(int32_t type, const hidl_string& cmd) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::signalLevelInfoChanged(int32_t type, + const V2_0::SehSignalBar& signalBarInfo) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::extendedRegistrationState( + int32_t type, const V2_0::SehExtendedRegStateResult& state) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::needPacketUsage(const hidl_string& iface, + needPacketUsage_cb hidl_cb) { + V2_0::SehPacketUsage usage; + hidl_cb(0, usage); + return Void(); +} + +Return SehRadioIndication::nrIconTypeChanged(uint32_t type, uint32_t nrIconType) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::callDetailsChanged( + uint32_t type, const hidl_vec& callDetails) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::vendorConfigurationChanged( + uint32_t type, const hidl_vec& configurations) { + l(__func__); + return Void(); +} + +Return SehRadioIndication::eriInfoReceived(uint32_t type, const SehEriInfo& eriInfo) { + l(__func__); + return Void(); +} + +} // namespace implementation +} // namespace V2_2 +} // namespace radio +} // namespace hardware +} // namespace samsung +} // namespace vendor diff --git a/ril/sehradiomanager/SehRadioIndication.h b/ril/sehradiomanager/SehRadioIndication.h new file mode 100644 index 0000000..b0fe8a3 --- /dev/null +++ b/ril/sehradiomanager/SehRadioIndication.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include + +namespace vendor { +namespace samsung { +namespace hardware { +namespace radio { +namespace V2_2 { +namespace implementation { + +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; + +class SehRadioIndication : public ISehRadioIndication { + public: + Return acbInfoChanged(int32_t type, const hidl_vec& acbInfo) override; + Return csFallback(int32_t type, int32_t state) override; + Return imsPreferenceChanged(int32_t type, const hidl_vec& imsPref) override; + Return voiceRadioBearerHandoverStatusChanged(int32_t type, int32_t state) override; + Return timerStatusChangedInd(int32_t type, const hidl_vec& eventNoti) override; + Return modemCapabilityIndication(int32_t type, const hidl_vec& data) override; + Return needTurnOnRadioIndication(int32_t type) override; + Return simPhonebookReadyIndication(int32_t type) override; + Return phonebookInitCompleteIndication(int32_t type) override; + Return deviceReadyNoti(int32_t type) override; + Return stkSmsSendResultIndication(int32_t type, int32_t result) override; + Return stkCallControlResultIndication(int32_t type, const hidl_string& cmd) override; + Return simSwapStateChangedIndication(int32_t type, int32_t state) override; + Return simCountMismatchedIndication(int32_t type, int32_t state) override; + Return simOnOffStateChangedNotify(int32_t type, int32_t mode) override; + Return releaseCompleteMessageIndication( + int32_t type, const V2_0::SehSsReleaseComplete& result) override; + Return sapNotify(int32_t type, const hidl_vec& data) override; + Return nrBearerAllocationChanged(int32_t type, int32_t status) override; + Return nrNetworkTypeAdded(int32_t type, int32_t status) override; + Return rrcStateChanged(int32_t type, const V2_0::SehRrcStateInfo& state) override; + Return configModemCapabilityChangeNoti( + int32_t type, const V2_0::SehConfigModemCapability& configModemCapa) override; + Return needApnProfileIndication(const hidl_string& select) override; + Return needSettingValueIndication(const hidl_string& key, + const hidl_string& table) override; + Return execute(int32_t type, const hidl_string& cmd) override; + Return signalLevelInfoChanged(int32_t type, + const V2_0::SehSignalBar& signalBarInfo) override; + Return extendedRegistrationState(int32_t type, + const V2_0::SehExtendedRegStateResult& state) override; + Return needPacketUsage(const hidl_string& iface, needPacketUsage_cb hidl_cb) override; + Return nrIconTypeChanged(uint32_t type, uint32_t nrIconType) override; + Return callDetailsChanged(uint32_t type, + const hidl_vec& callDetails) override; + Return vendorConfigurationChanged( + uint32_t type, const hidl_vec& configurations) override; + Return eriInfoReceived(uint32_t type, const SehEriInfo& eriInfo) override; +}; + +} // namespace implementation +} // namespace V2_2 +} // namespace radio +} // namespace hardware +} // namespace samsung +} // namespace vendor diff --git a/ril/sehradiomanager/SehRadioResponse.cpp b/ril/sehradiomanager/SehRadioResponse.cpp new file mode 100644 index 0000000..c95eca1 --- /dev/null +++ b/ril/sehradiomanager/SehRadioResponse.cpp @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define LOG_TAG "SehRadioResponse" + +#include "SehRadioResponse.h" + +namespace vendor { +namespace samsung { +namespace hardware { +namespace radio { +namespace V2_2 { +namespace implementation { + +using ::android::hardware::Void; + +Return SehRadioResponse::getIccCardStatusResponse() { + return Void(); +} + +Return SehRadioResponse::supplyNetworkDepersonalizationResponse( + const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::dialResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getCurrentCallsResponse() { + return Void(); +} + +Return SehRadioResponse::getImsRegistrationStateResponse() { + return Void(); +} + +Return SehRadioResponse::setImsCallListResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getPreferredNetworkListResponse() { + return Void(); +} + +Return SehRadioResponse::setPreferredNetworkListResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::sendEncodedUssdResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getDisable2gResponse(const RadioResponseInfo& info, + int32_t isDisable) { + return Void(); +} + +Return SehRadioResponse::setDisable2gResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getCnapResponse(const RadioResponseInfo& info, int32_t m) { + return Void(); +} + +Return SehRadioResponse::getPhonebookStorageInfoResponse() { + return Void(); +} + +Return SehRadioResponse::getUsimPhonebookCapabilityResponse( + const RadioResponseInfo& info, const hidl_vec& phonebookCapability) { + return Void(); +} + +Return SehRadioResponse::setSimOnOffResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::setSimInitEventResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getSimLockInfoResponse() { + return Void(); +} + +Return SehRadioResponse::supplyIccPersonalizationResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::changeIccPersonalizationResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getPhonebookEntryResponse() { + return Void(); +} + +Return SehRadioResponse::accessPhonebookEntryResponse(const RadioResponseInfo& info, + int32_t simPhonebookAccessResp) { + return Void(); +} + +Return SehRadioResponse::getCellBroadcastConfigResponse() { + return Void(); +} + +Return SehRadioResponse::emergencySearchResponse(const RadioResponseInfo& info, + int32_t respEmergencySearch) { + return Void(); +} + +Return SehRadioResponse::emergencyControlResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getAtrResponse(const RadioResponseInfo& info, + const hidl_string& atr) { + return Void(); +} + +Return SehRadioResponse::sendCdmaSmsExpectMoreResponse() { + return Void(); +} + +Return SehRadioResponse::sendSmsResponse() { + return Void(); +} + +Return SehRadioResponse::sendSMSExpectMoreResponse() { + return Void(); +} + +Return SehRadioResponse::sendCdmaSmsResponse() { + return Void(); +} + +Return SehRadioResponse::sendImsSmsResponse() { + return Void(); +} + +Return SehRadioResponse::getStoredMsgCountFromSimResponse() { + return Void(); +} + +Return SehRadioResponse::readSmsFromSimResponse() { + return Void(); +} + +Return SehRadioResponse::writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index) { + return Void(); +} + +Return SehRadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getCsgListResponse() { + return Void(); +} + +Return SehRadioResponse::selectCsgManualResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::setMobileDataSettingResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::sendRequestRawResponse(const RadioResponseInfo& info, + const hidl_vec& data) { + return Void(); +} + +Return SehRadioResponse::sendRequestStringsResponse(const RadioResponseInfo& info, + const hidl_vec& data) { + return Void(); +} + +Return SehRadioResponse::setNrModeResponse(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getNrModeResponse(const RadioResponseInfo& info, uint32_t nrMode) { + return Void(); +} + +Return SehRadioResponse::getNrIconResponse(const RadioResponseInfo& info, + uint32_t nrIconType) { + return Void(); +} + +Return SehRadioResponse::getIccCardStatusResponse_2_1(const RadioResponseInfo& info, + const V2_1::SehCardStatus& cardStatus) { + return Void(); +} + +Return SehRadioResponse::setNrModeResponse_2_2(const RadioResponseInfo& info) { + return Void(); +} + +Return SehRadioResponse::getVendorSpecificConfigurationResponse( + const RadioResponseInfo& info, const hidl_vec& configurations) { + return Void(); +} + +Return SehRadioResponse::setVendorSpecificConfigurationResponse( + const RadioResponseInfo& info) { + return Void(); +} + +} // namespace implementation +} // namespace V2_2 +} // namespace radio +} // namespace hardware +} // namespace samsung +} // namespace vendor diff --git a/ril/sehradiomanager/SehRadioResponse.h b/ril/sehradiomanager/SehRadioResponse.h new file mode 100644 index 0000000..476a8f2 --- /dev/null +++ b/ril/sehradiomanager/SehRadioResponse.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include + +namespace vendor { +namespace samsung { +namespace hardware { +namespace radio { +namespace V2_2 { +namespace implementation { + +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::radio::V1_0::RadioResponseInfo; + +class SehRadioResponse : public ISehRadioResponse { + public: + Return getIccCardStatusResponse() override; + Return supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info) override; + Return dialResponse(const RadioResponseInfo& info) override; + Return getCurrentCallsResponse() override; + Return getImsRegistrationStateResponse() override; + Return setImsCallListResponse(const RadioResponseInfo& info) override; + Return getPreferredNetworkListResponse() override; + Return setPreferredNetworkListResponse(const RadioResponseInfo& info) override; + Return sendEncodedUssdResponse(const RadioResponseInfo& info) override; + Return getDisable2gResponse(const RadioResponseInfo& info, int32_t isDisable) override; + Return setDisable2gResponse(const RadioResponseInfo& info) override; + Return getCnapResponse(const RadioResponseInfo& info, int32_t m) override; + Return getPhonebookStorageInfoResponse() override; + Return getUsimPhonebookCapabilityResponse( + const RadioResponseInfo& info, const hidl_vec& phonebookCapability) override; + Return setSimOnOffResponse(const RadioResponseInfo& info) override; + Return setSimInitEventResponse(const RadioResponseInfo& info) override; + Return getSimLockInfoResponse() override; + Return supplyIccPersonalizationResponse(const RadioResponseInfo& info) override; + Return changeIccPersonalizationResponse(const RadioResponseInfo& info) override; + Return getPhonebookEntryResponse() override; + Return accessPhonebookEntryResponse(const RadioResponseInfo& info, + int32_t simPhonebookAccessResp) override; + Return getCellBroadcastConfigResponse() override; + Return emergencySearchResponse(const RadioResponseInfo& info, + int32_t respEmergencySearch) override; + Return emergencyControlResponse(const RadioResponseInfo& info) override; + Return getAtrResponse(const RadioResponseInfo& info, const hidl_string& atr) override; + Return sendCdmaSmsExpectMoreResponse() override; + Return sendSmsResponse() override; + Return sendSMSExpectMoreResponse() override; + Return sendCdmaSmsResponse() override; + Return sendImsSmsResponse() override; + Return getStoredMsgCountFromSimResponse() override; + Return readSmsFromSimResponse() override; + Return writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index) override; + Return setDataAllowedResponse(const RadioResponseInfo& info) override; + Return getCsgListResponse() override; + Return selectCsgManualResponse(const RadioResponseInfo& info) override; + Return setMobileDataSettingResponse(const RadioResponseInfo& info) override; + Return sendRequestRawResponse(const RadioResponseInfo& info, + const hidl_vec& data) override; + Return sendRequestStringsResponse(const RadioResponseInfo& info, + const hidl_vec& data) override; + Return setNrModeResponse(const RadioResponseInfo& info) override; + Return getNrModeResponse(const RadioResponseInfo& info, uint32_t nrMode) override; + Return getNrIconResponse(const RadioResponseInfo& info, uint32_t nrIconType) override; + Return getIccCardStatusResponse_2_1(const RadioResponseInfo& info, + const V2_1::SehCardStatus& cardStatus) override; + Return setNrModeResponse_2_2(const RadioResponseInfo& info) override; + Return getVendorSpecificConfigurationResponse( + const RadioResponseInfo& info, + const hidl_vec& configurations) override; + Return setVendorSpecificConfigurationResponse(const RadioResponseInfo& info) override; +}; + +} // namespace implementation +} // namespace V2_2 +} // namespace radio +} // namespace hardware +} // namespace samsung +} // namespace vendor diff --git a/ril/sehradiomanager/sehradiomanager.cpp b/ril/sehradiomanager/sehradiomanager.cpp new file mode 100644 index 0000000..8472db8 --- /dev/null +++ b/ril/sehradiomanager/sehradiomanager.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 The LineageOS Project + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#define LOG_TAG "SehRadioManager" + +#include "SehRadioIndication.h" +#include "SehRadioResponse.h" + +#include +#include +#include + +#include + +using android::sp; +using android::base::GetIntProperty; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; + +using vendor::samsung::hardware::radio::V2_2::ISehRadio; +using vendor::samsung::hardware::radio::V2_2::SehVendorConfiguration; +using vendor::samsung::hardware::radio::V2_2::implementation::SehRadioIndication; +using vendor::samsung::hardware::radio::V2_2::implementation::SehRadioResponse; + +int main() { + int slotCount = GetIntProperty("ro.vendor.multisim.simslotcount", 1); + configureRpcThreadpool(slotCount * 2 + 1, true); + + for (int slot = 1; slot <= slotCount; slot++) { + auto samsungIndication = sp::make(); + auto samsungResponse = sp::make(); + auto svc = ISehRadio::getService("slot" + std::to_string(slot)); + svc->setResponseFunction(samsungResponse, samsungIndication); + + SehVendorConfiguration arg; + arg.name = "FW_READY"; + arg.value = "1"; + + svc->setVendorSpecificConfiguration(0x3232, {arg}); + LOG(INFO) << "HIDL FW_READY done (slot" << slot << ")"; + } + + joinRpcThreadpool(); + return 1; +} diff --git a/ril/sehradiomanager/sehradiomanager.rc b/ril/sehradiomanager/sehradiomanager.rc new file mode 100644 index 0000000..46d4247 --- /dev/null +++ b/ril/sehradiomanager/sehradiomanager.rc @@ -0,0 +1,8 @@ +service vendor.sehradiomanager /vendor/bin/hw/sehradiomanager + class main + user radio + group radio + disabled + +on property:sys.boot_completed=1 + start vendor.sehradiomanager