Revert "Fix check deprecation to use Hidl Metadata."

Revert "Use HIDL metadata for deprecation check"

Revert submission 10745362-check_unused

Reason for revert: Droidcop: Potential culprit for Bug 152161259
Reverted Changes:
I92cd7ce1c:Use HIDL metadata for deprecation check
I2b9492eec:Fix check deprecation to use Hidl Metadata.
I6e40a49d5:Add no unused hals test
Ia352a979d:Delete unused GNSS@2.0 Thermal@2.0 checks
I1c0ef715b:checkUnusedHals: use hidl metadata
I44a5240e8:Check unused HALs on device with target FCM versio...
I5c5ec4891:Check unused HALs when system ext matrix exists.
I17894c025:Add libhidlmetadata_headers
I2c7cbf8f5:Drop GNSS1.1 and Thermal1.0

Change-Id: I76831d3999de1e6ac67521b0885455466ce727a6
diff --git a/VintfObject.cpp b/VintfObject.cpp
index 115081f..320f97f 100644
--- a/VintfObject.cpp
+++ b/VintfObject.cpp
@@ -18,7 +18,6 @@
 
 #include <dirent.h>
 
-#include <algorithm>
 #include <functional>
 #include <memory>
 #include <mutex>
@@ -630,27 +629,26 @@
 
 bool VintfObject::IsHalDeprecated(const MatrixHal& oldMatrixHal,
                                   const CompatibilityMatrix& targetMatrix,
-                                  const ListInstances& listInstances,
-                                  const ChildrenMap& childrenMap, std::string* appendedError) {
+                                  const ListInstances& listInstances, std::string* error) {
     bool isDeprecated = false;
     oldMatrixHal.forEachInstance([&](const MatrixInstance& oldMatrixInstance) {
-        if (IsInstanceDeprecated(oldMatrixInstance, targetMatrix, listInstances, childrenMap,
-                                 appendedError)) {
+        if (IsInstanceDeprecated(oldMatrixInstance, targetMatrix, listInstances, error)) {
             isDeprecated = true;
         }
-        return true;  // continue to check next instance
+        return !isDeprecated;  // continue if no deprecated instance is found.
     });
     return isDeprecated;
 }
 
-// Let oldMatrixInstance = package@x.y-w::interface/instancePattern.
-// If any "@servedVersion::interface/servedInstance" in listInstances(package@x.y::interface)
-// matches instancePattern, return true iff for all child interfaces (from
-// GetListedInstanceInheritance), IsFqInstanceDeprecated returns false.
+// Let oldMatrixInstance = package@x.y-w::interface with instancePattern.
+// If any "servedInstance" in listInstances(package@x.y::interface) matches instancePattern, return
+// true iff:
+// 1. package@x.?::interface/servedInstance is not in targetMatrix; OR
+// 2. package@x.z::interface/servedInstance is in targetMatrix but
+//    servedInstance is not in listInstances(package@x.z::interface)
 bool VintfObject::IsInstanceDeprecated(const MatrixInstance& oldMatrixInstance,
                                        const CompatibilityMatrix& targetMatrix,
-                                       const ListInstances& listInstances,
-                                       const ChildrenMap& childrenMap, std::string* appendedError) {
+                                       const ListInstances& listInstances, std::string* error) {
     const std::string& package = oldMatrixInstance.package();
     const Version& version = oldMatrixInstance.versionRange().minVer();
     const std::string& interface = oldMatrixInstance.interface();
@@ -660,152 +658,60 @@
         instanceHint.push_back(oldMatrixInstance.exactInstance());
     }
 
-    std::vector<std::string> accumulatedErrors;
     auto list = listInstances(package, version, interface, instanceHint);
-
     for (const auto& pair : list) {
         const std::string& servedInstance = pair.first;
         Version servedVersion = pair.second;
-        std::string servedFqInstanceString =
-            toFQNameString(package, servedVersion, interface, servedInstance);
         if (!oldMatrixInstance.matchInstance(servedInstance)) {
-            // ignore unrelated instance
             continue;
         }
 
-        auto inheritance = GetListedInstanceInheritance(package, servedVersion, interface,
-                                                        servedInstance, listInstances, childrenMap);
-        if (!inheritance.has_value()) {
-            accumulatedErrors.push_back(inheritance.error().message());
-            continue;
-        }
-
-        std::vector<std::string> errors;
-        for (const auto& fqInstance : *inheritance) {
-            auto result = IsFqInstanceDeprecated(targetMatrix, oldMatrixInstance.format(),
-                                                 fqInstance, listInstances);
-            if (result.ok()) {
-                errors.clear();
-                break;
-            }
-            errors.push_back(result.error().message());
-        }
-
-        if (errors.empty()) {
-            continue;
-        }
-        accumulatedErrors.insert(accumulatedErrors.end(), errors.begin(), errors.end());
-    }
-
-    if (accumulatedErrors.empty()) {
-        return false;
-    }
-    appendLine(appendedError, android::base::Join(accumulatedErrors, "\n"));
-    return true;
-}
-
-// Check if fqInstance is listed in |listInstances|.
-bool VintfObject::IsInstanceListed(const ListInstances& listInstances,
-                                   const FqInstance& fqInstance) {
-    auto list =
-        listInstances(fqInstance.getPackage(), fqInstance.getVersion(), fqInstance.getInterface(),
-                      {fqInstance.getInstance()} /* instanceHint*/);
-    return std::any_of(list.begin(), list.end(),
-                       [&](const auto& pair) { return pair.first == fqInstance.getInstance(); });
-}
-
-// Return a list of FqInstance, where each element:
-// - is listed in |listInstances|; AND
-// - is, or inherits from, package@version::interface/instance (as specified by |childrenMap|)
-android::base::Result<std::vector<FqInstance>> VintfObject::GetListedInstanceInheritance(
-    const std::string& package, const Version& version, const std::string& interface,
-    const std::string& instance, const ListInstances& listInstances,
-    const ChildrenMap& childrenMap) {
-    FqInstance fqInstance;
-    if (!fqInstance.setTo(package, version.majorVer, version.minorVer, interface, instance)) {
-        return android::base::Error() << toFQNameString(package, version, interface, instance)
-                                      << " is not a valid FqInstance";
-    }
-
-    if (!IsInstanceListed(listInstances, fqInstance)) {
-        return {};
-    }
-
-    const FQName& fqName = fqInstance.getFqName();
-
-    std::vector<FqInstance> ret;
-    ret.push_back(fqInstance);
-
-    auto childRange = childrenMap.equal_range(fqName.string());
-    for (auto it = childRange.first; it != childRange.second; ++it) {
-        const auto& childFqNameString = it->second;
-        FQName childFqName;
-        if (!childFqName.setTo(childFqNameString)) {
-            return android::base::Error() << "Cannot parse " << childFqNameString << " as FQName";
-        }
-        FqInstance childFqInstance;
-        if (!childFqInstance.setTo(childFqName, fqInstance.getInstance())) {
-            return android::base::Error() << "Cannot merge " << childFqName.string() << "/"
-                                          << fqInstance.getInstance() << " as FqInstance";
-            continue;
-        }
-        if (!IsInstanceListed(listInstances, childFqInstance)) {
-            continue;
-        }
-        ret.push_back(childFqInstance);
-    }
-    return ret;
-}
-
-// Check if |fqInstance| is in |targetMatrix|; essentially equal to
-// targetMatrix.matchInstance(fqInstance), but provides richer error message. In details:
-// 1. package@x.?::interface/servedInstance is not in targetMatrix; OR
-// 2. package@x.z::interface/servedInstance is in targetMatrix but
-//    servedInstance is not in listInstances(package@x.z::interface)
-android::base::Result<void> VintfObject::IsFqInstanceDeprecated(
-    const CompatibilityMatrix& targetMatrix, HalFormat format, const FqInstance& fqInstance,
-    const ListInstances& listInstances) {
-    // Find minimum package@x.? in target matrix, and check if instance is in target matrix.
-    bool foundInstance = false;
-    Version targetMatrixMinVer{SIZE_MAX, SIZE_MAX};
-    targetMatrix.forEachInstanceOfPackage(
-        format, fqInstance.getPackage(), [&](const auto& targetMatrixInstance) {
-            if (targetMatrixInstance.versionRange().majorVer == fqInstance.getMajorVersion() &&
-                targetMatrixInstance.interface() == fqInstance.getInterface() &&
-                targetMatrixInstance.matchInstance(fqInstance.getInstance())) {
-                targetMatrixMinVer =
-                    std::min(targetMatrixMinVer, targetMatrixInstance.versionRange().minVer());
+        // Find any package@x.? in target matrix, and check if instance is in target matrix.
+        bool foundInstance = false;
+        Version targetMatrixMinVer;
+        targetMatrix.forEachHidlInstanceOfPackage(package, [&](const auto& targetMatrixInstance) {
+            if (targetMatrixInstance.versionRange().majorVer == version.majorVer &&
+                targetMatrixInstance.interface() == interface &&
+                targetMatrixInstance.matchInstance(servedInstance)) {
+                targetMatrixMinVer = targetMatrixInstance.versionRange().minVer();
                 foundInstance = true;
             }
-            return true;
+            return !foundInstance;  // continue if not found
         });
-    if (!foundInstance) {
-        return android::base::Error()
-               << fqInstance.string() << " is deprecated in compatibility matrix at FCM Version "
-               << targetMatrix.level() << "; it should not be served.";
-    }
+        if (!foundInstance) {
+            if (error) {
+                *error = toFQNameString(package, servedVersion, interface, servedInstance) +
+                         " is deprecated in compatibility matrix at FCM Version " +
+                         to_string(targetMatrix.level()) + "; it should not be served.";
+            }
+            return true;
+        }
 
-    // Assuming that targetMatrix requires @x.u-v, require that at least @x.u is served.
-    bool targetVersionServed = false;
-    for (const auto& newPair :
-         listInstances(fqInstance.getPackage(), targetMatrixMinVer, fqInstance.getInterface(),
-                       {fqInstance.getInstance()} /* instanceHint */)) {
-        if (newPair.first == fqInstance.getInstance()) {
-            targetVersionServed = true;
-            break;
+        // Assuming that targetMatrix requires @x.u-v, require that at least @x.u is served.
+        bool targetVersionServed = false;
+        for (const auto& newPair :
+             listInstances(package, targetMatrixMinVer, interface, instanceHint)) {
+            if (newPair.first == servedInstance) {
+                targetVersionServed = true;
+                break;
+            }
+        }
+
+        if (!targetVersionServed) {
+            appendLine(error, toFQNameString(package, servedVersion, interface, servedInstance) +
+                                  " is deprecated; requires at least " +
+                                  to_string(targetMatrixMinVer));
+            return true;
         }
     }
 
-    if (!targetVersionServed) {
-        return android::base::Error()
-               << fqInstance.string() << " is deprecated; requires at least " << targetMatrixMinVer;
-    }
-    return {};
+    return false;
 }
 
-int32_t VintfObject::checkDeprecation(const ListInstances& listInstances,
-                                      const std::vector<HidlInterfaceMetadata>& hidlMetadata,
-                                      std::string* error) {
+int32_t VintfObject::CheckDeprecation(const ListInstances& listInstances, std::string* error) {
+    return GetInstance()->checkDeprecation(listInstances, error);
+}
+int32_t VintfObject::checkDeprecation(const ListInstances& listInstances, std::string* error) {
     std::vector<Named<CompatibilityMatrix>> matrixFragments;
     auto matrixFragmentsStatus = getAllFrameworkMatrixLevels(&matrixFragments, error);
     if (matrixFragmentsStatus != OK) {
@@ -840,33 +746,24 @@
         return NAME_NOT_FOUND;
     }
 
-    std::multimap<std::string, std::string> childrenMap;
-    for (const auto& child : hidlMetadata) {
-        for (const auto& parent : child.inherited) {
-            childrenMap.emplace(parent, child.name);
-        }
-    }
-
-    // Find a list of possibly deprecated HALs by comparing |listInstances| with older matrices.
-    // Matrices with unspecified level are considered "current".
-    bool isDeprecated = false;
+    bool hasDeprecatedHals = false;
     for (const auto& namedMatrix : matrixFragments) {
         if (namedMatrix.object.level() == Level::UNSPECIFIED) continue;
         if (namedMatrix.object.level() >= deviceLevel) continue;
 
         const auto& oldMatrix = namedMatrix.object;
         for (const MatrixHal& hal : oldMatrix.getHals()) {
-            if (IsHalDeprecated(hal, *targetMatrix, listInstances, childrenMap, error)) {
-                isDeprecated = true;
-            }
+            hasDeprecatedHals |= IsHalDeprecated(hal, *targetMatrix, listInstances, error);
         }
     }
 
-    return isDeprecated ? DEPRECATED : NO_DEPRECATED_HALS;
+    return hasDeprecatedHals ? DEPRECATED : NO_DEPRECATED_HALS;
 }
 
-int32_t VintfObject::checkDeprecation(const std::vector<HidlInterfaceMetadata>& hidlMetadata,
-                                      std::string* error) {
+int32_t VintfObject::CheckDeprecation(std::string* error) {
+    return GetInstance()->checkDeprecation(error);
+}
+int32_t VintfObject::checkDeprecation(std::string* error) {
     using namespace std::placeholders;
     auto deviceManifest = getDeviceHalManifest();
     ListInstances inManifest =
@@ -882,7 +779,7 @@
                 });
             return ret;
         };
-    return checkDeprecation(inManifest, hidlMetadata, error);
+    return checkDeprecation(inManifest, error);
 }
 
 Level VintfObject::getKernelLevel(std::string* error) {
diff --git a/include/vintf/HalGroup.h b/include/vintf/HalGroup.h
index db87cec..9c5cda3 100644
--- a/include/vintf/HalGroup.h
+++ b/include/vintf/HalGroup.h
@@ -101,10 +101,10 @@
         });
     }
 
-    bool forEachInstanceOfPackage(HalFormat format, const std::string& package,
-                                  const std::function<bool(const InstanceType&)>& func) const {
+    bool forEachHidlInstanceOfPackage(const std::string& package,
+                                      const std::function<bool(const InstanceType&)>& func) const {
         for (const auto* hal : getHals(package)) {
-            if (hal->format != format) {
+            if (hal->format != HalFormat::HIDL) {
                 continue;
             }
             if (!hal->forEachInstance(func)) {
@@ -113,10 +113,6 @@
         }
         return true;
     }
-    bool forEachHidlInstanceOfPackage(const std::string& package,
-                                      const std::function<bool(const InstanceType&)>& func) const {
-        return forEachInstanceOfPackage(HalFormat::HIDL, package, func);
-    }
 
    protected:
     // Apply func to all instances of package@expectVersion::*/*.
diff --git a/include/vintf/VintfObject.h b/include/vintf/VintfObject.h
index cfc26ee..2a40271 100644
--- a/include/vintf/VintfObject.h
+++ b/include/vintf/VintfObject.h
@@ -17,12 +17,8 @@
 #ifndef ANDROID_VINTF_VINTF_OBJECT_H_
 #define ANDROID_VINTF_VINTF_OBJECT_H_
 
-#include <map>
 #include <memory>
 #include <optional>
-#include <string>
-#include <tuple>
-#include <vector>
 
 #include <android-base/result.h>
 #include <hidl/metadata.h>
@@ -172,9 +168,7 @@
      *         > 0 if there is at least one deprecated HAL
      *         < 0 if any error (mount partition fails, illformed XML, etc.)
      */
-    int32_t checkDeprecation(const ListInstances& listInstances,
-                             const std::vector<HidlInterfaceMetadata>& hidlMetadata,
-                             std::string* error = nullptr);
+    int32_t checkDeprecation(const ListInstances& listInstances, std::string* error = nullptr);
 
     /**
      * Check deprecation on existing VINTF metadata. Use Device Manifest as the
@@ -184,8 +178,7 @@
      *         > 0 if there is at least one deprecated HAL
      *         < 0 if any error (mount partition fails, illformed XML, etc.)
      */
-    int32_t checkDeprecation(const std::vector<HidlInterfaceMetadata>& hidlMetadata,
-                             std::string* error = nullptr);
+    int32_t checkDeprecation(std::string* error = nullptr);
 
     /**
      * Return kernel FCM version.
@@ -305,6 +298,31 @@
     static std::shared_ptr<const RuntimeInfo> GetRuntimeInfo(
         bool skipCache = false, RuntimeInfo::FetchFlags flags = RuntimeInfo::FetchFlag::ALL);
 
+    /**
+     * Check deprecation on framework matrices with a provided predicate.
+     *
+     * @param listInstances predicate that takes parameter in this format:
+     *        android.hardware.foo@1.0::IFoo
+     *        and returns {{"default", version}...} if HAL is in use, where version =
+     *        first version in interfaceChain where package + major version matches.
+     *
+     * @return = 0 if success (no deprecated HALs)
+     *         > 0 if there is at least one deprecated HAL
+     *         < 0 if any error (mount partition fails, illformed XML, etc.)
+     */
+    static int32_t CheckDeprecation(const ListInstances& listInstances,
+                                    std::string* error = nullptr);
+
+    /**
+     * Check deprecation on existing VINTF metadata. Use Device Manifest as the
+     * predicate to check if a HAL is in use.
+     *
+     * @return = 0 if success (no deprecated HALs)
+     *         > 0 if there is at least one deprecated HAL
+     *         < 0 if any error (mount partition fails, illformed XML, etc.)
+     */
+    static int32_t CheckDeprecation(std::string* error = nullptr);
+
    private:
     status_t getCombinedFrameworkMatrix(const std::shared_ptr<const HalManifest>& deviceManifest,
                                         CompatibilityMatrix* out, std::string* error = nullptr);
@@ -321,25 +339,12 @@
                                  std::string* error = nullptr);
     status_t fetchVendorHalManifest(HalManifest* out, std::string* error = nullptr);
     status_t fetchFrameworkHalManifest(HalManifest* out, std::string* error = nullptr);
-
-    using ChildrenMap = std::multimap<std::string, std::string>;
     static bool IsHalDeprecated(const MatrixHal& oldMatrixHal,
                                 const CompatibilityMatrix& targetMatrix,
-                                const ListInstances& listInstances, const ChildrenMap& childrenMap,
-                                std::string* appendedError);
+                                const ListInstances& listInstances, std::string* error);
     static bool IsInstanceDeprecated(const MatrixInstance& oldMatrixInstance,
                                      const CompatibilityMatrix& targetMatrix,
-                                     const ListInstances& listInstances,
-                                     const ChildrenMap& childrenMap, std::string* appendedError);
-
-    static android::base::Result<std::vector<FqInstance>> GetListedInstanceInheritance(
-        const std::string& package, const Version& version, const std::string& interface,
-        const std::string& instance, const ListInstances& listInstances,
-        const ChildrenMap& childrenMap);
-    static bool IsInstanceListed(const ListInstances& listInstances, const FqInstance& fqInstance);
-    static android::base::Result<void> IsFqInstanceDeprecated(
-        const CompatibilityMatrix& targetMatrix, HalFormat format, const FqInstance& fqInstance,
-        const ListInstances& listInstances);
+                                     const ListInstances& listInstances, std::string* error);
 
    public:
     /**
diff --git a/main.cpp b/main.cpp
index 5765f9b..70433b9 100644
--- a/main.cpp
+++ b/main.cpp
@@ -321,9 +321,8 @@
     }
 
     if (vm && fcm) {
-        // TODO(b/131717099): Use correct information from libhidlmetadata
-        auto deprecate = VintfObject::GetInstance()->checkDeprecation({}, &error);
-        std::cout << "VintfObject::CheckDeprecation (against device manifest) (w/o hidlmetadata)? "
+        auto deprecate = VintfObject::CheckDeprecation(&error);
+        std::cout << "VintfObject::CheckDeprecation (against device manifest)? "
                   << deprecateString(deprecate);
         if (deprecate != NO_DEPRECATED_HALS) std::cout << ", " << error;
         std::cout << std::endl;
diff --git a/test/vintf_object_tests.cpp b/test/vintf_object_tests.cpp
index 6b8f4c4..ad230dc 100644
--- a/test/vintf_object_tests.cpp
+++ b/test/vintf_object_tests.cpp
@@ -889,12 +889,12 @@
                 };
                 return ::android::OK;
             }));
-        expectFetchRepeatedly(kSystemVintfDir + "compatibility_matrix.1.xml", systemMatrixLevel1);
-        expectFetchRepeatedly(kSystemVintfDir + "compatibility_matrix.2.xml", systemMatrixLevel2);
+        expectFetch(kSystemVintfDir + "compatibility_matrix.1.xml", systemMatrixLevel1);
+        expectFetch(kSystemVintfDir + "compatibility_matrix.2.xml", systemMatrixLevel2);
         expectFileNotExist(StrEq(kProductMatrix));
         expectNeverFetch(kSystemLegacyMatrix);
 
-        expectFetchRepeatedly(kVendorManifest,
+        expectFetch(kVendorManifest,
                     "<manifest " + kMetaVersionStr + " type=\"device\" target-level=\"2\"/>");
         expectFileNotExist(StartsWith("/odm/"));
 
@@ -911,7 +911,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, {}, &error)) << error;
+    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, &error)) << error;
 }
 
 TEST_F(DeprecateTest, CheckRemoved) {
@@ -921,7 +921,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "removed@1.0 should be deprecated. " << error;
 }
 
@@ -931,7 +931,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "minor@1.0 should be deprecated. " << error;
 }
 
@@ -942,7 +942,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "minor@1.0::IMinor/legacy should be deprecated. " << error;
 }
 
@@ -953,7 +953,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "minor@1.1::IMinor/legacy should be deprecated. " << error;
 }
 
@@ -964,7 +964,7 @@
         "android.hardware.major@2.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "major@1.0 should be deprecated. " << error;
 }
 
@@ -974,36 +974,7 @@
         "android.hardware.major@1.0::IMajor/default",
     });
     std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
-        << "major@1.0 should be deprecated. " << error;
-}
-
-TEST_F(DeprecateTest, HidlMetadataNotDeprecate) {
-    auto pred = getInstanceListFunc({
-        "android.hardware.major@1.0::IMajor/default",
-        "android.hardware.major@2.0::IMajor/default",
-    });
-    std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
-        << "major@1.0 should be deprecated. " << error;
-    std::vector<HidlInterfaceMetadata> hidlMetadata{
-      {"android.hardware.major@2.0::IMajor", {"android.hardware.major@1.0::IMajor"}},
-    };
-    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, hidlMetadata, &error))
-        << "major@1.0 should not be deprecated because it extends from 2.0: " << error;
-}
-
-TEST_F(DeprecateTest, HidlMetadataDeprecate) {
-    auto pred = getInstanceListFunc({
-        "android.hardware.major@1.0::IMajor/default",
-    });
-    std::string error;
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
-        << "major@1.0 should be deprecated. " << error;
-    std::vector<HidlInterfaceMetadata> hidlMetadata{
-      {"android.hardware.major@2.0::IMajor", {"android.hardware.major@1.0::IMajor"}},
-    };
-    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, hidlMetadata, &error))
+    EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
         << "major@1.0 should be deprecated. " << error;
 }
 
@@ -1160,7 +1131,7 @@
         "android.hardware.regex@1.1::IRegex/regex_common/0",
         "android.hardware.regex@2.0::IRegex/default",
     });
-    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, {}, &error)) << error;
+    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, &error)) << error;
 
     for (const auto& deprecated : {
              "android.hardware.regex@1.0::IRegex/default",
@@ -1176,7 +1147,7 @@
             "android.hardware.regex@2.0::IRegex/default",
         });
         error.clear();
-        EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+        EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
             << deprecated << " should be deprecated. " << error;
     }
 }
@@ -1190,7 +1161,7 @@
         "android.hardware.regex@2.0::IRegex/regex/2.0/1",
         "android.hardware.regex@2.0::IRegex/default",
     });
-    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, {}, &error)) << error;
+    EXPECT_EQ(NO_DEPRECATED_HALS, vintfObject->checkDeprecation(pred, &error)) << error;
 
     for (const auto& deprecated : {
              "android.hardware.regex@1.0::IRegex/default",
@@ -1210,7 +1181,7 @@
         });
 
         error.clear();
-        EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, {}, &error))
+        EXPECT_EQ(DEPRECATED, vintfObject->checkDeprecation(pred, &error))
             << deprecated << " should be deprecated.";
     }
 }