]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - android/platform-hardware-interfaces.git/blob - health/2.0/README
health: Update README to remove .override [DO NOT MERGE]
[android/platform-hardware-interfaces.git] / health / 2.0 / README
1 Upgrading from health@1.0 HAL
3 0. Remove android.hardware.health@1.0* from PRODUCT_PACKAGES
4    in device/<manufacturer>/<device>/device.mk
6 1. If the device does not have a vendor-specific libhealthd AND does not
7    implement storage-related APIs, just do the following:
9     PRODUCT_PACKAGES += android.hardware.health@2.0-service
11    Otherwise, continue to Step 2.
13 2. Create directory
14    device/<manufacturer>/<device>/health
16 3. Create device/<manufacturer>/<device>/health/Android.bp
17    (or equivalent device/<manufacturer>/<device>/health/Android.mk)
19 cc_binary {
20     name: "android.hardware.health@2.0-service.<device>",
21     init_rc: ["android.hardware.health@2.0-service.<device>.rc"],
22     proprietary: true,
23     relative_install_path: "hw",
24     srcs: [
25         "HealthService.cpp",
26     ],
28     cflags: [
29         "-Wall",
30         "-Werror",
31     ],
33     static_libs: [
34         "android.hardware.health@2.0-impl",
35         "android.hardware.health@1.0-convert",
36         "libhealthservice",
37         "libbatterymonitor",
38     ],
40     shared_libs: [
41         "libbase",
42         "libcutils",
43         "libhidlbase",
44         "libhidltransport",
45         "libutils",
46         "android.hardware.health@2.0",
47     ],
49     header_libs: ["libhealthd_headers"],
51     // Uncomment the following to remove healthd from the build.
52     // overrides: [
53     //     "healthd",
54     // ],
55 }
57     3.1 (recommended) To remove healthd from the build, keep "overrides"
58           section, and include the following in device.mk:
59             DEVICE_FRAMEWORK_MANIFEST_FILE += \
60                 system/libhidl/vintfdata/manifest_healthd_exclude.xml
61     3.2 To keep healthd in the build, remove "overrides" section.
63 4. Create device/<manufacturer>/<device>/health/android.hardware.health@2.0-service.<device>.rc
65 service vendor.health-hal-2-0 /vendor/bin/hw/android.hardware.health@2.0-service.<device>
66     class hal
67     user system
68     group system
69     file /dev/kmsg w
71 5. Create device/<manufacturer>/<device>/health/HealthService.cpp:
73 #include <health2/service.h>
74 int main() { return health_service_main(); }
76 6. libhealthd dependency:
78 6.1 If the device has a vendor-specific libhealthd.<soc>, add it to static_libs.
80 6.2 If the device does not have a vendor-specific libhealthd, add the following
81     lines to HealthService.cpp:
83 #include <healthd/healthd.h>
84 void healthd_board_init(struct healthd_config*) {}
86 int healthd_board_battery_update(struct android::BatteryProperties*) {
87     // return 0 to log periodic polled battery status to kernel log
88     return 0;
89 }
91 7. Storage related APIs:
93 7.1 If the device does not implement IHealth.getDiskStats and
94     IHealth.getStorageInfo, add libstoragehealthdefault to static_libs.
96 7.2 If the device implements one of these two APIs, add and implement the
97     following functions in HealthService.cpp:
99 void get_storage_info(std::vector<struct StorageInfo>& info) {
100     // ...
102 void get_disk_stats(std::vector<struct DiskStats>& stats) {
103     // ...
106 8. Update necessary SELinux permissions. For example,
108 # device/<manufacturer>/<device>/sepolicy/vendor/file_contexts
109 /vendor/bin/hw/android\.hardware\.health@2\.0-service.<device> u:object_r:hal_health_default_exec:s0
111 # device/<manufacturer>/<device>/sepolicy/vendor/hal_health_default.te
112 # Add device specific permissions to hal_health_default domain, especially
113 # if Step 6.1 or Step 7.2 is done.