• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2009 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
15cc_defaults {
16    name: "libhwbinder_defaults",
17
18    export_include_dirs: ["include"],
19
20    sanitize: {
21        misc_undefined: ["integer"],
22    },
23    srcs: [
24        "Binder.cpp",
25        "BpHwBinder.cpp",
26        "BufferedTextOutput.cpp",
27        "Debug.cpp",
28        "IInterface.cpp",
29        "IPCThreadState.cpp",
30        "Parcel.cpp",
31        "ProcessState.cpp",
32        "Static.cpp",
33        "TextOutput.cpp",
34    ],
35
36    product_variables: {
37        binder32bit: {
38            cflags: ["-DBINDER_IPC_32BIT=1"],
39        },
40    },
41
42    cflags: [
43        "-Wall",
44        "-Werror",
45    ],
46}
47
48cc_defaults {
49    name: "libhwbinder-impl-shared-libs",
50    shared_libs: [
51        "libbase",
52        "liblog",
53        "libcutils",
54        "libutils",
55    ],
56    export_shared_lib_headers: [
57        "libbase",
58        "libutils",
59    ],
60}
61
62// WARNING: this should no longer be used
63cc_library {
64    name: "libhwbinder",
65    vendor_available: true,
66
67    export_include_dirs: ["include"],
68
69    visibility: [":__subpackages__"],
70}
71
72// Combined into libhidlbase for efficiency.
73// Used as shared library to provide headers for libhidltransport-impl-internal.
74cc_library_static {
75    name: "libhwbinder-impl-internal",
76    include_dirs: [
77        // TODO(b/31559095): get headers from bionic on host
78        "bionic/libc/kernel/android/uapi/",
79        "bionic/libc/kernel/uapi/",
80    ],
81
82    defaults: [
83        "libhwbinder_defaults",
84        "libhwbinder-impl-shared-libs",
85        "hwbinder_pgo",
86        "hwbinder_lto",
87    ],
88    host_supported: true,
89    recovery_available: true,
90    vendor_available: true,
91    // TODO(b/153609531): remove when no longer needed.
92    native_bridge_supported: true,
93    apex_available: [
94        "//apex_available:platform",
95        "com.android.neuralnetworks",
96        "com.android.bluetooth.updatable",
97        "com.android.media",
98        "com.android.media.swcodec",
99        "com.android.tethering",
100    ],
101    min_sdk_version: "29",
102}
103
104// Only libhwbinder_benchmark needs to have pgo enabled. When all places
105// support having PGO selectively enabled, all places can use libhwbinder.
106//
107// http://b/77320844
108cc_library_static {
109    name: "libhwbinder_pgo-impl-internal",
110    defaults: [
111        "libhwbinder_defaults",
112        "libhwbinder-impl-shared-libs",
113        "hwbinder_benchmark_pgo",
114        "hwbinder_lto",
115    ],
116}
117
118// Provide pgo property to build hwbinder with PGO
119cc_defaults {
120    name: "hwbinder_pgo",
121    pgo: {
122        instrumentation: true,
123        profile_file: "hwbinder/hwbinder.profdata",
124        benchmarks: ["hwbinder"],
125        enable_profile_use: true,
126    },
127}
128
129cc_defaults {
130    name: "hwbinder_benchmark_pgo",
131    pgo: {
132        instrumentation: true,
133        profile_file: "hwbinder/hwbinder.profdata",
134        benchmarks: ["hwbinder_benchmark"],
135        enable_profile_use: true,
136    },
137}
138
139// Provide lto property to build hwbinder with LTO
140cc_defaults {
141    name: "hwbinder_lto",
142    target: {
143        android: {
144            lto: {
145                thin: true,
146            },
147        },
148    },
149}
150