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