samsung: Introduce sehradiomanager
authorTim Zimmermann <tim@linux4.de>
Mon, 11 Mar 2024 19:28:24 +0000 (20:28 +0100)
committerJan Altensen (Stricted) <info@stricted.net>
Fri, 21 Jun 2024 04:02:30 +0000 (04:02 +0000)
* 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 <phh@phh.me>
Change-Id: Iebc83397101fc5c2d0ca04b2c2ae961dee6e6910

22 files changed:
interfaces/radio/2.0/Android.bp [new file with mode: 0644]
interfaces/radio/2.0/ISehRadio.hal [new file with mode: 0644]
interfaces/radio/2.0/ISehRadioIndication.hal [new file with mode: 0644]
interfaces/radio/2.0/ISehRadioResponse.hal [new file with mode: 0644]
interfaces/radio/2.0/types.hal [new file with mode: 0644]
interfaces/radio/2.1/Android.bp [new file with mode: 0644]
interfaces/radio/2.1/ISehRadio.hal [new file with mode: 0644]
interfaces/radio/2.1/ISehRadioIndication.hal [new file with mode: 0644]
interfaces/radio/2.1/ISehRadioResponse.hal [new file with mode: 0644]
interfaces/radio/2.1/types.hal [new file with mode: 0644]
interfaces/radio/2.2/Android.bp [new file with mode: 0644]
interfaces/radio/2.2/ISehRadio.hal [new file with mode: 0644]
interfaces/radio/2.2/ISehRadioIndication.hal [new file with mode: 0644]
interfaces/radio/2.2/ISehRadioResponse.hal [new file with mode: 0644]
interfaces/radio/2.2/types.hal [new file with mode: 0644]
ril/sehradiomanager/Android.bp [new file with mode: 0644]
ril/sehradiomanager/SehRadioIndication.cpp [new file with mode: 0644]
ril/sehradiomanager/SehRadioIndication.h [new file with mode: 0644]
ril/sehradiomanager/SehRadioResponse.cpp [new file with mode: 0644]
ril/sehradiomanager/SehRadioResponse.h [new file with mode: 0644]
ril/sehradiomanager/sehradiomanager.cpp [new file with mode: 0644]
ril/sehradiomanager/sehradiomanager.rc [new file with mode: 0644]

