OSDN Git Service

shim: Check if dumpsys module has started before invoking
authorChris Manton <cmanton@google.com>
Tue, 20 Apr 2021 22:16:56 +0000 (15:16 -0700)
committerChris Manton <cmanton@google.com>
Wed, 28 Apr 2021 04:15:37 +0000 (04:15 +0000)
Bug: 182544206
Test: gd/cert/run
Tag: #refactor
BYPASS_LONG_LINES_REASON: Bluetooth likes 120 lines

Change-Id: I67c83b36a7a9e5ac476d47760562d78bc1c95d36

main/shim/dumpsys.cc

index ff2b0b9..b251caa 100644 (file)
@@ -52,7 +52,12 @@ void bluetooth::shim::Dump(int fd, const char** args) {
     }
   }
   if (bluetooth::shim::is_gd_stack_started_up()) {
-    bluetooth::shim::GetDumpsys()->Dump(fd, args);
+    if (bluetooth::shim::is_gd_dumpsys_module_started()) {
+      bluetooth::shim::GetDumpsys()->Dump(fd, args);
+    } else {
+      dprintf(fd, "%s NOTE: gd dumpsys module not loaded or started\n",
+              kModuleName);
+    }
   } else {
     dprintf(fd, "%s gd stack is enabled but not started\n", kModuleName);
   }