vintf: VendorManifest -> HalManifest

VendorManifest is an old name and is changed
to HalManifest long ago in relavant documentation.
It merely consist of a list of "HALs" and doesn't
contain any runtime collectible information.

Test: mma
Test: libvintf_test

Change-Id: Iba78128c194a3efc34371b686943266829d8e33c
diff --git a/Android.bp b/Android.bp
index a85dc26..1821c7e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -38,7 +38,7 @@
         "ManifestHal.cpp",
         "MatrixHal.cpp",
         "MatrixKernel.cpp",
-        "VendorManifest.cpp",
+        "HalManifest.cpp",
     ],
 }
 
diff --git a/VendorManifest.cpp b/HalManifest.cpp
similarity index 82%
rename from VendorManifest.cpp
rename to HalManifest.cpp
index 0f645ec..acc6a3a 100644
--- a/VendorManifest.cpp
+++ b/HalManifest.cpp
@@ -16,7 +16,7 @@
 
 #define LOG_TAG "libvintf"
 
-#include "VendorManifest.h"
+#include "HalManifest.h"
 
 #include "parse_xml.h"
 #include "CompatibilityMatrix.h"
@@ -36,13 +36,13 @@
 namespace android {
 namespace vintf {
 
-constexpr Version VendorManifest::kVersion;
+constexpr Version HalManifest::kVersion;
 
-bool VendorManifest::add(ManifestHal &&hal) {
+bool HalManifest::add(ManifestHal &&hal) {
     return hal.isValid() && mHals.emplace(hal.name, std::move(hal)).second;
 }
 
-const ManifestHal *VendorManifest::getHal(const std::string &name) const {
+const ManifestHal *HalManifest::getHal(const std::string &name) const {
     const auto it = mHals.find(name);
     if (it == mHals.end()) {
         return nullptr;
@@ -50,24 +50,24 @@
     return &(it->second);
 }
 
-Transport VendorManifest::getTransport(const std::string &name, const Version &v) const {
+Transport HalManifest::getTransport(const std::string &name, const Version &v) const {
     const ManifestHal *hal = getHal(name);
     if (hal == nullptr) {
         return Transport::EMPTY;
     }
     if (std::find(hal->versions.begin(), hal->versions.end(), v) == hal->versions.end()) {
-        LOG(WARNING) << "VendorManifest::getTransport: Cannot find "
+        LOG(WARNING) << "HalManifest::getTransport: Cannot find "
                      << v.majorVer << "." << v.minorVer << " in supported versions of " << name;
         return Transport::EMPTY;
     }
     return hal->transport;
 }
 
-ConstMapValueIterable<std::string, ManifestHal> VendorManifest::getHals() const {
+ConstMapValueIterable<std::string, ManifestHal> HalManifest::getHals() const {
     return ConstMapValueIterable<std::string, ManifestHal>(mHals);
 }
 
-const std::vector<Version> &VendorManifest::getSupportedVersions(const std::string &name) const {
+const std::vector<Version> &HalManifest::getSupportedVersions(const std::string &name) const {
     static const std::vector<Version> empty{};
     const ManifestHal *hal = getHal(name);
     if (hal == nullptr) {
@@ -95,7 +95,7 @@
     return false;
 }
 
-std::vector<std::string> VendorManifest::checkIncompatiblity(const CompatibilityMatrix &mat) const {
+std::vector<std::string> HalManifest::checkIncompatiblity(const CompatibilityMatrix &mat) const {
     std::vector<std::string> incompatible;
     for (const MatrixHal &matrixHal : mat.getHals()) {
         // don't check optional; put it in the incompatibility list as well.
@@ -114,7 +114,7 @@
     return incompatible;
 }
 
-status_t VendorManifest::fetchAllInformation() {
+status_t HalManifest::fetchAllInformation() {
 #if 0
     // TODO: b/33755377 Uncomment this if we use a directory of fragments instead.
     status_t err = OK;
@@ -150,19 +150,19 @@
     }
     std::stringstream ss;
     ss << in.rdbuf();
-    bool success = gVendorManifestConverter(this, ss.str());
+    bool success = gHalManifestConverter(this, ss.str());
     if (!success) {
         LOG(ERROR) << "Illformed vendor manifest: " MANIFEST_FILE << ": "
-                   << gVendorManifestConverter.lastError();
+                   << gHalManifestConverter.lastError();
         return BAD_VALUE;
     }
     return OK;
 }
 
 // static
-const VendorManifest *VendorManifest::Get() {
-    static VendorManifest vm{};
-    static VendorManifest *vmp = nullptr;
+const HalManifest *HalManifest::Get() {
+    static HalManifest vm{};
+    static HalManifest *vmp = nullptr;
     static std::mutex mutex{};
 
     std::lock_guard<std::mutex> lock(mutex);
diff --git a/include/vintf/VendorManifest.h b/include/vintf/HalManifest.h
similarity index 91%
rename from include/vintf/VendorManifest.h
rename to include/vintf/HalManifest.h
index ddbbf6d..eb00782 100644
--- a/include/vintf/VendorManifest.h
+++ b/include/vintf/HalManifest.h
@@ -15,8 +15,8 @@
  */
 
 
-#ifndef ANDROID_VINTF_VENDOR_MANIFEST_H
-#define ANDROID_VINTF_VENDOR_MANIFEST_H
+#ifndef ANDROID_VINTF_HAL_MANIFEST_H
+#define ANDROID_VINTF_HAL_MANIFEST_H
 
 #include <map>
 #include <string>
@@ -34,13 +34,13 @@
 
 // A Vendor Interface Object is reported by the hardware and query-able from
 // framework code. This is the API for the framework.
-struct VendorManifest {
+struct HalManifest {
 public:
 
     // manifest.version
     constexpr static Version kVersion{1, 0};
 
-    VendorManifest() {}
+    HalManifest() {}
 
     // Get an HAL entry based on the component name. Return nullptr
     // if the entry does not exist. The component name looks like:
@@ -65,16 +65,16 @@
     // for the framework.
     std::vector<std::string> checkIncompatiblity(const CompatibilityMatrix &mat) const;
 
-    // Gather all Vendor Manifest fragments, and encapsulate in a VendorManifest.
+    // Gather all Vendor Manifest fragments, and encapsulate in a HalManifest.
     // If no error, it return the same singleton object in the future, and the HAL manifest
     // file won't be touched again.
     // If any error, nullptr is returned, and Get will try to parse the HAL manifest
     // again when it is called again.
     // This operation is thread-safe.
-    static const VendorManifest *Get();
+    static const HalManifest *Get();
 
 private:
-    friend struct VendorManifestConverter;
+    friend struct HalManifestConverter;
     friend struct LibVintfTest;
 
     // Add an hal to this manifest.
@@ -94,4 +94,4 @@
 } // namespace vintf
 } // namespace android
 
-#endif // ANDROID_VINTF_VENDOR_MANIFEST_H
+#endif // ANDROID_VINTF_HAL_MANIFEST_H
diff --git a/include/vintf/ManifestHal.h b/include/vintf/ManifestHal.h
index 837415f..4f007cf 100644
--- a/include/vintf/ManifestHal.h
+++ b/include/vintf/ManifestHal.h
@@ -61,7 +61,7 @@
 private:
     friend struct LibVintfTest;
     friend struct ManifestHalConverter;
-    friend struct VendorManifest;
+    friend struct HalManifest;
     friend bool parse(const std::string &s, ManifestHal *hal);
 
     // Whether this hal is a valid one. Note that an empty ManifestHal
diff --git a/include/vintf/RuntimeInfo.h b/include/vintf/RuntimeInfo.h
index 64bbb59..5b49631 100644
--- a/include/vintf/RuntimeInfo.h
+++ b/include/vintf/RuntimeInfo.h
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_VINTF_KERNEL_INFO_H
-#define ANDROID_VINTF_KERNEL_INFO_H
+#ifndef ANDROID_VINTF_RUNTIME_INFO_H
+#define ANDROID_VINTF_RUNTIME_INFO_H
 
 #include "Version.h"
 
@@ -29,7 +29,7 @@
 
 struct CompatibilityMatrix;
 
-// Kernel Info sent to OTA server
+// Runtime Info sent to OTA server
 struct RuntimeInfo {
 
     RuntimeInfo() {}
@@ -83,4 +83,4 @@
 } // namespace vintf
 } // namespace android
 
-#endif // ANDROID_VINTF_KERNEL_INFO_H
+#endif // ANDROID_VINTF_RUNTIME_INFO_H
diff --git a/include/vintf/parse_string.h b/include/vintf/parse_string.h
index 3cd5232..eef5c9e 100644
--- a/include/vintf/parse_string.h
+++ b/include/vintf/parse_string.h
@@ -23,7 +23,7 @@
 
 #include "CompatibilityMatrix.h"
 #include "RuntimeInfo.h"
-#include "VendorManifest.h"
+#include "HalManifest.h"
 
 namespace android {
 namespace vintf {
@@ -75,7 +75,7 @@
 // A string that describes the whole object, with versions of all
 // its components. For debugging and testing purposes only. This is not
 // the XML string.
-std::string dump(const VendorManifest &vm);
+std::string dump(const HalManifest &vm);
 
 std::string dump(const RuntimeInfo &ki);
 
diff --git a/include/vintf/parse_xml.h b/include/vintf/parse_xml.h
index a94cee2..f1c6a98 100644
--- a/include/vintf/parse_xml.h
+++ b/include/vintf/parse_xml.h
@@ -18,7 +18,7 @@
 #define ANDROID_VINTF_PARSE_XML_H
 
 #include "CompatibilityMatrix.h"
-#include "VendorManifest.h"
+#include "HalManifest.h"
 
 namespace android {
 namespace vintf {
@@ -34,7 +34,7 @@
     virtual bool operator()(Object *o, const std::string &xml) const = 0;
 };
 
-extern const XmlConverter<VendorManifest> &gVendorManifestConverter;
+extern const XmlConverter<HalManifest> &gHalManifestConverter;
 
 extern const XmlConverter<CompatibilityMatrix> &gCompatibilityMatrixConverter;
 
diff --git a/main.cpp b/main.cpp
index 29d74fc..960ecaa 100644
--- a/main.cpp
+++ b/main.cpp
@@ -18,14 +18,14 @@
 #include <vintf/parse_xml.h>
 #include <vintf/parse_string.h>
 #include <vintf/RuntimeInfo.h>
-#include <vintf/VendorManifest.h>
+#include <vintf/HalManifest.h>
 
 int main(int, char **) {
     using namespace ::android::vintf;
 
-    const VendorManifest *vm = VendorManifest::Get();
+    const HalManifest *vm = HalManifest::Get();
     if (vm != nullptr)
-        std::cout << gVendorManifestConverter(*vm);
+        std::cout << gHalManifestConverter(*vm);
 
     std::cout << std::endl;
     const RuntimeInfo *ki = RuntimeInfo::Get();
diff --git a/parse_string.cpp b/parse_string.cpp
index 75d48e2..2e1714f 100644
--- a/parse_string.cpp
+++ b/parse_string.cpp
@@ -347,7 +347,7 @@
     return true;
 }
 
-std::string dump(const VendorManifest &vm) {
+std::string dump(const HalManifest &vm) {
     std::ostringstream oss;
     bool first = true;
     for (const auto &hal : vm.getHals()) {
diff --git a/parse_xml.cpp b/parse_xml.cpp
index b98f09a..c58e0f3 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -446,15 +446,15 @@
 };
 const SepolicyConverter sepolicyConverter{};
 
-struct VendorManifestConverter : public XmlNodeConverter<VendorManifest> {
+struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
     std::string elementName() const override { return "manifest"; }
-    void mutateNode(const VendorManifest &m, NodeType *root, DocType *d) const override {
-        appendAttr(root, "version", VendorManifest::kVersion);
+    void mutateNode(const HalManifest &m, NodeType *root, DocType *d) const override {
+        appendAttr(root, "version", HalManifest::kVersion);
         for (const auto &hal : m.getHals()) {
             appendChild(root, manifestHalConverter(hal, d));
         }
     }
-    bool buildObject(VendorManifest *object, NodeType *root) const override {
+    bool buildObject(HalManifest *object, NodeType *root) const override {
         std::vector<ManifestHal> hals;
         if (!parseChildren(root, manifestHalConverter, &hals)) {
             return false;
@@ -466,7 +466,7 @@
     }
 };
 
-const VendorManifestConverter vendorManifestConverter{};
+const HalManifestConverter halManifestConverter{};
 
 struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatrix> {
     std::string elementName() const override { return "compatibility-matrix"; }
@@ -497,7 +497,7 @@
 const CompatibilityMatrixConverter compatibilityMatrixConverter{};
 
 // Publicly available as in parse_xml.h
-const XmlConverter<VendorManifest> &gVendorManifestConverter = vendorManifestConverter;
+const XmlConverter<HalManifest> &gHalManifestConverter = halManifestConverter;
 const XmlConverter<CompatibilityMatrix> &gCompatibilityMatrixConverter
         = compatibilityMatrixConverter;
 
diff --git a/test/main.cpp b/test/main.cpp
index cfaa0fc..6a55da9 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -20,7 +20,7 @@
 #include <vintf/parse_xml.h>
 #include <vintf/CompatibilityMatrix.h>
 #include <vintf/RuntimeInfo.h>
-#include <vintf/VendorManifest.h>
+#include <vintf/HalManifest.h>
 
 #include <android-base/logging.h>
 #include <android-base/parseint.h>
@@ -33,7 +33,7 @@
 extern const XmlConverter<MatrixHal> &gMatrixHalConverter;
 extern const XmlConverter<KernelConfigTypedValue> &gKernelConfigTypedValueConverter;
 extern const XmlConverter<HalImplementation> &gHalImplementationConverter;
-extern const XmlConverter<VendorManifest> &gVendorManifestConverter;
+extern const XmlConverter<HalManifest> &gHalManifestConverter;
 extern const XmlConverter<CompatibilityMatrix> &gCompatibilityMatrixConverter;
 
 struct LibVintfTest : public ::testing::Test {
@@ -48,16 +48,16 @@
     bool add(CompatibilityMatrix &cm, MatrixKernel &&kernel) {
         return cm.add(std::move(kernel));
     }
-    bool add(VendorManifest &vm, ManifestHal &&hal) {
+    bool add(HalManifest &vm, ManifestHal &&hal) {
         return vm.add(std::move(hal));
     }
     void set(CompatibilityMatrix &cm, Sepolicy &&sepolicy) {
         cm.mSepolicy = sepolicy;
     }
-    const ManifestHal *getHal(VendorManifest &vm, const std::string &name) {
+    const ManifestHal *getHal(HalManifest &vm, const std::string &name) {
         return vm.getHal(name);
     }
-    ConstMapValueIterable<std::string, ManifestHal> getHals(VendorManifest &vm) {
+    ConstMapValueIterable<std::string, ManifestHal> getHals(HalManifest &vm) {
         return vm.getHals();
     }
     bool isEqual(const CompatibilityMatrix &cm1, const CompatibilityMatrix &cm2) {
@@ -66,8 +66,8 @@
     bool isValid(const ManifestHal &mh) {
         return mh.isValid();
     }
-    VendorManifest testVendorManifest() {
-        VendorManifest vm;
+    HalManifest testHalManifest() {
+        HalManifest vm;
         vm.add(ManifestHal::hal("android.hardware.camera", ImplLevel::SOC, "msm8892",
                 Version(2,0), Transport::HWBINDER));
         vm.add(ManifestHal::hal("android.hardware.nfc", ImplLevel::GENERIC, "generic",
@@ -97,7 +97,7 @@
 
 
 TEST_F(LibVintfTest, Stringify) {
-    VendorManifest vm = testVendorManifest();
+    HalManifest vm = testHalManifest();
     EXPECT_EQ(dump(vm), "hidl/android.hardware.camera/hwbinder/soc/msm8892/2.0:"
                         "hidl/android.hardware.nfc/passthrough/generic/generic/1.0");
 
@@ -111,9 +111,9 @@
     EXPECT_EQ(v, v2);
 }
 
-TEST_F(LibVintfTest, VendorManifestConverter) {
-    VendorManifest vm = testVendorManifest();
-    std::string xml = gVendorManifestConverter(vm);
+TEST_F(LibVintfTest, HalManifestConverter) {
+    HalManifest vm = testHalManifest();
+    std::string xml = gHalManifestConverter(vm);
     EXPECT_EQ(xml,
         "<manifest version=\"1.0\">\n"
         "    <hal format=\"hidl\">\n"
@@ -312,12 +312,12 @@
     ManifestHal invalidHal = ManifestHal::hal("android.hardware.camera", ImplLevel::SOC, "msm8892",
             {{Version(2,0), Version(2,1)}}, Transport::PASSTHROUGH);
     EXPECT_FALSE(isValid(invalidHal));
-    VendorManifest vm2;
+    HalManifest vm2;
     EXPECT_FALSE(add(vm2, std::move(invalidHal)));
 }
 
-TEST_F(LibVintfTest, VendorManifestGetHal) {
-    VendorManifest vm = testVendorManifest();
+TEST_F(LibVintfTest, HalManifestGetHal) {
+    HalManifest vm = testHalManifest();
     EXPECT_NE(getHal(vm, "android.hardware.camera"), nullptr);
     EXPECT_EQ(getHal(vm, "non-existent"), nullptr);