summaryrefslogtreecommitdiff
path: root/cmds/idmap2/tests/ResourceUtilsTests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add fabricated RRO generation to libidmap2Ryan Mitchell2021-02-091-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Read manifest values using resource id in idmap2Ryan Mitchell2021-01-081-1/+23
| | | | | | | | | | | | | 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
* Run idmap2 static-checks and fix formatting issuesRyan Mitchell2019-04-151-4/+2
| | | | | | Bug: 130324774 Test: builds Change-Id: I2cf9d3aa268ffe38e525fadee9d81fc6aefe19b1
* idmap2: fix clang-tidy warnings [modernize-*]Mårten Kongstad2018-12-211-4/+2
| | | | | | Bug: 120024673 Test: mmm frameworks/base/cmds/idmap2; check output Change-Id: I8768169fb7b541eb6b1aa3311c46a710eb71aac9
* idmap2: fix clang-tidy warnings [readability-*]Mårten Kongstad2018-12-201-2/+2
| | | | | | Bug: 120024673 Test: mmm frameworks/base/cmds/idmap2; check output Change-Id: I1565afac8d34e4347d8c946228d1134211e8b435
* idmap2: replace std::pair<bool, T> with Result<T>Mårten Kongstad2018-12-171-9/+6
| | | | | | | | | | | | | | | | | | | | | Introduce a new type Result<T> to indicate if an operation succeeded or not, and if it did, to hold the return value of the operation. This is the same as how std::pair<bool, T> is already used in the codebase, so replace all instances with Result<T> to improve clarity. Result<T> is simply an alias for std::optional<T>. The difference is semantic: use Result<T> as the return value for functions that can fail, use std::optional<T> when values are truly optional. This is modelled after Rust's std::result and std::option. A future change may graduate Result<T> to a proper class which can hold additional details on why an operation failed, such as a string or an error code. As a special case, continue to use std::unique_ptr<T> instead of Result<std::unique_ptr<T>> for now: the latter would increase code complexity without added benefit. Test: make idmap2_tests Change-Id: I2a8355107ed2b6485409e5e655a84cf1e20b9911
* idmap2: initial code dropMårten Kongstad2018-10-301-0/+69
idmap2 is a reboot of the idmap project. The project aims to - use modern C++ - greatly improve test and debug support - interface towards AssetManager2 (instead of AssetManager) - provide a solid foundation to add support for new features To make it easier to verify correctness, this first version of idmap2 is feature equivalent to idmap. Later versions will add support for new features such as <overlayable>. Bug: 78815803 Test: make idmap2_tests Change-Id: I1d806dc875a493e730ab55d2fdb027618e586d16