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