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 | |
| 15 | cc_defaults { |
| 16 | name: "libhealth_aidl_common_defaults", |
| 17 | vendor: true, |
| 18 | shared_libs: [ |
| 19 | "libbase", |
| 20 | "libbinder_ndk", |
| 21 | "libcutils", |
| 22 | "liblog", |
| 23 | "libutils", |
| 24 | "android.hardware.health-V1-ndk", |
| 25 | |
| 26 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 27 | "libhidlbase", |
| 28 | ], |
| 29 | static_libs: [ |
| 30 | "libbatterymonitor", |
| 31 | "libhealthloop", |
| 32 | |
| 33 | // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo. |
| 34 | "android.hardware.health-translate-ndk", |
| 35 | ], |
| 36 | } |
| 37 | |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 38 | // Dependency to libhealthd_charger_ui. No UI in recovery. |
| 39 | cc_defaults { |
| 40 | name: "libhealth_aidl_charger_defaults", |
| 41 | shared_libs: [ |
| 42 | // common |
| 43 | "android.hardware.health-V1-ndk", |
| 44 | "libbase", |
| 45 | "libcutils", |
| 46 | "liblog", |
| 47 | "libutils", |
| 48 | |
| 49 | // charger UI only |
| 50 | "libpng", |
| 51 | ], |
| 52 | |
| 53 | static_libs: [ |
| 54 | // common |
| 55 | "libbatterymonitor", |
| 56 | "libhealthloop", |
| 57 | |
| 58 | // charger UI only |
| 59 | "libhealthd_draw", |
| 60 | "libhealthd_charger_ui", |
| 61 | "libminui", |
| 62 | "libsuspend", |
| 63 | ], |
| 64 | |
| 65 | target: { |
| 66 | recovery: { |
| 67 | // No UI and libsuspend for recovery charger. |
| 68 | cflags: [ |
| 69 | "-DCHARGER_FORCE_NO_UI=1", |
| 70 | ], |
| 71 | exclude_shared_libs: [ |
| 72 | "libpng", |
| 73 | ], |
| 74 | exclude_static_libs: [ |
| 75 | "libhealthd_draw", |
| 76 | "libhealthd_charger_ui", |
| 77 | "libminui", |
| 78 | "libsuspend", |
| 79 | ], |
| 80 | }, |
| 81 | }, |
| 82 | } |
| 83 | |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 84 | // AIDL version of libhealth2impl. |
| 85 | // A helper library for health HAL implementation. |
| 86 | // HAL implementations can link to this library and extend the Health class. |
| 87 | cc_library_static { |
| 88 | name: "libhealth_aidl_impl", |
| 89 | defaults: [ |
| 90 | "libhealth_aidl_common_defaults", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 91 | "libhealth_aidl_charger_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 92 | ], |
| 93 | export_include_dirs: ["include"], |
| 94 | export_static_lib_headers: [ |
| 95 | "libbatterymonitor", |
| 96 | ], |
| 97 | srcs: [ |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 98 | "ChargerUtils.cpp", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 99 | "health-convert.cpp", |
| 100 | "HalHealthLoop.cpp", |
| 101 | "Health.cpp", |
| 102 | "LinkedCallback.cpp", |
| 103 | ], |
| 104 | visibility: [ |
| 105 | ":__subpackages__", |
| 106 | "//hardware/interfaces/tests/extension/health:__subpackages__", |
| 107 | ], |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 108 | target: { |
| 109 | recovery: { |
| 110 | exclude_srcs: [ |
| 111 | "ChargerUtils.cpp", |
| 112 | ], |
| 113 | }, |
| 114 | }, |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | // AIDL version of android.hardware.health@2.1-service. |
| 118 | // Default binder service of the health HAL. |
| 119 | cc_binary { |
| 120 | name: "android.hardware.health-service.example", |
| 121 | relative_install_path: "hw", |
| 122 | init_rc: ["android.hardware.health-service.example.rc"], |
| 123 | vintf_fragments: ["android.hardware.health-service.example.xml"], |
| 124 | defaults: [ |
| 125 | "libhealth_aidl_common_defaults", |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 126 | "libhealth_aidl_charger_defaults", |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 127 | ], |
| 128 | static_libs: [ |
| 129 | "libhealth_aidl_impl", |
| 130 | ], |
| 131 | srcs: ["main.cpp"], |
Yifan Hong | a8f55ca | 2021-10-20 23:05:45 -0700 | [diff] [blame^] | 132 | overrides: [ |
| 133 | "charger", |
| 134 | ], |
Yifan Hong | 830cdb1 | 2021-01-11 20:47:23 -0800 | [diff] [blame] | 135 | } |