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

Commit b1c0c8af authored by Balraj Selvaraj's avatar Balraj Selvaraj Committed by android-build-merger
Browse files

GAP Setting remove device pending status as FALSE

am: 22bd60c6

* commit '22bd60c6':
  GAP Setting remove device pending status as FALSE
parents 680e9eeb 22bd60c6
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
#define BTA_DM_SWITCH_DELAY_TIMER_MS 500
#endif

static void bta_dm_reset_sec_dev_pending(BD_ADDR remote_bd_addr);
static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
static void bta_dm_observe_results_cb(tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_observe_cmpl_cb(void * p_result);
@@ -2764,6 +2765,12 @@ static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class,
#endif
        if(bta_dm_cb.p_sec_cback)
            bta_dm_cb.p_sec_cback(event, &sec_event);

        // Setting remove_dev_pending flag to FALSE, where it will avoid deleting the
        // security device record when the ACL connection link goes down in case of
        // reconnection.
        if (bta_dm_cb.device_list.count)
            bta_dm_reset_sec_dev_pending(p_auth_cmpl->bd_addr);
    }
    else
    {
@@ -3452,6 +3459,29 @@ static void bta_dm_delay_role_switch_cback(UNUSED_ATTR void *data)
    bta_dm_adjust_roles(FALSE);
}

/*******************************************************************************
**
** Function         bta_dm_reset_sec_dev_pending
**
** Description      Setting the remove device pending status to FALSE from
**                  security device DB, when the link key notification
**                  event comes.
**
** Returns          void
**
*******************************************************************************/
static void bta_dm_reset_sec_dev_pending(BD_ADDR remote_bd_addr)
{
    for (size_t i = 0; i < bta_dm_cb.device_list.count; i++)
    {
        if (bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, remote_bd_addr) == 0)
        {
            bta_dm_cb.device_list.peer_device[i].remove_dev_pending = FALSE;
            return;
        }
    }
}

/*******************************************************************************
**
** Function         bta_dm_remove_sec_dev_entry