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

Commit 03b0bb26 authored by Jack He's avatar Jack He
Browse files

Assign pairing code to bta_dm_cb before device name resolution

Device name resolution, BTM_ReadRemoteDeviceName(), will cause
bta_dm_sp_cback() to exit early and bta_dm_pinname_cback() callback
will be invoked after the resolution, which continues the pairing
with pairing code from bta_dm_cb.num_val. Hence, bta_dm_cb.num_val
needs to be assigned before BTM_ReadRemoteDeviceName() is called.

Test: manual
Bug: 31381715
Change-Id: I61f06a9d878dd72154d6621eb094dcea5f701cbc
(cherry picked from commit 23790f91)
parent 0f22bd76
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2870,6 +2870,8 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
    /*case BTM_SP_KEY_REQ_EVT: */
    case BTM_SP_KEY_NOTIF_EVT:
#endif
        bta_dm_cb.num_val = sec_event.key_notif.passkey = p_data->key_notif.passkey;

        if(BTM_SP_CFM_REQ_EVT == event)
        {
          /* Due to the switch case falling through below to BTM_SP_KEY_NOTIF_EVT,
@@ -2895,7 +2897,6 @@ static UINT8 bta_dm_sp_cback (tBTM_SP_EVT event, tBTM_SP_EVT_DATA *p_data)
           }
        }

        bta_dm_cb.num_val = sec_event.key_notif.passkey = p_data->key_notif.passkey;
        if (BTM_SP_KEY_NOTIF_EVT == event)
        {
            /* If the device name is not known, save bdaddr and devclass