diff options
author | Steven Moreland <smoreland@google.com> | 2018-02-08 16:49:23 +0000 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-02-08 16:49:23 +0000 |
commit | 6538e7515b00694574b222da2898716e3cb1431a (patch) | |
tree | bcf05c8d5b280e86ce08024368ecad72f117d11d | |
parent | d7687b2a89d374d8403b4c6c7f94a21c747aa66f (diff) | |
download | libhidl-6538e7515b00694574b222da2898716e3cb1431a.tar.gz |
Revert "Reland "Remove gBn/sConstructorMap.""
This reverts commit d7687b2a89d374d8403b4c6c7f94a21c747aa66f.
Reason for revert: b/73103210
Change-Id: Ibd956944c49f4b1a2e51992a4d199a60cd64d7b5
-rw-r--r-- | transport/HidlPassthroughSupport.cpp | 3 | ||||
-rw-r--r-- | transport/Static.cpp | 6 | ||||
-rw-r--r-- | transport/include/hidl/HidlBinderSupport.h | 5 | ||||
-rw-r--r-- | transport/include/hidl/Static.h | 4 |
4 files changed, 17 insertions, 1 deletions
diff --git a/transport/HidlPassthroughSupport.cpp b/transport/HidlPassthroughSupport.cpp index d7903bd..e5eb164 100644 --- a/transport/HidlPassthroughSupport.cpp +++ b/transport/HidlPassthroughSupport.cpp @@ -27,6 +27,9 @@ namespace details { static sp<IBase> tryWrap(const std::string& descriptor, sp<IBase> iface) { auto func = getBsConstructorMap().get(descriptor, nullptr); + if (!func) { + func = gBsConstructorMap.get(descriptor, nullptr); + } if (func) { return func(static_cast<void*>(iface.get())); } diff --git a/transport/Static.cpp b/transport/Static.cpp index aa1ac42..cbe6add 100644 --- a/transport/Static.cpp +++ b/transport/Static.cpp @@ -29,11 +29,17 @@ namespace details { Mutex gDefaultServiceManagerLock; sp<android::hidl::manager::V1_0::IServiceManager> gDefaultServiceManager; +// Deprecated; kept for ABI compatibility. Use getBnConstructorMap. +BnConstructorMap gBnConstructorMap{}; + ConcurrentMap<const ::android::hidl::base::V1_0::IBase*, wp<::android::hardware::BHwBinder>> gBnMap{}; ConcurrentMap<wp<::android::hidl::base::V1_0::IBase>, SchedPrio> gServicePrioMap{}; +// Deprecated; kept for ABI compatibility. Use getBsConstructorMap. +BsConstructorMap gBsConstructorMap{}; + // For static executables, it is not guaranteed that gBnConstructorMap are initialized before // used in HAL definition libraries. BnConstructorMap& getBnConstructorMap() { 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 @@ sp<IBinder> toBinder(sp<IType> iface) { 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 @@ using BnConstructorMap = ConcurrentMap<std::string, std::function<sp<IBinder>(vo // 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 @@ using BsConstructorMap = ConcurrentMap<std::string, // 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 |