Merge changes from topic "no_hal_static_libs"

* changes:
  health 1.0: add helper library for -impl
  health 1.0 default -> Soong
  health 1.0 does not use HAL_STATIC_LIBS
This commit is contained in:
Yifan Hong
2019-12-05 20:11:32 +00:00
committed by Gerrit Code Review
3 changed files with 118 additions and 45 deletions

View File

@@ -18,3 +18,55 @@ cc_library_static {
}
cc_library_static {
name: "android.hardware.health@1.0-impl-helper",
vendor: true,
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",
],
}
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",
],
}
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",
],
}

View File

@@ -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_HAL_STATIC_LIBRARIES := libhealthd
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))

View File

@@ -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
<hal format="hidl">
<name>android.hardware.health</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IHealth</name>
<instance>default</instance>
</interface>
</hal>
```
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.<board>`:
1. Define your passthrough implementation. Example (replace `<device>`
and `<board>` accordingly):
```bp
cc_library_shared {
name: "android.hardware.health@1.0-impl-<device>",
vendor: true,
relative_install_path: "hw",
static_libs: [
"android.hardware.health@1.0-impl-helper",
"android.hardware.health@1.0-convert",
"libhealthd.<board>",
],
}
```
1. Add to `device.mk`.
```
PRODUCT_PACKAGES += android.hardware.health@1.0-impl-<device>
```
1. Define appropriate SELinux permissions.