summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2018-06-27 12:47:24 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-06-27 12:47:24 -0700
commit82a6560f30df776a6b954f5ff77343487f5efb64 (patch)
tree4d3c949bba372b6f7081cb28ef1d7aad7e6dec1a
parent5c853ebd87165c8baa275b90da087b7eecb02d8f (diff)
parent9fd3387f62af5f53b7cfcf4f03df62e9e06f45ed (diff)
downloadlibhidl-82a6560f30df776a6b954f5ff77343487f5efb64.tar.gz
Checks for grave getOrCreateCachedBinder problems.
am: 9fd3387f62 Change-Id: Ifaa16291eeb5a94a9e3b64147afcc53c4c258803
-rw-r--r--transport/HidlBinderSupport.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/transport/HidlBinderSupport.cpp b/transport/HidlBinderSupport.cpp
index 015d607..a221b46 100644
--- a/transport/HidlBinderSupport.cpp
+++ b/transport/HidlBinderSupport.cpp
@@ -199,8 +199,8 @@ status_t writeToParcel(const Status &s, Parcel* parcel) {
}
sp<IBinder> getOrCreateCachedBinder(::android::hidl::base::V1_0::IBase* ifacePtr) {
- LOG_ALWAYS_FATAL_IF(ifacePtr->isRemote(),
- "getOrCreateCachedBinder does not have a way to construct remote binders");
+ LOG_ALWAYS_FATAL_IF(ifacePtr->isRemote(), "%s does not have a way to construct remote binders",
+ __func__);
std::string descriptor = details::getDescriptor(ifacePtr);
if (descriptor.empty()) {
@@ -219,16 +219,15 @@ sp<IBinder> getOrCreateCachedBinder(::android::hidl::base::V1_0::IBase* ifacePtr
if (!func) {
// TODO(b/69122224): remove this static variable when prebuilts updated
func = details::gBnConstructorMap.get(descriptor, nullptr);
- if (!func) {
- return nullptr;
- }
}
+ LOG_ALWAYS_FATAL_IF(func == nullptr, "%s gBnConstructorMap returned null for %s", __func__,
+ descriptor.c_str());
sBnObj = sp<IBinder>(func(static_cast<void*>(ifacePtr)));
+ LOG_ALWAYS_FATAL_IF(sBnObj == nullptr, "%s Bn constructor function returned null for %s",
+ __func__, descriptor.c_str());
- if (sBnObj != nullptr) {
- details::gBnMap.setLocked(ifacePtr, static_cast<BHwBinder*>(sBnObj.get()));
- }
+ details::gBnMap.setLocked(ifacePtr, static_cast<BHwBinder*>(sBnObj.get()));
}
return sBnObj;