| // Copyright (C) 2021 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package { |
| // See: http://go/android-license-faq |
| // A large-scale-change added 'default_applicable_licenses' to import |
| // all of the 'license_kinds' from "hardware_interfaces_license" |
| // to get the below license kinds: |
| // SPDX-license-identifier-Apache-2.0 |
| default_applicable_licenses: ["hardware_interfaces_license"], |
| } |
| |
| cc_defaults { |
| name: "libhealth_aidl_common_defaults", |
| shared_libs: [ |
| "libbase", |
| "libbinder_ndk", |
| "libcutils", |
| "liblog", |
| "libutils", |
| "android.hardware.health-V3-ndk", |
| |
| // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| "libhidlbase", |
| ], |
| static_libs: [ |
| "libbatterymonitor", |
| "libhealthloop", |
| |
| // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| "android.hardware.health-translate-ndk", |
| ], |
| } |
| |
| // Dependency to libhealthd_charger_ui. No UI in recovery. |
| cc_defaults { |
| name: "libhealth_aidl_charger_defaults", |
| shared_libs: [ |
| // common |
| "android.hardware.health-V3-ndk", |
| "libbase", |
| "libcutils", |
| "liblog", |
| "libutils", |
| |
| // charger UI only |
| "libpng", |
| ], |
| |
| static_libs: [ |
| // common |
| "libbatterymonitor", |
| "libhealthloop", |
| |
| // charger UI only |
| "libhealthd_draw", |
| "libhealthd_charger_ui", |
| "libminui", |
| "libsuspend", |
| ], |
| |
| target: { |
| recovery: { |
| // No UI and libsuspend for recovery charger. |
| cflags: [ |
| "-DCHARGER_FORCE_NO_UI=1", |
| ], |
| exclude_shared_libs: [ |
| "libpng", |
| ], |
| exclude_static_libs: [ |
| "libhealthd_draw", |
| "libhealthd_charger_ui", |
| "libminui", |
| "libsuspend", |
| ], |
| }, |
| }, |
| } |
| |
| // AIDL version of libhealth2impl. |
| // A helper library for health HAL implementation. |
| // HAL implementations can link to this library and extend the Health class. |
| cc_library_static { |
| name: "libhealth_aidl_impl", |
| defaults: [ |
| "libhealth_aidl_common_defaults", |
| "libhealth_aidl_charger_defaults", |
| ], |
| vendor: true, |
| recovery_available: true, |
| export_include_dirs: ["include"], |
| export_static_lib_headers: [ |
| "libbatterymonitor", |
| ], |
| srcs: [ |
| "ChargerUtils.cpp", |
| "health-convert.cpp", |
| "HalHealthLoop.cpp", |
| "Health.cpp", |
| "LinkedCallback.cpp", |
| ], |
| target: { |
| recovery: { |
| exclude_srcs: [ |
| "ChargerUtils.cpp", |
| ], |
| }, |
| }, |
| } |
| |
| // Users of libhealth_aidl_impl should use this defaults. |
| cc_defaults { |
| name: "libhealth_aidl_impl_user", |
| defaults: [ |
| "libhealth_aidl_common_defaults", |
| "libhealth_aidl_charger_defaults", |
| ], |
| } |
| |
| // AIDL version of android.hardware.health@2.1-service. |
| // Default binder service of the health HAL. |
| cc_defaults { |
| name: "android.hardware.health-service.example-defaults", |
| relative_install_path: "hw", |
| vintf_fragments: ["android.hardware.health-service.example.xml"], |
| defaults: [ |
| "libhealth_aidl_impl_user", |
| ], |
| static_libs: [ |
| "libhealth_aidl_impl", |
| ], |
| srcs: ["main.cpp"], |
| } |
| |
| 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"], |
| } |
| |
| // AIDL Fuzz version of libhealth2impl. |
| cc_library_static { |
| name: "fuzz_libhealth_aidl_impl", |
| defaults: [ |
| "libhealth_aidl_common_defaults", |
| "libhealth_aidl_charger_defaults", |
| ], |
| recovery_available: true, |
| export_include_dirs: ["include"], |
| export_static_lib_headers: [ |
| "libbatterymonitor", |
| ], |
| srcs: [ |
| "ChargerUtils.cpp", |
| "health-convert.cpp", |
| "HalHealthLoop.cpp", |
| "Health.cpp", |
| "LinkedCallback.cpp", |
| ], |
| target: { |
| recovery: { |
| exclude_srcs: [ |
| "ChargerUtils.cpp", |
| ], |
| }, |
| }, |
| } |
| |
| cc_fuzz { |
| name: "android.hardware.health-service.aidl_fuzzer", |
| defaults: [ |
| "libhealth_aidl_impl_user", |
| "service_fuzzer_defaults", |
| ], |
| static_libs: [ |
| "android.hardware.health-V3-ndk", |
| "libbase", |
| "liblog", |
| "fuzz_libhealth_aidl_impl", |
| ], |
| srcs: ["fuzzer.cpp"], |
| fuzz_config: { |
| cc: [ |
| "hamzeh@google.com", |
| ], |
| }, |
| } |