Revert "Reland "Remove gBn/sConstructorMap.""
This reverts commit d7687b2a89d374d8403b4c6c7f94a21c747aa66f.
Reason for revert: b/73103210
Change-Id: Ibd956944c49f4b1a2e51992a4d199a60cd64d7b5
diff --git a/transport/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index 55003cc..9759af1 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -332,7 +332,10 @@
if (sBnObj == 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)));
diff --git a/transport/include/hidl/Static.h b/transport/include/hidl/Static.h
index 9d9a14a..0522e44 100644
--- a/transport/include/hidl/Static.h
+++ b/transport/include/hidl/Static.h
@@ -44,6 +44,8 @@
// For HidlBinderSupport and autogenerated code
// value function receives reinterpret_cast<void *>(static_cast<IFoo *>(foo)),
// returns sp<IBinder>
+// deprecated; use getBnConstructorMap instead.
+extern BnConstructorMap gBnConstructorMap;
BnConstructorMap& getBnConstructorMap();
using BsConstructorMap = ConcurrentMap<std::string,
@@ -51,6 +53,8 @@
// For HidlPassthroughSupport and autogenerated code
// value function receives reinterpret_cast<void *>(static_cast<IFoo *>(foo)),
// returns sp<IBase>
+// deprecated; use getBsConstructorMap instead.
+extern BsConstructorMap gBsConstructorMap;
BsConstructorMap& getBsConstructorMap();
} // namespace details
} // namespace hardware