summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-03-16 16:49:45 -0500
committerYifan Hong2018-03-16 18:19:13 -0500
commit74c142a159515c680061201ad0d442dcdce70954 (patch)
tree6acacf4cd148fe4aeb586392363ecf85fd29b12c /include
parent5da19c972bde27bd3d7184ce3cc4b27ad0a9136d (diff)
downloadplatform-system-libvintf-74c142a159515c680061201ad0d442dcdce70954.tar.gz
platform-system-libvintf-74c142a159515c680061201ad0d442dcdce70954.tar.xz
platform-system-libvintf-74c142a159515c680061201ad0d442dcdce70954.zip
Add CompatibilityMatrix::hasInstance
... by moving HalManifest::hasInstance to HalGroup::hasInstance. Test: libvintf_test Bug: 65028233 Change-Id: I7602cf08eb48c3f8f863af944b54027d735c7d38
Diffstat (limited to 'include')
-rw-r--r--include/vintf/HalGroup.h12
-rw-r--r--include/vintf/HalManifest.h4
2 files changed, 12 insertions, 4 deletions
diff --git a/include/vintf/HalGroup.h b/include/vintf/HalGroup.h
index a590a0b..033adf0 100644
--- a/include/vintf/HalGroup.h
+++ b/include/vintf/HalGroup.h
@@ -153,6 +153,18 @@ struct HalGroup {
153 return ret; 153 return ret;
154 } 154 }
155 155
156 // Return whether instance is in getInstances(...).
157 bool hasInstance(const std::string& halName, const Version& version,
158 const std::string& interfaceName, const std::string& instance) const {
159 bool found = false;
160 (void)forEachInstanceOfInterface(halName, version, interfaceName,
161 [&found, &instance](const auto& e) {
162 found |= (instance == e.instance());
163 return !found; // if not found, continue
164 });
165 return found;
166 }
167
156 protected: 168 protected:
157 // sorted map from component name to the component. 169 // sorted map from component name to the component.
158 // The component name looks like: android.hardware.foo 170 // The component name looks like: android.hardware.foo
diff --git a/include/vintf/HalManifest.h b/include/vintf/HalManifest.h
index f60114b..60fc303 100644
--- a/include/vintf/HalManifest.h
+++ b/include/vintf/HalManifest.h
@@ -70,10 +70,6 @@ struct HalManifest : public HalGroup<ManifestHal>, public XmlFileGroup<ManifestX
70 // (dupes removed) 70 // (dupes removed)
71 std::set<Version> getSupportedVersions(const std::string &name) const; 71 std::set<Version> getSupportedVersions(const std::string &name) const;
72 72
73 // Convenience method for checking if instanceName is in getInstances(halName, interfaceName)
74 bool hasInstance(const std::string& halName, const Version& version,
75 const std::string& interfaceName, const std::string& instanceName) const;
76
77 // Check compatibility against a compatibility matrix. Considered compatible if 73 // Check compatibility against a compatibility matrix. Considered compatible if
78 // - framework manifest vs. device compat-mat 74 // - framework manifest vs. device compat-mat
79 // - checkIncompatibility for HALs returns only optional HALs 75 // - checkIncompatibility for HALs returns only optional HALs