Support generating the new TYPE_HIDL_INTERFACE for vts.
* Needs to distiguish the callback interface vs normal interface. The
former has TYPE_HIDL_CALLBACK in vts and the latter has
TYPE_HILD_INTERFACE
Test: make hidl-gen
Bug: 32764837
Change-Id: Ic5bd44ed707ad302be98abe271abad1758ff276f
diff --git a/Interface.cpp b/Interface.cpp
index 24d59ec..302ce73 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -226,6 +226,14 @@
return fullJavaName();
}
+std::string Interface::getVtsType() const {
+ if (StringHelper::EndsWith(localName(), "Callback")) {
+ return "TYPE_HIDL_CALLBACK";
+ } else {
+ return "TYPE_HIDL_INTERFACE";
+ }
+}
+
void Interface::emitReaderWriter(
Formatter &out,
const std::string &name,
@@ -407,15 +415,16 @@
}
status_t Interface::emitVtsAttributeType(Formatter &out) const {
- out << "type: TYPE_HIDL_CALLBACK\n"
+ out << "type: " << getVtsType() << "\n"
<< "predefined_type: \""
<< localName()
<< "\"\n"
- << "is_callback: true\n";
+ << "is_callback: "
+ << (StringHelper::EndsWith(localName(), "Callback") ? "true" : "false")
+ << "\n";
return OK;
}
-
bool Interface::hasOnewayMethods() const {
for (auto const &method : methods()) {
if (method->isOneway()) {