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

Commit ec028fa0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "stack::btm::dev Move dumpsys device record to proper module" into main am: 98f26ad0

parents dd8336e2 98f26ad0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@
#include "osi/include/allocator.h"
#include "osi/include/stack_power_telemetry.h"
#include "osi/include/wakelock.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sco_hfp_hal.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/a2dp_api.h"
@@ -902,6 +903,7 @@ static void dump(int fd, const char** arguments) {
  DumpsysHid(fd);
  DumpsysBtaDm(fd);
  SDP_Dumpsys(fd);
  DumpsysRecord(fd);
  bluetooth::shim::Dump(fd, arguments);
  power_telemetry::GetInstance().Dumpsys(fd);
  log::debug("Finished bluetooth dumpsys");
+0 −21
Original line number Diff line number Diff line
@@ -1225,26 +1225,6 @@ void DumpsysBtm(int fd) {
}
#undef DUMPSYS_TAG

#define DUMPSYS_TAG "shim::record"
void DumpsysRecord(int fd) {
  LOG_DUMPSYS_TITLE(fd, DUMPSYS_TAG);

  if (btm_sec_cb.sec_dev_rec == nullptr) {
    LOG_DUMPSYS(fd, "Record is empty - no devices");
    return;
  }

  unsigned cnt = 0;
  list_node_t* end = list_end(btm_sec_cb.sec_dev_rec);
  for (list_node_t* node = list_begin(btm_sec_cb.sec_dev_rec); node != end;
       node = list_next(node)) {
    tBTM_SEC_DEV_REC* p_dev_rec = static_cast<tBTM_SEC_DEV_REC*>(list_node(node));
    // TODO: handle in tBTM_SEC_DEV_REC.ToString
    LOG_DUMPSYS(fd, "%03u %s", ++cnt, p_dev_rec->ToString().c_str());
  }
}
#undef DUMPSYS_TAG

#define DUMPSYS_TAG "shim::stack"
void DumpsysNeighbor(int fd) {
  LOG_DUMPSYS(fd, "Stack information %lc%lc", kRunicBjarkan, kRunicHagall);
@@ -1283,7 +1263,6 @@ void DumpsysNeighbor(int fd) {
#undef DUMPSYS_TAG

void shim::Acl::Dump(int fd) const {
  DumpsysRecord(fd);
  DumpsysNeighbor(fd);
  DumpsysAcl(fd);
  L2CA_Dumpsys(fd);
+21 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include "common/init_flags.h"
#include "internal_include/bt_target.h"
#include "l2c_api.h"
#include "main/shim/dumpsys.h"
#include "osi/include/allocator.h"
#include "rust/src/connection/ffi/connection_shim.h"
#include "stack/btm/btm_sec.h"
@@ -778,6 +779,26 @@ const tBLE_BD_ADDR BTM_Sec_GetAddressWithType(const RawAddress& bd_addr) {
  }
}

#define DUMPSYS_TAG "shim::record"
void DumpsysRecord(int fd) {
  LOG_DUMPSYS_TITLE(fd, DUMPSYS_TAG);

  if (btm_sec_cb.sec_dev_rec == nullptr) {
    LOG_DUMPSYS(fd, "Record is empty - no devices");
    return;
  }

  unsigned cnt = 0;
  list_node_t* end = list_end(btm_sec_cb.sec_dev_rec);
  for (list_node_t* node = list_begin(btm_sec_cb.sec_dev_rec); node != end;
       node = list_next(node)) {
    tBTM_SEC_DEV_REC* p_dev_rec = static_cast<tBTM_SEC_DEV_REC*>(list_node(node));
    // TODO: handle in tBTM_SEC_DEV_REC.ToString
    LOG_DUMPSYS(fd, "%03u %s", ++cnt, p_dev_rec->ToString().c_str());
  }
}
#undef DUMPSYS_TAG

namespace bluetooth {
namespace testing {
namespace legacy {
+11 −0
Original line number Diff line number Diff line
@@ -192,3 +192,14 @@ std::vector<tBTM_SEC_DEV_REC*> btm_get_sec_dev_rec();

bool BTM_Sec_AddressKnown(const RawAddress& address);
const tBLE_BD_ADDR BTM_Sec_GetAddressWithType(const RawAddress& bd_addr);

/*******************************************************************************
 *
 * Function         DumpsysRecord
 *
 * Description      Provides dumpsys access to device records.
 *
 * Returns          void
 *
 ******************************************************************************/
void DumpsysRecord(int fd);
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <unistd.h>

#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec_cb.h"
@@ -41,3 +42,5 @@ TEST_F(StackBtmDevTest, btm_sec_allocate_dev_rec__with_list) {
  ASSERT_NE(nullptr, btm_sec_allocate_dev_rec());
  ::btm_sec_cb.Free();
}

TEST_F(StackBtmDevTest, DumpsysRecord) { DumpsysRecord(STDOUT_FILENO); }
Loading