• 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        "system/bt",
19    ],
20    header_libs: ["libbluetooth_headers"],
21}
22
23// Source variables
24// ========================================================
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.
69// ========================================================
70btserviceBaseTestSrc = [
71    "hal/fake_bluetooth_av_interface.cc",
72    "hal/fake_bluetooth_gatt_interface.cc",
73    "hal/fake_bluetooth_interface.cc",
74    "test/a2dp_sink_unittest.cc",
75    "test/a2dp_source_unittest.cc",
76    "test/adapter_unittest.cc",
77    "test/advertise_data_unittest.cc",
78    "test/fake_hal_util.cc",
79    "test/gatt_client_unittest.cc",
80    "test/gatt_server_unittest.cc",
81    "test/low_energy_advertiser_unittest.cc",
82    "test/low_energy_client_unittest.cc",
83    "test/low_energy_scanner_unittest.cc",
84    "test/settings_unittest.cc",
85]
86
87// Native system service for target
88// ========================================================
89cc_binary {
90    name: "bluetoothtbd",
91    defaults: ["fluoride_service_defaults"],
92    srcs: btserviceBinderDaemonSrc +
93        btserviceLinuxSrc +
94        btserviceDaemonSrc +
95        ["main.cc"],
96    static_libs: [
97        "libbluetooth-binder-common",
98        "libbtcore",
99        "libbluetooth-types",
100        "libosi",
101    ],
102
103    shared_libs: [
104        "libchrome",
105        "libbinder",
106        "libcutils",
107        "liblog",
108        "libutils",
109    ],
110    init_rc: ["bluetoothtbd.rc"],
111}
112
113// Native system service unit tests for target and host
114
115// ========================================================
116cc_test {
117    name: "bluetoothtbd_test",
118    test_suites: ["device-tests"],
119    defaults: ["fluoride_service_defaults"],
120    srcs: btserviceBaseTestSrc +
121        btserviceDaemonSrc + [
122            "test/main.cc",
123        ],
124    aidl: {
125        include_dirs: [
126            "system/bt/service/common",
127            "frameworks/native/aidl/binder",
128        ],
129    },
130    static_libs: [
131        "libbluetooth-common",
132        "libgmock",
133        "liblog",
134        "libbluetooth-types",
135        "libutils",
136    ],
137    shared_libs: [
138        "libchrome",
139    ],
140
141    host_supported: true,
142    test_options: {
143        unit_test: true,
144    },
145    target: {
146        // This includes Binder related tests that can only be run
147        // on target.
148        android: {
149            srcs: btserviceBinderDaemonSrc + [
150                "test/parcelable_unittest.cc",
151                "test/ParcelableTest.aidl",
152            ],
153            static_libs: [
154                "libbluetooth-binder-common",
155            ],
156            shared_libs: [
157                "libbinder",
158            ],
159        },
160        host: {
161            srcs: [
162                "test/stub_ipc_handler_binder.cc",
163            ],
164        },
165        linux_glibc: {
166            srcs: btserviceLinuxSrc + [
167                // TODO(bcf): Fix this test.
168                //"test/ipc_linux_unittest.cc",
169            ],
170        },
171    },
172    sanitize: {
173        cfi: false,
174    },
175}
176
177// Native system service CLI for target
178// ========================================================
179cc_binary {
180    name: "bluetooth-cli",
181    defaults: ["fluoride_defaults"],
182    srcs: ["client/main.cc"],
183    static_libs: [
184        "libbluetooth-binder-common",
185    ],
186    shared_libs: [
187        "libbinder",
188        "libutils",
189    ],
190}
191
192// Heart Rate GATT service example for target
193// ========================================================
194cc_binary {
195    name: "bt-example-hr-server",
196    defaults: ["fluoride_defaults"],
197    local_include_dirs: ["example/heart_rate"],
198    srcs: [
199        "example/heart_rate/heart_rate_server.cc",
200        "example/heart_rate/server_main.cc",
201    ],
202    static_libs: [
203        "libbluetooth-binder-common",
204    ],
205    shared_libs: [
206        "libbinder",
207        "libutils",
208    ],
209}
210
211cc_library_static {
212    name: "libbluetoothtbd_hal",
213    defaults: ["fluoride_defaults"],
214    include_dirs: ["system/bt"],
215    header_libs: ["libbluetooth_headers"],
216    srcs: [
217        "hal/bluetooth_gatt_interface.cc",
218        "hal/bluetooth_interface.cc",
219        "logging_helpers.cc",
220    ],
221}
222