Loading health/aidl/README.md +13 −3 Original line number Diff line number Diff line Loading @@ -80,7 +80,9 @@ If you [determined](#determine) that the example health AIDL HAL service works for your device, install it with ```mk PRODUCT_PACKAGES += android.hardware.health-service.example PRODUCT_PACKAGES += \ android.hardware.health-service.example \ android.hardware.health-service.example_recovery \ ``` Then, delete any existing `service` with `class charger` in your device-specific Loading Loading @@ -156,6 +158,16 @@ If your device does not support off-line charging mode, or does not have a UI for charger (`ro.charger.no_ui=true`), skip the invocation of `ChargerModeMain()` in `main()`. ### Build system changes Install both the platform and recovery variant of the service. For example: ```mk PRODUCT_PACKAGES += \ android.hardware.health-service.cuttlefish \ android.hardware.health-service.cuttlefish_recovery \ ``` ### SELinux rules Add device specific permissions to the domain where the health HAL Loading Loading @@ -306,5 +318,3 @@ permissions. Example (assuming that your health AIDL service runs in domain type hal_health_tuna, charger_type, domain; hal_server_domain(hal_health_default, hal_health) ``` [comment: TODO(b/170338625): explain recovery]: # health/aidl/default/Android.bp +20 −8 Original line number Diff line number Diff line Loading @@ -23,8 +23,6 @@ package { cc_defaults { name: "libhealth_aidl_common_defaults", recovery_available: true, vendor: true, shared_libs: [ "libbase", "libbinder_ndk", Loading Loading @@ -100,6 +98,8 @@ cc_library_static { "libhealth_aidl_common_defaults", "libhealth_aidl_charger_defaults", ], vendor: true, recovery_available: true, export_include_dirs: ["include"], export_static_lib_headers: [ "libbatterymonitor", Loading @@ -122,10 +122,9 @@ cc_library_static { // AIDL version of android.hardware.health@2.1-service. // Default binder service of the health HAL. cc_binary { name: "android.hardware.health-service.example", cc_defaults { name: "android.hardware.health-service.example-defaults", relative_install_path: "hw", init_rc: ["android.hardware.health-service.example.rc"], vintf_fragments: ["android.hardware.health-service.example.xml"], defaults: [ "libhealth_aidl_common_defaults", Loading @@ -135,7 +134,20 @@ cc_binary { "libhealth_aidl_impl", ], srcs: ["main.cpp"], overrides: [ "charger", ], } cc_binary { name: "android.hardware.health-service.example", vendor: true, defaults: ["android.hardware.health-service.example-defaults"], init_rc: ["android.hardware.health-service.example.rc"], overrides: ["charger"], } cc_binary { name: "android.hardware.health-service.example_recovery", recovery: true, defaults: ["android.hardware.health-service.example-defaults"], init_rc: ["android.hardware.health-service.example_recovery.rc"], overrides: ["charger.recovery"], } health/aidl/default/android.hardware.health-service.example_recovery.rc 0 → 100644 +7 −0 Original line number Diff line number Diff line service vendor.health-default /system/bin/hw/android.hardware.health-service.example_recovery class hal seclabel u:r:hal_health_default:s0 user system group system capabilities WAKE_ALARM BLOCK_SUSPEND file /dev/kmsg w health/aidl/default/main.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -39,14 +39,16 @@ static constexpr const char* gInstanceName = "default"; static constexpr std::string_view gChargerArg{"--charger"}; int main(int argc, char** argv) { #ifdef __ANDROID_RECOVERY__ android::base::InitLogging(argv, android::base::KernelLogger); #endif // make a default health service auto config = std::make_unique<healthd_config>(); ::android::hardware::health::InitHealthdConfig(config.get()); auto binder = ndk::SharedRefBase::make<Health>(gInstanceName, std::move(config)); if (argc >= 2 && argv[1] == gChargerArg) { android::base::InitLogging(argv, &android::base::KernelLogger); #if !CHARGER_FORCE_NO_UI // If charger shouldn't have UI for your device, simply drop the line below // for your service implementation. This corresponds to Loading Loading
health/aidl/README.md +13 −3 Original line number Diff line number Diff line Loading @@ -80,7 +80,9 @@ If you [determined](#determine) that the example health AIDL HAL service works for your device, install it with ```mk PRODUCT_PACKAGES += android.hardware.health-service.example PRODUCT_PACKAGES += \ android.hardware.health-service.example \ android.hardware.health-service.example_recovery \ ``` Then, delete any existing `service` with `class charger` in your device-specific Loading Loading @@ -156,6 +158,16 @@ If your device does not support off-line charging mode, or does not have a UI for charger (`ro.charger.no_ui=true`), skip the invocation of `ChargerModeMain()` in `main()`. ### Build system changes Install both the platform and recovery variant of the service. For example: ```mk PRODUCT_PACKAGES += \ android.hardware.health-service.cuttlefish \ android.hardware.health-service.cuttlefish_recovery \ ``` ### SELinux rules Add device specific permissions to the domain where the health HAL Loading Loading @@ -306,5 +318,3 @@ permissions. Example (assuming that your health AIDL service runs in domain type hal_health_tuna, charger_type, domain; hal_server_domain(hal_health_default, hal_health) ``` [comment: TODO(b/170338625): explain recovery]: #
health/aidl/default/Android.bp +20 −8 Original line number Diff line number Diff line Loading @@ -23,8 +23,6 @@ package { cc_defaults { name: "libhealth_aidl_common_defaults", recovery_available: true, vendor: true, shared_libs: [ "libbase", "libbinder_ndk", Loading Loading @@ -100,6 +98,8 @@ cc_library_static { "libhealth_aidl_common_defaults", "libhealth_aidl_charger_defaults", ], vendor: true, recovery_available: true, export_include_dirs: ["include"], export_static_lib_headers: [ "libbatterymonitor", Loading @@ -122,10 +122,9 @@ cc_library_static { // AIDL version of android.hardware.health@2.1-service. // Default binder service of the health HAL. cc_binary { name: "android.hardware.health-service.example", cc_defaults { name: "android.hardware.health-service.example-defaults", relative_install_path: "hw", init_rc: ["android.hardware.health-service.example.rc"], vintf_fragments: ["android.hardware.health-service.example.xml"], defaults: [ "libhealth_aidl_common_defaults", Loading @@ -135,7 +134,20 @@ cc_binary { "libhealth_aidl_impl", ], srcs: ["main.cpp"], overrides: [ "charger", ], } cc_binary { name: "android.hardware.health-service.example", vendor: true, defaults: ["android.hardware.health-service.example-defaults"], init_rc: ["android.hardware.health-service.example.rc"], overrides: ["charger"], } cc_binary { name: "android.hardware.health-service.example_recovery", recovery: true, defaults: ["android.hardware.health-service.example-defaults"], init_rc: ["android.hardware.health-service.example_recovery.rc"], overrides: ["charger.recovery"], }
health/aidl/default/android.hardware.health-service.example_recovery.rc 0 → 100644 +7 −0 Original line number Diff line number Diff line service vendor.health-default /system/bin/hw/android.hardware.health-service.example_recovery class hal seclabel u:r:hal_health_default:s0 user system group system capabilities WAKE_ALARM BLOCK_SUSPEND file /dev/kmsg w
health/aidl/default/main.cpp +4 −2 Original line number Diff line number Diff line Loading @@ -39,14 +39,16 @@ static constexpr const char* gInstanceName = "default"; static constexpr std::string_view gChargerArg{"--charger"}; int main(int argc, char** argv) { #ifdef __ANDROID_RECOVERY__ android::base::InitLogging(argv, android::base::KernelLogger); #endif // make a default health service auto config = std::make_unique<healthd_config>(); ::android::hardware::health::InitHealthdConfig(config.get()); auto binder = ndk::SharedRefBase::make<Health>(gInstanceName, std::move(config)); if (argc >= 2 && argv[1] == gChargerArg) { android::base::InitLogging(argv, &android::base::KernelLogger); #if !CHARGER_FORCE_NO_UI // If charger shouldn't have UI for your device, simply drop the line below // for your service implementation. This corresponds to Loading