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