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/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index fc834b9..09111f4 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -330,9 +330,12 @@
sp<IBinder> sBnObj = wBnObj.promote();
if (sBnObj == nullptr) {
- auto func = details::gBnConstructorMap.get(myDescriptor, nullptr);
+ auto func = details::getBnConstructorMap().get(myDescriptor, nullptr);
if (!func) {
- return nullptr;
+ func = details::gBnConstructorMap.get(myDescriptor, nullptr);
+ if (!func) {
+ return nullptr;
+ }
}
sBnObj = sp<IBinder>(func(static_cast<void*>(ifacePtr)));