Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af608cc9 authored by Hansong Zhang's avatar Hansong Zhang Committed by Myles Watson
Browse files

Revert "HID: Fix the behavior of virtual_cable_unplug"

This reverts commit 87b96013.

Reason for revert: Connected HID keyboard won't unpair
Bug: 76907578
Test: SL4A
Change-Id: I7d289183ac05b5f926c145799418461377228569
parent bbd4f009
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -253,8 +253,18 @@ 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);
      LOG(INFO) << __func__ << ": Only removing HID data";
      btif_hd_remove_device(p_data->conn.bda);
      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);
      }
      HAL_CBACK(bt_hd_callbacks, vc_unplug_cb);
      break;

+14 −1
Original line number Diff line number Diff line
@@ -816,6 +816,13 @@ 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;
@@ -1040,6 +1047,12 @@ 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);
        HAL_CBACK(bt_hh_callbacks, virtual_unplug_cb, &(p_dev->bd_addr),
                  (bthh_status_t)p_data->dev_status.status);