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

Commit 4af5fde7 authored by Hansong Zhang's avatar Hansong Zhang Committed by Jakub Pawlowski
Browse files

Enable BLE background connection when stack is started

Remove variable btm_cb.ble_ctr_cb.bg_conn_type. We can enable the
background mode when the Bluetooth stack is started and don't have
to wait until the first background connection request from HID
Device/Hearing Aid/GATT. As soon as we add the first device to white
list, the stack will send HCI Create Connection (White List) command.

Test: manual. Bond to a BLE mouse and turn off/on Bluetooth. Also test
with initiating another direct/white list connection while another white
list connection is pending
Bug: 111562702
Bug: 112827989
Change-Id: I82a476489d181d17aa1c1da8202df1be76928d77
parent 0de7ddfa
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -567,11 +567,6 @@ void BTA_DmSetBleConnScanParams(uint32_t scan_interval, uint32_t scan_window) {
                                          scan_interval, scan_window));
}

/** Set BLE connectable mode to auto connect */
void BTA_DmBleStartAutoConn() {
  do_in_main_thread(FROM_HERE, base::Bind(BTM_BleStartAutoConn));
}

/*******************************************************************************
 *
 * Function         bta_dm_discover_send_msg
+0 −2
Original line number Diff line number Diff line
@@ -365,7 +365,6 @@ class HearingAidImpl : public HearingAid {

      /* add device into BG connection to accept remote initiated connection */
      BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false);
      BTA_DmBleStartAutoConn();
    }

    callbacks->OnDeviceAvailable(capabilities, hiSyncId, address);
@@ -814,7 +813,6 @@ class HearingAidImpl : public HearingAid {
    if (hearingDevice->first_connection) {
      /* add device into BG connection to accept remote initiated connection */
      BTA_GATTC_Open(gatt_if, address, false, GATT_TRANSPORT_LE, false);
      BTA_DmBleStartAutoConn();

      btif_storage_add_hearing_aid(
          address, hearingDevice->psm, hearingDevice->capabilities,
+0 −2
Original line number Diff line number Diff line
@@ -1995,8 +1995,6 @@ static void bta_hh_le_add_dev_bg_conn(tBTA_HH_DEV_CB* p_cb, bool check_bond) {
    BTA_GATTC_Open(bta_hh_cb.gatt_if, p_cb->addr, false, GATT_TRANSPORT_LE,
                   false);
    p_cb->in_bg_conn = true;

    BTA_DmBleStartAutoConn();
  }
  return;
}
+0 −5
Original line number Diff line number Diff line
@@ -1384,11 +1384,6 @@ extern void BTA_DmCloseACL(const RawAddress& bd_addr, bool remove_dev,
extern void BTA_DmBleSecurityGrant(const RawAddress& bd_addr,
                                   tBTA_DM_BLE_SEC_GRANT res);

/**
 * Set BLE connectable mode to auto connect
 */
extern void BTA_DmBleStartAutoConn();

/*******************************************************************************
 *
 * Function         BTA_DmBlePasskeyReply
+0 −4
Original line number Diff line number Diff line
@@ -303,10 +303,6 @@ void btif_gattc_open_impl(int client_if, RawAddress address, bool is_direct,
    }
  }

  if (transport == GATT_TRANSPORT_LE) {
    BTA_DmBleStartAutoConn();
  }

  // Connect!
  BTIF_TRACE_DEBUG("%s Transport=%d, device type=%d, phy=%d", __func__,
                   transport, device_type, initiating_phys);
Loading