diff --git a/universal7885-common/hidl-packages/radio/Android.bp b/universal7885-common/hidl-packages/radio/Android.bp new file mode 100644 index 0000000..c1c67fc --- /dev/null +++ b/universal7885-common/hidl-packages/radio/Android.bp @@ -0,0 +1,21 @@ +cc_binary { + name: "android.hardware.radio@1.4-service.samsung", + init_rc: ["android.hardware.radio@1.4-service.samsung.rc"], + relative_install_path: "hw", + vendor: true, + srcs: [ + "service.cpp", + ], + shared_libs: [ + "libhidlbase", + "liblog", + "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", + "vendor.samsung.hardware.radio@2.1", + "android.hidl.safe_union@1.0", + ], +} diff --git a/universal7885-common/hidl-packages/radio/android.hardware.radio@1.4-service.samsung.rc b/universal7885-common/hidl-packages/radio/android.hardware.radio@1.4-service.samsung.rc new file mode 100644 index 0000000..9a970ae --- /dev/null +++ b/universal7885-common/hidl-packages/radio/android.hardware.radio@1.4-service.samsung.rc @@ -0,0 +1,4 @@ +service vendor.radio-1-4 /vendor/bin/hw/android.hardware.radio@1.4-service.samsung + class hal + user system + group system diff --git a/universal7885-common/hidl-packages/radio/service.cpp b/universal7885-common/hidl-packages/radio/service.cpp new file mode 100644 index 0000000..5ebddeb --- /dev/null +++ b/universal7885-common/hidl-packages/radio/service.cpp @@ -0,0 +1,38 @@ +#define LOG_TAG "android.hardware.radio@1.4-service.samsung" + +#include +#include +#include + +using android::OK; +using android::sp; +using android::status_t; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::hardware::radio::V1_4::IRadio; +using vendor::samsung::hardware::radio::V2_1::ISehRadio; + +#define SLOT_1 "slot1" +#define SLOT_2 "slot2" + +static void registerInstance(const char *name) { + sp sehRadio = ISehRadio::getService(name); + sp radio = IRadio::castFrom(static_cast>(sehRadio)); + if (radio) { + status_t status = radio->registerAsService(name); + ALOGW_IF(status != OK, "Could not register IRadio v1.4 %s", name); + } else { + ALOGE("Failed to cast to Radio V1.4"); + } +} + +int main(void) { + configureRpcThreadpool(1, true); + + registerInstance(SLOT_1); + registerInstance(SLOT_2); + ALOGD("Default service is ready."); + + joinRpcThreadpool(); + return 1; +} diff --git a/universal7885-common/sepolicy/vendor/file_contexts b/universal7885-common/sepolicy/vendor/file_contexts index ad8dac3..3233b55 100644 --- a/universal7885-common/sepolicy/vendor/file_contexts +++ b/universal7885-common/sepolicy/vendor/file_contexts @@ -217,6 +217,7 @@ /(vendor|system/vendor)/bin/hw/vendor\.samsung\.hardware\.gnss@[0-9]\.[0-9]-service u:object_r:hal_gnss_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.sensors@[0-9]\.[0-9]-service\.a10 u:object_r:hal_sensors_default_exec:s0 /(vendor|system/vendor)/bin/hw/android\.hardware\.power\.stats-service\.exynos7 u:object_r:hal_power_stats_default_exec:s0 +/(vendor|system/vendor)/bin/hw/android\.hardware\.radio@1\.4-service\.samsung u:object_r:hal_radio_default_exec:s0 /(vendor|system/vendor)/firmware(/.*)? u:object_r:vendor_firmware_file:s0 /factory(/.*)? u:object_r:sec_efs_file:s0 diff --git a/universal7885-common/universal7885-common.mk b/universal7885-common/universal7885-common.mk index c4e91aa..5fcc36d 100644 --- a/universal7885-common/universal7885-common.mk +++ b/universal7885-common/universal7885-common.mk @@ -275,12 +275,10 @@ PRODUCT_COPY_FILES += \ # RIL PRODUCT_PACKAGES += \ - android.hardware.radio@1.4.vendor \ + android.hardware.radio@1.4-service.samsung \ android.hardware.radio@1.0 \ android.hardware.radio.config@1.2.vendor \ android.hardware.radio.deprecated@1.0.vendor \ - vendor.samsung.hardware.radio@2.1.vendor \ - vendor.samsung.hardware.radio.channel@2.0.vendor PRODUCT_PACKAGES += \ secril_config_svc