diff options
author | Zhuoyao Zhang <zhuoyao@google.com> | 2016-11-10 14:37:35 -0800 |
---|---|---|
committer | Zhuoyao Zhang <zhuoyao@google.com> | 2016-11-10 18:33:49 -0800 |
commit | a588b23323213c525bf34dc0562679195afe611e (patch) | |
tree | f59808148692503ff1f8b066c44ac3ca0322471c | |
parent | 1af73531ba32b3dfc6ef23a8bf0172dd00be43cc (diff) | |
download | hidl-a588b23323213c525bf34dc0562679195afe611e.tar.gz |
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
-rw-r--r-- | Interface.cpp | 15 | ||||
-rw-r--r-- | Interface.h | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/Interface.cpp b/Interface.cpp index 24d59eca..302ce736 100644 --- a/Interface.cpp +++ b/Interface.cpp @@ -226,6 +226,14 @@ std::string Interface::getJavaType(bool /* forInitializer */) const { 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::emitVtsMethodDeclaration(Formatter &out) const { } 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()) { diff --git a/Interface.h b/Interface.h index 1c74f6fd..f1f10d53 100644 --- a/Interface.h +++ b/Interface.h @@ -73,6 +73,7 @@ struct Interface : public Scope { bool specifyNamespaces) const override; std::string getJavaType(bool forInitializer) const override; + std::string getVtsType() const override; void emitReaderWriter( Formatter &out, |