Add is_inherited field for each API in generated .vts file
* Currently if a HAL interface is extended from another inteface,
hidl-gen will generate all methods (both inherited and defined within
the interface) in the output .vts file. Add the flag is_inherited to
distinguish the ones inherited from other APIs.
* This is used in vts to get the total APIs defiend with each interface
which which be used for API coverage measurment.
Bug: 110851162
Test: make vts
Change-Id: I307178d1c849b5dc8be01338b458cb96e6dc1294
diff --git a/Interface.cpp b/Interface.cpp
index e0c99d6..9fb7442 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -918,7 +918,7 @@
}
}
-void Interface::emitVtsMethodDeclaration(Formatter& out) const {
+void Interface::emitVtsMethodDeclaration(Formatter& out, bool isInherited) const {
for (const auto &method : methods()) {
if (method->isHidlReserved()) {
continue;
@@ -927,6 +927,7 @@
out << "api: {\n";
out.indent();
out << "name: \"" << method->name() << "\"\n";
+ out << "is_inherited: " << (isInherited ? "true" : "false") << "\n";
// Generate declaration for each return value.
for (const auto &result : method->results()) {
out << "return_type_hidl: {\n";