Prepare vts to use libvintf.
* Move method getHals() and getInstances() to HalGroup.h.
* Add method getHal() in HalGroup.h which identify a hal that
matches the given name and version.
* Add method containsVersion() in MatrixHal.h and ManifestHal.h
which checkes whether the hal supports the given version.
* Add methods getInstances() and hasInstance() in MatrixHal.h and
ManifestHal.h
Bug: 68023937
Test: make libvintf
run libvintf_test
Change-Id: If6afa789f84af95f9752aee17b6fd9d97236f85c
diff --git a/MatrixHal.cpp b/MatrixHal.cpp
index 1db7f40..50c5116 100644
--- a/MatrixHal.cpp
+++ b/MatrixHal.cpp
@@ -32,5 +32,21 @@
return true;
}
+bool MatrixHal::containsVersion(const Version& version) const {
+ for (VersionRange vRange : versionRanges) {
+ if (vRange.contains(version)) return true;
+ }
+ return false;
+}
+
+std::set<std::string> MatrixHal::getInstances(const std::string& interfaceName) const {
+ std::set<std::string> ret;
+ auto it = interfaces.find(interfaceName);
+ if (it != interfaces.end()) {
+ ret.insert(it->second.instances.begin(), it->second.instances.end());
+ }
+ return ret;
+}
+
} // namespace vintf
} // namespace android