Remove <impl> tag from ManifestHal.

It is deprecated as suggested by documentation.
Test: libvintf_test

Bug: 36602724

Change-Id: Ifc847f87f654b0c62dba6106ae5b19c9c2d87f30
diff --git a/include/vintf/ImplLevel.h b/include/vintf/ImplLevel.h
deleted file mode 100644
index 4e69e2b..0000000
--- a/include/vintf/ImplLevel.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef ANDROID_VINTF_IMPL_LEVEL_H
-#define ANDROID_VINTF_IMPL_LEVEL_H
-
-#include <stdint.h>
-#include <string>
-#include <array>
-
-namespace android {
-namespace vintf {
-
-enum class ImplLevel : size_t {
-    EMPTY = 0,
-    TARGET,
-    SOC,
-    GENERIC
-};
-
-static const std::array<std::string, 4> gImplLevelStrings = {
-    {
-        "",
-        "target",
-        "soc",
-        "generic",
-    }
-};
-
-} // namespace vintf
-} // namespace android
-
-#endif // ANDROID_VINTF_IMPL_LEVEL_H
diff --git a/include/vintf/ManifestHal.h b/include/vintf/ManifestHal.h
index 3a73f07..ffa272d 100644
--- a/include/vintf/ManifestHal.h
+++ b/include/vintf/ManifestHal.h
@@ -23,7 +23,6 @@
 #include <map>
 
 #include "HalFormat.h"
-#include "ImplLevel.h"
 #include "ManifestHalInterface.h"
 #include "TransportArch.h"
 #include "Version.h"
