summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-08-23 17:14:02 -0500
committerYifan Hong2017-08-24 12:16:04 -0500
commit734a3394faffd042b99c520963f78d3084f2e56e (patch)
tree1619031c96a19588587f58022ac5fdfaa2e9a0f0 /parse_xml.cpp
parent69340357fd09afdbf35d18b549fd12088a7bdafc (diff)
downloadplatform-system-libvintf-734a3394faffd042b99c520963f78d3084f2e56e.tar.gz
platform-system-libvintf-734a3394faffd042b99c520963f78d3084f2e56e.tar.xz
platform-system-libvintf-734a3394faffd042b99c520963f78d3084f2e56e.zip
Do not allow first <kernel> version to have non-empty <condition>.
Stating <condition> on a <kernel> tag in fwk compat mat means the fragment is conditionally used. Older libvintf (libvintf on O devices) use the first <kernel> tag with a match version unconditionally. Disable this to allow old libvintf to parse the requirements more correctly. In detail: * O libvintf may still falsely accept incompatible fwk comp mat, because it only looks at the first <kernel> element. The conditional requirements are not checked. * O libvintf does not falsely reject a compatible fwk comp mat. Conditional requirements are never the first <kernel> element and hence are not checked by O libvintf. This is a workaround solution for backwards compatibility, since O has been released. Test: libvintf_test Bug: 64124223 Change-Id: I20a9bb768720fc83ac5cdf293a976cb279cb6eab Merged-In: I20a9bb768720fc83ac5cdf293a976cb279cb6eab
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index f524fb8..3e495fd 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -887,6 +887,21 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
887 !parseOptionalChild(root, avbConverter, {}, &object->framework.mAvbMetaVersion)) { 887 !parseOptionalChild(root, avbConverter, {}, &object->framework.mAvbMetaVersion)) {
888 return false; 888 return false;
889 } 889 }
890
891 std::set<Version> seenKernelVersions;
892 for (const auto& kernel : object->framework.mKernels) {
893 Version minLts(kernel.minLts().version, kernel.minLts().majorRev);
894 if (seenKernelVersions.find(minLts) != seenKernelVersions.end()) {
895 continue;
896 }
897 if (!kernel.conditions().empty()) {
898 this->mLastError = "First <kernel> for version " + to_string(minLts) +
899 " must have empty <conditions> for backwards compatibility.";
900 return false;
901 }
902 seenKernelVersions.insert(minLts);
903 }
904
890 } else if (object->mType == SchemaType::DEVICE) { 905 } else if (object->mType == SchemaType::DEVICE) {
891 // <vndk> can be missing because it can be determined at build time, not hard-coded 906 // <vndk> can be missing because it can be determined at build time, not hard-coded
892 // in the XML file. 907 // in the XML file.