create gBsConstructorMap; add wrapPassthrough
Similar to gBnConstructorMap, this map helps wrapping a local
interface with the smallest BsFoo possible. They are added
in Static.h/cpp.
Added HidlPassthroughSupport.h/cpp to hold wrapPassthrough.
Also fixes a few Return object isOk() checks.
Fix: 33307350
Test: hidl_test
Change-Id: I92a7283699bfe5b022df5ab5a9ead5690477ea97
diff --git a/transport/include/hidl/HidlTransportUtils.h b/transport/include/hidl/HidlTransportUtils.h
index d890988..dc444dc 100644
--- a/transport/include/hidl/HidlTransportUtils.h
+++ b/transport/include/hidl/HidlTransportUtils.h
@@ -31,7 +31,7 @@
}
bool canCast = false;
- interface->interfaceChain([&](const hidl_vec<hidl_string> &types) {
+ auto ret = interface->interfaceChain([&](const hidl_vec<hidl_string> &types) {
for (size_t i = 0; i < types.size(); i++) {
if (types[i] == castTo) {
canCast = true;
@@ -39,7 +39,17 @@
}
}
});
- return canCast;
+ return ret.isOk() && canCast;
+}
+
+inline std::string getDescriptor(::android::hidl::base::V1_0::IBase* interface) {
+ std::string myDescriptor{};
+ auto ret = interface->interfaceChain([&](const hidl_vec<hidl_string> &types) {
+ if (types.size() > 0) {
+ myDescriptor = types[0].c_str();
+ }
+ });
+ return ret.isOk() ? myDescriptor : "";
}
} // namespace hardware