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

Commit 147824b3 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Don't refresh GATT database after bonding

According to the Bluetooth spec: "For a given client, the server shall have
one set of attributes.".

If we discover services before bonding, we should be fine using them
afterwards, without need to refresh whole GATT database.

This change should speed up bonding HOGP devces by around one second.

Refreshment of GATT database was tied to connection parameter
reenabling. Make sure bonding does not disable connection parameter
change.

Bug: 67057055
Test: Bond with HOGP device, verify profile is connected properly
Change-Id: I1e738c56e211cf3d9234b424f354bf3e468227aa
parent 36e90951
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -2845,7 +2845,6 @@ static void btif_dm_ble_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) {
      state = BT_BOND_STATE_NONE;
    } else {
      btif_dm_save_ble_bonding_keys();
      BTA_GATTC_Refresh(bd_addr);
      btif_dm_get_remote_services_by_transport(&bd_addr, GATT_TRANSPORT_LE);
    }
  } else {
+0 −12
Original line number Diff line number Diff line
@@ -1404,18 +1404,6 @@ void smp_idle_terminate(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  }
}

/*******************************************************************************
 * Function     smp_fast_conn_param
 * Description  apply default connection parameter for pairing process
 ******************************************************************************/
void smp_fast_conn_param(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  /* Disable L2CAP connection parameter updates while bonding since
     some peripherals are not able to revert to fast connection parameters
     during the start of service discovery. Connection paramter updates
     get enabled again once service discovery completes. */
  L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, false);
}

/*******************************************************************************
 * Function     smp_both_have_public_keys
 * Description  The function is called when both local and peer public keys are
+0 −1
Original line number Diff line number Diff line
@@ -419,7 +419,6 @@ extern void smp_send_pair_rsp(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_key_distribution(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_proc_srk_info(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_generate_csrk(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_fast_conn_param(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_key_pick_key(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_both_have_public_keys(tSMP_CB* p_cb, tSMP_INT_DATA* p_data);
extern void smp_start_secure_connection_phase1(tSMP_CB* p_cb,
+4 −6
Original line number Diff line number Diff line
@@ -154,7 +154,6 @@ enum {
  SMP_SET_LOCAL_OOB_KEYS,
  SMP_SET_LOCAL_OOB_RAND_COMMITMENT,
  SMP_IDLE_TERMINATE,
  SMP_FAST_CONN_PARAM,
  SMP_SM_NO_ACTION
};

@@ -218,8 +217,7 @@ static const tSMP_ACT smp_sm_action[] = {
    smp_process_secure_connection_oob_data,
    smp_set_local_oob_keys,
    smp_set_local_oob_random_commitment,
    smp_idle_terminate,
    smp_fast_conn_param};
    smp_idle_terminate};

/************ SMP Master FSM State/Event Indirection Table **************/
static const uint8_t smp_master_entry_map[][SMP_STATE_MAX] = {
@@ -343,7 +341,7 @@ static const uint8_t smp_master_wait_for_app_response_table[][SMP_SM_NUM_COLS] =
        /* SEC_GRANT */
        {SMP_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},
        /* IO_RSP */
        {SMP_SEND_PAIR_REQ, SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
        {SMP_SEND_PAIR_REQ, SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP},

        /* TK ready */
        /* KEY_READY */
@@ -351,7 +349,7 @@ static const uint8_t smp_master_wait_for_app_response_table[][SMP_SM_NUM_COLS] =

        /* start enc mode setup */
        /* ENC_REQ */
        {SMP_START_ENC, SMP_FAST_CONN_PARAM, SMP_STATE_ENCRYPTION_PENDING},
        {SMP_START_ENC, SMP_SM_NO_ACTION, SMP_STATE_ENCRYPTION_PENDING},
        /* DISCARD_SEC_REQ */
        {SMP_PROC_DISCARD, SMP_SM_NO_ACTION, SMP_STATE_IDLE}
        /* user confirms NC 'OK', i.e. phase 1 is completed */
@@ -629,7 +627,7 @@ static const uint8_t smp_slave_wait_for_app_response_table[][SMP_SM_NUM_COLS] =
    {
        /* Event                   Action                 Next State */
        /* IO_RSP */
        {SMP_PROC_IO_RSP, SMP_FAST_CONN_PARAM, SMP_STATE_PAIR_REQ_RSP},
        {SMP_PROC_IO_RSP, SMP_SM_NO_ACTION, SMP_STATE_PAIR_REQ_RSP},
        /* SEC_GRANT */
        {SMP_PROC_SEC_GRANT, SMP_SEND_APP_CBACK, SMP_STATE_WAIT_APP_RSP},