summaryrefslogtreecommitdiff
path: root/cmds/idmap2/libidmap2/XmlParser.cpp
AgeCommit message (Collapse)Author
2021-02-09Add fabricated RRO generation to libidmap2Ryan Mitchell
Fabricated Runtime Resource Overlays are overlays that are generated at runtime and are stored in the data/ partition. The system can fabricate RROs at runtime to dynamically theme the device. Idmaps can now be created from APK RROs and fabricated RROs. Rather than operating on ApkAssets, libidmap2 now operates on abstract resource "containers" that supply resource values. Target resource containers implement methods needed to query overlayable and target overlay information. Currently only APKs can be loaded as target resource containers. Overlay resource containers implement methods to supply the mapping of target resource to overlay value and other overlay information. The format of a fabricated RRO is as follows: 0x00 - 0x04 : fabricated overlay magic (always FRRO) 0x04 - 0x08 : file format version 0x08 - 0x0c : crc of version + proto data 0x0c - EOF : proto fabricated overlay data The magic is used to quickly detect if the file is a fabricated overlay. The version is incremented whenever backwards incompatible changes are made to the proto file format. Idmap must always be able to upgrade fabricated overlays from previous versions to new versions, so all previous versions must be checked into the tree. Bug: 172471315 Test: libidmap2_tests && libandroidfw_tests Change-Id: I4c9f29da278672e5695fb57d131a44c11a835180
2021-01-08Read manifest values using resource id in idmap2Ryan Mitchell
Idmap2 currently reads android:targetPackage and android:targetName from overlay manifests by looking for an attribute with the name of the attribute resource. This fixes the divergence from package parsing by finding the attributes using their resource ids. Bug: 175060836 Test: libidmap2_tests Change-Id: I09965e5880a1e6c48c3f8077db0c595484804ce7
2020-12-21Add explicit Result::ok() checks where neededBernie Innocenti
Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests Exempt-From-Owner-Approval: mechanical mass refactoring Change-Id: I3117833c51cdb333cccdfd159d1582f2adef77db
2020-12-08Revert^2 "libandroidfw hardening for IncFs"Ryan Mitchell
55ef6167a2c235bd88c7216238b2001b46795b79 Change-Id: I02d4890d181655dfd0a14c188468db512559d27b Merged-In: I02d4890d181655dfd0a14c188468db512559d27b
2019-10-04Improve idmap2 xml parsingRyan Mitchell
To parse the <overlay> tags for internal overlay references, we require the ability to parse XML. The current implementation only allows idmap2 to find a tag somewhere in an xml file. This implementation allows for the retrieval of an iterator that iterates over direct children xml elements. Now we can enforce that the <overlay> tag in the manifest is nested within the <manifest> tag and we can ensure <item> tags are within the <overlay> tags of the overlay resource configuration xml. Bug: 135051420 Bug: 135943783 Test: idmap2_tests Change-Id: I12f965b55c18960af6cf9dc6ca46429f53124c9a
2019-10-02Revert "Improve idmap2 xml parsing"Ryan Mitchell
This reverts commit 58cdc2a8226e8618331a81c1e1b77a4421bb5629. Reason for revert: <aosp/1129572 caused a build failure> Change-Id: Iecae19877dacf9ec5c2b2bc59dca362f573e9a7a
2019-10-01Improve idmap2 xml parsingRyan Mitchell
To parse the <overlay> tags for internal overlay references, we require the ability to parse XML. The current implementation only allows idmap2 to find a tag somewhere in an xml file. This implementation allows for the retrieval of an iterator that iterates over direct children xml elements. Now we can enforce that the <overlay> tag in the manifest is nested within the <manifest> tag and we can ensure <item> tags are within the <overlay> tags of the overlay resource configuration xml. Bug: 135051420 Bug: 135943783 Test: idmap2_tests Change-Id: I1a1c4329514eb63b7575c4376adc0d8cda217269