1// Common variables
2// ========================================================
3package {
4    // See: http://go/android-license-faq
5    // A large-scale-change added 'default_applicable_licenses' to import
6    // all of the 'license_kinds' from "system_bt_license"
7    // to get the below license kinds:
8    //   SPDX-license-identifier-Apache-2.0
9    default_applicable_licenses: ["system_bt_license"],
10}
11
12btifCommonIncludes = [
13    "system/bt",
14    "system/bt/bta/include",
15    "system/bt/bta/sys",
16    "system/bt/bta/dm",
17    "system/bt/btcore/include",
18    "system/bt/device/include",
19    "system/bt/internal_include",
20    "system/bt/stack/include",
21    "system/bt/stack/l2cap",
22    "system/bt/stack/a2dp",
23    "system/bt/stack/btm",
24    "system/bt/stack/avdt",
25    "system/bt/udrv/include",
26    "system/bt/btif/avrcp",
27    "system/bt/btif/include",
28    "system/bt/btif/co",
29    "system/bt/hci/include",
30    "system/bt/vnd/include",
31    "system/bt/embdrv/sbc/encoder/include",
32    "system/bt/embdrv/sbc/decoder/include",
33    "system/bt/utils/include",
34    "system/bt/include",
35    "system/libhwbinder/include",
36]
37
38// libbtif static library for target
39// ========================================================
40cc_library_static {
41    name: "libbtif",
42    defaults: ["fluoride_defaults"],
43    include_dirs: btifCommonIncludes,
44    srcs: [
45        // AVRCP Target Service
46        "avrcp/avrcp_service.cc",
47        // Callouts
48        "co/bta_dm_co.cc",
49        "co/bta_av_co.cc",
50        "co/bta_hh_co.cc",
51        "co/bta_pan_co.cc",
52        "co/bta_gatts_co.cc",
53        // HAL layer
54        "src/bluetooth.cc",
55        // BTIF implementation
56        "src/btif_a2dp.cc",
57        "src/btif_a2dp_audio_interface.cc",
58        "src/btif_a2dp_control.cc",
59        "src/btif_a2dp_sink.cc",
60        "src/btif_a2dp_source.cc",
61        "src/btif_activity_attribution.cc",
62        "src/btif_av.cc",
63        "src/btif_ble_advertiser.cc",
64        "src/btif_ble_scanner.cc",
65        "src/btif_bqr.cc",
66        "src/btif_config.cc",
67        "src/btif_config_cache.cc",
68        "src/btif_config_transcode.cc",
69        "src/btif_core.cc",
70        "src/btif_debug.cc",
71        "src/btif_debug_btsnoop.cc",
72        "src/btif_debug_conn.cc",
73        "src/btif_dm.cc",
74        "src/btif_gatt.cc",
75        "src/btif_gatt_client.cc",
76        "src/btif_gatt_server.cc",
77        "src/btif_gatt_test.cc",
78        "src/btif_gatt_util.cc",
79        "src/btif_vc.cc",
80        "src/btif_hearing_aid.cc",
81        "src/btif_hf.cc",
82        "src/btif_hf_client.cc",
83        "src/btif_hh.cc",
84        "src/btif_hd.cc",
85        "src/btif_le_audio.cc",
86        "src/btif_metrics_logging.cc",
87        "src/btif_pan.cc",
88        "src/btif_profile_queue.cc",
89        "src/btif_rc.cc",
90        "src/btif_sdp.cc",
91        "src/btif_sdp_server.cc",
92        "src/btif_sock.cc",
93        "src/btif_sock_rfc.cc",
94        "src/btif_sock_l2cap.cc",
95        "src/btif_sock_sco.cc",
96        "src/btif_sock_sdp.cc",
97        "src/btif_sock_thread.cc",
98        "src/btif_sock_util.cc",
99        "src/btif_storage.cc",
100        "src/btif_uid.cc",
101        "src/btif_util.cc",
102        "src/btif_keystore.cc",
103        "src/stack_manager.cc",
104    ],
105    shared_libs: [
106        "android.hardware.bluetooth.a2dp@1.0",
107        "android.hardware.bluetooth.audio@2.0",
108        "android.hardware.bluetooth.audio@2.1",
109        "libcrypto",
110        "libcutils",
111        "libhidlbase",
112        "liblog",
113        "libtinyxml2",
114        "libutils",
115        "libz",
116    ],
117    target: {
118        android: {
119            shared_libs: [
120                "libaaudio",
121                "libfmq",
122            ],
123            srcs: ["src/btif_avrcp_audio_track.cc"],
124        },
125        host: {
126            srcs: ["src/btif_avrcp_audio_track_linux.cc"],
127        },
128    },
129    whole_static_libs: [
130        "avrcp-target-service",
131        "lib-bt-packets",
132        "libbt-audio-hal-interface",
133        "libaudio-a2dp-hw-utils",
134    ],
135    cflags: [
136        "-DBUILDCFG",
137    ],
138    host_supported: true,
139}
140
141// btif unit tests for target
142// ========================================================
143cc_test {
144    name: "net_test_btif",
145    defaults: ["fluoride_defaults"],
146    test_suites: ["device-tests"],
147    include_dirs: btifCommonIncludes,
148    srcs: [
149        "test/btif_storage_test.cc",
150    ],
151    header_libs: ["libbluetooth_headers"],
152    shared_libs: [
153        "libaaudio",
154        "android.hardware.bluetooth@1.0",
155        "android.hardware.bluetooth@1.1",
156        "android.hardware.bluetooth.a2dp@1.0",
157        "android.hardware.bluetooth.audio@2.0",
158        "android.hardware.bluetooth.audio@2.1",
159        "android.system.suspend.control-V1-ndk",
160        "libbinder_ndk",
161        "libfmq",
162        "libhidlbase",
163        "liblog",
164        "libprotobuf-cpp-lite",
165        "libcutils",
166        "libprocessgroup",
167        "libutils",
168        "libcrypto",
169    ],
170    static_libs: [
171        "libbt-bta",
172        "libbtcore",
173        "libbt-common",
174        "libbt-stack",
175        "libbt-sbc-decoder",
176        "libbt-sbc-encoder",
177        "libbt-utils",
178        "libFraunhoferAAC",
179        "libg722codec",
180        "libbtdevice",
181        "libbt-hci",
182        "libudrv-uipc",
183        "libbluetooth-types",
184        "libosi",
185        "libbt-protos-lite",
186   ],
187    whole_static_libs: [
188        "libbtif",
189        "libbluetooth-for-tests",
190    ],
191    cflags: ["-DBUILDCFG"],
192    sanitize: {
193        integer_overflow: true,
194    },
195}
196
197// btif profile queue unit tests for target
198// ========================================================
199cc_test {
200    name: "net_test_btif_profile_queue",
201    defaults: ["fluoride_defaults"],
202    test_suites: ["device-tests"],
203    include_dirs: btifCommonIncludes,
204    srcs: [
205        "src/btif_profile_queue.cc",
206        "test/btif_profile_queue_test.cc",
207    ],
208    header_libs: ["libbluetooth_headers"],
209    shared_libs: [
210        "liblog",
211        "libcutils",
212    ],
213    static_libs: [
214        "libbluetooth-types",
215        "libosi",
216    ],
217    cflags: ["-DBUILDCFG"],
218}
219
220// btif rc unit tests for target
221// ========================================================
222cc_test {
223    name: "net_test_btif_rc",
224    defaults: ["fluoride_defaults"],
225    test_suites: ["device-tests"],
226    host_supported: true,
227    test_options: {
228        unit_test: true,
229    },
230    include_dirs: btifCommonIncludes,
231    srcs: [
232        "test/btif_rc_test.cc",
233    ],
234    header_libs: ["libbluetooth_headers"],
235    shared_libs: [
236        "libcrypto",
237        "libcutils",
238        "liblog",
239        "libprotobuf-cpp-lite",
240    ],
241    static_libs: [
242        "libbluetooth-types",
243        "libbt-common",
244        "libbt-protos-lite",
245        "libosi",
246        "libosi-AllocationTestHarness",
247    ],
248    cflags: ["-DBUILDCFG"],
249    sanitize: {
250        address: true,
251        cfi: true,
252        misc_undefined: ["bounds"],
253    },
254}
255
256// btif config cache unit tests for target
257// ========================================================
258cc_test {
259    name: "net_test_btif_config_cache",
260    defaults: ["fluoride_defaults"],
261    test_suites: ["device-tests"],
262    host_supported: true,
263    test_options: {
264        unit_test: true,
265    },
266    include_dirs: btifCommonIncludes,
267    srcs: [
268        "src/btif_config_cache.cc",
269        "test/btif_config_cache_test.cc",
270    ],
271    header_libs: ["libbluetooth_headers"],
272    shared_libs: [
273        "liblog",
274        "libcutils",
275    ],
276    static_libs: [
277        "libbluetooth-types",
278        "libosi",
279        "libgmock",
280        "libc++fs",
281    ],
282    cflags: ["-DBUILDCFG"],
283}
284
285// btif hf client service tests for target
286// ========================================================
287cc_test {
288    name: "net_test_btif_hf_client_service",
289    defaults: ["fluoride_defaults"],
290    test_suites: ["device-tests"],
291    include_dirs: btifCommonIncludes,
292    srcs: [
293        "test/btif_hf_client_service_test.cc",
294    ],
295    header_libs: ["libbluetooth_headers"],
296    shared_libs: [
297        "libcutils",
298        "liblog",
299    ],
300    static_libs: [
301        "libbluetooth-types",
302        "libosi",
303    ],
304    cflags: ["-DBUILDCFG"],
305}
306
307// Cycle stack test
308// ========================================================
309cc_test {
310    name: "net_test_btif_stack",
311    host_supported: true,
312    defaults: ["fluoride_defaults"],
313    test_suites: ["device-tests"],
314    include_dirs: [
315        "frameworks/av/media/libaaudio/include",
316        "system/bt",
317        "system/bt/bta/dm",
318        "system/bt/bta/include",
319        "system/bt/bta/sys",
320        "system/bt/btif/avrcp",
321        "system/bt/btif/co",
322        "system/bt/btif/include",
323        "system/bt/device/include",
324        "system/bt/embdrv/sbc/decoder/include",
325        "system/bt/embdrv/sbc/encoder/include",
326        "system/bt/gd",
327        "system/bt/hci/include",
328        "system/bt/include",
329        "system/bt/internal_include",
330        "system/bt/stack/a2dp",
331        "system/bt/stack/avdt",
332        "system/bt/stack/btm",
333        "system/bt/stack/include",
334        "system/bt/stack/l2cap",
335        "system/bt/udrv/include",
336        "system/bt/utils/include",
337        "system/bt/vnd/include",
338        "system/libfmq/include",
339        "system/libhwbinder/include",
340        ],
341      srcs: [
342          ":LibBluetoothSources",
343          ":TestMockAndroidHardware",
344          ":TestMockBta",
345          ":TestMockBtcore",
346          ":TestMockCommon",
347          ":TestMockFrameworks",
348          ":TestMockHci",
349          ":TestMockMainShim",
350          ":TestMockStack",
351          ":TestMockSystemLibfmq",
352          ":TestMockUdrv",
353          "test/btif_stack_test.cc",
354      ],
355      generated_headers: [
356        "BluetoothGeneratedBundlerSchema_h_bfbs",
357        "BluetoothGeneratedDumpsysDataSchema_h",
358        "BluetoothGeneratedDumpsysTestData_h",
359        "BluetoothGeneratedPackets_h",
360      ],
361      header_libs: ["libbluetooth_headers"],
362      shared_libs: [
363          "android.hardware.bluetooth.a2dp@1.0",
364          "android.hardware.bluetooth.audio@2.0",
365          "android.hardware.bluetooth.audio@2.1",
366          "libcrypto",
367          "libcutils",
368          "libflatbuffers-cpp",
369          "libhidlbase",
370          "liblog",
371          "libtinyxml2",
372      ],
373      whole_static_libs: [
374          "libbtif",
375      ],
376      static_libs: [
377          "libbluetooth-types",
378          "libbtdevice",
379          "libgmock",
380          "libosi",
381      ],
382      cflags: ["-DBUILDCFG"],
383}
384