Skip to content
Snippets Groups Projects
Commit 0769e709 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Add host support for libbluetooth.so

Bug: 181590011
Tag: #refactor
Test: compile
Change-Id: I9a53eeaac5a5c612d47671bca4f95cf252faeb93
parent a41cd707
No related branches found
No related tags found
No related merge requests found
......@@ -118,9 +118,6 @@ cc_library_static {
"libaaudio",
"libfmq",
],
whole_static_libs: [
"libbt-audio-hal-interface",
],
srcs: ["src/btif_avrcp_audio_track.cc"],
},
host: {
......@@ -130,6 +127,7 @@ cc_library_static {
whole_static_libs: [
"avrcp-target-service",
"lib-bt-packets",
"libbt-audio-hal-interface",
"libaudio-a2dp-hw-utils",
],
cflags: [
......
......@@ -35,12 +35,6 @@
static const size_t BTSNOOP_MEM_BUFFER_SIZE = (256 * 1024);
#endif
// Block size for copying buffers (for compression/encoding etc.)
static const size_t BLOCK_SIZE = 16384;
// Maximum line length in bugreport (should be multiple of 4 for base64 output)
static const uint8_t MAX_LINE_LENGTH = 128;
static std::mutex buffer_mutex;
static ringbuffer_t* buffer = NULL;
static uint64_t last_timestamp_ms = 0;
......@@ -134,6 +128,18 @@ static size_t btsnoop_calculate_packet_length(uint16_t type,
}
}
void btif_debug_btsnoop_init(void) {
if (buffer == NULL) buffer = ringbuffer_init(BTSNOOP_MEM_BUFFER_SIZE);
btsnoop_mem_set_callback(btsnoop_cb);
}
#ifndef OS_ANDROID
void btif_debug_btsnoop_dump(int fd) {}
#else
// Block size for copying buffers (for compression/encoding etc.)
static constexpr size_t BLOCK_SIZE = 16384;
static bool btsnoop_compress(ringbuffer_t* rb_dst, ringbuffer_t* rb_src) {
CHECK(rb_dst != NULL);
CHECK(rb_src != NULL);
......@@ -175,11 +181,6 @@ static bool btsnoop_compress(ringbuffer_t* rb_dst, ringbuffer_t* rb_src) {
return rc;
}
void btif_debug_btsnoop_init(void) {
if (buffer == NULL) buffer = ringbuffer_init(BTSNOOP_MEM_BUFFER_SIZE);
btsnoop_mem_set_callback(btsnoop_cb);
}
void btif_debug_btsnoop_dump(int fd) {
ringbuffer_t* ringbuffer = ringbuffer_init(BTSNOOP_MEM_BUFFER_SIZE);
if (ringbuffer == NULL) {
......@@ -219,6 +220,9 @@ void btif_debug_btsnoop_dump(int fd) {
while (ringbuffer_size(ringbuffer) > 0) {
size_t read = ringbuffer_pop(ringbuffer, b64_in, 3);
// Maximum line length in bugreport (should be multiple of 4 for base64
// output)
constexpr uint8_t MAX_LINE_LENGTH = 128;
if (line_length >= MAX_LINE_LENGTH) {
dprintf(fd, "\n");
line_length = 0;
......@@ -232,3 +236,4 @@ void btif_debug_btsnoop_dump(int fd) {
error:
ringbuffer_free(ringbuffer);
}
#endif
......@@ -36,5 +36,7 @@ void ActivityAttribution::Start() {}
void ActivityAttribution::Stop() {}
const ModuleFactory ActivityAttribution::Factory = ModuleFactory([]() { return new ActivityAttribution(); });
} // namespace activity_attribution
} // namespace bluetooth
......@@ -99,14 +99,10 @@ cc_library_shared {
"android.hardware.bluetooth.audio@2.1",
"android.hardware.bluetooth@1.0",
"android.hardware.bluetooth@1.1",
"android.system.suspend.control-V1-ndk",
"libaaudio",
"libbinder_ndk",
"libcrypto",
"libcutils",
"libdl",
"libflatbuffers-cpp",
"libfmq",
"libhidlbase",
"liblog",
"libprocessgroup",
......@@ -137,6 +133,19 @@ cc_library_shared {
"libosi",
"libbt-protos-lite",
],
target: {
android: {
shared_libs: [
"android.system.suspend.control-V1-ndk",
"libaaudio",
"libfmq",
],
required: [
"libldacBT_enc",
"libldacBT_abr",
],
},
},
// Shared library link options.
// References to global symbols and functions should bind to the library
// itself. This is to avoid issues with some of the unit/system tests
......@@ -146,15 +155,14 @@ cc_library_shared {
required: [
"bt_did.conf",
"bt_stack.conf",
"libldacBT_enc",
"libldacBT_abr",
],
cflags: [
"-DBUILDCFG",
],
sanitize: {
scs: true,
never: true,
},
host_supported: true,
}
cc_library_static {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment