summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-03-13 20:22:34 -0500
committerYifan Hong2018-03-13 20:46:18 -0500
commit470144fa4d01f1d422ee332fd7ce1c9d09014878 (patch)
treed32f678beba6b88ca0914be1277dcbdd38f2f011 /ManifestHal.cpp
parentce4289b9dc2706687d1515dc6e120fd030e8787f (diff)
downloadplatform-system-libvintf-470144fa4d01f1d422ee332fd7ce1c9d09014878.tar.gz
platform-system-libvintf-470144fa4d01f1d422ee332fd7ce1c9d09014878.tar.xz
platform-system-libvintf-470144fa4d01f1d422ee332fd7ce1c9d09014878.zip
Add ManifestHal::isDisabledHal().
When a <hal> does not have any instances (e.g. no <version>, or no <fqname> tags), with override=true, the HAL is disabled for this product. Bug: 73556059 Bug: 69051162 Test: libvintf_test Change-Id: I135748c5624feb2fa4cd8e57b515744566a5d709
Diffstat (limited to 'ManifestHal.cpp')
-rw-r--r--ManifestHal.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/ManifestHal.cpp b/ManifestHal.cpp
index d04d3e0..aa9d358 100644
--- a/ManifestHal.cpp
+++ b/ManifestHal.cpp
@@ -63,5 +63,15 @@ bool ManifestHal::forEachInstance(const std::function<bool(const ManifestInstanc
63 return true; 63 return true;
64} 64}
65 65
66bool ManifestHal::isDisabledHal() const {
67 if (!isOverride()) return false;
68 bool hasInstance = false;
69 forEachInstance([&hasInstance](const auto&) {
70 hasInstance = true;
71 return false; // has at least one instance, stop here.
72 });
73 return !hasInstance;
74}
75
66} // namespace vintf 76} // namespace vintf
67} // namespace android 77} // namespace android