Update hidl-gen support for vts.

* Support the new Enum type (based on scalar_data)
* Support sub_struct/sub_union defined within compound type.
* Code cleanup: use getVtsType() instead of hard code ones.

Test: make hidl-gen, locally run make hidl_gen_test.
Bug: 30762234
Change-Id: I9a21b5757e0a9fc6cd1bf829ab123565a7990ad5
diff --git a/Interface.cpp b/Interface.cpp
index ba5ea8c..cd9dcd3 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -172,6 +172,10 @@
 
 status_t Interface::emitVtsAttributeDeclaration(Formatter &out) const {
     for (const auto &type : getSubTypes()) {
+        // Skip for TypeDef as it is just an alias of a defined type.
+        if (type->isTypeDef()) {
+            continue;
+        }
         out << "attribute: {\n";
         out.indent();
         status_t status = type->emitVtsTypeDeclarations(out);