Revert "Remove gBn/sConstructorMap from headers."

This reverts commit 0288c9a89f9c06414a3ccee926bb075dd303e52a.

Reason for revert: crashing when device have old prebuilts
that doesn't even have the static map within
getBn/sConstructorMap

Bug: 69122224
Bug: 73486242
Test: boots
Change-Id: Ic7bac4f54eca5d96e9564f22a78ac0e3de9c864f
Merged-In: Ic7bac4f54eca5d96e9564f22a78ac0e3de9c864f
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