summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* SerializeFlags is a namespace.Yifan Hong2018-08-081-9/+9
| | | | | | | | | | | | | | | | The SerializeFlags becomes a namespace that contains the original class definition under type SerializeFlags::Type and static constants. Consequently, all SeralizeFlags methods can now be constexpr. Also added static tests. Test: libvintf_test Test: vintf_object_test Bug: 110711640 Change-Id: I786a1f77e19defc2ab2d025de3ed7cfe48f4fbce
* AssembleVintf: fix error message for unsupported tags/attrs for additional ↵Yifan Hong2018-08-081-5/+15
| | | | | | | | | | | | | | | | | | | | | | 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
* SerializeFlags: Remove legacy APIsYifan Hong2018-08-081-15/+15
| | | | | | | | | | Remove legacy bitwise operators and boolean conversions that are meant to be compatible with the old negative flags usage. Also fix all such usages. Bug: 110711640 Test: libvintf_test Change-Id: Ic69a7066dd3ae320aeb0a1848eb7719f67da29d3
* SerializeFlag => SerializeFlagsYifan Hong2018-08-081-21/+21
| | | | | | | | | | | | This is a straightforward refactoring to remove the SerializeFlag enum. They are combined into one class because SerializeFlag is the old negative bitfields and is confusing. SerializeFlags will contain positive bitfields. Bug: 110711640 Test: libvintf_test Change-Id: I46070db674955add4971b0dc5736a43436f54ddf
* assemble_vintf: add --no-kernel-requirements optionYifan Hong2018-07-261-4/+15
| | | | | | | | | | | | | | When specified, <config> under <kernel> will not be written to the output matrix, and kernel minor revision will be set to zero. These requirements are added in P but is verified against the running kernel (instead of the incoming kernel). This incorrect behavior in recovery forces us to drop these requirements during OTA. These requirements are still checked by VTS. Bug: 111840577 Test: libvintf_test Change-Id: Id0d7851f5cc11fbd8e6e2928ce377769855445db
* Add -Wextra-semi.Yifan Hong2018-07-161-2/+3
| | | | | | | | | | The headers fail to compile when included in libhidl, because libhidl has -Wextra-semi. I decided to clean them up and add -Wextra-semi for all files for libvintf. Test: builds Change-Id: Ida1ed6d3855e582a5c09bc60128dd8c4cfd4210a
* Add ManifestHal::insertInstanceYifan Hong2018-05-021-0/+6
| | | | | | | | | ... that allows to add <fqname> to ManifestHal object from code. This helps, for example, lshal. Bug: 74247301 Test: pass Change-Id: I28b5bb1240e24f1762d2df4cb1ded242fabea99e
* regex-instance: HalInterface stores regex instances.Yifan Hong2018-03-221-1/+18
| | | | | | | | | | | | | Parse <regex-instance> regular expression patterns using Extended Regular Expression syntax, and store it in HalInterface object. Bug: 73738616 Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Change-Id: If0b8e3bc053a6c2ecd9048092071f52f7896bba0
* regex-instance: HalInterface: add regex API and hide public fieldsYifan Hong2018-03-221-12/+13
| | | | | | | | | | | | | | | | <regex-instance> is added under an <interface> tag, which is represented by an HalInterface object. Add API for looping over all <regex-instance>s / <instance>s under it. With this API, HalInterface can hide its public fields. Bug: 73738616 Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Change-Id: Ia072dd7e946c28789797db8a46fd968bc7872dca
* Add <fqname> to manifests.Yifan Hong2018-03-141-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | The format of <fqname> is: <hal> <name>android.hardware.foo</name> <!-- transport, etc. --> <fqname>@1.0::IFoo/default</fqname> </hal> It is possible to mix <fqname> and <version> x <interface> x <instance> ; see tests for details. This allows instances at different versions. For example, it is now allowed to serve @1.0::IFoo/default, @1.1::IFoo/custom simultaneously without serving @1.1::IFoo/default. If override="true" and no <version>x<interface>x<instance> nor <fqname>, the HAL tag is disabled. (Previously, the HAL tag is disabled iff no <version> exists). Bug: 73556059 Test: libvintf_test Test: vintf_object_test Change-Id: I80cb9ccdeec708c2c5530812913b37f8b3cc3ffa
* Add ManifestHal::isOverride().Yifan Hong2018-03-131-3/+3
| | | | | | | | | Hide the isOverride field. Bug: 73556059 Test: vts_treble_vintf_test Test: libvintf_test Change-Id: Ib7d4a96e7043124617841277b06afc456d01672a
* Only "level" for FCM and "target-level" for dev manifest.Yifan Hong2018-02-121-8/+15
| | | | | | | | | | The level attribute for device CM and fwk manifest is different and has not been finalize yet. Do not modify the mLevel field for them. Test: libvintf_test Test: vintf_object_test Bug: 37226359 Change-Id: I7b541f6d906fbf03487845be0728172e03bb60a5
* parse_xml.cpp: Deserilization does not touch lastError()Yifan Hong2018-02-121-214/+230
| | | | | | | | | | | | | | | | | | The global mLastError fields for each converters can potentially cause a segfault when a program with multiple threads tries to deserialize a bad file at the same time. - deserialization APIs that touches the mLastError field are marked as non-const APIs - const variants are provided (error is provided as an output parameter) - Functionalities are equivalent (tests ensure this). Test: libvintf_test Test: vintf_object_test Fixes: 71874788 Change-Id: I416de909b32809a4ac377d9da998c48d7d409457
* Do not allow duplicated manifest.vendor-ndk.version.Yifan Hong2018-02-021-0/+10
| | | | | | | | | | | | | As specified by VINTF doc in P, the following is not allowed: <manifest...> <vendor-ndk><version>27</version></vendor-ndk> <vendor-ndk><version>27</version></vendor-ndk> </manifest> Test: libvintf_test Change-Id: Ib9d42d2d75b7362c268597bc947c214e03dd5d00 Fixes: 72461606
* remove LIBVINTF_HOST macroYifan Hong2018-01-311-4/+4
| | | | | | | | | | | | There is a mixed use of LIBVINTF_HOST and LIBVINTF_TARGET, and for libvintftest, LIBVINTF_HOST is not even defined properly. Remove the use of LIBVINTF_HOST and replace with LIBVINTF_TARGET instead. Test: libvintf_test Test: vintf_object_test Change-Id: I557e65376dfd1d0fe953e9a7a03a47f227596460
* CompatibilityMatrix: do not write <sepolicy> and <avb> if emptyYifan Hong2018-01-231-2/+6
| | | | | | | | 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
* Support <system-sdk> in fwk manifest and dev matrix.Yifan Hong2018-01-181-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | <system-sdk> is a tag in framework manifest and device matrix. It states a list of System SDK levels that the framework supports for vendor apps / vendor apps requires. Format: <system-sdk> <version>14</version> <version>15</version> </system-sdk> Versions must not be duplicated. It is compatible when the set specified in framework manifest is a superset of the set specified in the device compatibility matrix. Test: libvintf_test Test: vintf_object_tests Bug: 69088799 Change-Id: I802f055ea60666995202438a770d1e440517ec5c
* ManifestHal: add "override" attributeYifan Hong2018-01-181-0/+4
| | | | | | | | | | "override" is a boolean attribute on <hal> tags that suggest the <hal> tag can override any existing <hal> tags, even if there is a major version conflict. Test: libvintf_test Bug: 69051162 Change-Id: I388dc15b9e45170b6c9778f4e7efc8fd27869892
* Add <vendor-ndk> tag to fwk manifest and device matrixYifan Hong2018-01-121-0/+33
| | | | | | | | | | | | | | | | | | | | | | ... 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
* Mark Vndk / VndkVersionRange as deprecated.Yifan Hong2018-01-121-1/+15
| | | | | | | | | <vndk> tag becomes deprecated and should not be used. <vendor-ndk> is used to replace it instead. Test: builds Bug: 36400653 Change-Id: Ibeaa6c366fd78f3d4b0f06c13d8a33b71f4be1cf
* Do not add empty <vndk> tag to device compatibility matrixYifan Hong2018-01-111-1/+3
| | | | | | | | | | | | ... to make the output clean. This change is backwards compatible since <vndk> is parsed as an optional tag. From this change on, <vndk> should no longer be used (both in device compatibility matrix and in framework manifest). Test: libvintf_test Bug: 36400653 Change-Id: I3b5e849dc39350ba9b5782568991544572ed31d5
* Allow clean mode in assemble_vintfYifan Hong2017-12-141-16/+50
| | | | | | | | | | | | XmlConverter serialization accepts optional flags that controls the sections in final output. Test: assemble_vintf -i current.xml --no-hals and --hals-only Test: assemble_vintf -i device/*/manifest.xml --no-hals and --hals-only Bug: 62720090 Change-Id: Icfc1bdf28f3bc550a75f25e17fca742522aee24c Merged-In: Icfc1bdf28f3bc550a75f25e17fca742522aee24c
* Implement FCM Version in matrices / manifests.Yifan Hong2017-12-141-3/+9
| | | | | | | | | | | | | | | | | "level" is an attribute on compatibility matrices / manifests to specify the FCM Version they declare / implement. Value can be "legacy" or a positive number, or empty (for old files). Test: libvintf_test Test: Built manifests / matrices has not changed (because value is "unspecified"). Bug: 69854976 device manfiest must specify FCM Version Bug: 69636193 all matrices should be installed to system image Bug: 64720381 deprecation schedule Change-Id: I15d34343fae4ad79d86bd50e9de8c4f6ac09fdfd Merged-In: I15d34343fae4ad79d86bd50e9de8c4f6ac09fdfd
* Allow native HALs to have <transport> tag.Yifan Hong2017-10-161-3/+1
|\ | | | | | | | | | | am: c81841f975 Change-Id: I1decdda74f97d1e334a81c4957e466183a4b643a
| * Allow native HALs to have <transport> tag.Yifan Hong2017-10-161-3/+1
| | | | | | | | | | | | | | | | | | | | | | assemble_vintf should not drop the empty <transport/> tag for native HALs, otherwise older versions of libvintf cannot parse the file. Test: m system_manifest.xml -j and manually look at the file Test: sideload package from O DR Bug: 67653129 Change-Id: I403031f1546e7a26b0ad40b992d191ee3c7b80c6
| * Do not allow first <kernel> version to have non-empty <condition>.Yifan Hong2017-08-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stating <condition> on a <kernel> tag in fwk compat mat means the fragment is conditionally used. Older libvintf (libvintf on O devices) use the first <kernel> tag with a match version unconditionally. Disable this to allow old libvintf to parse the requirements more correctly. In detail: * O libvintf may still falsely accept incompatible fwk comp mat, because it only looks at the first <kernel> element. The conditional requirements are not checked. * O libvintf does not falsely reject a compatible fwk comp mat. Conditional requirements are never the first <kernel> element and hence are not checked by O libvintf. This is a workaround solution for backwards compatibility, since O has been released. Test: libvintf_test Bug: 64124223 Change-Id: I20a9bb768720fc83ac5cdf293a976cb279cb6eab Merged-In: I20a9bb768720fc83ac5cdf293a976cb279cb6eab
| * Improve error messages in parse_xml.cppYifan Hong2017-08-241-2/+2
| | | | | | | | | | | | | | Test: pass Bug: 64124223 Change-Id: I8fdd8e0a2e3b96725c30339dcbdcaff848322cf4 Merged-In: I8fdd8e0a2e3b96725c30339dcbdcaff848322cf4
| * Add <conditions> to <kernel> in framework compat matYifan Hong2017-08-231-0/+17
| | | | | | | | | | | | | | | | | | | | | | When <conditions> are present, the <kernel> tag is only checked when all conditions are met. This is to support arch-specific kernel config requirements. Test: libvintf_test Bug: 64124223 Change-Id: I91ecd115ca42473b79bda24d9b8613eed817e7e2 Merged-In: I91ecd115ca42473b79bda24d9b8613eed817e7e2
| * Add hardcoded version checks for netutils-wrapperYifan Hong2017-08-161-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each version bump of netutils-wrapper lose some functionality, and hence only the major version is bumped. Also, vendor code should only depend on a single version of netutils-wrapper. Hardcode this requirement in host-side libvintf to check compatibility when framework manifest and device compatibility matrix is built. Test: host libvintf_test Test: target libvintf_test Test: host vintf_object_test Test: target vintf_object_test Test: m system_manifest.xml compatibility_matrix.xml Test: boots Bug: 64447338 Change-Id: I75c28f3e021d16860e4577c3ecfaec2bd89d8a3d
| * Native HALs don't require <transport>.Yifan Hong2017-08-071-2/+32
| | | | | | | | | | | | | | | | | | | | | | This is stated in go/android-treble-vintf-object but the code was not well tested. Fortunately, native HALs are not used (until now), so we need to conform to the documentation here. Test: libvintf_test Bug: 64447338 Change-Id: I00d96137d4052d9da50f696ef665a73d09d818a7 Merged-In: I00d96137d4052d9da50f696ef665a73d09d818a7
* | Fix XML file metaversioning logic.Yifan Hong2017-09-191-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * define libvintf metaversion at VintfObject::kMetaVersion. * libvintf@x.y should be able to read all XML files at version x.z, where y >= z. * The minor version of compatibility-matrix.version now means the minimum libvintf metaversion that can parse this file. This CL does not change any behavior on existing XML files at version 1.0. Test: libvintf_test Test: vintf_object_test Bug: 62801658 Change-Id: If1b74ef83e56565a715e50786a7531ed086755f7
* | Do not allow first <kernel> version to have non-empty <condition>.Yifan Hong2017-08-241-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stating <condition> on a <kernel> tag in fwk compat mat means the fragment is conditionally used. Older libvintf (libvintf on O devices) use the first <kernel> tag with a match version unconditionally. Disable this to allow old libvintf to parse the requirements more correctly. In detail: * O libvintf may still falsely accept incompatible fwk comp mat, because it only looks at the first <kernel> element. The conditional requirements are not checked. * O libvintf does not falsely reject a compatible fwk comp mat. Conditional requirements are never the first <kernel> element and hence are not checked by O libvintf. This is a workaround solution for backwards compatibility, since O has been released. Test: libvintf_test Bug: 64124223 Change-Id: I20a9bb768720fc83ac5cdf293a976cb279cb6eab Merged-In: I20a9bb768720fc83ac5cdf293a976cb279cb6eab
* | Improve error messages in parse_xml.cppYifan Hong2017-08-241-2/+2
| | | | | | | | | | | | | | Test: pass Bug: 64124223 Change-Id: I8fdd8e0a2e3b96725c30339dcbdcaff848322cf4 Merged-In: I8fdd8e0a2e3b96725c30339dcbdcaff848322cf4
* | Add <conditions> to <kernel> in framework compat matYifan Hong2017-08-241-0/+17
| | | | | | | | | | | | | | | | | | | | | | When <conditions> are present, the <kernel> tag is only checked when all conditions are met. This is to support arch-specific kernel config requirements. Test: libvintf_test Bug: 64124223 Change-Id: I91ecd115ca42473b79bda24d9b8613eed817e7e2 Merged-In: I91ecd115ca42473b79bda24d9b8613eed817e7e2
* | Add hardcoded version checks for netutils-wrapperYifan Hong2017-08-161-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Each version bump of netutils-wrapper lose some functionality, and hence only the major version is bumped. Also, vendor code should only depend on a single version of netutils-wrapper. Hardcode this requirement in host-side libvintf to check compatibility when framework manifest and device compatibility matrix is built. Test: host libvintf_test Test: target libvintf_test Test: host vintf_object_test Test: target vintf_object_test Test: m system_manifest.xml compatibility_matrix.xml Test: boots Bug: 64447338 Change-Id: I75c28f3e021d16860e4577c3ecfaec2bd89d8a3d Merged-In: I75c28f3e021d16860e4577c3ecfaec2bd89d8a3d
* | Track tinyxml2 API change.android-o-iot-preview-5Elliott Hughes2017-08-081-1/+1
| | | | | | | | | | | | Bug: http://b/64459264 Test: builds Change-Id: Ica24adee8874b28b793570e2cdf8f2b24d073287
* | Native HALs don't require <transport>.Yifan Hong2017-08-071-2/+32
|/ | | | | | | | | | | This is stated in go/android-treble-vintf-object but the code was not well tested. Fortunately, native HALs are not used (until now), so we need to conform to the documentation here. Test: libvintf_test Bug: 64447338 Change-Id: I00d96137d4052d9da50f696ef665a73d09d818a7 Merged-In: I00d96137d4052d9da50f696ef665a73d09d818a7
* Add <xmlfile> to manifest / comp mat.Yifan Hong2017-06-231-0/+88
| | | | | | | | | | | | | | | | | | | | | | | | | manifest.xml is allowed to contain <xmlfile> that is similar to: <xmlfile> <name>media_profile</name> <version>1.0</version> <path>/path/to/media_profile_v1_0.xml</path> </xmlfile> For compatibility-matrix.xml <xmlfile format="dtd" optional="false"> <name>media_profile</name> <version>1.0-1</version> <path>/path/to/media_profile_v1_1.dtd</path> </xmlfile> The <path> tag is optional. See test/main.cpp for examples. Test: libvintf_test Test: vintf_object_test Bug: 38359330 Change-Id: I0a921f32d023e1ba9c54ea6e898bb385fc7abd4f
* Update better error message.Yifan Hong2017-06-021-2/+6
| | | | | | Test: pass Change-Id: I35ca5d6ff1ca3df7bc3b09ef9859b067e5e8f77b Fixes: 62273754
* Do not allow duplicated major version across <hal> in manifestsYifan Hong2017-05-221-1/+2
| | | | | | | | | | | | | | | | | | <hal> entries has to be grouped by versions. Otherwise, if <transport> is different in two <hal> entries with the same <name> and <version>, getTransport always return the first match. As a side effect, fixes an incorrect behavior in HalManifest::isCompatible that test for <instance> tags across two <hal>'s with the same name and version (because it shouldn't occur at all). This incorrect behavior is hidden under an EXPECT_FALSE in libvintf_test. Now that this is never allowed, the test is changed to EXPECT_TRUE. Test: libvintf_test Change-Id: I10d4619f3828bf695485938c315c73a924ba6340 Merged-In: I10d4619f3828bf695485938c315c73a924ba6340 Fixes: 38502835
* Rework compat check of ManifestHal vs. MatrixHalYifan Hong2017-05-191-2/+5
| | | | | | | | | | | | | | | | | | <interface> and <instance> in a compatibility-matrix.hal also needs to be checked in a manifest.hal. Specifically, all instances specified in compatibility-matrix.hal must be present in manifest.hal, although they can span across different tag elements. See tests for samples. For details, see: go/android-treble-vintf-object Test: libvintf_test Test: vintf_object_test Bug: 38395193 Change-Id: Ia009c5a1d779818594efc4c7f485d9fe4f23ed55 Merged-In: Ia009c5a1d779818594efc4c7f485d9fe4f23ed55
* Add HalInterface to compatibility matrixYifan Hong2017-05-191-1/+12
| | | | | | | | | Test: libvintf_test Test: vintf_object_test Bug: 38395193 Change-Id: I6dfc21bbfb63b575558405e441f3926ff3813eb8 Merged-In: I6dfc21bbfb63b575558405e441f3926ff3813eb8
* Renamed ManifestHalInterface to HalInterfaceYifan Hong2017-05-191-27/+27
| | | | | | | | | | because it is used by compatibility matrix as well. Bug: 38395193 Test: compiles Change-Id: I186fdf4e7fd7076f2ac9d7e95eda5ba7510f9dad Merged-In: I186fdf4e7fd7076f2ac9d7e95eda5ba7510f9dad
* Add device/fwk compatibility matrix to VintfObject.Yifan Hong2017-05-041-1/+3
| | | | | | | | | | | | For framework compatibility matrix, <sepolicy> sections is injected in build time. Test: libvintf_test Test: adb shell vintf; matrices exist, compatible = true Bug: 37321309 Bug: 36814503 Change-Id: I997b93456a261f0cdb85997ae88f4ac5a5f36ff3 Merged-In: I997b93456a261f0cdb85997ae88f4ac5a5f36ff3
* Allow VNDK to be missing from compatibility matrix.Yifan Hong2017-04-281-1/+3
| | | | | | | <vndk> is injected at build time. Test: pass Change-Id: I91146012cd3e9cbd1e15abb33757490479124efa
* Remove a TODO commentYifan Hong2017-04-171-1/+2
| | | | | | | | | | <sepolicy> can be missing because it can be determined by build time flag instead of hard-coded in the XML file. Test: pass Bug: 36456394 Change-Id: Ifcbe7bd6aad680a0e350cd58d6d5e2fbea2a58bd Merged-In: Ifcbe7bd6aad680a0e350cd58d6d5e2fbea2a58bd
* Allow avb.vbmeta-version to be missing from compat matYifan Hong2017-04-151-1/+1
| | | | | | | | | | For non verified boot devices, vbmeta-version doesn't make sense. So allow it to be missing from compatibility matrix. Test: libvintf_test Bug: 35322304 Change-Id: I6583c65c28441dec5f7f5f4520fd18a2a22f89e0
* Add avb.vbmeta-version to CompatibilityMatrix and RuntimeInfoYifan Hong2017-04-131-1/+15
| | | | | | | | | | | | | | RuntimeInfo fetch avb vbmeta version by reading the following two sysprops: - ro.boot.vbmeta.avb_version - ro.boot.avb_version If the sysprop does not exist, 0.0 is set. Test: libvintf_test Test: adb shell vintf (shows 0.0 because CLs for sysprops are not merged yet) Bug: 35322304 Change-Id: I345bc792d1a7ceb585d246ec657707814b42ceff
* compatibility-matrix.sepolicy.sepolicy-version formatYifan Hong2017-04-131-3/+3
| | | | | | | | | | should be 25.0 or 26.0-3; also there can be multiple sepolicy-version entries. Change the code to reflect these. Test: libvintf_test Bug: 36456394 VINTF: add sepolicy version Bug: 36737087 We need a way to identify which "platform version" Change-Id: Iaf660c6326fb42a21b16e8b8129005053a28f01b
* Include Vndk version to compatibility matrix XML.Yifan Hong2017-04-131-0/+2
| | | | | | | | | Serialization code is missing before. Also added tests for converting device compatibility matrices. Test: libvintf_test Bug: 36400653 Change-Id: I57aabafdf71f7e9ce05f30e0b14c3d83dc1c183f