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

Commit 99a072e3 authored by Hui Peng's avatar Hui Peng
Browse files

[Invisalign2] cleanup the logic in BTA_dm_on_hw_on

remove the code for setting up bta_dm_sec_cb
and bta_dm_acl_cb

Bug: 301661850
Test: mma packages/modules/Bluetooth
Change-Id: Ibad55782475487bf703f501b8f9a6dc5f2605cd7
parent 9e2c7ca4
Loading
Loading
Loading
Loading
+1 −15
Original line number Diff line number Diff line
@@ -199,8 +199,6 @@ void bta_dm_enable(tBTA_DM_SEC_CBACK* p_sec_cback,
 ******************************************************************************/
static void bta_dm_init_cb(void) {
  bta_dm_cb = {};
  bta_dm_acl_cb = {};
  bta_dm_sec_cb = {};

  bta_dm_cb.disable_timer = alarm_new("bta_dm.disable_timer");
  bta_dm_cb.switch_delay_timer = alarm_new("bta_dm.switch_delay_timer");
@@ -234,8 +232,6 @@ static void bta_dm_deinit_cb(void) {
    }
  }
  bta_dm_cb = {};
  bta_dm_acl_cb = {};
  bta_dm_sec_cb = {};
}

void BTA_dm_on_hw_off() {
@@ -254,24 +250,13 @@ void BTA_dm_on_hw_off() {

void BTA_dm_on_hw_on() {
  DEV_CLASS dev_class;
  tBTA_DM_SEC_CBACK* temp_sec_cback;
  tBTA_DM_ACL_CBACK* temp_acl_cback;

  uint8_t key_mask = 0;
  tBTA_BLE_LOCAL_ID_KEYS id_key;

  /* save callbacks */
  temp_sec_cback = bta_dm_sec_cb.p_sec_cback;
  temp_acl_cback = bta_dm_acl_cb.p_acl_cback;

  /* make sure the control block is properly initialized */
  bta_dm_init_cb();

  /* and restore the callbacks */
  bta_dm_sec_cb.p_sec_cback = temp_sec_cback;
  bta_dm_acl_cb.p_acl_cback = temp_acl_cback;


  /* hw is ready, go on with BTA DM initialization */
  alarm_free(bta_dm_search_cb.search_timer);
  alarm_free(bta_dm_search_cb.gatt_close_timer);
@@ -313,6 +298,7 @@ void BTA_dm_on_hw_on() {
  bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID;

  btm_dm_sec_init();
  btm_sec_on_hw_on();

  BTM_WritePageTimeout(osi_property_get_int32(PROPERTY_PAGE_TIMEOUT,
                                              p_bta_dm_cfg->page_timeout));
+6 −0
Original line number Diff line number Diff line
@@ -75,6 +75,12 @@ const tBTM_APPL_INFO bta_security = {
// Stores the local Input/Output Capabilities of the Bluetooth device.
static uint8_t btm_local_io_caps;

void btm_sec_on_hw_on() {
  tBTA_DM_SEC_CBACK* temp_sec_cback = bta_dm_sec_cb.p_sec_cback;
  bta_dm_sec_cb = {};
  bta_dm_sec_cb.p_sec_cback = temp_sec_cback;
}

void bta_dm_ble_sirk_sec_cb_register(tBTA_DM_SEC_CBACK* p_cback) {
  /* Save the callback to be called when a request of member validation will be
   * needed. */
+1 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ typedef struct {
extern tBTA_DM_SEC_CB bta_dm_sec_cb;

void bta_dm_sec_enable(tBTA_DM_SEC_CBACK* p_sec_cback);
void btm_sec_on_hw_on();

void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
                           tBT_DEVICE_TYPE dev_type);