summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-08-02 18:03:59 -0500
committerYifan Hong2018-08-08 12:07:39 -0500
commit304cdab7107142bd5047715871b60024d6c1ed1b (patch)
treeb4e9a0b76ad4480f22cd76f26a4b76cc00b489b2 /parse_xml.cpp
parenta1b112d010c403ccdddba10b1882054b3b48da8d (diff)
downloadplatform-system-libvintf-304cdab7107142bd5047715871b60024d6c1ed1b.tar.gz
platform-system-libvintf-304cdab7107142bd5047715871b60024d6c1ed1b.tar.xz
platform-system-libvintf-304cdab7107142bd5047715871b60024d6c1ed1b.zip
AssembleVintf: fix error message for unsupported tags/attrs for additional manifests
The error message used to contain extraneous values like: <manifest version="1.0" type="device" target-level="1"> <sepolicy> <version>0.0</version> </sepolicy> </manifest> Fix it so that it becomes: <manifest target-level="1" /> Test: manual with additional manifest, then `m device_manifest.xml` Bug: 78943004 Change-Id: I2d66c4db5a5c2136907ac2dc814262909c73b9e0
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp20
1 files changed, 15 insertions, 5 deletions
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<HalManifest> {
865 } 865 }
866 void mutateNode(const HalManifest& m, NodeType* root, DocType* d, 866 void mutateNode(const HalManifest& m, NodeType* root, DocType* d,
867 SerializeFlags flags) const override { 867 SerializeFlags flags) const override {
868 appendAttr(root, "version", m.getMetaVersion()); 868 if (flags.isMetaVersionEnabled()) {
869 appendAttr(root, "type", m.mType); 869 appendAttr(root, "version", m.getMetaVersion());
870 }
871 if (flags.isSchemaTypeEnabled()) {
872 appendAttr(root, "type", m.mType);
873 }
870 874
871 if (flags.isHalsEnabled()) { 875 if (flags.isHalsEnabled()) {
872 appendChildren(root, manifestHalConverter, m.getHals(), d, flags); 876 appendChildren(root, manifestHalConverter, m.getHals(), d, flags);
873 } 877 }
874 if (m.mType == SchemaType::DEVICE) { 878 if (m.mType == SchemaType::DEVICE) {
875 if (flags.isSepolicyEnabled()) { 879 if (flags.isSepolicyEnabled()) {
876 appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d)); 880 if (m.device.mSepolicyVersion != Version{}) {
881 appendChild(root, halManifestSepolicyConverter(m.device.mSepolicyVersion, d));
882 }
877 } 883 }
878 if (m.mLevel != Level::UNSPECIFIED) { 884 if (m.mLevel != Level::UNSPECIFIED) {
879 this->appendAttr(root, "target-level", m.mLevel); 885 this->appendAttr(root, "target-level", m.mLevel);
@@ -1026,8 +1032,12 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
1026 } 1032 }
1027 void mutateNode(const CompatibilityMatrix& m, NodeType* root, DocType* d, 1033 void mutateNode(const CompatibilityMatrix& m, NodeType* root, DocType* d,
1028 SerializeFlags flags) const override { 1034 SerializeFlags flags) const override {
1029 appendAttr(root, "version", m.getMinimumMetaVersion()); 1035 if (flags.isMetaVersionEnabled()) {
1030 appendAttr(root, "type", m.mType); 1036 appendAttr(root, "version", m.getMinimumMetaVersion());
1037 }
1038 if (flags.isSchemaTypeEnabled()) {
1039 appendAttr(root, "type", m.mType);
1040 }
1031 1041
1032 if (flags.isHalsEnabled()) { 1042 if (flags.isHalsEnabled()) {
1033 appendChildren(root, matrixHalConverter, iterateValues(m.mHals), d); 1043 appendChildren(root, matrixHalConverter, iterateValues(m.mHals), d);