diff options
author | Steve Kondik <steve@cyngn.com> | 2016-03-11 04:05:26 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-03-11 17:01:09 -0800 |
commit | 718ba0bd6de6a0f4b8c63f0146f8978981eb5cb4 (patch) | |
tree | abf1ab9ce750848bcdb65ecf200676f9e1fec00e | |
parent | 775a7bab3bde0cf64b638100a5b40b22d421bb88 (diff) | |
parent | 04e4c5498beb89f54251dbbda6c83622372bd979 (diff) | |
download | android_system_bt-718ba0bd6de6a0f4b8c63f0146f8978981eb5cb4.tar.gz android_system_bt-718ba0bd6de6a0f4b8c63f0146f8978981eb5cb4.tar.bz2 android_system_bt-718ba0bd6de6a0f4b8c63f0146f8978981eb5cb4.zip |
Merge tag 'android-6.0.1_r22' of https://android.googlesource.com/platform/system/bt into cm-13.0staging/cm-13.0+r22
Android 6.0.1 release 22
Change-Id: I2e682780163afc7e9c88865192a6342027c80586
-rw-r--r-- | bta/hf_client/bta_hf_client_main.c | 6 | ||||
-rw-r--r-- | btif/src/btif_config.c | 14 | ||||
-rw-r--r-- | btif/src/btif_dm.c | 10 | ||||
-rw-r--r-- | btif/src/btif_hf.c | 2 | ||||
-rw-r--r-- | btif/src/btif_media_task.c | 8 | ||||
-rw-r--r-- | btif/src/btif_rc.c | 3 | ||||
-rw-r--r-- | device/include/interop.h | 4 | ||||
-rw-r--r-- | device/include/interop_database.h | 32 | ||||
-rw-r--r-- | device/src/interop.c | 1 | ||||
-rw-r--r-- | stack/btm/btm_acl.c | 1 | ||||
-rw-r--r-- | stack/btm/btm_dev.c | 4 | ||||
-rw-r--r-- | stack/rfcomm/rfc_mx_fsm.c | 1 |
12 files changed, 76 insertions, 10 deletions
diff --git a/bta/hf_client/bta_hf_client_main.c b/bta/hf_client/bta_hf_client_main.c index f5244b78c..4c01e47cf 100644 --- a/bta/hf_client/bta_hf_client_main.c +++ b/bta/hf_client/bta_hf_client_main.c @@ -573,7 +573,8 @@ void bta_hf_client_slc_seq(BOOLEAN error) break; case BTA_HF_CLIENT_AT_BRSF: - if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_CODEC) + if ((bta_hf_client_cb.scb.features & BTA_HF_CLIENT_FEAT_CODEC) + && (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_CODEC)) { bta_hf_client_send_at_bac(); break; @@ -595,7 +596,8 @@ void bta_hf_client_slc_seq(BOOLEAN error) break; case BTA_HF_CLIENT_AT_CMER: - if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_FEAT_3WAY) + if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_FEAT_3WAY + && bta_hf_client_cb.scb.features & BTA_HF_CLIENT_FEAT_3WAY) { bta_hf_client_send_at_chld('?', 0); } diff --git a/btif/src/btif_config.c b/btif/src/btif_config.c index e3fb16b53..325c54028 100644 --- a/btif/src/btif_config.c +++ b/btif/src/btif_config.c @@ -27,6 +27,7 @@ #include "osi/include/alarm.h" #include "osi/include/allocator.h" #include "btcore/include/bdaddr.h" +#include "btif_common.h" #include "btif_config.h" #include "btif_config_transcode.h" #include "btif_util.h" @@ -44,7 +45,7 @@ static const char *LEGACY_CONFIG_FILE_PATH = "/data/misc/bluedroid/bt_config.xml static const period_ms_t CONFIG_SETTLE_PERIOD_MS = 3000; static void timer_config_save_cb(void *data); -static void btif_config_write(void); +static void btif_config_write(UINT16 event, char *p_param); static void btif_config_devcache_cleanup(void); // TODO(zachoverflow): Move these two functions out, because they are too specific for this file @@ -360,8 +361,10 @@ void btif_config_flush(void) { alarm_cancel(alarm_timer); + btif_config_write(0, NULL); + pthread_mutex_lock(&lock); config_flush(CONFIG_FILE_PATH); - btif_config_write(); + pthread_mutex_unlock(&lock); } int btif_config_clear(void){ @@ -385,10 +388,13 @@ int btif_config_clear(void){ } static void timer_config_save_cb(UNUSED_ATTR void *data) { - btif_config_write(); + // Moving file I/O to btif context instead of timer callback because + // it usually takes a lot of time to be completed, introducing + // delays during A2DP playback causing blips or choppiness. + btif_transfer_context(btif_config_write, 0, NULL, 0, NULL); } -static void btif_config_write(void) { +static void btif_config_write(UNUSED_ATTR UINT16 event, UNUSED_ATTR char *p_param) { assert(config != NULL); assert(alarm_timer != NULL); diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c index 836a15009..69e9bf52c 100644 --- a/btif/src/btif_dm.c +++ b/btif/src/btif_dm.c @@ -1242,6 +1242,16 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) } } + // We could have received a new link key without going through the pairing flow. + // If so, we don't want to perform SDP or any other operations on the authenticated + // device. + if (!bdaddr_equals(p_auth_cmpl->bd_addr, pairing_cb.bd_addr)) { + char address[32]; + bdaddr_to_string(&p_auth_cmpl->bd_addr, address, sizeof(address)); + LOG_INFO("%s skipping SDP since we did not initiate pairing to %s.", __func__, address); + return; + } + // Skip SDP for certain HID Devices if (p_auth_cmpl->success) { diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c index 1d956a393..43707adfc 100644 --- a/btif/src/btif_hf.c +++ b/btif/src/btif_hf.c @@ -1162,7 +1162,7 @@ static bt_status_t cops_response(const char *cops, bt_bdaddr_t *bd_addr) tBTA_AG_RES_DATA ag_res; /* Format the response */ - sprintf (ag_res.str, "0,0,\"%s\"", cops); + sprintf (ag_res.str, "0,0,\"%.16s\"", cops); ag_res.ok_flag = BTA_AG_OK_DONE; BTA_AgResult (btif_hf_cb[idx].handle, BTA_AG_COPS_RES, &ag_res); diff --git a/btif/src/btif_media_task.c b/btif/src/btif_media_task.c index 5596e005b..9fbcfbdf8 100644 --- a/btif/src/btif_media_task.c +++ b/btif/src/btif_media_task.c @@ -2491,6 +2491,11 @@ static void btif_media_task_aa_start_tx(void) APPL_TRACE_IMP("btif_media_task_aa_start_tx is timer %d, feeding mode %d", btif_media_cb.is_tx_timer, btif_media_cb.feeding_mode); + if (btif_media_cb.is_tx_timer) { + LOG_WARN(LOG_TAG, "%s media alarm already running", __func__); + return; + } + /* Use a timer to poll the UIPC, get rid of the UIPC call back */ // UIPC_Ioctl(UIPC_CH_ID_AV_AUDIO, UIPC_REG_CBACK, NULL); @@ -2512,7 +2517,8 @@ static void btif_media_task_aa_start_tx(void) return; } - alarm_set_periodic(btif_media_cb.media_alarm, BTIF_MEDIA_TIME_TICK, btif_media_task_alarm_cb, NULL); + alarm_set_periodic(btif_media_cb.media_alarm, BTIF_MEDIA_TIME_TICK, + btif_media_task_alarm_cb, NULL); #endif } diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c index 2bc4af767..4a83c269d 100644 --- a/btif/src/btif_rc.c +++ b/btif/src/btif_rc.c @@ -41,6 +41,7 @@ #include "btif_util.h" #include "btif_av.h" #include "hardware/bt_rc.h" +#include "device/include/interop.h" #include "uinput.h" #include "bdaddr.h" @@ -559,6 +560,8 @@ static BOOLEAN btif_rc_get_connection_state() int clients; for (clients = 0; clients < btif_max_rc_clients; clients++) + if ( (btif_rc_cb[clients].rc_features & BTA_AV_FEAT_ADV_CTRL) && + (btif_rc_cb[clients].rc_features & BTA_AV_FEAT_RCTG)) { if (btif_rc_cb[clients].rc_connected == TRUE) { diff --git a/device/include/interop.h b/device/include/interop.h index 8391b4942..48aaf9066 100644 --- a/device/include/interop.h +++ b/device/include/interop.h @@ -58,6 +58,10 @@ typedef enum { //Few carkits take long time to start sending AT commands //Increase AG_CONN TIMEOUT so that AG connection go through INTEROP_INCREASE_AG_CONN_TIMEOUT, + // Devices requiring this workaround do not handle Bluetooth Absolute Volume + // control correctly, leading to undesirable (potentially harmful) volume levels + // or general lack of controlability. + INTEROP_DISABLE_ABSOLUTE_VOLUME } interop_feature_t; // Check if a given |addr| matches a known interoperability workaround as identified diff --git a/device/include/interop_database.h b/device/include/interop_database.h index a0bdae756..c044db194 100644 --- a/device/include/interop_database.h +++ b/device/include/interop_database.h @@ -59,6 +59,38 @@ static const interop_addr_t interop_addr_database[] = { // BMW car kits (Harman/Becker) {{0x9c, 0xdf, 0x03, 0,0,0}, 3, INTEROP_AUTO_RETRY_PAIRING}, + // Ausdom M05 - unacceptably loud volume + {{0xa0, 0xe9, 0xdb, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // iKross IKBT83B HS - unacceptably loud volume + {{0x00, 0x14, 0x02, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // Jabra EXTREAM2 - unacceptably loud volume + {{0x1c, 0x48, 0xf9, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // JayBird BlueBuds X - low granularity on volume control + {{0x44, 0x5e, 0xf3, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + {{0xd4, 0x9c, 0x28, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // LG Tone HBS-730 - unacceptably loud volume + {{0x00, 0x18, 0x6b, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + {{0xb8, 0xad, 0x3e, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // LG Tone HV-800 - unacceptably loud volume + {{0xa0, 0xe9, 0xdb, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // Mpow Cheetah - unacceptably loud volume + {{0x00, 0x11, 0xb1, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // SOL REPUBLIC Tracks Air - unable to adjust volume back off from max + {{0xa4, 0x15, 0x66, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // Swage Rokitboost HS - unacceptably loud volume + {{0x00, 0x14, 0xf1, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + + // VW Car Kit - not enough granularity with volume + {{0x00, 0x26, 0x7e, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME}, + // Apple Magic Mouse {{0x04, 0x0C, 0xCE, 0,0,0}, 3, INTEROP_DISABLE_SDP_AFTER_PAIRING}, // Bluetooth Laser Travel Mouse diff --git a/device/src/interop.c b/device/src/interop.c index 633a3861c..32d819844 100644 --- a/device/src/interop.c +++ b/device/src/interop.c @@ -35,6 +35,7 @@ static const char* interop_feature_string(const interop_feature_t feature) { CASE_RETURN_STR(INTEROP_DISABLE_AUTH_FOR_HID_POINTING) CASE_RETURN_STR(INTEROP_DISABLE_SNIFF_DURING_SCO) CASE_RETURN_STR(INTEROP_INCREASE_AG_CONN_TIMEOUT) + CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME) } return "UNKNOWN"; diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c index 93928d4d2..7e3af0616 100644 --- a/stack/btm/btm_acl.c +++ b/stack/btm/btm_acl.c @@ -332,6 +332,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn, /* if BR/EDR do something more */ if (transport == BT_TRANSPORT_BR_EDR) { + btsnd_hcic_read_rmt_clk_offset (p->hci_handle); btsnd_hcic_rmt_ver_req (p->hci_handle); } p_dev_rec = btm_find_dev_by_handle (hci_handle); diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c index 44a3bf8a9..78af31ffb 100644 --- a/stack/btm/btm_dev.c +++ b/stack/btm/btm_dev.c @@ -152,9 +152,9 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name, if (pin_length >= 16 || key_type == BTM_LKEY_TYPE_AUTH_COMB || key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256) { - // Set the fiag if the link key was made by using either a 16 digit + // Set the flag if the link key was made by using either a 16 digit // pin or MITM. - p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED; + p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED | BTM_SEC_LINK_KEY_AUTHED; } } diff --git a/stack/rfcomm/rfc_mx_fsm.c b/stack/rfcomm/rfc_mx_fsm.c index 5c1c1a698..667a57161 100644 --- a/stack/rfcomm/rfc_mx_fsm.c +++ b/stack/rfcomm/rfc_mx_fsm.c @@ -411,6 +411,7 @@ void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data) p_mcb->state = RFC_MX_STATE_CONNECTED; p_mcb->peer_ready = TRUE; + PORT_StartCnf (p_mcb, RFCOMM_SUCCESS); } return; |