summaryrefslogtreecommitdiff
path: root/cmds/idmap2/libidmap2/ZipFile.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
2019-09-26idmap2: ZipFile::Open: fix potential memory leakMårten Kongstad
Even if OpenArchive in libziparchive returns a non-zero value (indicating failure), it will have allocated memory that needs to be freed via CloseArchive. Add the missing call. Test: valgrind --leak-check=full --show-leak-kinds=all --error-exitcode=1 $ANDROID_HOST_OUT/nativetest64/idmap2_tests/idmap2_tests Change-Id: I92d47459c27e62ba4544327d7b7f3c4106e6ad34
2019-05-06libidmap2: track libziparchive API change.Elliott Hughes
Bug: http://b/129068177 Test: treehugger Change-Id: Id1e855d17cde15b2db37df5e192e2011c60eaebe
2019-04-15Run idmap2 static-checks and fix formatting issuesRyan Mitchell
Bug: 130324774 Test: builds Change-Id: I2cf9d3aa268ffe38e525fadee9d81fc6aefe19b1
2019-02-27idmap2: switch to improved Result classMårten Kongstad
Remove the old std::optional based Result class, replace uses with the new std::variant based Result class. Test: make idmap2_tests Change-Id: I401cb36e5af06133a2872d835cf29bfb0b106597
2018-12-21idmap2: fix clang-tidy warnings [modernize-*]Mårten Kongstad
Bug: 120024673 Test: mmm frameworks/base/cmds/idmap2; check output Change-Id: I8768169fb7b541eb6b1aa3311c46a710eb71aac9
2018-12-17idmap2: replace std::pair<bool, T> with Result<T>Mårten Kongstad
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
2018-10-30idmap2: initial code dropMårten Kongstad
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