summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2017-08-23 17:14:02 -0500
committerYifan Hong2017-08-24 12:18:35 -0500
commitf4a27290334634ccff29997610da6a0c221cca0c (patch)
treebaddf66aaff7d6508fb678f1d874c7f97700e7a4
parent992fe2eef69f2c23284a77449e3334beabfa7cd7 (diff)
downloadplatform-system-libvintf-f4a27290334634ccff29997610da6a0c221cca0c.tar.gz
platform-system-libvintf-f4a27290334634ccff29997610da6a0c221cca0c.tar.xz
platform-system-libvintf-f4a27290334634ccff29997610da6a0c221cca0c.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
-rw-r--r--parse_xml.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index f56e01a..259fd4e 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.