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

Commit f9523dc5 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

Print what module is being started/stopped in crash am: 4bf8a9e1

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1522141

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If6bfcf13bac35f7f7dae5ddab26156783d88aeb3
parents f21cb433 4bf8a9e1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ Module* ModuleRegistry::Start(const ModuleFactory* module, Thread* thread) {
  }

  Module* instance = module->ctor_();
  last_instance_ = "starting " + instance->ToString();
  set_registry_and_handler(instance, thread);

  instance->ListDependencies(&instance->dependencies_);
@@ -99,6 +100,7 @@ void ModuleRegistry::StopAll() {
  for (auto it = start_order_.rbegin(); it != start_order_.rend(); it++) {
    auto instance = started_modules_.find(*it);
    ASSERT(instance != started_modules_.end());
    last_instance_ = "stopping " + instance->second->ToString();

    // Clear the handler before stopping the module to allow it to shut down gracefully.
    LOG_INFO("Stopping Handler of Module %s", instance->second->ToString().c_str());
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ class ModuleRegistry {

  std::map<const ModuleFactory*, Module*> started_modules_;
  std::vector<const ModuleFactory*> start_order_;
  std::string last_instance_;
};

class ModuleDumper {
+8 −2
Original line number Diff line number Diff line
@@ -42,7 +42,10 @@ void StackManager::StartUp(ModuleList* modules, Thread* stack_thread) {
                                  std::move(promise)));

  auto init_status = future.wait_for(std::chrono::seconds(3));
  ASSERT_LOG(init_status == std::future_status::ready, "Can't start stack");
  ASSERT_LOG(
      init_status == std::future_status::ready,
      "Can't start stack, last instance: %s",
      registry_.last_instance_.c_str());

  LOG_INFO("init complete");
}
@@ -58,7 +61,10 @@ void StackManager::ShutDown() {
  handler_->Post(common::BindOnce(&StackManager::handle_shut_down, common::Unretained(this), std::move(promise)));

  auto stop_status = future.wait_for(std::chrono::seconds(5));
  ASSERT_LOG(stop_status == std::future_status::ready, "Can't stop stack");
  ASSERT_LOG(
      stop_status == std::future_status::ready,
      "Can't stop stack, last instance: %s",
      registry_.last_instance_.c_str());

  handler_->Clear();
  handler_->WaitUntilStopped(std::chrono::milliseconds(2000));