Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 1 | // Copyright (C) 2021 The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
Bob Badour | a88d5b1 | 2021-10-28 17:18:27 -0700 | [diff] [blame] | 15 | package { |
| 16 | // See: http://go/android-license-faq |
| 17 | // A large-scale-change added 'default_applicable_licenses' to import |
| 18 | // all of the 'license_kinds' from "hardware_interfaces_license" |
| 19 | // to get the below license kinds: |
| 20 | // SPDX-license-identifier-Apache-2.0 |
| 21 | default_applicable_licenses: ["hardware_interfaces_license"], |
| 22 | } |
| 23 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 24 | cc_defaults { |
| 25 | name: "libhealth_aidl_common_defaults", |
Yifan Hong | e32a8ea | 2021-10-20 21:54:20 -0700 | [diff] [blame] | 26 | recovery_available: true, |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 27 | vendor: true, |
| 28 | shared_libs: [ |
| 29 | "libbase", |
| 30 | "libbinder_ndk", |
| 31 | "libcutils", |
| 32 | "liblog", |
| 33 | "libutils", |
| 34 | "android.hardware.health-V1-ndk", |
| 35 | |
| 36 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 37 | "libhidlbase", |
| 38 | ], |
| 39 | static_libs: [ |
| 40 | "libbatterymonitor", |
| 41 | "libhealthloop", |
| 42 | |
| 43 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 44 | "android.hardware.health-translate-ndk", |
| 45 | ], |
| 46 | } |
| 47 | |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 48 | // Dependency to libhealthd_charger_ui. No UI in recovery. |
| 49 | cc_defaults { |
| 50 | name: "libhealth_aidl_charger_defaults", |
| 51 | shared_libs: [ |
| 52 | // common |
| 53 | "android.hardware.health-V1-ndk", |
| 54 | "libbase", |
| 55 | "libcutils", |
| 56 | "liblog", |
| 57 | "libutils", |
| 58 | |
| 59 | // charger UI only |
| 60 | "libpng", |
| 61 | ], |
| 62 | |
| 63 | static_libs: [ |
| 64 | // common |
| 65 | "libbatterymonitor", |
| 66 | "libhealthloop", |
| 67 | |
| 68 | // charger UI only |
| 69 | "libhealthd_draw", |
| 70 | "libhealthd_charger_ui", |
| 71 | "libminui", |
| 72 | "libsuspend", |
| 73 | ], |
| 74 | |
| 75 | target: { |
| 76 | recovery: { |
| 77 | // No UI and libsuspend for recovery charger. |
| 78 | cflags: [ |
| 79 | "-DCHARGER_FORCE_NO_UI=1", |
| 80 | ], |
| 81 | exclude_shared_libs: [ |
| 82 | "libpng", |
| 83 | ], |
| 84 | exclude_static_libs: [ |
| 85 | "libhealthd_draw", |
| 86 | "libhealthd_charger_ui", |
| 87 | "libminui", |
| 88 | "libsuspend", |
| 89 | ], |
| 90 | }, |
| 91 | }, |
| 92 | } |
| 93 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 94 | // AIDL version of libhealth2impl. |
| 95 | // A helper library for health HAL implementation. |
| 96 | // HAL implementations can link to this library and extend the Health class. |
| 97 | cc_library_static { |
| 98 | name: "libhealth_aidl_impl", |
| 99 | defaults: [ |
| 100 | "libhealth_aidl_common_defaults", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 101 | "libhealth_aidl_charger_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 102 | ], |
| 103 | export_include_dirs: ["include"], |
| 104 | export_static_lib_headers: [ |
| 105 | "libbatterymonitor", |
| 106 | ], |
| 107 | srcs: [ |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 108 | "ChargerUtils.cpp", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 109 | "health-convert.cpp", |
| 110 | "HalHealthLoop.cpp", |
| 111 | "Health.cpp", |
| 112 | "LinkedCallback.cpp", |
| 113 | ], |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 114 | target: { |
| 115 | recovery: { |
| 116 | exclude_srcs: [ |
| 117 | "ChargerUtils.cpp", |
| 118 | ], |
| 119 | }, |
| 120 | }, |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | // AIDL version of android.hardware.health@2.1-service. |
| 124 | // Default binder service of the health HAL. |
| 125 | cc_binary { |
| 126 | name: "android.hardware.health-service.example", |
| 127 | relative_install_path: "hw", |
| 128 | init_rc: ["android.hardware.health-service.example.rc"], |
| 129 | vintf_fragments: ["android.hardware.health-service.example.xml"], |
| 130 | defaults: [ |
| 131 | "libhealth_aidl_common_defaults", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 132 | "libhealth_aidl_charger_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 133 | ], |
| 134 | static_libs: [ |
| 135 | "libhealth_aidl_impl", |
| 136 | ], |
| 137 | srcs: ["main.cpp"], |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame] | 138 | overrides: [ |
| 139 | "charger", |
| 140 | ], |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 141 | } |