Use interfaceDescriptor instead of interfaceChain
wherever suits. Sementically, interfaceDescriptor
returns the first element of interfaceChain; use
interfaceDescriptor when the rest of the elements
aren't used.
Bug: 34136228
Test: hidl_test
Change-Id: Id7650788a00a37a6d0fcb574547371965ddf4a04
diff --git a/transport/include/hidl/HidlTransportUtils.h b/transport/include/hidl/HidlTransportUtils.h
index dc444dc..0fe70c4 100644
--- a/transport/include/hidl/HidlTransportUtils.h
+++ b/transport/include/hidl/HidlTransportUtils.h
@@ -21,6 +21,7 @@
namespace android {
namespace hardware {
+namespace details {
/*
* Verifies the interface chain of 'interface' contains 'castTo'
@@ -44,14 +45,14 @@
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();
- }
+ auto ret = interface->interfaceDescriptor([&](const hidl_string &types) {
+ myDescriptor = types.c_str();
});
- return ret.isOk() ? myDescriptor : "";
+ ret.isOk(); // ignored, return empty string if not isOk()
+ return myDescriptor;
}
+} // namespace details
} // namespace hardware
} // namespace android