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

Commit e8bcfa04 authored by Chris Manton's avatar Chris Manton
Browse files

btm_history: Output only if state has changed

Bug: 188074901
Tag: #refactor
Test: gd/cert/run
Change-Id: If51f5603ad47c862d34d2eb0483b5328ee486e6e
parent 1b18e84d
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -4554,10 +4554,12 @@ static void btm_sec_change_pairing_state(tBTM_PAIRING_STATE new_state) {
            btm_pair_state_descr(btm_cb.pairing_state),
            btm_pair_state_descr(new_state), btm_cb.pairing_flags);

  BTM_LogHistory(
      kBtmLogTag, btm_cb.pairing_bda, "Pairing state changed",
      base::StringPrintf("%s => %s", btm_pair_state_descr(btm_cb.pairing_state),
  if (btm_cb.pairing_state != new_state) {
    BTM_LogHistory(kBtmLogTag, btm_cb.pairing_bda, "Pairing state changed",
                   base::StringPrintf(
                       "%s => %s", btm_pair_state_descr(btm_cb.pairing_state),
                       btm_pair_state_descr(new_state)));
  }
  btm_cb.pairing_state = new_state;

  if (new_state == BTM_PAIR_STATE_IDLE) {
+12 −0
Original line number Diff line number Diff line
@@ -25,6 +25,12 @@

#include "osi/include/log.h"

namespace {

constexpr char kBtmLogTag[] = "SMP";

}

const char* const smp_state_name[] = {
    "SMP_STATE_IDLE",
    "SMP_STATE_WAIT_APP_RSP",
@@ -937,6 +943,12 @@ void smp_set_state(tSMP_STATE state) {
    SMP_TRACE_DEBUG("State change: %s(%d) ==> %s(%d)",
                    smp_get_state_name(smp_cb.state), smp_cb.state,
                    smp_get_state_name(state), state);
    if (smp_cb.state != state) {
      BTM_LogHistory(
          kBtmLogTag, smp_cb.pairing_ble_bd_addr, "Security state changed",
          base::StringPrintf("%s => %s", smp_get_state_name(smp_cb.state),
                             smp_get_state_name(state)));
    }
    smp_cb.state = state;
  } else {
    SMP_TRACE_DEBUG("smp_set_state invalid state =%d", state);