Double gBn/sConstructorMap
The new getBn/sConstructorMap() functions ensure that the
map is initialized before usage. For ABI compatibility (to prebuilt
HAL definition libs), the old global map is kept and checked as well.
Test: boots
Bug: 69122224
Change-Id: I32b1a612f8e841d1e7dca5335230a3dc7d589da5
diff --git a/transport/HidlPassthroughSupport.cpp b/transport/HidlPassthroughSupport.cpp
index e101e27..b79d21c 100644
--- a/transport/HidlPassthroughSupport.cpp
+++ b/transport/HidlPassthroughSupport.cpp
@@ -35,9 +35,12 @@
// interfaceDescriptor fails
return nullptr;
}
- auto func = gBsConstructorMap.get(myDescriptor, nullptr);
+ auto func = getBsConstructorMap().get(myDescriptor, nullptr);
if (!func) {
- return nullptr;
+ func = gBsConstructorMap.get(myDescriptor, nullptr);
+ if (!func) {
+ return nullptr;
+ }
}
sp<IBase> base = func(static_cast<void*>(iface.get()));
@@ -51,4 +54,4 @@
} // namespace details
} // namespace hardware
-} // namespace android
\ No newline at end of file
+} // namespace android