From 909a21f5d188638f8a4f3071f3825f057796318c Mon Sep 17 00:00:00 2001 From: Konsta Date: Sat, 15 Mar 2025 00:12:54 +0200 Subject: [PATCH] health: convert to apex --- device.mk | 2 +- health/Android.bp | 38 ++++++++++++++++--- health/android.hardware.health-service.rpi.rc | 2 +- health/apex_file_contexts | 3 ++ health/apex_manifest.json | 4 ++ sepolicy/file_contexts | 3 -- 6 files changed, 41 insertions(+), 11 deletions(-) create mode 100644 health/apex_file_contexts create mode 100644 health/apex_manifest.json diff --git a/device.mk b/device.mk index 8bc970d..61fb5c8 100644 --- a/device.mk +++ b/device.mk @@ -198,7 +198,7 @@ PRODUCT_COPY_FILES += \ # Health PRODUCT_PACKAGES += \ - android.hardware.health-service.rpi + com.android.hardware.health.rpi5 # Kernel PRODUCT_COPY_FILES += \ diff --git a/health/Android.bp b/health/Android.bp index 501a1d8..9462505 100644 --- a/health/Android.bp +++ b/health/Android.bp @@ -7,26 +7,52 @@ cc_binary { name: "android.hardware.health-service.rpi", relative_install_path: "hw", vendor: true, - init_rc: ["android.hardware.health-service.rpi.rc"], - vintf_fragments: ["android.hardware.health-service.rpi.xml"], srcs: [ "HealthImpl.cpp", "main.cpp", ], static_libs: [ - "android.hardware.health-translate-ndk", "libbatterymonitor", - "libhealthloop", "libhealth_aidl_impl", + "libhealthloop", ], shared_libs: [ + "android.hardware.health-V4-ndk", "libbase", "libbinder_ndk", "libcutils", - "libhidlbase", "liblog", "libutils", - "android.hardware.health-V4-ndk", ], overrides: ["charger"], + installable: false, +} + +prebuilt_etc { + name: "android.hardware.health-service.rpi.rc", + src: "android.hardware.health-service.rpi.rc", + installable: false, +} + +prebuilt_etc { + name: "android.hardware.health-service.rpi.xml", + src: "android.hardware.health-service.rpi.xml", + sub_dir: "vintf", + installable: false, +} + +apex { + name: "com.android.hardware.health.rpi5", + manifest: "apex_manifest.json", + file_contexts: "apex_file_contexts", + key: "com.android.hardware.key", + certificate: ":com.android.hardware.certificate", + updatable: false, + vendor: true, + + binaries: ["android.hardware.health-service.rpi"], + prebuilts: [ + "android.hardware.health-service.rpi.rc", + "android.hardware.health-service.rpi.xml", + ], } diff --git a/health/android.hardware.health-service.rpi.rc b/health/android.hardware.health-service.rpi.rc index 18b5fab..dfbd291 100644 --- a/health/android.hardware.health-service.rpi.rc +++ b/health/android.hardware.health-service.rpi.rc @@ -1,4 +1,4 @@ -service vendor.health-default /vendor/bin/hw/android.hardware.health-service.rpi +service vendor.health-rpi /apex/com.android.hardware.health.rpi5/bin/hw/android.hardware.health-service.rpi class hal user system group system diff --git a/health/apex_file_contexts b/health/apex_file_contexts new file mode 100644 index 0000000..bfe80b7 --- /dev/null +++ b/health/apex_file_contexts @@ -0,0 +1,3 @@ +(/.*)? u:object_r:vendor_file:s0 +/etc(/.*)? u:object_r:vendor_configs_file:s0 +/bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0 diff --git a/health/apex_manifest.json b/health/apex_manifest.json new file mode 100644 index 0000000..86f81fe --- /dev/null +++ b/health/apex_manifest.json @@ -0,0 +1,4 @@ +{ + "name": "com.android.hardware.health.rpi5", + "version": 1 +} diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index c15eb12..921d3c6 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -28,9 +28,6 @@ /vendor/lib(64)?/libminigbm_gralloc_gbm_mesa\.so u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/libminigbm_gralloc4_utils_gbm_mesa\.so u:object_r:same_process_hal_file:s0 -# Health -/vendor/bin/hw/android\.hardware\.health-service\.rpi u:object_r:hal_health_default_exec:s0 - # Lights /sys/class/backlight/11-0045/brightness u:object_r:sysfs_leds:s0 /sys/class/backlight/11-0045/max_brightness u:object_r:sysfs_leds:s0