|  | // Copyright (C) 2009 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. | 
|  |  | 
|  | cc_defaults { | 
|  | name: "libhwbinder_defaults", | 
|  |  | 
|  | export_include_dirs: ["include"], | 
|  |  | 
|  | sanitize: { | 
|  | misc_undefined: ["integer"], | 
|  | }, | 
|  | srcs: [ | 
|  | "Binder.cpp", | 
|  | "BpHwBinder.cpp", | 
|  | "BufferedTextOutput.cpp", | 
|  | "Debug.cpp", | 
|  | "IInterface.cpp", | 
|  | "IPCThreadState.cpp", | 
|  | "Parcel.cpp", | 
|  | "ProcessState.cpp", | 
|  | "Static.cpp", | 
|  | "TextOutput.cpp", | 
|  | ], | 
|  |  | 
|  | product_variables: { | 
|  | binder32bit: { | 
|  | cflags: ["-DBINDER_IPC_32BIT=1"], | 
|  | }, | 
|  | }, | 
|  |  | 
|  | cflags: [ | 
|  | "-Wall", | 
|  | "-Werror", | 
|  | ], | 
|  | } | 
|  |  | 
|  | cc_defaults { | 
|  | name: "libhwbinder-impl-shared-libs", | 
|  | shared_libs: [ | 
|  | "libbase", | 
|  | "liblog", | 
|  | "libcutils", | 
|  | "libutils", | 
|  | ], | 
|  | export_shared_lib_headers: [ | 
|  | "libbase", | 
|  | "libutils", | 
|  | ], | 
|  | } | 
|  |  | 
|  | // WARNING: this should no longer be used | 
|  | cc_library { | 
|  | name: "libhwbinder", | 
|  | vendor_available: true, | 
|  |  | 
|  | export_include_dirs: ["include"], | 
|  |  | 
|  | visibility: [":__subpackages__"], | 
|  | } | 
|  |  | 
|  | // Combined into libhidlbase for efficiency. | 
|  | // Used as shared library to provide headers for libhidltransport-impl-internal. | 
|  | cc_library_static { | 
|  | name: "libhwbinder-impl-internal", | 
|  | include_dirs: [ | 
|  | // TODO(b/31559095): get headers from bionic on host | 
|  | "bionic/libc/kernel/android/uapi/", | 
|  | "bionic/libc/kernel/uapi/", | 
|  | ], | 
|  |  | 
|  | defaults: [ | 
|  | "libhwbinder_defaults", | 
|  | "libhwbinder-impl-shared-libs", | 
|  | "hwbinder_pgo", | 
|  | "hwbinder_lto", | 
|  | ], | 
|  | host_supported: true, | 
|  | recovery_available: true, | 
|  | vendor_available: true, | 
|  | // TODO(b/153609531): remove when no longer needed. | 
|  | native_bridge_supported: true, | 
|  | apex_available: [ | 
|  | "//apex_available:platform", | 
|  | "com.android.neuralnetworks", | 
|  | "com.android.bluetooth.updatable", | 
|  | "com.android.media", | 
|  | "com.android.media.swcodec", | 
|  | "com.android.tethering", | 
|  | ], | 
|  | min_sdk_version: "29", | 
|  | } | 
|  |  | 
|  | // Only libhwbinder_benchmark needs to have pgo enabled. When all places | 
|  | // support having PGO selectively enabled, all places can use libhwbinder. | 
|  | // | 
|  | // http://b/77320844 | 
|  | cc_library_static { | 
|  | name: "libhwbinder_pgo-impl-internal", | 
|  | defaults: [ | 
|  | "libhwbinder_defaults", | 
|  | "libhwbinder-impl-shared-libs", | 
|  | "hwbinder_benchmark_pgo", | 
|  | "hwbinder_lto", | 
|  | ], | 
|  | } | 
|  |  | 
|  | // Provide pgo property to build hwbinder with PGO | 
|  | cc_defaults { | 
|  | name: "hwbinder_pgo", | 
|  | pgo: { | 
|  | instrumentation: true, | 
|  | profile_file: "hwbinder/hwbinder.profdata", | 
|  | benchmarks: ["hwbinder"], | 
|  | enable_profile_use: true, | 
|  | }, | 
|  | } | 
|  |  | 
|  | cc_defaults { | 
|  | name: "hwbinder_benchmark_pgo", | 
|  | pgo: { | 
|  | instrumentation: true, | 
|  | profile_file: "hwbinder/hwbinder.profdata", | 
|  | benchmarks: ["hwbinder_benchmark"], | 
|  | enable_profile_use: true, | 
|  | }, | 
|  | } | 
|  |  | 
|  | // Provide lto property to build hwbinder with LTO | 
|  | cc_defaults { | 
|  | name: "hwbinder_lto", | 
|  | target: { | 
|  | android: { | 
|  | lto: { | 
|  | thin: true, | 
|  | }, | 
|  | }, | 
|  | }, | 
|  | } |