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