1// Copyright (C) 2019 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 15package { 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 24bpf { 25 name: "filterPowerSupplyEvents.o_non_vendor", 26 srcs: ["filterPowerSupplyEvents.c"], 27 visibility: ["//visibility:private"], 28} 29 30bpf { 31 name: "filterPowerSupplyEvents.o", 32 srcs: ["filterPowerSupplyEvents.c"], 33 // "vendor: true" because all binaries that use this BPF filter are vendor 34 // binaries. 35 vendor: true, 36} 37 38// Since "required" sections are ignored in static library definitions, 39// filterPowerSupplyEvents.o has been added in 40// build/make/target/product/base_vendor.mk. 41cc_library_static { 42 name: "libhealthloop", 43 vendor_available: true, 44 recovery_available: true, 45 srcs: [ 46 "HealthLoop.cpp", 47 "utils.cpp", 48 ], 49 shared_libs: [ 50 "libbase", 51 "libcutils", 52 ], 53 header_libs: [ 54 "bpf_headers", 55 "libbatteryservice_headers", 56 "libhealthd_headers", 57 "libutils_headers", 58 ], 59 export_include_dirs: [ 60 "include", 61 ], 62} 63 64cc_genrule { 65 name: "filterPowerSupplyEvents.h", 66 out: ["filterPowerSupplyEvents.h"], 67 srcs: [":filterPowerSupplyEvents.o_non_vendor"], 68 cmd: "cat $(in) | od -v -tx1 | cut -c9- | grep -v '^$$' | sed 's/^/0x/;s/ /, 0x/g;s/^, //;s/$$/,/' > $(out)", 69} 70 71cc_test_host { 72 name: "filterPowerSupplyEventsTest", 73 team: "trendy_team_pixel_system_sw_storage", 74 srcs: [ 75 "filterPowerSupplyEventsTest.cpp", 76 ], 77 shared_libs: [ 78 "libbase", 79 "libbpf", 80 ], 81 static_libs: [ 82 "libgmock", 83 ], 84 generated_headers: [ 85 "libbpf_headers", 86 ], 87 device_first_generated_headers: [ 88 "filterPowerSupplyEvents.h", 89 ], 90 compile_multilib: "64", 91} 92