1// Copyright (C) 2016 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    default_applicable_licenses: ["system_libhidl_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22    name: "system_libhidl_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26    ],
27    license_text: [
28        "NOTICE",
29    ],
30}
31
32cc_defaults {
33    name: "libhidl-defaults",
34    cflags: [
35        "-Wall",
36        "-Wdocumentation", // since some users use this
37        "-Werror",
38        "-Wextra-semi",
39    ],
40}
41
42phony {
43    name: "libhidl",
44    required: [
45        "libhidlbase",
46    ],
47}
48
49cc_library_headers {
50    name: "libhidl_gtest_helper",
51    export_include_dirs: ["gtest_helper"],
52}
53
54cc_test {
55    name: "libhidl_test",
56    host_supported: true,
57    defaults: ["libhidl-defaults"],
58    gtest: false,
59    srcs: ["test_main.cpp"],
60    test_suites: ["device-tests"],
61
62    shared_libs: [
63        "android.hidl.memory@1.0",
64        "libbase",
65        "libhidlbase",
66        "liblog",
67        "libutils",
68        "libcutils",
69    ],
70    static_libs: [
71        "libgtest",
72        "libgmock",
73    ],
74
75    cflags: [
76        "-O0",
77        "-g",
78    ],
79}
80
81cc_library {
82    name: "libhidlbase",
83    defaults: ["libhidlbase-combined-impl"],
84    host_supported: true,
85    // TODO(b/153609531): remove when no longer needed.
86    native_bridge_supported: true,
87    recovery_available: true,
88    vendor_available: true,
89    product_available: true,
90    apex_available: [
91        // TODO(b/137948090): not fully supported in APEX for certain usecases
92        // - large dependency sizes
93        // - VINTF manifest cannot be read from APEX
94        // - no testing story/infra for deprecation schedule
95        "//apex_available:platform",
96        "com.android.neuralnetworks",
97        "test_com.android.neuralnetworks",
98        "com.android.bluetooth.updatable",
99        "com.android.media",
100        "com.android.media.swcodec",
101        "com.android.tethering",
102    ],
103    vndk: {
104        enabled: true,
105        support_system_process: true,
106    },
107    whole_static_libs: [
108        "libhwbinder-impl-internal",
109    ],
110    min_sdk_version: "29",
111}
112
113// Only libhwbinder_benchmark needs to have pgo enabled. When all places
114// support having PGO selectively enabled, all places can use libhwbinder.
115//
116// http://b/77320844
117cc_library {
118    name: "libhidlbase_pgo",
119    defaults: [
120        "libhidlbase-combined-impl",
121        "hwbinder_benchmark_pgo",
122    ],
123    whole_static_libs: [
124        "libhwbinder_pgo-impl-internal",
125    ],
126
127    visibility: ["//system/libhwbinder:__subpackages__"],
128}
129
130// WARNING: deprecated
131// This library is no longer required, and dependencies should be taken on libhidlbase instead.
132// This is automatically removed by bpfix. Once there are no makefiles, fixes can be automatically applied, and this can be removed.
133cc_library {
134    name: "libhidltransport",
135    vendor_available: true,
136
137    visibility: [
138        ":__subpackages__",
139        "//hardware:__subpackages__",
140        "//test/sts:__subpackages__",
141        "//vendor:__subpackages__",
142    ],
143}
144
145cc_defaults {
146    name: "libhidlbase-combined-impl",
147
148    defaults: [
149        "hidl-module-defaults",
150        "libhidl-defaults",
151        "libhwbinder-impl-shared-libs",
152    ],
153
154    shared_libs: [
155        "libbase",
156        "liblog",
157        "libutils",
158        "libcutils",
159    ],
160    export_shared_lib_headers: [
161        "libcutils", // for native_handle.h
162        "libutils",
163    ],
164    static_libs: [
165        "libhwbinder-impl-internal",
166    ],
167
168    target: {
169        android: {
170            shared_libs: [
171                "libvndksupport",
172            ],
173        },
174        recovery: {
175            exclude_shared_libs: [
176                "libvndksupport",
177            ],
178        },
179    },
180
181    export_include_dirs: [
182        "base/include",
183        "transport/include",
184    ],
185
186    header_libs: [
187        "libfmq-base",
188    ],
189    export_header_lib_headers: [
190        "libfmq-base",
191    ],
192
193    generated_sources: [
194        "android.hidl.manager@1.0_genc++",
195        "android.hidl.manager@1.1_genc++",
196        "android.hidl.manager@1.2_genc++",
197        "android.hidl.base@1.0_genc++",
198    ],
199    generated_headers: [
200        "android.hidl.manager@1.0_genc++_headers",
201        "android.hidl.manager@1.1_genc++_headers",
202        "android.hidl.manager@1.2_genc++_headers",
203        "android.hidl.base@1.0_genc++_headers",
204    ],
205    export_generated_headers: [
206        "android.hidl.manager@1.0_genc++_headers",
207        "android.hidl.manager@1.1_genc++_headers",
208        "android.hidl.manager@1.2_genc++_headers",
209        "android.hidl.base@1.0_genc++_headers",
210    ],
211
212    srcs: [
213        "base/HidlInternal.cpp",
214        "base/HidlSupport.cpp",
215        "base/Status.cpp",
216        "base/TaskRunner.cpp",
217        "transport/HidlBinderSupport.cpp",
218        "transport/HidlLazyUtils.cpp",
219        "transport/HidlPassthroughSupport.cpp",
220        "transport/HidlTransportSupport.cpp",
221        "transport/HidlTransportUtils.cpp",
222        "transport/LegacySupport.cpp",
223        "transport/ServiceManagement.cpp",
224        "transport/Static.cpp",
225    ],
226
227    product_variables: {
228        debuggable: {
229            cflags: ["-DLIBHIDL_TARGET_DEBUGGABLE"],
230        },
231        enforce_vintf_manifest: {
232            cflags: ["-DENFORCE_VINTF_MANIFEST"],
233        },
234    },
235
236    sanitize: {
237        misc_undefined: ["integer"],
238    },
239}
240