@@ -31,11 +30,6 @@
 namespace android {
 namespace vintf {
 
-struct HalImplementation {
-    ImplLevel implLevel = ImplLevel::EMPTY;
-    std::string impl;
-};
-
 // A component of HalManifest.
 struct ManifestHal {
 
@@ -44,7 +38,6 @@
     HalFormat format = HalFormat::HIDL;
     std::string name;
     std::vector<Version> versions;
-    HalImplementation impl;
     TransportArch transportArch;
     std::map<std::string, ManifestHalInterface> interfaces;
 
diff --git a/include/vintf/parse_string.h b/include/vintf/parse_string.h
index 8f3bb70..8c81de4 100644
--- a/include/vintf/parse_string.h
+++ b/include/vintf/parse_string.h
@@ -29,7 +29,6 @@
 namespace vintf {
 
 std::ostream &operator<<(std::ostream &os, HalFormat hf);
-std::ostream &operator<<(std::ostream &os, ImplLevel il);
 std::ostream &operator<<(std::ostream &os, Transport tr);
 std::ostream &operator<<(std::ostream &os, Arch ar);
 std::ostream &operator<<(std::ostream &os, KernelConfigType il);
@@ -52,7 +51,6 @@
 }
 
 bool parse(const std::string &s, HalFormat *hf);
-bool parse(const std::string &s, ImplLevel *il);
 bool parse(const std::string &s, Transport *tr);
 bool parse(const std::string &s, Arch *ar);
 bool parse(const std::string &s, KernelConfigType *il);
diff --git a/parse_string.cpp b/parse_string.cpp
index f6ecc31..cec3adf 100644
--- a/parse_string.cpp
+++ b/parse_string.cpp
@@ -92,7 +92,6 @@
     }                                                              \
 
 DEFINE_PARSE_STREAMIN_FOR_ENUM(HalFormat);
-DEFINE_PARSE_STREAMIN_FOR_ENUM(ImplLevel);
 DEFINE_PARSE_STREAMIN_FOR_ENUM(Transport);
 DEFINE_PARSE_STREAMIN_FOR_ENUM(Arch);
 DEFINE_PARSE_STREAMIN_FOR_ENUM(KernelConfigType);
@@ -270,7 +269,7 @@
 
 bool parse(const std::string &s, ManifestHal *hal) {
     std::vector<std::string> v = SplitString(s, '/');
-    if (v.size() != 5) {
+    if (v.size() != 4) {
         return false;
     }
     if (!parse(v[0], &hal->format)) {
@@ -280,11 +279,7 @@
     if (!parse(v[2], &hal->transportArch)) {
         return false;
     }
-    if (!parse(v[3], &hal->impl.implLevel)) {
-        return false;
-    }
-    hal->impl.impl = v[4];
-    if (!parse(v[5], &hal->versions)) {
+    if (!parse(v[3], &hal->versions)) {
         return false;
     }
     return hal->isValid();
@@ -294,8 +289,6 @@
     return os << hal.format << "/"
               << hal.name << "/"
               << hal.transportArch << "/"
-              << hal.impl.implLevel << "/"
-              << hal.impl.impl << "/"
               << hal.versions;
 }
 
diff --git a/parse_xml.cpp b/parse_xml.cpp
index d3838f8..f52f849 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -455,23 +455,6 @@
 
 const MatrixKernelConverter matrixKernelConverter{};
 
-struct HalImplementationConverter : public XmlNodeConverter<HalImplementation> {
-    std::string elementName() const override { return "impl"; }
-    void mutateNode(const HalImplementation &impl, NodeType *root, DocType *d) const override {
-        appendAttr(root, "level", impl.implLevel);
-        appendText(root, impl.impl, d);
-    }
-    bool buildObject(HalImplementation *object, NodeType *root) const override {
-        if (!parseAttr(root, "level", &object->implLevel) ||
-            !parseText(root, &object->impl)) {
-            return false;
-        }
-        return true;
-    }
-};
-
-const HalImplementationConverter halImplementationConverter{};
-
 struct ManfiestHalInterfaceConverter : public XmlNodeConverter<ManifestHalInterface> {
     std::string elementName() const override { return "interface"; }
     void mutateNode(const ManifestHalInterface &intf, NodeType *root, DocType *d) const override {
@@ -504,9 +487,6 @@
         if (!hal.transportArch.empty()) {
             appendChild(root, transportArchConverter(hal.transportArch, d));
         }
-        if (hal.impl.implLevel != ImplLevel::EMPTY) {
-            appendChild(root, halImplementationConverter(hal.impl, d));
-        }
         appendChildren(root, versionConverter, hal.versions, d);
         appendChildren(root, manfiestHalInterfaceConverter, iterateValues(hal.interfaces), d);
     }
@@ -515,7 +495,6 @@
         if (!parseOptionalAttr(root, "format", HalFormat::HIDL, &object->format) ||
             !parseTextElement(root, "name", &object->name) ||
             !parseChild(root, transportArchConverter, &object->transportArch) ||
-            !parseOptionalChild(root, halImplementationConverter, {}, &object->impl) ||
             !parseChildren(root, versionConverter, &object->versions) ||
             !parseChildren(root, manfiestHalInterfaceConverter, &interfaces)) {
             return false;
@@ -620,7 +599,6 @@
 const XmlConverter<KernelConfigTypedValue> &gKernelConfigTypedValueConverter
         = kernelConfigTypedValueConverter;
 const XmlConverter<MatrixHal> &gMatrixHalConverter = matrixHalConverter;
-const XmlConverter<HalImplementation> &gHalImplementationConverter = halImplementationConverter;
 const XmlConverter<ManifestHal> &gManifestHalConverter = manifestHalConverter;
 
 } // namespace vintf
diff --git a/test/main.cpp b/test/main.cpp
index ef52d13..61b6bd9 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -33,7 +33,6 @@
 extern const XmlConverter<ManifestHal> &gManifestHalConverter;
 extern const XmlConverter<MatrixHal> &gMatrixHalConverter;
 extern const XmlConverter<KernelConfigTypedValue> &gKernelConfigTypedValueConverter;
-extern const XmlConverter<HalImplementation> &gHalImplementationConverter;
 extern const XmlConverter<HalManifest> &gHalManifestConverter;
 extern const XmlConverter<CompatibilityMatrix> &gCompatibilityMatrixConverter;
 
@@ -73,7 +72,6 @@
             .format = HalFormat::HIDL,
             .name = "android.hardware.camera",
             .versions = {Version(2, 0)},
-            .impl = HalImplementation{ImplLevel::SOC, "msm8892"},
             .transportArch = {Transport::HWBINDER, Arch::ARCH_EMPTY},
             .interfaces = {
                 {"ICamera", {"ICamera", {"legacy/0", "default"}}},
@@ -84,7 +82,6 @@
             .format = HalFormat::HIDL,
             .name = "android.hardware.nfc",
             .versions = {Version(1, 0)},
-            .impl = HalImplementation{ImplLevel::GENERIC, "generic"},
             .transportArch = {Transport::PASSTHROUGH, Arch::ARCH_32_64},
             .interfaces = {
                 {"INfc", {"INfc", {"default"}}}
@@ -116,8 +113,8 @@
 
 TEST_F(LibVintfTest, Stringify) {
     HalManifest vm = testHalManifest();
-    EXPECT_EQ(dump(vm), "hidl/android.hardware.camera/hwbinder/soc/msm8892/2.0:"
-                        "hidl/android.hardware.nfc/passthrough32+64/generic/generic/1.0");
+    EXPECT_EQ(dump(vm), "hidl/android.hardware.camera/hwbinder/2.0:"
+                        "hidl/android.hardware.nfc/passthrough32+64/1.0");
 
     EXPECT_EQ(to_string(HalFormat::HIDL), "hidl");
     EXPECT_EQ(to_string(HalFormat::NATIVE), "native");
@@ -137,7 +134,6 @@
         "    <hal format=\"hidl\">\n"
         "        <name>android.hardware.camera</name>\n"
         "        <transport>hwbinder</transport>\n"
-        "        <impl level=\"soc\">msm8892</impl>\n"
         "        <version>2.0</version>\n"
         "        <interface>\n"
         "            <name>IBetterCamera</name>\n"
@@ -152,7 +148,6 @@
         "    <hal format=\"hidl\">\n"
         "        <name>android.hardware.nfc</name>\n"
         "        <transport arch=\"32+64\">passthrough</transport>\n"
-        "        <impl level=\"generic\">generic</impl>\n"
         "        <version>1.0</version>\n"
         "        <interface>\n"
         "            <name>INfc</name>\n"
@@ -162,21 +157,6 @@
         "</manifest>\n");
 }
 
-TEST_F(LibVintfTest, EmptyImpl) {
-    EXPECT_EQ(gManifestHalConverter(
-        ManifestHal{
-            .format = HalFormat::HIDL,
-            .name = "android.hidl.manager",
-            .impl = HalImplementation{},
-            .transportArch = {Transport::HWBINDER, Arch::ARCH_EMPTY},
-        }),
-        "<hal format=\"hidl\">\n"
-        "    <name>android.hidl.manager</name>\n"
-        "    <transport>hwbinder</transport>\n"
-        "</hal>\n"
-    ) << "HalImplementation should be missing.";
-}
-
 TEST_F(LibVintfTest, HalManifestOptional) {
     HalManifest vm;
     EXPECT_TRUE(gHalManifestConverter(&vm,
@@ -230,16 +210,6 @@
     EXPECT_EQ(v, v2);
 }
 
-TEST_F(LibVintfTest, HalImplementationConverter) {
-    HalImplementation hl{ImplLevel::SOC, "msm8992"};
-    std::string xml = gHalImplementationConverter(hl);
-    EXPECT_EQ(xml, "<impl level=\"soc\">msm8992</impl>\n");
-    HalImplementation hl2;
-    EXPECT_TRUE(gHalImplementationConverter(&hl2, xml));
-    EXPECT_EQ(hl.impl, hl2.impl);
-    EXPECT_EQ(hl.implLevel, hl2.implLevel);
-}
-
 TEST_F(LibVintfTest, MatrixHalConverter) {
     MatrixHal mh{HalFormat::NATIVE, "android.hardware.camera",
             {{VersionRange(1,2,3), VersionRange(4,5,6)}},
@@ -403,7 +373,6 @@
         .format = HalFormat::HIDL,
         .name = "android.hardware.camera",
         .versions = {{Version(2, 0), Version(2, 1)}},
-        .impl = HalImplementation{ImplLevel::SOC, "msm8892"},
         .transportArch = {Transport::PASSTHROUGH, Arch::ARCH_32_64}
     };