1// Bluetooth main HW module / shared library for target
2package {
3    // See: http://go/android-license-faq
4    // A large-scale-change added 'default_applicable_licenses' to import
5    // all of the 'license_kinds' from "system_bt_license"
6    // to get the below license kinds:
7    //   SPDX-license-identifier-Apache-2.0
8    default_applicable_licenses: ["system_bt_license"],
9}
10
11filegroup {
12    name: "LibBluetoothSources",
13    srcs: [
14        "stack_config.cc",
15    ],
16}
17
18cc_library_static {
19    name: "libbte",
20    defaults: ["fluoride_defaults"],
21    srcs: [
22        ":BluetoothStackManagerSources",
23        ":LibBluetoothShimSources",
24        ":LibBluetoothSources",
25    ],
26    include_dirs: [
27        "hardware/interfaces/keymaster/4.0/support/include",
28        "packages/modules/Bluetooth/system",
29        "packages/modules/Bluetooth/system/bta/dm",
30        "packages/modules/Bluetooth/system/bta/include",
31        "packages/modules/Bluetooth/system/bta/sys",
32        "packages/modules/Bluetooth/system/btif/co",
33        "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include",
34        "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include",
35        "packages/modules/Bluetooth/system/gd",
36        "packages/modules/Bluetooth/system/stack/a2dp",
37        "packages/modules/Bluetooth/system/stack/avdt",
38        "packages/modules/Bluetooth/system/stack/btm",
39        "packages/modules/Bluetooth/system/stack/include",
40        "packages/modules/Bluetooth/system/stack/l2cap",
41        "packages/modules/Bluetooth/system/udrv/include",
42        "system/security/keystore/include",
43    ],
44    apex_available: [
45        "com.android.btservices",
46    ],
47    host_supported: true,
48    min_sdk_version: "Tiramisu",
49    static_libs: [
50        "bluetooth_flags_c_lib",
51        "libbluetooth_gd",
52        "libbluetooth_log",
53        "libbt-platform-protos-lite",
54        "libcom.android.sysprop.bluetooth.wrapped",
55    ],
56    header_libs: ["libbluetooth_headers"],
57}
58
59cc_library {
60    name: "libbluetooth",
61    visibility: [
62        "//cts/hostsidetests:__subpackages__",
63        "//packages/modules/Bluetooth:__subpackages__",
64    ],
65    defaults: ["fluoride_defaults"],
66    header_libs: ["libbluetooth_headers"],
67    export_header_lib_headers: ["libbluetooth_headers"],
68    include_dirs: [
69        "hardware/interfaces/keymaster/4.0/support/include",
70        "packages/modules/Bluetooth/system",
71        "packages/modules/Bluetooth/system/bta/dm",
72        "packages/modules/Bluetooth/system/bta/include",
73        "packages/modules/Bluetooth/system/bta/sys",
74        "packages/modules/Bluetooth/system/btif/co",
75        "packages/modules/Bluetooth/system/embdrv/sbc/decoder/include",
76        "packages/modules/Bluetooth/system/embdrv/sbc/encoder/include",
77        "packages/modules/Bluetooth/system/stack/a2dp",
78        "packages/modules/Bluetooth/system/stack/avdt",
79        "packages/modules/Bluetooth/system/stack/btm",
80        "packages/modules/Bluetooth/system/stack/include",
81        "packages/modules/Bluetooth/system/stack/l2cap",
82        "packages/modules/Bluetooth/system/udrv/include",
83        "system/security/keystore/include",
84    ],
85    shared_libs: [
86        "[email protected]",
87        "[email protected]",
88    ],
89    target: {
90        android: {
91            shared_libs: [
92                "libstatssocket",
93            ],
94        },
95    },
96    // Shared library link options.
97    // References to global symbols and functions should bind to the library
98    // itself. This is to avoid issues with some of the unit/system tests
99    // that might link statically with some of the code in the library, and
100    // also dlopen(3) the shared library.
101    ldflags: ["-Wl,-Bsymbolic,-Bsymbolic-functions"],
102    sanitize: {
103        scs: true,
104    },
105    apex_available: [
106        "com.android.btservices",
107    ],
108    host_supported: true,
109    min_sdk_version: "30",
110}
111
112cc_library_static {
113    name: "libbluetooth-for-tests",
114    defaults: ["fluoride_defaults"],
115
116    srcs: [
117        ":BluetoothStackManagerSources",
118        ":LibBluetoothShimSources",
119        ":LibBluetoothSources",
120    ],
121    host_supported: true,
122    include_dirs: [
123        "packages/modules/Bluetooth/system",
124        "packages/modules/Bluetooth/system/bta/include",
125        "packages/modules/Bluetooth/system/gd",
126        "packages/modules/Bluetooth/system/stack/include",
127    ],
128    whole_static_libs: [
129        "libbluetooth_gd", // Gabeldorsche
130    ],
131    header_libs: ["libbluetooth_headers"],
132    static_libs: [
133        "bluetooth_flags_c_lib",
134        "libbluetooth_log",
135        "libbt-platform-protos-lite",
136        "libcom.android.sysprop.bluetooth.wrapped",
137    ],
138}
139
140cc_test {
141    name: "net_test_main_shim",
142    test_suites: ["general-tests"],
143    host_supported: true,
144    test_options: {
145        unit_test: true,
146    },
147    defaults: [
148        "fluoride_defaults",
149        "mts_defaults",
150    ],
151    include_dirs: [
152        "packages/modules/Bluetooth/system",
153        "packages/modules/Bluetooth/system/gd",
154        "packages/modules/Bluetooth/system/stack/btm",
155        "packages/modules/Bluetooth/system/stack/include",
156    ],
157    srcs: [
158        ":BluetoothOsSources_host",
159        ":TestCommonMainHandler",
160        ":TestCommonMockFunctions",
161        ":TestFakeOsi",
162        ":TestMockBta",
163        ":TestMockBtif",
164        ":TestMockBtu",
165        ":TestMockJni",
166        ":TestMockLegacyHciCommands",
167        ":TestMockLegacyHciInterface",
168        ":TestMockMainShimEntry",
169        ":TestMockStack",
170        "shim/acl.cc",
171        "shim/acl_api.cc",
172        "shim/acl_interface.cc",
173        "shim/btm_api.cc",
174        "shim/config.cc",
175        "shim/distance_measurement_manager.cc",
176        "shim/dumpsys.cc",
177        "shim/hci_layer.cc",
178        "shim/le_advertising_manager.cc",
179        "shim/le_scanning_manager.cc",
180        "shim/metric_id_api.cc",
181        "shim/metrics_api.cc",
182        "shim/shim.cc",
183        "shim/stack.cc",
184        "shim/utils.cc",
185        "test/common_stack_test.cc",
186        "test/main_shim_dumpsys_test.cc",
187        "test/main_shim_test.cc",
188    ],
189    static_libs: [
190        "bluetooth_flags_c_lib_for_test",
191        "libbase",
192        "libbluetooth-types",
193        "libbluetooth_core_rs_bridge",
194        "libbluetooth_crypto_toolbox",
195        "libbluetooth_gd",
196        "libbluetooth_hci_pdl",
197        "libbluetooth_log",
198        "libbt-common",
199        "libbt-platform-protos-lite",
200        "libbtdevice",
201        "libchrome",
202        "libcom.android.sysprop.bluetooth.wrapped",
203        "libevent",
204        "libflatbuffers-cpp",
205        "libgmock",
206        "liblog",
207        "libosi",
208    ],
209    aidl: {
210        libs: ["bluetooth_constants"],
211    },
212    shared_libs: [
213        "libPlatformProperties",
214        "libaconfig_storage_read_api_cc",
215        "libbinder",
216        "libbinder_ndk",
217        "libcrypto",
218        "server_configurable_flags",
219    ],
220    sanitize: {
221        address: true,
222        all_undefined: true,
223        cfi: true,
224        integer_overflow: true,
225        scs: true,
226        diag: {
227            undefined: true,
228        },
229    },
230    min_sdk_version: "Tiramisu",
231    header_libs: ["libbluetooth_headers"],
232}
233