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

Commit 93eea786 authored by Chris Manton's avatar Chris Manton
Browse files

gd_shim: Skip legacy dumpsys if no registrants

Test: dumpsys on live system
Bug: 173755948
Tag: #refactor

Change-Id: I658e091c7f4fcd3977baea7534b8bc6d33a736cb
parent 0ad9c08b
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
namespace {
constexpr char kModuleName[] = "shim::legacy::dumpsys";
static std::unordered_map<const void*, bluetooth::shim::DumpsysFunction>*
    dumpsys_functions_;
    dumpsys_functions_{nullptr};
}  // namespace

void bluetooth::shim::RegisterDumpsysFunction(const void* token,
@@ -42,11 +42,15 @@ void bluetooth::shim::UnregisterDumpsysFunction(const void* token) {
}

void bluetooth::shim::Dump(int fd, const char** args) {
  if (dumpsys_functions_ == nullptr) {
    dprintf(fd, "%s No registered dumpsys shim legacy targets\n", kModuleName);
  } else {
    dprintf(fd, "%s Dumping shim legacy targets:%zd\n", kModuleName,
            dumpsys_functions_->size());
    for (auto& dumpsys : *dumpsys_functions_) {
      dumpsys.second(fd);
    }
  }
  if (bluetooth::shim::is_gd_stack_started_up()) {
    bluetooth::shim::GetDumpsys()->Dump(fd, args);
  } else {