• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "system_bt_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["system_bt_license"],
8}
9
10subdirs = [
11    "common",
12]
13
14cc_defaults {
15    name: "fluoride_service_defaults",
16    defaults: ["fluoride_defaults"],
17    include_dirs: [
18        "packages/modules/Bluetooth/system",
19        "packages/modules/Bluetooth/system/gd",
20    ],
21    header_libs: ["libbluetooth_headers"],
22}
23
24// Source variables
25btserviceDaemonSrc = [
26    "a2dp_sink.cc",
27    "a2dp_source.cc",
28    "adapter.cc",
29    "avrcp_control.cc",
30    "avrcp_target.cc",
31    "daemon.cc",
32    "gatt_client.cc",
33    "gatt_server.cc",
34    "gatt_server_old.cc",
35    "hal/bluetooth_av_interface.cc",
36    "hal/bluetooth_avrcp_interface.cc",
37    "hal/bluetooth_gatt_interface.cc",
38    "hal/bluetooth_interface.cc",
39    "ipc/ipc_handler.cc",
40    "ipc/ipc_manager.cc",
41    "logging_helpers.cc",
42    "low_energy_advertiser.cc",
43    "low_energy_scanner.cc",
44    "low_energy_client.cc",
45    "settings.cc",
46]
47
48btserviceLinuxSrc = [
49    "ipc/ipc_handler_linux.cc",
50    "ipc/linux_ipc_host.cc",
51]
52
53btserviceBinderDaemonSrc = [
54    "ipc/binder/bluetooth_a2dp_sink_binder_server.cc",
55    "ipc/binder/bluetooth_a2dp_source_binder_server.cc",
56    "ipc/binder/bluetooth_avrcp_control_binder_server.cc",
57    "ipc/binder/bluetooth_avrcp_target_binder_server.cc",
58    "ipc/binder/bluetooth_binder_server.cc",
59    "ipc/binder/bluetooth_gatt_client_binder_server.cc",
60    "ipc/binder/bluetooth_gatt_server_binder_server.cc",
61    "ipc/binder/bluetooth_le_advertiser_binder_server.cc",
62    "ipc/binder/bluetooth_le_scanner_binder_server.cc",
63    "ipc/binder/bluetooth_low_energy_binder_server.cc",
64    "ipc/binder/interface_with_instances_base.cc",
65    "ipc/binder/ipc_handler_binder.cc",
66]
67
68// Main unit test sources. These get built for host and target.
69btserviceBaseTestSrc = [
70    "hal/fake_bluetooth_av_interface.cc",
71    "hal/fake_bluetooth_gatt_interface.cc",
72    "hal/fake_bluetooth_interface.cc",
73    "test/a2dp_sink_unittest.cc",
74    "test/a2dp_source_unittest.cc",
75    "test/adapter_unittest.cc",
76    "test/advertise_data_unittest.cc",
77    "test/fake_hal_util.cc",
78    "test/gatt_client_unittest.cc",
79    "test/gatt_server_unittest.cc",
80    "test/low_energy_advertiser_unittest.cc",
81    "test/low_energy_client_unittest.cc",
82    "test/low_energy_scanner_unittest.cc",
83    "test/settings_unittest.cc",
84]
85
86// Native system service for target
87cc_binary {
88    name: "bluetoothtbd",
89    defaults: ["fluoride_service_defaults"],
90    srcs: btserviceBinderDaemonSrc +
91        btserviceLinuxSrc +
92        btserviceDaemonSrc +
93        ["main.cc"],
94    static_libs: [
95        "avrcp-target-service",
96        "libaudio-a2dp-hw-utils",
97        "libbluetooth-binder-common",
98        "libbluetooth-dumpsys",
99        "libbluetooth-types",
100        "libbt-audio-hal-interface",
101        "libbt-bta",
102        "libbt-common",
103        "libbtcore",
104        "libbtdevice",
105        "libbte",
106        "libbt-hci",
107        "libbtif",
108        "lib-bt-packets",
109        "lib-bt-packets-avrcp",
110        "lib-bt-packets-base",
111        "libbt-protos-lite",
112        "libbt-sbc-decoder",
113        "libbt-sbc-encoder",
114        "libbt-stack",
115        "libbt-utils",
116        "libc++fs",
117        "libchrome",
118        "libflatbuffers-cpp",
119        "libFraunhoferAAC",
120        "libg722codec",
121        "liblc3",
122        "libopus",
123        "libosi",
124        "libudrv-uipc",
125    ],
126
127    shared_libs: [
128        "android.hardware.bluetooth@1.0",
129        "android.hardware.bluetooth@1.1",
130        "android.hardware.bluetooth.a2dp@1.0",
131        "android.hardware.bluetooth.audio@2.0",
132        "android.hardware.bluetooth.audio@2.1",
133        "android.system.suspend.control-V1-ndk",
134        "android.system.suspend-V1-ndk",
135        "libaaudio",
136        "libbinder",
137        "libbinder_ndk",
138        "libcrypto",
139        "libcutils",
140        "libfmq",
141        "liblog",
142        "libprocessgroup",
143        "libprotobuf-cpp-lite",
144        "libutils",
145    ],
146    init_rc: ["bluetoothtbd.rc"],
147    target: {
148        android: {
149            shared_libs: [
150                "android.hardware.bluetooth.audio-V2-ndk",
151            ],
152        },
153    },
154}
155
156// Native system service unit tests for target and host
157
158cc_test {
159    name: "bluetoothtbd_test",
160    test_suites: ["device-tests"],
161    defaults: [
162        "fluoride_service_defaults",
163        "mts_defaults",
164    ],
165    srcs: btserviceBaseTestSrc +
166        btserviceDaemonSrc + [
167            "test/main.cc",
168        ],
169    aidl: {
170        include_dirs: [
171            "packages/modules/Bluetooth/system/service/common",
172            "frameworks/native/aidl/binder",
173        ],
174    },
175    static_libs: [
176        "android.hardware.bluetooth.a2dp@1.0",
177        "avrcp-target-service",
178        "libaudio-a2dp-hw-utils",
179        "libbluetooth-common",
180        "libbluetooth-dumpsys",
181        "libbluetooth-types",
182        "libbt-audio-hal-interface",
183        "libbt-bta",
184        "libbt-common",
185        "libbtcore",
186        "libbtdevice",
187        "libbte",
188        "libbt-hci",
189        "libbtif",
190        "lib-bt-packets",
191        "lib-bt-packets-avrcp",
192        "lib-bt-packets-base",
193        "libbt-protos-lite",
194        "libbt-sbc-decoder",
195        "libbt-sbc-encoder",
196        "libbt-stack",
197        "libbt-utils",
198        "libc++fs",
199        "libchrome",
200        "libgmock",
201        "liblog",
202        "libflatbuffers-cpp",
203        "libFraunhoferAAC",
204        "libg722codec",
205        "liblc3",
206        "libopus",
207        "libosi",
208        "libudrv-uipc",
209    ],
210    shared_libs: [
211        "android.hardware.bluetooth@1.0",
212        "android.hardware.bluetooth@1.1",
213        "android.hardware.bluetooth.audio@2.0",
214        "android.hardware.bluetooth.audio@2.1",
215        "libbinder_ndk",
216        "libcrypto",
217        "libfmq",
218        "libprocessgroup",
219        "libprotobuf-cpp-lite",
220    ],
221
222    host_supported: true,
223    test_options: {
224        unit_test: true,
225    },
226    target: {
227        // This includes Binder related tests that can only be run
228        // on target.
229        android: {
230            srcs: btserviceBinderDaemonSrc + [
231                "test/parcelable_unittest.cc",
232                "test/ParcelableTest.aidl",
233            ],
234            static_libs: [
235                "android.system.suspend.control-V1-ndk",
236                "libbluetooth-binder-common",
237            ],
238            shared_libs: [
239                "android.hardware.bluetooth.audio-V2-ndk",
240                "android.system.suspend-V1-ndk",
241                "libbinder",
242                "libvndksupport",
243            ],
244        },
245        host: {
246            srcs: [
247                "test/stub_ipc_handler_binder.cc",
248            ],
249        },
250        host_linux: {
251            srcs: btserviceLinuxSrc + [
252                // TODO(bcf): Fix this test.
253                //"test/ipc_linux_unittest.cc",
254            ],
255        },
256    },
257    sanitize: {
258        cfi: false,
259    },
260}
261
262// Native system service CLI for target
263cc_binary {
264    name: "bluetooth-cli",
265    defaults: ["fluoride_defaults"],
266    srcs: ["client/main.cc"],
267    static_libs: [
268        "libbluetooth-binder-common",
269    ],
270    shared_libs: [
271        "libbinder",
272        "libutils",
273    ],
274}
275
276// Heart Rate GATT service example for target
277cc_binary {
278    name: "bt-example-hr-server",
279    defaults: ["fluoride_defaults"],
280    local_include_dirs: ["example/heart_rate"],
281    srcs: [
282        "example/heart_rate/heart_rate_server.cc",
283        "example/heart_rate/server_main.cc",
284    ],
285    static_libs: [
286        "libbluetooth-binder-common",
287    ],
288    shared_libs: [
289        "libbinder",
290        "libutils",
291    ],
292}
293
294cc_library_static {
295    name: "libbluetoothtbd_hal",
296    defaults: ["fluoride_defaults"],
297    include_dirs: ["packages/modules/Bluetooth/system"],
298    header_libs: ["libbluetooth_headers"],
299    srcs: [
300        "hal/bluetooth_gatt_interface.cc",
301        "hal/bluetooth_interface.cc",
302        "logging_helpers.cc",
303    ],
304}
305