A few fix of hidl-gen for vts generator.

* Remove component_type.
* Use the new VectorDataValueMessage.

Bug: 30762234
Change-Id: I4262240c1b79129bc3801eba3b6037843a484220
diff --git a/EnumType.cpp b/EnumType.cpp
index bdae930..4cfe227 100644
--- a/EnumType.cpp
+++ b/EnumType.cpp
@@ -240,7 +240,10 @@
 }
 
 status_t EnumType::emitVtsAttributeType(Formatter &out) const {
-    out << "type: TYPE_ENUM\n" << "predefined_type:\"" << localName() << "\"\n";
+    out << "type: TYPE_ENUM\n"
+        << "predefined_type: \""
+        << localName()
+        << "\"\n";
     return OK;
 }
 
diff --git a/Interface.cpp b/Interface.cpp
index 33e8c88..f8647a5 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -220,7 +220,8 @@
     out << "type: TYPE_HIDL_CALLBACK\n"
         << "predefined_type: \""
         << localName()
-        << "\"\n";
+        << "\"\n"
+        << "is_callback: true\n";
     return OK;
 }
 
diff --git a/ScalarType.cpp b/ScalarType.cpp
index cff91c3..ffac447 100644
--- a/ScalarType.cpp
+++ b/ScalarType.cpp
@@ -208,11 +208,21 @@
 }
 
 status_t ScalarType::emitVtsTypeDeclarations(Formatter &out) const {
-    std::string extra;
-    out << "type: TYPE_SCALAR\n"
-        << "scalar_type: "
-        << getCppType(StorageMode_Stack, &extra)
-        << "\n";
+    static const char *const kName[] = {
+            "bool_t",
+            "opaque",
+            "int8_t",
+            "uint8_t",
+            "int16_t",
+            "uint16_t",
+            "int32_t",
+            "uint32_t",
+            "int64_t",
+            "uint64_t",
+            "float_t",
+            "double_t"
+    };
+    out << "type: TYPE_SCALAR\n"<< "scalar_type: \""<< kName[mKind]<< "\"\n";
     return OK;
 }
 
diff --git a/generateVts.cpp b/generateVts.cpp
index 0c3ba93..4f3585f 100644
--- a/generateVts.cpp
+++ b/generateVts.cpp
@@ -107,22 +107,6 @@
     Formatter out(file);
 
     out << "component_class: HAL_HIDL\n";
-
-    // Get the component_type for interface from annotation.
-    if (isInterface) {
-        const Interface *iface = mRootScope->getInterface();
-        Annotation *annotation = iface->annotations().valueFor("hal_type");
-        if (annotation != NULL) {
-            std::vector<std::string> * values = annotation->params().valueFor(
-                    "type");
-            if (values != NULL) {
-                out << "component_type: "
-                    << removeQuotes(values->at(0))
-                    << "\n";
-            }
-        }
-    }
-
     out << "component_type_version: " << mPackage.version().substr(1) << "\n";
     out << "component_name: \""
         << (isInterface ? ifaceName : "types")
diff --git a/test/data/android/hardware/nfc/1.0/Nfc.vts b/test/data/android/hardware/nfc/1.0/Nfc.vts
index 6d70ff6..4dd78f6 100644
--- a/test/data/android/hardware/nfc/1.0/Nfc.vts
+++ b/test/data/android/hardware/nfc/1.0/Nfc.vts
@@ -1,5 +1,4 @@
 component_class: HAL_HIDL
-component_type: NFC
 component_type_version: 1.0
 component_name: "INfc"
 
@@ -13,11 +12,12 @@
     name: "open"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
     arg: {
       type: TYPE_HIDL_CALLBACK
       predefined_type: "INfcClientCallback"
+      is_callback: true
     }
   }
 
@@ -25,7 +25,7 @@
     name: "write"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
     arg: {
       type: TYPE_STRUCT
@@ -37,13 +37,13 @@
     name: "core_initialized"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
     arg: {
       type: TYPE_VECTOR
       vector_value: {
         type: TYPE_SCALAR
-        scalar_type: uint8_t
+        scalar_type: "uint8_t"
       }
     }
   }
@@ -52,7 +52,7 @@
     name: "pre_discover"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
   }
 
@@ -60,7 +60,7 @@
     name: "close"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
   }
 
@@ -68,7 +68,7 @@
     name: "control_granted"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
   }
 
@@ -76,7 +76,7 @@
     name: "power_cycle"
     return_type_hidl: {
       type: TYPE_SCALAR
-      scalar_type: int32_t
+      scalar_type: "int32_t"
     }
   }
 
diff --git a/test/data/android/hardware/nfc/1.0/NfcClientCallback.vts b/test/data/android/hardware/nfc/1.0/NfcClientCallback.vts
index fb34126..39d1ef8 100644
--- a/test/data/android/hardware/nfc/1.0/NfcClientCallback.vts
+++ b/test/data/android/hardware/nfc/1.0/NfcClientCallback.vts
@@ -1,5 +1,4 @@
 component_class: HAL_HIDL
-component_type: NFC
 component_type_version: 1.0
 component_name: "INfcClientCallback"
 
@@ -12,11 +11,11 @@
     name: "sendEvent"
     arg: {
       type: TYPE_ENUM
-      predefined_type:"nfc_event_t"
+      predefined_type: "nfc_event_t"
     }
     arg: {
       type: TYPE_ENUM
-      predefined_type:"nfc_status_t"
+      predefined_type: "nfc_status_t"
     }
   }
 
diff --git a/test/data/android/hardware/nfc/1.0/types.vts b/test/data/android/hardware/nfc/1.0/types.vts
index 89a3fba..b8cbb59 100644
--- a/test/data/android/hardware/nfc/1.0/types.vts
+++ b/test/data/android/hardware/nfc/1.0/types.vts
@@ -51,7 +51,7 @@
     type: TYPE_VECTOR
     vector_value: {
       type: TYPE_SCALAR
-      scalar_type: uint8_t
+      scalar_type: "uint8_t"
     }
   }
 }