From 87b960136d9e295a55ee328de13aa54efd6fe60f Mon Sep 17 00:00:00 2001 From: Hansong Zhang <hsz@google.com> Date: Mon, 16 Oct 2017 17:00:16 -0700 Subject: [PATCH] HID: Fix the behavior of virtual_cable_unplug The Bluetooth HID profile itself should not unbond other device; the Bluetooth HID host and device should only disconnect the HID profile when sending or receiving virtual_cable_unplug command. Bug: 67866553 Test: Test with SL4A. Change-Id: Ie378a7292309d2b11f53fcd82bca1cf42e64b0c0 --- system/btif/src/btif_hd.cc | 14 ++------------ system/btif/src/btif_hh.cc | 15 +-------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/system/btif/src/btif_hd.cc b/system/btif/src/btif_hd.cc index eb3dbbb530c..dd39bc75284 100644 --- a/system/btif/src/btif_hd.cc +++ b/system/btif/src/btif_hd.cc @@ -253,18 +253,8 @@ static void btif_hd_upstreams_evt(uint16_t event, char* p_param) { case BTA_HD_VC_UNPLUG_EVT: HAL_CBACK(bt_hd_callbacks, connection_state_cb, (RawAddress*)&p_data->conn.bda, BTHD_CONN_STATE_DISCONNECTED); - if (bta_dm_check_if_only_hd_connected(p_data->conn.bda)) { - BTIF_TRACE_DEBUG("%s: Removing bonding as only HID profile connected", - __func__); - BTA_DmRemoveDevice(p_data->conn.bda); - } else { - RawAddress* bd_addr = (RawAddress*)&p_data->conn.bda; - BTIF_TRACE_DEBUG( - "%s: Only removing HID data as some other profiles " - "connected", - __func__); - btif_hd_remove_device(*bd_addr); - } + LOG(INFO) << __func__ << ": Only removing HID data"; + btif_hd_remove_device(p_data->conn.bda); HAL_CBACK(bt_hd_callbacks, vc_unplug_cb); break; diff --git a/system/btif/src/btif_hh.cc b/system/btif/src/btif_hh.cc index 0e914d1fbf8..2f59858fef6 100644 --- a/system/btif/src/btif_hh.cc +++ b/system/btif/src/btif_hh.cc @@ -815,13 +815,6 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { BTIF_TRACE_DEBUG("%s: uhid fd=%d local_vup=%d", __func__, p_dev->fd, p_dev->local_vup); btif_hh_stop_vup_timer(&(p_dev->bd_addr)); - /* If this is a locally initiated VUP, remove the bond as ACL got - * disconnected while VUP being processed. - */ - if (p_dev->local_vup) { - p_dev->local_vup = false; - BTA_DmRemoveDevice(p_dev->bd_addr); - } btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED; p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED; @@ -1046,13 +1039,7 @@ static void btif_hh_upstreams_evt(uint16_t event, char* p_param) { HAL_CBACK(bt_hh_callbacks, connection_state_cb, &(p_dev->bd_addr), p_dev->dev_status); BTIF_TRACE_DEBUG("%s---Removing HID bond", __func__); - /* If it is locally initiated VUP or remote device has its major COD as - Peripheral removed the bond.*/ - if (p_dev->local_vup || check_cod_hid(&(p_dev->bd_addr))) { - p_dev->local_vup = false; - BTA_DmRemoveDevice(p_dev->bd_addr); - } else - btif_hh_remove_device(p_dev->bd_addr); + btif_hh_remove_device(p_dev->bd_addr); HAL_CBACK(bt_hh_callbacks, virtual_unplug_cb, &(p_dev->bd_addr), (bthh_status_t)p_data->dev_status.status); } -- GitLab