libvintf 2.0.

Bump libvintf's meta version to 2.0.

Older versions of libvintf can't parse meta
version 2.0. Now that VINTF checks are no longer executed
during OTA time but only during build times, we no longer
need forwards-compatibility of libvintf (that is, older
versions of libvintf doesn't need to parse new VINTF metadata
anymore).

Now, libvintf can read all manifests / matrices with version 1.x
and 2.0. Libvintf always writes manifests / matrices with version
2.0.

This is the first non-forwards-compatible change to libvintf.

Test: libvintf_test
Bug: 139300422

Change-Id: Ic66091a1e6a70248a38c5404c02c201f627413df
diff --git a/parse_xml.cpp b/parse_xml.cpp
index fee7ba6..b59bd6b 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -967,15 +967,17 @@
         }
     }
     bool buildObject(HalManifest* object, NodeType* root, std::string* error) const override {
-        std::vector<ManifestHal> hals;
-        if (!parseAttr(root, "version", &object->mMetaVersion, error) ||
-            !parseAttr(root, "type", &object->mType, error) ||
-            !parseChildren(root, manifestHalConverter, &hals, error)) {
+        Version metaVersion;
+        if (!parseAttr(root, "version", &metaVersion, error)) return false;
+        if (metaVersion > kMetaVersion) {
+            *error = "Unrecognized manifest.version " + to_string(metaVersion) + " (libvintf@" +
+                     to_string(kMetaVersion) + ")";
             return false;
         }
-        if (!kMetaVersion.minorAtLeast(object->mMetaVersion)) {
-            *error = "Unrecognized manifest.version " + to_string(object->mMetaVersion) +
-                     " (libvintf@" + to_string(kMetaVersion) + ")";
+
+        std::vector<ManifestHal> hals;
+        if (!parseAttr(root, "type", &object->mType, error) ||
+            !parseChildren(root, manifestHalConverter, &hals, error)) {
             return false;
         }
         if (object->mType == SchemaType::DEVICE) {
@@ -1099,7 +1101,7 @@
     void mutateNode(const CompatibilityMatrix& m, NodeType* root, DocType* d,
                     SerializeFlags::Type flags) const override {
         if (flags.isMetaVersionEnabled()) {
-            appendAttr(root, "version", m.getMinimumMetaVersion());
+            appendAttr(root, "version", kMetaVersion);
         }
         if (flags.isSchemaTypeEnabled()) {
             appendAttr(root, "type", m.mType);
@@ -1152,10 +1154,16 @@
     }
     bool buildObject(CompatibilityMatrix* object, NodeType* root,
                      std::string* error) const override {
-        Version version;
+        Version metaVersion;
+        if (!parseAttr(root, "version", &metaVersion, error)) return false;
+        if (metaVersion > kMetaVersion) {
+            *error = "Unrecognized compatibility-matrix.version " + to_string(metaVersion) +
+                     " (libvintf@" + to_string(kMetaVersion) + ")";
+            return false;
+        }
+
         std::vector<MatrixHal> hals;
-        if (!parseAttr(root, "version", &version, error) ||
-            !parseAttr(root, "type", &object->mType, error) ||
+        if (!parseAttr(root, "type", &object->mType, error) ||
             !parseChildren(root, matrixHalConverter, &hals, error)) {
             return false;
         }
@@ -1210,11 +1218,6 @@
             }
         }
 
-        if (!kMetaVersion.minorAtLeast(version)) {
-            *error = "Unrecognized compatibility-matrix.version " + to_string(version) +
-                     " (libvintf@" + to_string(kMetaVersion) + ")";
-            return false;
-        }
         for (auto &&hal : hals) {
             if (!object->add(std::move(hal))) {
                 *error = "Duplicated compatibility-matrix.hal entry";