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
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 @@
appendChildren(root, matrixKernelConverter, m.framework.mKernels, d);
}
if (!(flags & SerializeFlag::NO_SEPOLICY)) {
- appendChild(root, sepolicyConverter(m.framework.mSepolicy, d));
+ if (!(m.framework.mSepolicy == Sepolicy{})) {
+ appendChild(root, sepolicyConverter(m.framework.mSepolicy, d));
+ }
}
if (!(flags & SerializeFlag::NO_AVB)) {
- appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d));
+ if (!(m.framework.mAvbMetaVersion == Version{})) {
+ appendChild(root, avbConverter(m.framework.mAvbMetaVersion, d));
+ }
}
} else if (m.mType == SchemaType::DEVICE) {
if (!(flags & SerializeFlag::NO_VNDK)) {