Merge "Acquire the global lock when the dump method is called." into udc-dev am: f5c86e53bf

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/22561847

Change-Id: I9fcfea4711fc1e5c11c40c21fd1b2d03039b1247
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp
index e30c38a..d6a85da 100644
--- a/wifi/aidl/default/wifi.cpp
+++ b/wifi/aidl/default/wifi.cpp
@@ -19,6 +19,7 @@
 #include <android-base/logging.h>
 
 #include "aidl_return_util.h"
+#include "aidl_sync_util.h"
 #include "wifi_status_util.h"
 
 namespace {
@@ -32,6 +33,7 @@
 namespace wifi {
 using aidl_return_util::validateAndCall;
 using aidl_return_util::validateAndCallWithLock;
+using aidl_sync_util::acquireGlobalLock;
 
 Wifi::Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool,
            const std::shared_ptr<legacy_hal::WifiLegacyHalFactory> legacy_hal_factory,
@@ -78,6 +80,7 @@
 }
 
 binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) {
+    const auto lock = acquireGlobalLock();
     LOG(INFO) << "-----------Debug was called----------------";
     if (chips_.size() == 0) {
         LOG(INFO) << "No chips to display.";