From 304cdab7107142bd5047715871b60024d6c1ed1b Mon Sep 17 00:00:00 2001
From: Yifan Hong
Date: Thu, 2 Aug 2018 16:03:59 -0700
Subject: AssembleVintf: fix error message for unsupported tags/attrs for
additional manifests
The error message used to contain extraneous values like:
0.0
Fix it so that it becomes:
Test: manual with additional manifest, then
`m device_manifest.xml`
Bug: 78943004
Change-Id: I2d66c4db5a5c2136907ac2dc814262909c73b9e0
---
parse_xml.cpp | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
(limited to 'parse_xml.cpp')
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 0aec6b8..ff6ecc2 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -865,15 +865,21 @@ struct HalManifestConverter : public XmlNodeConverter {
}
void mutateNode(const HalManifest& m, NodeType* root, DocType* d,
SerializeFlags flags) const override {
- appendAttr(root, "version", m.getMetaVersion());
- appendAttr(root, "type", m.mType);
+ if (flags.isMetaVersionEnabled()) {
+ appendAttr(root, "version", m.getMetaVersion());
+ }
+ if (flags.isSchemaTypeEnabled()) {
+ appendAttr(root, "type", m.mType);
+ }
if (flags.isHalsEnabled()) {
appendChildren(root, manifestHalConverter, m.getHals(), d, flags);
}
if (m.mType == SchemaType::DEVICE) {
if (flags.isSepolicyEnabled()) {
- appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d));
+ if (m.device.mSepolicyVersion != Version{}) {
+ appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d));
+ }
}
if (m.mLevel != Level::UNSPECIFIED) {
this->appendAttr(root, "target-level", m.mLevel);
@@ -1026,8 +1032,12 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter