summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-01-23 17:29:27 -0600
committerYifan Hong2018-01-23 18:48:32 -0600
commit244970c81abe1fe28cb8ab2f1992b646bd07fce3 (patch)
treeea96fbf6366d5d475d8024ca078f490e36c5e8cb /parse_xml.cpp
parentcbc3823cc32aa07dd06b8320c24c92664929a788 (diff)
downloadplatform-system-libvintf-244970c81abe1fe28cb8ab2f1992b646bd07fce3.tar.gz
platform-system-libvintf-244970c81abe1fe28cb8ab2f1992b646bd07fce3.tar.xz
platform-system-libvintf-244970c81abe1fe28cb8ab2f1992b646bd07fce3.zip
CompatibilityMatrix: do not write <sepolicy> and <avb> if empty
They are parsed as optional tags, so it is okay to not write them when they contain no values. Test: libvintf_test Change-Id: I5da7830e3838b25def874dd4ef01b20b900bac5f
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 74ba880..5900f27 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -954,10 +954,14 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
954 appendChildren(root, matrixKernelConverter, m.framework.mKernels, d); 954 appendChildren(root, matrixKernelConverter, m.framework.mKernels, d);
955 } 955 }
956 if (!(flags & SerializeFlag::NO_SEPOLICY)) { 956 if (!(flags & SerializeFlag::NO_SEPOLICY)) {
957 appendChild(root, sepolicyConverter(m.framework.mSepolicy, d)); 957 if (!(m.framework.mSepolicy == Sepolicy{})) {
958 appendChild(root, sepolicyConverter(m.framework.mSepolicy, d));
959 }
958 } 960 }
959 if (!(flags & SerializeFlag::NO_AVB)) { 961 if (!(flags & SerializeFlag::NO_AVB)) {
960 appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d)); 962 if (!(m.framework.mAvbMetaVersion == Version{})) {
963 appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d));
964 }
961 } 965 }
962 } else if (m.mType == SchemaType::DEVICE) { 966 } else if (m.mType == SchemaType::DEVICE) {
963 if (!(flags & SerializeFlag::NO_VNDK)) { 967 if (!(flags & SerializeFlag::NO_VNDK)) {