summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYifan Hong2018-01-09 18:16:40 -0600
committerYifan Hong2018-01-12 14:37:00 -0600
commitfeb454ebc29f29ca7f5241130fac243e769436e2 (patch)
tree21e4f99d52c6d8ae507625cc07557362254169aa /parse_xml.cpp
parent0f529fab7c41b36014b90813e646b9f4a6bfc59b (diff)
downloadplatform-system-libvintf-feb454ebc29f29ca7f5241130fac243e769436e2.tar.gz
platform-system-libvintf-feb454ebc29f29ca7f5241130fac243e769436e2.tar.xz
platform-system-libvintf-feb454ebc29f29ca7f5241130fac243e769436e2.zip
Add <vendor-ndk> tag to fwk manifest and device matrix
... in place of the old <vndk> tag. The format of this tag is: - in framework manifest: a string (a number, or VERSION_CODE during development): <vendor-ndk> <version>27</version> </vendor-ndk> <vendor-ndk> <version>P</version> </vendor-ndk> - in device matrix: same format, but only one <vendor-ndk> tag. <vendor-ndk> <version>27</version> </vendor-ndk> Test: libvintf_test Bug: 36400653 Change-Id: If235e257026d719838076bf0e0a2b42aa8524971
Diffstat (limited to 'parse_xml.cpp')
-rw-r--r--parse_xml.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/parse_xml.cpp b/parse_xml.cpp
index 3e16b80..9a09eae 100644
--- a/parse_xml.cpp
+++ b/parse_xml.cpp
@@ -698,6 +698,8 @@ const SepolicyConverter sepolicyConverter{};
698 698
699[[deprecated]] 699[[deprecated]]
700const XmlTextConverter<VndkVersionRange> vndkVersionRangeConverter{"version"}; 700const XmlTextConverter<VndkVersionRange> vndkVersionRangeConverter{"version"};
701
702const XmlTextConverter<std::string> vndkVersionConverter{"version"};
701const XmlTextConverter<std::string> vndkLibraryConverter{"library"}; 703const XmlTextConverter<std::string> vndkLibraryConverter{"library"};
702 704
703struct [[deprecated]] VndkConverter : public XmlNodeConverter<Vndk> { 705struct [[deprecated]] VndkConverter : public XmlNodeConverter<Vndk> {
@@ -718,6 +720,23 @@ struct [[deprecated]] VndkConverter : public XmlNodeConverter<Vndk> {
718[[deprecated]] 720[[deprecated]]
719const VndkConverter vndkConverter{}; 721const VndkConverter vndkConverter{};
720 722
723struct VendorNdkConverter : public XmlNodeConverter<VendorNdk> {
724 std::string elementName() const override { return "vendor-ndk"; }
725 void mutateNode(const VendorNdk& object, NodeType* root, DocType* d) const override {
726 appendChild(root, vndkVersionConverter(object.mVersion, d));
727 appendChildren(root, vndkLibraryConverter, object.mLibraries, d);
728 }
729 bool buildObject(VendorNdk* object, NodeType* root) const override {
730 if (!parseChild(root, vndkVersionConverter, &object->mVersion) ||
731 !parseChildren(root, vndkLibraryConverter, &object->mLibraries)) {
732 return false;
733 }
734 return true;
735 }
736};
737
738const VendorNdkConverter vendorNdkConverter{};
739
721struct HalManifestSepolicyConverter : public XmlNodeConverter<Version> { 740struct HalManifestSepolicyConverter : public XmlNodeConverter<Version> {
722 std::string elementName() const override { return "sepolicy"; } 741 std::string elementName() const override { return "sepolicy"; }
723 void mutateNode(const Version &m, NodeType *root, DocType *d) const override { 742 void mutateNode(const Version &m, NodeType *root, DocType *d) const override {
@@ -775,6 +794,8 @@ struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
775#pragma clang diagnostic ignored "-Wdeprecated-declarations" 794#pragma clang diagnostic ignored "-Wdeprecated-declarations"
776 appendChildren(root, vndkConverter, m.framework.mVndks, d); 795 appendChildren(root, vndkConverter, m.framework.mVndks, d);
777#pragma clang diagnostic pop 796#pragma clang diagnostic pop
797
798 appendChildren(root, vendorNdkConverter, m.framework.mVendorNdks, d);
778 } 799 }
779 } 800 }
780 801
@@ -817,6 +838,10 @@ struct HalManifestConverter : public XmlNodeConverter<HalManifest> {
817 } 838 }
818 } 839 }
819#pragma clang diagnostic pop 840#pragma clang diagnostic pop
841
842 if (!parseChildren(root, vendorNdkConverter, &object->framework.mVendorNdks)) {
843 return false;
844 }
820 } 845 }
821 for (auto &&hal : hals) { 846 for (auto &&hal : hals) {
822 std::string description{hal.name}; 847 std::string description{hal.name};
@@ -915,6 +940,10 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
915 appendChild(root, vndkConverter(m.device.mVndk, d)); 940 appendChild(root, vndkConverter(m.device.mVndk, d));
916 } 941 }
917#pragma clang diagnostic pop 942#pragma clang diagnostic pop
943
944 if (!(m.device.mVendorNdk == VendorNdk{})) {
945 appendChild(root, vendorNdkConverter(m.device.mVendorNdk, d));
946 }
918 } 947 }
919 } 948 }
920 949
@@ -963,6 +992,10 @@ struct CompatibilityMatrixConverter : public XmlNodeConverter<CompatibilityMatri
963 return false; 992 return false;
964 } 993 }
965#pragma clang diagnostic pop 994#pragma clang diagnostic pop
995
996 if (!parseOptionalChild(root, vendorNdkConverter, {}, &object->device.mVendorNdk)) {
997 return false;
998 }
966 } 999 }
967 1000
968 if (!kMetaVersion.minorAtLeast(version)) { 1001 if (!kMetaVersion.minorAtLeast(version)) {