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

Commit 32618b8d authored by Archie Pusaka's avatar Archie Pusaka Committed by Gerrit Code Review
Browse files

Merge "hh: Reconnect HoGP in the background on local initiated disconnection" into main

parents ecb352f5 99ce2219
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -507,7 +507,7 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {

  // Initiate HID host connection
  if (p_cb->link_spec.transport == BT_TRANSPORT_LE) {
    bta_hh_le_open_conn(p_cb);
    bta_hh_le_open_conn(p_cb, p_data->api_conn.direct);
  } else {
    bta_hh_bredr_conn(p_cb);
  }
+2 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ void BTA_HhClose(uint8_t dev_handle) {
 * Returns          void
 *
 ******************************************************************************/
void BTA_HhOpen(const tAclLinkSpec& link_spec) {
void BTA_HhOpen(const tAclLinkSpec& link_spec, bool direct) {
  tBTA_HH_API_CONN* p_buf = (tBTA_HH_API_CONN*)osi_calloc(sizeof(tBTA_HH_API_CONN));
  tBTA_HH_PROTO_MODE mode = BTA_HH_PROTO_RPT_MODE;

@@ -135,6 +135,7 @@ void BTA_HhOpen(const tAclLinkSpec& link_spec) {
  p_buf->hdr.layer_specific = BTA_HH_INVALID_HANDLE;
  p_buf->mode = mode;
  p_buf->link_spec = link_spec;
  p_buf->direct = direct;

  bta_sys_sendmsg((void*)p_buf);
}
+2 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ typedef struct {
  BT_HDR_RIGID hdr;
  tAclLinkSpec link_spec;
  tBTA_HH_PROTO_MODE mode;
  bool direct;
} tBTA_HH_API_CONN;

/* internal event data from BTE HID callback */
@@ -292,7 +293,7 @@ tBTA_HH_STATUS bta_hh_read_ssr_param(const tAclLinkSpec& link_spec, uint16_t* p_
/* functions for LE HID */
void bta_hh_le_enable(void);
void bta_hh_le_deregister(void);
void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb);
void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, bool direct);
void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB* p_cb);
void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB* p_cb);
void bta_hh_le_write_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data);
+16 −1
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ static uint8_t bta_hh_le_get_le_dev_hdl(uint8_t cb_index) {
 * Parameters:
 *
 ******************************************************************************/
void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb) {
void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, bool direct) {
  p_cb->hid_handle = bta_hh_le_get_le_dev_hdl(p_cb->index);
  if (p_cb->hid_handle == BTA_HH_IDX_INVALID) {
    tBTA_HH_STATUS status = BTA_HH_ERR_NO_RES;
@@ -289,6 +289,15 @@ void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb) {
  }

  bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = p_cb->index;  // Update index map
  if (!direct) {
    // don't reconnect unbonded device
    if (!BTM_IsLinkKeyKnown(p_cb->link_spec.addrt.bda, BT_TRANSPORT_LE)) {
      return;
    }
    log::debug("Add {} to background connection list", p_cb->link_spec);
    bta_hh_le_add_dev_bg_conn(p_cb);
    return;
  }

  BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->link_spec.addrt.bda, BTM_BLE_DIRECT_CONNECTION, false);
}
@@ -2178,6 +2187,12 @@ void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB* p_cb) {
 *
 ******************************************************************************/
static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb) {
  if (com::android::bluetooth::flags::hogp_reconnection()) {
    if (p_cb->in_bg_conn) {
      return;
    }
  }

  /* Add device into BG connection to accept remote initiated connection */
  BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->link_spec.addrt.bda, BTM_BLE_BKG_CONNECT_ALLOW_LIST,
                 false);
+1 −1
Original line number Diff line number Diff line
@@ -391,7 +391,7 @@ void BTA_HhDisable(void);
 * Returns          void
 *
 ******************************************************************************/
void BTA_HhOpen(const tAclLinkSpec& link_spec);
void BTA_HhOpen(const tAclLinkSpec& link_spec, bool direct);

/*******************************************************************************
 *
Loading