From a588b23323213c525bf34dc0562679195afe611e Mon Sep 17 00:00:00 2001 From: Zhuoyao Zhang Date: Thu, 10 Nov 2016 14:37:35 -0800 Subject: 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 --- Interface.cpp | 15 ++++++++++++--- 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, -- cgit v1.2.3