summaryrefslogtreecommitdiff
path: root/cmds/idmap2/tests/Idmap2BinaryTests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* idmap2: fix clang-format warningsMårten Kongstad2022-02-141-4/+4
| | | | | | | Bug: N/A Test: frameworks/base/cmds/idmap2/static-checks.sh Test: atest --host idmap2_tests Change-Id: I5cd8d512df188371d4b2096246e51effbcbc1a61
* Rename ProcResult stdout and stderr fieldsColin Cross2021-08-171-22/+22
| | | | | | | | | stdout and stderr are macros in musl, which causes build failures when they are used as field names. Rename the fields to stdout_str and stderr_str. Test: builds Change-Id: I04770d2d6e82ca8393308ab12a304838a80f0ae5
* Accept --overlay-name flag in idmap2Ryan Mitchell2021-01-061-9/+26
| | | | | | | | | | | | | | | | | | To support allowing for multiple <overlay> tags in one package, idmap2 must be able to generate an idmap for an individual <overlay> tag. `idmap2 create` now accepts a --overlay-name flag that specifies which tag to use to generate the idmap. The value of --overlay-name should be set to the value of the android:name attribute on the <overlay> tag to use. If the flag is not present, idmap2 will look for an <overlay> tag with no value for android:name. Bug: 162841629 Test: libandroidfw_tests Test: libidmap2_tests Change-Id: I02316d0b88773f02c04a5d462be9825016fa496d
* Merge changes I1d3e5e66,I86b869af,Iab4d3902,I645ee722 am: 72864d2930 am: ↵Treehugger Robot2020-10-191-4/+4
|\ | | | | | | | | | | | | | | 968582e45f am: cb2ebfc692 am: c59b81c978 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1461087 Change-Id: Ib58c1acbb9629a6654eb8e1666872974f0c75944
| * Remove malloc/free for inline overlay valuesRyan Mitchell2020-10-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove malloc/free of android::ResTable_entry for inline overlay values. Add `target_entry_inline` to the idmap format to encode inline overlay values separate from direct mapping of target resource to overlay resource. This reduces the number of bytes needed to represent a direct mapping of target resource to overlay resource from 9 bytes to 8 bytes per entry. Fixed all idmap alignment issues that required the framework to use "#pragma pack(push, 1)" when loading idmaps. Bug: 170341022 Test: idmap2_tests and libandroidfw_tests Change-Id: Iab4d3902508f02773464724913e0ee966e3689e4
* | idmap2: remove the 'scan' commandMårten Kongstad2020-07-201-125/+0
|/ | | | | | | | | | | The 'scan' command has been replaced by 'create-multiple'. Remove the unused code. Also remove unused functions and #includes from FileUtils, and the obsolete JNI plumbing. Test: atest idmap2_tests OverlayDeviceTests OverlayHostTests Change-Id: Iae073c13ce64b5db48f22f7e723bc8c0c5fcd2c9
* Refactor overlayable policyWinson2020-02-261-5/+10
| | | | | | | | | | | | | | | | | | | | To make it easier to add the actor policy in a follow up CL, move most of the policy handling to a central location. The strings and transformation between strings and flags is now handled in libidmap2policies, with libandroidfw containing the single source of policy flags. This also extracts all the test resource IDs into an R.h so they can be swapped without having to edit a dozen files each time. Bug: 130563563 Test: m aapt2_tests idmapt2_tests and run from host test output Test: atest libandroidfw_tests Change-Id: Ie533c9cebf938215df7586f00c38763ae467e606
* Allow for RRO internal referencingRyan Mitchell2019-10-171-1/+48
| | | | | | | | | | | | | | | | | | | | | | This change allows RROs to reference their own internal resources as expected. Overlays are loaded as shared libraries so they can have their own resource id space that does not conflict with the resource id space of the target or other overlays. References to overlay resources that override target resources now appear as references to the target resources. Overlay values that are inlined into the xml file specified using android:overlayResources are now able to be used at runtime. See go/rro-references for more information. Bug: 135943783 Test: idmap2_tests Test: libandroidfw_tests Change-Id: Ie349c56d7fd3f7d94b7d595ed6d01dc6b59b6178
* Idmap format changes for bidirectional lookupRyan Mitchell2019-10-171-50/+1
| | | | | | | | | | | | | | | | | | This change modifies the idmap file format to allow for target resources to map to arbitrary type/value combinations and to allow overlay resources to be mapped back to target resource ids so references to overlay resources can appear as references to target resources at runtime. The mappings of target resources to overlay resources and vice-versa are both encoded as sparse arrays. Instead of looking up a resource by indexing into an array that maps to the overlay resource id, the runtime will binary search over the sparse array to find the type and value that overlays the target resource. Bug: 135943783 Test: idmap2_tests Change-Id: I5d5344cdb7fe35f4f2e8d6781016299dea5d1e20
* Add odm and oem policiesRyan Mitchell2019-04-171-4/+4
| | | | | | | | | This change adds parsing, encoding, and validating of odm and oem overlayable policies to aapt2, libandroidfw, and idmap2. Bug: 121033532 Test: aapt2_tests, idmap2_tests Change-Id: Ifc0d4b6c9f9c37e06b2988abade69dbb277c50c2
* Do not fail idmap scan if one idmap fails to generateRyan Mitchell2019-04-151-0/+18
| | | | | | | | | If one static overlay fails to have its idmap generated, continue scanning other overlays. Bug: 130324774 Test: idmap2_tests and manual Change-Id: I06a74c844ebc81dcfb5b50e8c9a30a68c7e4ffb0
* Run idmap2 static-checks and fix formatting issuesRyan Mitchell2019-04-151-6/+3
| | | | | | Bug: 130324774 Test: builds Change-Id: I2cf9d3aa268ffe38e525fadee9d81fc6aefe19b1
* idmap2: move Idmap.h to ResultMårten Kongstad2019-03-201-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the signatures of Idmap::FromApkAssets and Idmap::FromBinaryStream from std::unique_ptr<const Idmap> func(..., std::ostream& out_error); to Result<std::unique_ptr<const Idmap>> func(...); The returned pointer is still a unique pointer to ensure the dynamically allocated memory is automatically released when no longer used. This means that using the returned value of either function requires one of two patterns: const auto idmap = func(...); if (!idmap) { return Error(...); } (*idmap)->accept(...); or auto result = func(...); if (!result) { return Error(...); } const auto idmap = std::move(*result); idmap->accept(...); Note that in the second example, result must be non-const or the call to std::move(*result) will not compile. With this change, the entire idmap2 project has been converted to use Result. Test: make idmap2_tests Change-Id: I533f4e03b99645523d94dd5f446ad76fb435f661
* idmap2: add signature policyWinson2019-02-151-4/+4
| | | | | | | | | | Handles the new signature policy for overlayable resources. Bug: 119402606 Test: idmap2_tests target Change-Id: I7961e04a879c40c240ed9097bb510addb8b56680
* Enforce overlayable API when definedRyan Mitchell2019-02-051-0/+14
| | | | | | | | | If a package defines overlayable resources, then do not allow resources that are not defined as overlayable to be overlaid. Bug:123600120 Test: idmap2_tests and cts-tradefed run cts -m CtsRROTestCases Change-Id: I35120a97ccf4650e67c7ba65a60f4f3c51b0e627
* Merge "idmap2: lock down write access to /data/resouce-cache"TreeHugger Robot2019-01-241-0/+23
|\
| * idmap2: lock down write access to /data/resouce-cacheMårten Kongstad2019-01-181-0/+23
| | | | | | | | | | | | | | | | | | | | Deny write access to /data/resource-cache for UIDs other than root and system. While this is already handled by SELinux rules, add an additional layer of security to explicitly prevent malicious apps from messing with the system's idmap files. Test: make idmap2_tests Change-Id: Id986633558d5d02452276f05f64337a8700f148a
* | Add enforcement of overlayable targetNameRyan Mitchell2019-01-181-4/+4
|/ | | | | | | | | | | | | | | Adds android:targetName to the overlay manifest attributes and PackageParser reads the name into PackageInfo. Specifying android:targetName on an overlay allows the overlay to be associated with a particular set of overlayable resources. The overlay can only override the values of the resources defined within the target overlayable element. Test: idmap2_tests Bug: 119390855 Bug: 110869880 Change-Id: I1128274af4cae983f61ae15cdfcbface63233ff2
* Add enforcement of idmap policiesMårten Kongstad2019-01-161-7/+25
| | | | | | | | | | | | | | Teaches idmap2 to recognize policy restrictions put on overlayable resources. If overlayable enforcement is turned on for an overlay, then any resources defined within the overlayable api of the target will have policy restrictions imposed on them. All resources without overlayable definitions will continue to be overlayable without policy restrictions. Bug: 119390857 Test: atest idmap2 and booting Co-authored-by: Ryan Mitchell <rtmitchell@google.com> Change-Id: I7e435648eb6e4a87b0b90a7b2a0c3f33c1516ea6
* 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
* Merge "idmap2: fix clang-tidy warnings [readability-*]"TreeHugger Robot2018-12-211-1/+1
|\
| * idmap2: fix clang-tidy warnings [readability-*]Mårten Kongstad2018-12-201-1/+1
| | | | | | | | | | | | Bug: 120024673 Test: mmm frameworks/base/cmds/idmap2; check output Change-Id: I1565afac8d34e4347d8c946228d1134211e8b435
* | idmap2: move static functions to anonymous namespacesMårten Kongstad2018-12-201-2/+6
|/ | | | | | | | Move static functions to anonymous namespaces: this is the contemporary way to express the same thing. Test: make idmap2_tests Change-Id: I41ed387455996db1ac515d04eb560d179b5b5169
* idmap2: initial code dropMårten Kongstad2018-10-301-0/+313
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