compat: Add android.hardware.radio.c_shim@1.{0..3}

* They're copied from `android.hardware.radio.config@1.{0..3}.so`,
  renamed to `android.hardware.radio.c_shim@1.{0..3}.so`, and
  hexedited hidl interface descriptor to
  `lineage.hardware.radio.config@1.{0..3}::IRadioConfig`
* For making stock RIL service register radio.config service to
  `lineage.hardware.radio.config` interface instead, so that we can
  add a wrapper that registers to `android.hardware.radio.config`
* Example usage on extract-files.sh:
```
        vendor/lib64/libril-qc-hal-qmi.so)
            for v in 1.{0..2}; do
                sed -i "s|android.hardware.radio.config@${v}.so|android.hardware.radio.c_shim@${v}.so|g" "${2}"
            done
            ;;
```

Change-Id: Ie8c48c0164c1787c851d4b3c0ccd334e0d405cd4
This commit is contained in:
Yumi Yukimura 2024-03-28 05:55:52 +08:00
parent 1522a475d9
commit 201615cf7c

View file

@ -0,0 +1,75 @@
#
# Copyright (C) 2024 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
LOCAL_PATH := $(call my-dir)
_shim_hidl_library_name := android.hardware.radio.c_shim
_frontend_hidl_package_name := android.hardware.radio.config
_backend_hidl_package_name := lineage.hardware.radio.config
_frontend_hidl_interface_name := IRadioConfig
_backend_hidl_interface_name := $(_frontend_hidl_interface_name)
ifeq ($(TARGET_IS_64_BIT),true)
_lib_dir := lib64
else
_lib_dir := lib
endif
include $(CLEAR_VARS)
_version := 1.0
_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g"
LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version)
LOCAL_MODULE_STEM := $(LOCAL_MODULE).so
LOCAL_MODULE_CLASS := DATA
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir)
LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor
LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so
LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
_version := 1.1
_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g"
LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version)
LOCAL_MODULE_STEM := $(LOCAL_MODULE).so
LOCAL_MODULE_CLASS := DATA
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir)
LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor
LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so
LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
_version := 1.2
_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g"
LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version)
LOCAL_MODULE_STEM := $(LOCAL_MODULE).so
LOCAL_MODULE_CLASS := DATA
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir)
LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor
LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so
LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
_version := 1.3
_sed_pattern := "s|$(_frontend_hidl_package_name)@$(_version)::$(_frontend_hidl_interface_name)|$(_backend_hidl_package_name)@$(_version)::$(_backend_hidl_interface_name)|g;s|$(_frontend_hidl_package_name)(@1\.[0-9]\.so)|$(_shim_hidl_library_name)\1|g"
LOCAL_MODULE := $(_shim_hidl_library_name)@$(_version)
LOCAL_MODULE_STEM := $(LOCAL_MODULE).so
LOCAL_MODULE_CLASS := DATA
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/$(_lib_dir)
LOCAL_REQUIRED_MODULES := $(_frontend_hidl_package_name)@$(_version).vendor
LOCAL_PREBUILT_MODULE_FILE := $(TARGET_OUT_VENDOR)/$(_lib_dir)/$(_frontend_hidl_package_name)@$(_version).so
LOCAL_POST_INSTALL_CMD := /usr/bin/sed -E -i $(_sed_pattern) $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_STEM)
include $(BUILD_PREBUILT)