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

Commit 05334db8 authored by Rahul Arya's avatar Rahul Arya Committed by Android (Google) Code Review
Browse files

Merge changes I28a4d60a,I6dc8713f,I8d85fb54 into tm-qpr-dev

* changes:
  Fix issue where HIDH gets stuck after HIDD toggles
  Properly clean up HIDD control block on disconnect
  Fix rc connect fail after remove bond
parents 689d8d9f 8c3fcb9a
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -79,7 +79,10 @@ void BTA_HdEnable(tBTA_HD_CBACK* p_cback) {
void BTA_HdDisable(void) {
  APPL_TRACE_API("%s", __func__);

  if (!bluetooth::common::init_flags::
          delay_hidh_cleanup_until_hidh_ready_start_is_enabled()) {
    bta_sys_deregister(BTA_ID_HD);
  }

  BT_HDR_RIGID* p_buf = (BT_HDR_RIGID*)osi_malloc(sizeof(BT_HDR_RIGID));
  p_buf->event = BTA_HD_API_DISABLE_EVT;
+8 −1
Original line number Diff line number Diff line
@@ -32,10 +32,12 @@
#include "bt_target.h"  // Must be first to define build configuration

#include "bta/include/bta_hd_api.h"
#include "bta/sys/bta_sys.h"
#include "btif/include/btif_common.h"
#include "btif/include/btif_hd.h"
#include "btif/include/btif_storage.h"
#include "btif/include/btif_util.h"
#include "gd/common/init_flags.h"
#include "include/hardware/bt_hd.h"
#include "osi/include/allocator.h"
#include "osi/include/compat.h"
@@ -162,6 +164,7 @@ static void btif_hd_upstreams_evt(uint16_t event, char* p_param) {
      BTIF_TRACE_DEBUG("%s: status=%d", __func__, p_data->status);
      btif_hd_cb.status = BTIF_HD_DISABLED;
      if (btif_hd_cb.service_dereg_active) {
        bta_sys_deregister(BTA_ID_HD);
        BTIF_TRACE_WARNING("registering hid host now");
        btif_hh_service_registration(TRUE);
        btif_hd_cb.service_dereg_active = FALSE;
@@ -181,6 +184,7 @@ static void btif_hd_upstreams_evt(uint16_t event, char* p_param) {
        addr = NULL;
      }

      LOG_INFO("Registering HID device app");
      btif_hd_cb.app_registered = TRUE;
      HAL_CBACK(bt_hd_callbacks, application_state_cb, addr,
                BTHD_APP_STATE_REGISTERED);
@@ -192,7 +196,10 @@ static void btif_hd_upstreams_evt(uint16_t event, char* p_param) {
                BTHD_APP_STATE_NOT_REGISTERED);
      if (btif_hd_cb.service_dereg_active) {
        BTIF_TRACE_WARNING("disabling hid device service now");
        if (!bluetooth::common::init_flags::
                delay_hidh_cleanup_until_hidh_ready_start_is_enabled()) {
          btif_hd_free_buf();
        }
        BTA_HdDisable();
      }
      break;
+9 −0
Original line number Diff line number Diff line
@@ -538,6 +538,15 @@ bt_status_t btif_hh_virtual_unplug(const RawAddress* bd_addr) {
       (btif_hh_cb.status == BTIF_HH_DEV_CONNECTING)) {
          btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
          btif_hh_cb.pending_conn_address = RawAddress::kEmpty;

      /* need to notify up-layer device is disconnected to avoid
       * state out of sync with up-layer */
      do_in_jni_thread(base::Bind(
            [](RawAddress bd_addrcb) {
              HAL_CBACK(bt_hh_callbacks, connection_state_cb, &bd_addrcb,
                        BTHH_CONN_STATE_DISCONNECTED);
            },
           *bd_addr));
    }
    return BT_STATUS_FAIL;
  }
+2 −1
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ table InitFlagsData {
    btaa_hci_is_enabled:bool (privacy:"Any");
    bta_dm_clear_conn_id_on_client_close_is_enabled:bool (privacy:"Any");
    btm_dm_flush_discovery_queue_on_search_cancel_is_enabled:bool (privacy:"Any");
    finite_att_timeout_is_enabled:bool (privacy:"Any");
    clear_hidd_interrupt_cid_on_disconnect_is_enabled:bool (privacy:"Any");
    delay_hidh_cleanup_until_hidh_ready_start_is_enabled:bool (privacy:"Any");
    gatt_robust_caching_client_is_enabled:bool (privacy:"Any");
    gatt_robust_caching_server_is_enabled:bool (privacy:"Any");
    gd_core_is_enabled:bool (privacy:"Any");
+4 −2
Original line number Diff line number Diff line
@@ -39,8 +39,10 @@ flatbuffers::Offset<bluetooth::common::InitFlagsData> bluetooth::dumpsys::InitFl
      initFlags::bta_dm_clear_conn_id_on_client_close_is_enabled());
  builder.add_btm_dm_flush_discovery_queue_on_search_cancel_is_enabled(
      initFlags::btm_dm_flush_discovery_queue_on_search_cancel_is_enabled());
  builder.add_finite_att_timeout_is_enabled(initFlags::finite_att_timeout_is_enabled());
  builder.add_gatt_robust_caching_client_is_enabled(initFlags::gatt_robust_caching_client_is_enabled());
  builder.add_clear_hidd_interrupt_cid_on_disconnect_is_enabled(
      initFlags::clear_hidd_interrupt_cid_on_disconnect_is_enabled());
  builder.add_delay_hidh_cleanup_until_hidh_ready_start_is_enabled(
      initFlags::delay_hidh_cleanup_until_hidh_ready_start_is_enabled());
  builder.add_gatt_robust_caching_server_is_enabled(initFlags::gatt_robust_caching_server_is_enabled());
  builder.add_gd_core_is_enabled(initFlags::gd_core_is_enabled());
  builder.add_gd_l2cap_is_enabled(initFlags::gd_l2cap_is_enabled());
Loading