diff --git a/interfaces/radio/2.0/Android.bp b/interfaces/radio/2.0/Android.bp
new file mode 100644 (file)
index 0000000..b68f30d
--- /dev/null
@@ -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 (file)
index 0000000..dad9699
--- /dev/null
@@ -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<uint8_t> data);
+
+    sendRequestStrings();
+};
diff --git a/interfaces/radio/2.0/ISehRadioIndication.hal b/interfaces/radio/2.0/ISehRadioIndication.hal
new file mode 100644 (file)
index 0000000..6e51ce0
--- /dev/null
@@ -0,0 +1,64 @@
+package vendor.samsung.hardware.radio@2.0;
+
+interface ISehRadioIndication {
+    oneway acbInfoChanged(int32_t type, vec<int32_t> acbInfo);
+
+    oneway csFallback(int32_t type, int32_t state);
+
+    oneway imsPreferenceChanged(int32_t type, vec<int32_t> imsPref);
+
+    oneway voiceRadioBearerHandoverStatusChanged(int32_t type, int32_t state);
+
+    oneway timerStatusChangedInd(int32_t type, vec<int32_t> eventNoti);
+
+    oneway modemCapabilityIndication(int32_t type, vec<int8_t> 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<int8_t> 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 (file)
index 0000000..41f3be7
--- /dev/null
@@ -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<SehCall> calls);
+     */
+    oneway getCurrentCallsResponse();
+
+    /*
+     * (RadioResponseInfo info, vec<SehOperatorInfo> networkInfos)
+     */
+    oneway getImsRegistrationStateResponse();
+
+    oneway setImsCallListResponse(RadioResponseInfo info);
+
+    /*
+     * RadioResponseInfo, vec<SehPreferredNetworkInfo> 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<int32_t> 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<SehCsgInfo>
+     */
+    oneway getCsgListResponse();
+
+    oneway selectCsgManualResponse(RadioResponseInfo info);
+
+    oneway setMobileDataSettingResponse(RadioResponseInfo info);
+
+    oneway sendRequestRawResponse(RadioResponseInfo info, vec<int8_t> data);
+
+    oneway sendRequestStringsResponse(RadioResponseInfo info, vec<string> data);
+};
diff --git a/interfaces/radio/2.0/types.hal b/interfaces/radio/2.0/types.hal
new file mode 100644 (file)
index 0000000..9c44cd1
--- /dev/null
@@ -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<string> 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<SehAppStatus> 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 (file)
index 0000000..86a8787
--- /dev/null
@@ -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 (file)
index 0000000..95df8b3
--- /dev/null
@@ -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 (file)
index 0000000..f7296ff
--- /dev/null
@@ -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 (file)
index 0000000..7ab9cca
--- /dev/null
@@ -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 (file)
index 0000000..03d410d
--- /dev/null
@@ -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 (file)
index 0000000..40cd58b
--- /dev/null
@@ -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 (file)
index 0000000..e65eab9
--- /dev/null
@@ -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<SehVendorConfiguration> configurations);
+};
diff --git a/interfaces/radio/2.2/ISehRadioIndication.hal b/interfaces/radio/2.2/ISehRadioIndication.hal
new file mode 100644 (file)
index 0000000..16021c6
--- /dev/null
@@ -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<SehCallDetails> callDetails);
+
+    oneway vendorConfigurationChanged(uint32_t type, vec<SehVendorConfiguration> 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 (file)
index 0000000..07d6159
--- /dev/null
@@ -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<SehVendorConfiguration> 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 (file)
index 0000000..06c3519
--- /dev/null
@@ -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 (file)
index 0000000..8ff0de2
--- /dev/null
@@ -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 (file)
index 0000000..5be32d6
--- /dev/null
@@ -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 <android-base/logging.h>
+
+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<void> SehRadioIndication::acbInfoChanged(int32_t type, const hidl_vec<int32_t>& acbInfo) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::csFallback(int32_t type, int32_t state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::imsPreferenceChanged(int32_t type,
+                                                      const hidl_vec<int32_t>& imsPref) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::voiceRadioBearerHandoverStatusChanged(int32_t type,
+                                                                       int32_t state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::timerStatusChangedInd(int32_t type,
+                                                       const hidl_vec<int32_t>& eventNoti) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::modemCapabilityIndication(int32_t type,
+                                                           const hidl_vec<int8_t>& data) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::needTurnOnRadioIndication(int32_t type) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::simPhonebookReadyIndication(int32_t type) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::phonebookInitCompleteIndication(int32_t type) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::deviceReadyNoti(int32_t type) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::stkSmsSendResultIndication(int32_t type, int32_t result) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::stkCallControlResultIndication(int32_t type,
+                                                                const hidl_string& cmd) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::simSwapStateChangedIndication(int32_t type, int32_t state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::simCountMismatchedIndication(int32_t type, int32_t state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::simOnOffStateChangedNotify(int32_t type, int32_t mode) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::releaseCompleteMessageIndication(
+        int32_t type, const V2_0::SehSsReleaseComplete& result) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::sapNotify(int32_t type, const hidl_vec<int8_t>& data) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::nrBearerAllocationChanged(int32_t type, int32_t status) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::nrNetworkTypeAdded(int32_t type, int32_t status) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::rrcStateChanged(int32_t type, const V2_0::SehRrcStateInfo& state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::configModemCapabilityChangeNoti(
+        int32_t type, const V2_0::SehConfigModemCapability& configModemCapa) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::needApnProfileIndication(const hidl_string& select) {
+    l(__func__);
+    return Void();
+}
+
+Return<int32_t> SehRadioIndication::needSettingValueIndication(const hidl_string& key,
+                                                               const hidl_string& table) {
+    l(__func__);
+    return -1;
+}
+
+Return<void> SehRadioIndication::execute(int32_t type, const hidl_string& cmd) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::signalLevelInfoChanged(int32_t type,
+                                                        const V2_0::SehSignalBar& signalBarInfo) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::extendedRegistrationState(
+        int32_t type, const V2_0::SehExtendedRegStateResult& state) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::needPacketUsage(const hidl_string& iface,
+                                                 needPacketUsage_cb hidl_cb) {
+    V2_0::SehPacketUsage usage;
+    hidl_cb(0, usage);
+    return Void();
+}
+
+Return<void> SehRadioIndication::nrIconTypeChanged(uint32_t type, uint32_t nrIconType) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::callDetailsChanged(
+        uint32_t type, const hidl_vec<V2_0::SehCallDetails>& callDetails) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> SehRadioIndication::vendorConfigurationChanged(
+        uint32_t type, const hidl_vec<SehVendorConfiguration>& configurations) {
+    l(__func__);
+    return Void();
+}
+
+Return<void> 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 (file)
index 0000000..b0fe8a3
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2024 The LineageOS Project
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <vendor/samsung/hardware/radio/2.2/ISehRadioIndication.h>
+#include <vendor/samsung/hardware/radio/2.2/types.h>
+
+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<void> acbInfoChanged(int32_t type, const hidl_vec<int32_t>& acbInfo) override;
+    Return<void> csFallback(int32_t type, int32_t state) override;
+    Return<void> imsPreferenceChanged(int32_t type, const hidl_vec<int32_t>& imsPref) override;
+    Return<void> voiceRadioBearerHandoverStatusChanged(int32_t type, int32_t state) override;
+    Return<void> timerStatusChangedInd(int32_t type, const hidl_vec<int32_t>& eventNoti) override;
+    Return<void> modemCapabilityIndication(int32_t type, const hidl_vec<int8_t>& data) override;
+    Return<void> needTurnOnRadioIndication(int32_t type) override;
+    Return<void> simPhonebookReadyIndication(int32_t type) override;
+    Return<void> phonebookInitCompleteIndication(int32_t type) override;
+    Return<void> deviceReadyNoti(int32_t type) override;
+    Return<void> stkSmsSendResultIndication(int32_t type, int32_t result) override;
+    Return<void> stkCallControlResultIndication(int32_t type, const hidl_string& cmd) override;
+    Return<void> simSwapStateChangedIndication(int32_t type, int32_t state) override;
+    Return<void> simCountMismatchedIndication(int32_t type, int32_t state) override;
+    Return<void> simOnOffStateChangedNotify(int32_t type, int32_t mode) override;
+    Return<void> releaseCompleteMessageIndication(
+            int32_t type, const V2_0::SehSsReleaseComplete& result) override;
+    Return<void> sapNotify(int32_t type, const hidl_vec<int8_t>& data) override;
+    Return<void> nrBearerAllocationChanged(int32_t type, int32_t status) override;
+    Return<void> nrNetworkTypeAdded(int32_t type, int32_t status) override;
+    Return<void> rrcStateChanged(int32_t type, const V2_0::SehRrcStateInfo& state) override;
+    Return<void> configModemCapabilityChangeNoti(
+            int32_t type, const V2_0::SehConfigModemCapability& configModemCapa) override;
+    Return<void> needApnProfileIndication(const hidl_string& select) override;
+    Return<int32_t> needSettingValueIndication(const hidl_string& key,
+                                               const hidl_string& table) override;
+    Return<void> execute(int32_t type, const hidl_string& cmd) override;
+    Return<void> signalLevelInfoChanged(int32_t type,
+                                        const V2_0::SehSignalBar& signalBarInfo) override;
+    Return<void> extendedRegistrationState(int32_t type,
+                                           const V2_0::SehExtendedRegStateResult& state) override;
+    Return<void> needPacketUsage(const hidl_string& iface, needPacketUsage_cb hidl_cb) override;
+    Return<void> nrIconTypeChanged(uint32_t type, uint32_t nrIconType) override;
+    Return<void> callDetailsChanged(uint32_t type,
+                                    const hidl_vec<V2_0::SehCallDetails>& callDetails) override;
+    Return<void> vendorConfigurationChanged(
+            uint32_t type, const hidl_vec<SehVendorConfiguration>& configurations) override;
+    Return<void> 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 (file)
index 0000000..c95eca1
--- /dev/null
@@ -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<void> SehRadioResponse::getIccCardStatusResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::supplyNetworkDepersonalizationResponse(
+        const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::dialResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getCurrentCallsResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getImsRegistrationStateResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setImsCallListResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getPreferredNetworkListResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setPreferredNetworkListResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendEncodedUssdResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getDisable2gResponse(const RadioResponseInfo& info,
+                                                    int32_t isDisable) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setDisable2gResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getCnapResponse(const RadioResponseInfo& info, int32_t m) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getPhonebookStorageInfoResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getUsimPhonebookCapabilityResponse(
+        const RadioResponseInfo& info, const hidl_vec<int32_t>& phonebookCapability) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setSimOnOffResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setSimInitEventResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getSimLockInfoResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::supplyIccPersonalizationResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::changeIccPersonalizationResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getPhonebookEntryResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::accessPhonebookEntryResponse(const RadioResponseInfo& info,
+                                                            int32_t simPhonebookAccessResp) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getCellBroadcastConfigResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::emergencySearchResponse(const RadioResponseInfo& info,
+                                                       int32_t respEmergencySearch) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::emergencyControlResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getAtrResponse(const RadioResponseInfo& info,
+                                              const hidl_string& atr) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendCdmaSmsExpectMoreResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendSmsResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendSMSExpectMoreResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendCdmaSmsResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendImsSmsResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getStoredMsgCountFromSimResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::readSmsFromSimResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setDataAllowedResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getCsgListResponse() {
+    return Void();
+}
+
+Return<void> SehRadioResponse::selectCsgManualResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setMobileDataSettingResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendRequestRawResponse(const RadioResponseInfo& info,
+                                                      const hidl_vec<int8_t>& data) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::sendRequestStringsResponse(const RadioResponseInfo& info,
+                                                          const hidl_vec<hidl_string>& data) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setNrModeResponse(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getNrModeResponse(const RadioResponseInfo& info, uint32_t nrMode) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getNrIconResponse(const RadioResponseInfo& info,
+                                                 uint32_t nrIconType) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getIccCardStatusResponse_2_1(const RadioResponseInfo& info,
+                                                            const V2_1::SehCardStatus& cardStatus) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::setNrModeResponse_2_2(const RadioResponseInfo& info) {
+    return Void();
+}
+
+Return<void> SehRadioResponse::getVendorSpecificConfigurationResponse(
+        const RadioResponseInfo& info, const hidl_vec<SehVendorConfiguration>& configurations) {
+    return Void();
+}
+
+Return<void> 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 (file)
index 0000000..476a8f2
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2024 The LineageOS Project
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+#pragma once
+
+#include <vendor/samsung/hardware/radio/2.2/ISehRadioResponse.h>
+#include <vendor/samsung/hardware/radio/2.2/types.h>
+
+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<void> getIccCardStatusResponse() override;
+    Return<void> supplyNetworkDepersonalizationResponse(const RadioResponseInfo& info) override;
+    Return<void> dialResponse(const RadioResponseInfo& info) override;
+    Return<void> getCurrentCallsResponse() override;
+    Return<void> getImsRegistrationStateResponse() override;
+    Return<void> setImsCallListResponse(const RadioResponseInfo& info) override;
+    Return<void> getPreferredNetworkListResponse() override;
+    Return<void> setPreferredNetworkListResponse(const RadioResponseInfo& info) override;
+    Return<void> sendEncodedUssdResponse(const RadioResponseInfo& info) override;
+    Return<void> getDisable2gResponse(const RadioResponseInfo& info, int32_t isDisable) override;
+    Return<void> setDisable2gResponse(const RadioResponseInfo& info) override;
+    Return<void> getCnapResponse(const RadioResponseInfo& info, int32_t m) override;
+    Return<void> getPhonebookStorageInfoResponse() override;
+    Return<void> getUsimPhonebookCapabilityResponse(
+            const RadioResponseInfo& info, const hidl_vec<int32_t>& phonebookCapability) override;
+    Return<void> setSimOnOffResponse(const RadioResponseInfo& info) override;
+    Return<void> setSimInitEventResponse(const RadioResponseInfo& info) override;
+    Return<void> getSimLockInfoResponse() override;
+    Return<void> supplyIccPersonalizationResponse(const RadioResponseInfo& info) override;
+    Return<void> changeIccPersonalizationResponse(const RadioResponseInfo& info) override;
+    Return<void> getPhonebookEntryResponse() override;
+    Return<void> accessPhonebookEntryResponse(const RadioResponseInfo& info,
+                                              int32_t simPhonebookAccessResp) override;
+    Return<void> getCellBroadcastConfigResponse() override;
+    Return<void> emergencySearchResponse(const RadioResponseInfo& info,
+                                         int32_t respEmergencySearch) override;
+    Return<void> emergencyControlResponse(const RadioResponseInfo& info) override;
+    Return<void> getAtrResponse(const RadioResponseInfo& info, const hidl_string& atr) override;
+    Return<void> sendCdmaSmsExpectMoreResponse() override;
+    Return<void> sendSmsResponse() override;
+    Return<void> sendSMSExpectMoreResponse() override;
+    Return<void> sendCdmaSmsResponse() override;
+    Return<void> sendImsSmsResponse() override;
+    Return<void> getStoredMsgCountFromSimResponse() override;
+    Return<void> readSmsFromSimResponse() override;
+    Return<void> writeSmsToSimResponse(const RadioResponseInfo& info, int32_t index) override;
+    Return<void> setDataAllowedResponse(const RadioResponseInfo& info) override;
+    Return<void> getCsgListResponse() override;
+    Return<void> selectCsgManualResponse(const RadioResponseInfo& info) override;
+    Return<void> setMobileDataSettingResponse(const RadioResponseInfo& info) override;
+    Return<void> sendRequestRawResponse(const RadioResponseInfo& info,
+                                        const hidl_vec<int8_t>& data) override;
+    Return<void> sendRequestStringsResponse(const RadioResponseInfo& info,
+                                            const hidl_vec<hidl_string>& data) override;
+    Return<void> setNrModeResponse(const RadioResponseInfo& info) override;
+    Return<void> getNrModeResponse(const RadioResponseInfo& info, uint32_t nrMode) override;
+    Return<void> getNrIconResponse(const RadioResponseInfo& info, uint32_t nrIconType) override;
+    Return<void> getIccCardStatusResponse_2_1(const RadioResponseInfo& info,
+                                              const V2_1::SehCardStatus& cardStatus) override;
+    Return<void> setNrModeResponse_2_2(const RadioResponseInfo& info) override;
+    Return<void> getVendorSpecificConfigurationResponse(
+            const RadioResponseInfo& info,
+            const hidl_vec<SehVendorConfiguration>& configurations) override;
+    Return<void> 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 (file)
index 0000000..8472db8
--- /dev/null
@@ -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 <android-base/logging.h>
+#include <android-base/properties.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <vendor/samsung/hardware/radio/2.2/ISehRadio.h>
+
+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<SehRadioIndication>::make();
+        auto samsungResponse = sp<SehRadioResponse>::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 (file)
index 0000000..46d4247
--- /dev/null
@@ -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