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

Commit 79eed764 authored by yamei du's avatar yamei du Committed by Hui Peng
Browse files

SMP: Use correct SMP pair fail reason

The pairing failure reason sent from remote devices
is not read correctly from packet, this CL fixes it.

Bug: 320745565
Bug: 320744382

Test: m com.android.btservices | Manual Start SMP pairing to a
peer device, then reject pairing at the peer side and check the
pairing failure reason in logs.

Change-Id: Ie6829ea218bd507ff73d8803b49bb458773b5cfb
parent 67f44019
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

#include <cstring>

#include "android_bluetooth_flags.h"
#include "btif/include/btif_common.h"
#include "btif/include/core_callbacks.h"
#include "btif/include/stack_manager_t.h"
@@ -520,9 +521,13 @@ void smp_proc_pair_fail(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
    LOG_WARN("rcvd_cmd_len %d too short: must be at least 2",
             p_cb->rcvd_cmd_len);
    p_cb->status = SMP_INVALID_PARAMETERS;
  } else {
    if (IS_FLAG_ENABLED(fix_pairing_failure_reason_from_remote)) {
      p_cb->status = static_cast<tSMP_STATUS>(p_data->p_data[0]);
    } else {
      p_cb->status = p_data->status;
    }
  }

  /* Cancel pending auth complete timer if set */
  alarm_cancel(p_cb->delayed_auth_timer_ent);