diff options
author | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 14:54:51 +0000 |
---|---|---|
committer | Ricardo Cerqueira <ricardo@cyngn.com> | 2015-11-05 14:54:51 +0000 |
commit | d5fbc46a5628d9c6864313be455422f41dcf9280 (patch) | |
tree | 4463e64014d48a2f3e8d3799e5cc4ab2117a2f1c /hci | |
parent | 795db14c0fdc5f8dedd0763bdb71eb5ce4d3293b (diff) | |
parent | 3ad752f927cbbcf8be4febee076b5d891e925f8c (diff) | |
download | android_system_bt-d5fbc46a5628d9c6864313be455422f41dcf9280.tar.gz android_system_bt-d5fbc46a5628d9c6864313be455422f41dcf9280.tar.bz2 android_system_bt-d5fbc46a5628d9c6864313be455422f41dcf9280.zip |
Merge tag 'android-6.0.0_r26' into cm-13.0
Android 6.0.0 release 26
Conflicts:
audio_a2dp_hw/audio_a2dp_hw.c
btif/co/bta_hh_co.c
btif/src/btif_core.c
btif/src/btif_dm.c
hci/src/btsnoop_net.c
Change-Id: Idc868e4339246f35bc9ac5974c87460bbc6ee3b2
Diffstat (limited to 'hci')
-rw-r--r-- | hci/src/btsnoop_net.c | 11 | ||||
-rw-r--r-- | hci/src/hci_hal_h4.c | 9 | ||||
-rw-r--r-- | hci/src/hci_inject.c | 8 | ||||
-rw-r--r-- | hci/src/low_power_manager.c | 5 |
4 files changed, 31 insertions, 2 deletions
diff --git a/hci/src/btsnoop_net.c b/hci/src/btsnoop_net.c index 8c69b6732..077a4d432 100644 --- a/hci/src/btsnoop_net.c +++ b/hci/src/btsnoop_net.c @@ -77,6 +77,10 @@ static int local_socket_create(void) { } void btsnoop_net_open() { +#if (!defined(BT_NET_DEBUG) || (BT_NET_DEBUG != TRUE)) + return; // Disable using network sockets for security reasons +#endif + listen_thread_valid_ = (pthread_create(&listen_thread_, NULL, listen_fn_, NULL) == 0); if (!listen_thread_valid_) { LOG_ERROR("%s pthread_create failed: %s", __func__, strerror(errno)); @@ -86,6 +90,10 @@ void btsnoop_net_open() { } void btsnoop_net_close() { +#if (!defined(BT_NET_DEBUG) || (BT_NET_DEBUG != TRUE)) + return; // Disable using network sockets for security reasons +#endif + if (listen_thread_valid_) { shutdown(listen_socket_, SHUT_RDWR); shutdown(listen_socket_local_, SHUT_RDWR); @@ -97,6 +105,9 @@ void btsnoop_net_close() { void btsnoop_net_write(const void *data, size_t length) { ssize_t ret; +#if (!defined(BT_NET_DEBUG) || (BT_NET_DEBUG != TRUE)) + return; // Disable using network sockets for security reasons +#endif pthread_mutex_lock(&client_socket_lock_); if (client_socket_btsnoop != -1) { diff --git a/hci/src/hci_hal_h4.c b/hci/src/hci_hal_h4.c index 0a9333ced..1a5734e4b 100644 --- a/hci/src/hci_hal_h4.c +++ b/hci/src/hci_hal_h4.c @@ -27,10 +27,15 @@ #include "osi/include/osi.h" #include "osi/include/log.h" #include "osi/include/reactor.h" +#include "osi/include/thread.h" #include "vendor.h" #define HCI_HAL_SERIAL_BUFFER_SIZE 1026 +// Increased HCI thread priority to keep up with the audio sub-system +// when streaming time sensitive data (A2DP). +#define HCI_THREAD_PRIORITY -19 + // Our interface and modules we import static const hci_hal_t interface; static const hci_hal_callbacks_t *callbacks; @@ -83,6 +88,10 @@ static bool hal_open() { stream_has_interpretation = false; eager_reader_register(uart_stream, thread_get_reactor(thread), event_uart_has_bytes, NULL); + // Raise thread priorities to keep up with audio + thread_set_priority(thread, HCI_THREAD_PRIORITY); + thread_set_priority(eager_reader_get_read_thread(uart_stream), HCI_THREAD_PRIORITY); + return true; error: diff --git a/hci/src/hci_inject.c b/hci/src/hci_inject.c index a17a3d3b7..8ba5f989a 100644 --- a/hci/src/hci_inject.c +++ b/hci/src/hci_inject.c @@ -61,6 +61,10 @@ static void read_ready(socket_t *socket, void *context); static void client_free(void *ptr); bool hci_inject_open(const hci_t *hci_interface) { +#if (!defined(BT_NET_DEBUG) || (BT_NET_DEBUG != TRUE)) + return true; // Disable using network sockets for security reasons +#endif + assert(listen_socket == NULL); assert(thread == NULL); assert(clients == NULL); @@ -92,6 +96,10 @@ error:; } void hci_inject_close(void) { +#if (!defined(BT_NET_DEBUG) || (BT_NET_DEBUG != TRUE)) + return; // Disable using network sockets for security reasons +#endif + socket_free(listen_socket); list_free(clients); thread_free(thread); diff --git a/hci/src/low_power_manager.c b/hci/src/low_power_manager.c index 9435e4fe1..00d0fae53 100644 --- a/hci/src/low_power_manager.c +++ b/hci/src/low_power_manager.c @@ -79,7 +79,6 @@ static void init(thread_t *post_thread) { thread = post_thread; vendor->set_callback(VENDOR_SET_LPM_MODE, vendor_enable_disable_callback); - vendor->send_command(VENDOR_GET_LPM_IDLE_TIMEOUT, &idle_timeout_ms); idle_alarm = alarm_new(); if (!idle_alarm) { @@ -121,7 +120,7 @@ static void wake_assert() { static void transmit_done() { transmit_is_done = true; - if (wake_state == LPM_WAKE_W4_TX_DONE) { + if (wake_state == LPM_WAKE_W4_TX_DONE || wake_state == LPM_WAKE_ASSERTED) { wake_state = LPM_WAKE_W4_TIMEOUT; start_idle_timer(); } @@ -147,6 +146,8 @@ static void enable(bool enable) { } else { uint8_t command = enable ? BT_VND_LPM_ENABLE : BT_VND_LPM_DISABLE; state = enable ? LPM_ENABLING : LPM_DISABLING; + if (state == LPM_ENABLING) + vendor->send_command(VENDOR_GET_LPM_IDLE_TIMEOUT, &idle_timeout_ms); vendor->send_async_command(VENDOR_SET_LPM_MODE, &command); } } |