From 16273aea6626f1ab5c3c8dc1a8f321461216641f Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 2 Dec 2019 17:58:50 -0800 Subject: [PATCH 1/3] health 1.0 does not use HAL_STATIC_LIBS BOARD_HAL_STATIC_LIBRARIES is deprecated / obsolete. No devices in our internal tree uses it. Devices that uses it should build their own HALs and link to the correct libhealthd.(board) in that vendor-specific module. Test: pass Bug: 127677771 Change-Id: I289d020960331e2dc2225ccbd378a73ccc51a056 --- health/1.0/default/Android.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/health/1.0/default/Android.mk b/health/1.0/default/Android.mk index bbf37af3b3..05987f39bf 100644 --- a/health/1.0/default/Android.mk +++ b/health/1.0/default/Android.mk @@ -19,7 +19,7 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := android.hardware.health@1.0-convert -LOCAL_HAL_STATIC_LIBRARIES := libhealthd +LOCAL_STATIC_LIBRARIES += libhealthd.default include $(BUILD_SHARED_LIBRARY) From 891220af485a02850478f88a20a8fd91561876ac Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 2 Dec 2019 18:05:41 -0800 Subject: [PATCH 2/3] health 1.0 default -> Soong Now that HAL_STATIC_LIBS are removed, convert to Soong. Also, avoid using global includes and use libbase_headers instead. Test: builds Change-Id: I50ef691e049ed0943de6f384ce7ddba96c0345a5 --- health/1.0/default/Android.bp | 42 ++++++++++++++++++++++++++++++++ health/1.0/default/Android.mk | 45 ----------------------------------- 2 files changed, 42 insertions(+), 45 deletions(-) delete mode 100644 health/1.0/default/Android.mk diff --git a/health/1.0/default/Android.bp b/health/1.0/default/Android.bp index 049e3930c6..e4e6ce7b4b 100644 --- a/health/1.0/default/Android.bp +++ b/health/1.0/default/Android.bp @@ -18,3 +18,45 @@ cc_library_static { } +cc_library_shared { + name: "android.hardware.health@1.0-impl", + vendor: true, + relative_install_path: "hw", + srcs: ["Health.cpp"], + + header_libs: [ + "libbase_headers", + "libhealthd_headers", + ], + + shared_libs: [ + "libcutils", + "libhidlbase", + "liblog", + "libutils", + "android.hardware.health@1.0", + ], + + static_libs: [ + "android.hardware.health@1.0-convert", + "libhealthd.default", + ], +} + +cc_binary { + name: "android.hardware.health@1.0-service", + vendor: true, + relative_install_path: "hw", + init_rc: ["android.hardware.health@1.0-service.rc"], + srcs: ["HealthService.cpp"], + + shared_libs: [ + "liblog", + "libcutils", + "libdl", + "libbase", + "libutils", + "libhidlbase", + "android.hardware.health@1.0", + ], +} diff --git a/health/1.0/default/Android.mk b/health/1.0/default/Android.mk deleted file mode 100644 index 05987f39bf..0000000000 --- a/health/1.0/default/Android.mk +++ /dev/null @@ -1,45 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.health@1.0-impl -LOCAL_PROPRIETARY_MODULE := true -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_C_INCLUDES := system/core/base/include -LOCAL_SRC_FILES := \ - Health.cpp \ - -LOCAL_HEADER_LIBRARIES := libhealthd_headers - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libhidlbase \ - liblog \ - libutils \ - android.hardware.health@1.0 \ - -LOCAL_STATIC_LIBRARIES := android.hardware.health@1.0-convert - -LOCAL_STATIC_LIBRARIES += libhealthd.default - -include $(BUILD_SHARED_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_PROPRIETARY_MODULE := true -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_MODULE := android.hardware.health@1.0-service -LOCAL_INIT_RC := android.hardware.health@1.0-service.rc -LOCAL_SRC_FILES := \ - HealthService.cpp \ - -LOCAL_SHARED_LIBRARIES := \ - liblog \ - libcutils \ - libdl \ - libbase \ - libutils \ - libhidlbase \ - android.hardware.health@1.0 \ - -include $(BUILD_EXECUTABLE) - -include $(call first-makefiles-under,$(LOCAL_PATH)) From b808bd7d46eee8ff4d2689c1284b6e8049d54c35 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Tue, 3 Dec 2019 12:51:42 -0800 Subject: [PATCH 3/3] health 1.0: add helper library for -impl Now that libhealthd is no longer recognized as a HAL_STATIC_LIBRARY, vendors must define their own android.hardware.health@1.0-impl module. Add a helper and README.md for them to explain this transition. Test: builds Bug: 127677771 Change-Id: I65c162e7b5caed93c39a4a1cb6a2893fbb25724b --- health/1.0/default/Android.bp | 16 +++++++-- health/1.0/default/README.md | 66 +++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 health/1.0/default/README.md diff --git a/health/1.0/default/Android.bp b/health/1.0/default/Android.bp index e4e6ce7b4b..7581335a3a 100644 --- a/health/1.0/default/Android.bp +++ b/health/1.0/default/Android.bp @@ -18,10 +18,9 @@ cc_library_static { } -cc_library_shared { - name: "android.hardware.health@1.0-impl", +cc_library_static { + name: "android.hardware.health@1.0-impl-helper", vendor: true, - relative_install_path: "hw", srcs: ["Health.cpp"], header_libs: [ @@ -39,6 +38,17 @@ cc_library_shared { static_libs: [ "android.hardware.health@1.0-convert", + ], +} + +cc_library_shared { + name: "android.hardware.health@1.0-impl", + vendor: true, + relative_install_path: "hw", + + static_libs: [ + "android.hardware.health@1.0-impl-helper", + "android.hardware.health@1.0-convert", "libhealthd.default", ], } diff --git a/health/1.0/default/README.md b/health/1.0/default/README.md new file mode 100644 index 0000000000..1ded7dede5 --- /dev/null +++ b/health/1.0/default/README.md @@ -0,0 +1,66 @@ +# Implement the 2.1 HAL instead! + +It is strongly recommended that you implement the 2.1 HAL directly. See +`hardware/interfaces/health/2.1/README.md` for more details. + +# Implement Health 1.0 HAL + +1. Install common binderized service. The binderized service `dlopen()`s + passthrough implementations on the device, so there is no need to write + your own. + + ```mk + # Install default binderized implementation to vendor. + PRODUCT_PACKAGES += android.hardware.health@1.0-service + ``` + +1. Add proper VINTF manifest entry to your device manifest. Example: + + ```xml + + android.hardware.health + hwbinder + 1.0 + + IHealth + default + + + ``` + +1. Install the proper passthrough implemetation. + + 1. If you want to use the default implementation (with default `libhealthd`), + add the following to `device.mk`: + + ```mk + PRODUCT_PACKAGES += \ + android.hardware.health@1.0-impl + ``` + + 1. Otherwise, if you have a customized `libhealthd.`: + + 1. Define your passthrough implementation. Example (replace `` + and `` accordingly): + + ```bp + cc_library_shared { + name: "android.hardware.health@1.0-impl-", + vendor: true, + relative_install_path: "hw", + + static_libs: [ + "android.hardware.health@1.0-impl-helper", + "android.hardware.health@1.0-convert", + "libhealthd.", + ], + } + ``` + + 1. Add to `device.mk`. + + ``` + PRODUCT_PACKAGES += android.hardware.health@1.0-impl- + ``` + + 1. Define appropriate SELinux permissions.