• 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    //   SPDX-license-identifier-MIT
8    default_applicable_licenses: ["system_bt_license"],
9}
10
11cc_defaults {
12    name: "fluoride_osi_defaults",
13    defaults: ["fluoride_defaults"],
14    include_dirs: [
15        "packages/modules/Bluetooth/system",
16        "packages/modules/Bluetooth/system/gd",
17        "packages/modules/Bluetooth/system/stack/include",
18    ],
19}
20
21filegroup {
22    name: "OsiCompatSources",
23    srcs: [
24        "src/compat.cc",
25    ],
26}
27
28// libosi static library for target
29cc_library_static {
30    name: "libosi",
31    visibility: [
32        "//packages/apps/Test/connectivity/sl4n",
33        "//packages/modules/Bluetooth:__subpackages__",
34    ],
35    export_include_dirs: [
36        "include",
37    ],
38    local_include_dirs: [
39        "include_internal",
40    ],
41    defaults: [
42        "fluoride_defaults",
43        "fluoride_osi_defaults",
44    ],
45    whole_static_libs: [
46        "bluetooth_flags_c_lib",
47    ],
48    // TODO(mcchou): Remove socket_utils sources after platform specific
49    // dependencies are abstracted.
50    srcs: [
51        ":OsiCompatSources",
52        "src/alarm.cc",
53        "src/allocator.cc",
54        "src/config.cc",
55        "src/fixed_queue.cc",
56        "src/future.cc",
57        "src/hash_map_utils.cc",
58        "src/list.cc",
59        "src/mutex.cc",
60        "src/properties.cc",
61        "src/reactor.cc",
62        "src/ringbuffer.cc",
63        "src/socket.cc",
64        "src/socket_utils/socket_local_client.cc",
65        "src/socket_utils/socket_local_server.cc",
66        "src/stack_power_telemetry.cc",
67        "src/thread.cc",
68        "src/thread_scheduler.cc",
69        "src/wakelock.cc",
70
71        // internal source that should not be used outside of libosi
72        "src/internal/semaphore.cc",
73    ],
74    host_supported: true,
75    // TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
76    // should be compatible for a Linux host OS. We should figure out what to do for
77    // a non-Linux host OS.
78    target: {
79        host_linux: {
80            cflags: [
81                "-D_GNU_SOURCE",
82            ],
83        },
84    },
85    cflags: [
86        "-DLIB_OSI_INTERNAL",
87    ],
88    min_sdk_version: "Tiramisu",
89    apex_available: [
90        "com.android.btservices",
91    ],
92    header_libs: ["libbluetooth_headers"],
93    static_libs: [
94        "libaconfig_storage_read_api_cc",
95        "libbluetooth_log",
96        "libbt-platform-protos-lite",
97        "libbt_shim_bridge",
98        "server_configurable_flags",
99    ],
100}
101
102// libosi unit tests for target and host
103cc_test {
104    name: "net_test_osi",
105    test_suites: ["general-tests"],
106    defaults: [
107        "fluoride_osi_defaults",
108        "mts_defaults",
109    ],
110    host_supported: true,
111    srcs: [
112        "test/alarm_test.cc",
113        "test/allocator_test.cc",
114        "test/config_test.cc",
115        "test/fixed_queue_test.cc",
116        "test/future_test.cc",
117        "test/hash_map_utils_test.cc",
118        "test/list_test.cc",
119        "test/properties_test.cc",
120        "test/reactor_test.cc",
121        "test/ringbuffer_test.cc",
122        "test/stack_power_telemetry_test.cc",
123        "test/thread_test.cc",
124        "test/wakelock_test.cc", // test internal sources only used inside the libosi
125
126        "test/internal/semaphore_test.cc",
127    ],
128    shared_libs: [
129        "libaconfig_storage_read_api_cc",
130        "libbase",
131        "libcrypto",
132        "libcutils",
133        "liblog",
134        "server_configurable_flags",
135    ],
136    local_include_dirs: [
137        "include_internal",
138        "test",
139    ],
140    static_libs: [
141        "libbluetooth-types",
142        "libbluetooth_crypto_toolbox",
143        "libbluetooth_gd",
144        "libbluetooth_log",
145        "libbt-common",
146        "libbt_shim_bridge",
147        "libbt_shim_ffi",
148        "libchrome",
149        "libevent",
150        "libgmock",
151        "libosi",
152        "libprotobuf-cpp-lite",
153        "libstatslog_bt",
154    ],
155    target: {
156        android: {
157            shared_libs: [
158                "libstatssocket",
159            ],
160        },
161    },
162    cflags: [
163        "-DLIB_OSI_INTERNAL",
164        "-Wno-unused-parameter",
165    ],
166    sanitize: {
167        address: true,
168        cfi: false,
169    },
170    header_libs: ["libbluetooth_headers"],
171}
172