summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceTable_test.cpp
AgeCommit message (Collapse)Author
2021-03-29Refactor aapt2 tests ResourceTable changesRyan Mitchell
This changes refactors tests to use the NewResourceBuilder class that makes it easier to construct resource entries. Bug: 183102797 Test: aapt2_tests Change-Id: I851f9fb99a003769f8df8c1876997eee0864822a
2020-02-26Refactor overlayable policyWinson
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
2019-01-16Remove RRO policy product_servicesRyan Mitchell
Since Q will no longer have a product_services partition, remove instances of the product_services policy across aapt2, androidfw, and idmap2. Bug:122745343 Test: aapt2_tests and libandroidfw_tests Change-Id: I97c223a0bf5a2eab95811e5f738b44af6335e0ea
2018-12-13Add actor and name parsing for overlayableRyan Mitchell
Add parsing of two overlayable attributes: name : The unnique identifying name of the overlayable set of resources actor: The component responsible for enabling and disabling overlays targeting the specified set of resources Bug: 110869880 Bug: 119390855 Test: m -j aapt2_tests Change-Id: Id42463e2b92b69034fb39cd29bc8606affb61ba7
2018-12-11Refactor policy parsingRyan Mitchell
This change removes the ability for an overlayable resource to be defined in multiple policy blocks within the same overlayable. This change also changes aapt2 to use a bit mask to keep track of the parsed policies. Bug: 110869880 Bug: 120298168 Test: aapt2_tests Change-Id: Ie26cd913f94a16c0b312f222bccfa48f62feceaa
2018-11-06RRO: Added partition policies for overlaysRyan Mitchell
<overlayable> tags can now have policy elements that indicate which partition the overlay apk must reside on in order to be allowed to overlay a resource. This change only adds parsing of <policy> and encoding of policy in the proto ResourceTable. A later change will add the encoding of policy and overlayable in the binary APK. <overlayable> <policy type="system|vendor|product|product_services|public" > <item type="string" name="oof" /> </policy> </overlayable> Bug: 110869880 Test: make aapt2_tests Change-Id: I8d4ed7b0e01f981149c6e3190af1681073b79b03
2018-10-08libandroidfw: move ConfigDescription from aapt2 to libandroidfwMÃ¥rten Kongstad
This is to allow idmap2 to access ConfigDescription. Test: libandroidfw_tests Test: aapt2_tests Change-Id: I54210bbbd8dad5903cb7100807df977efa394ad5
2018-08-27AAPT2: Fix resource table load time regressionRyan Mitchell
A previous change (deee395) caused duplicate entries to be created for entries eith entry ids greater than 0x0ff. This is because the wrong data type was used (uint8_t instead of uint16_t). This made loading in resources slower as well since more entries had to be iterated over. Bug: 36051266 Test: Dumping all resources in 700 apks found in the android tree took 1 minute instead of 5 minutes. Created a test in aapt2_tests. Change-Id: I1c3d830da517a56ac3496221dbe605c72e0c6014
2018-01-11AAPT2: Allow compatible duplicate AttributesAdam Lesinski
If a resource XML file defines two compatible Attributes, they should be merged without throwing an error. Ex: <declare-styleable> <attr name="conflict" format="string" /> </declare-styleable> <declare-styleable> <attr name="conflict" format="string|reference" /> </declare-styleable> In this case, string|reference and string are the same, so these should merge correctly. Bug: 65699599 Test: make aapt2_tests Test: make AaptBasicTest Change-Id: I7b0f956d2332f7f0b458acd59ca0a606b2cfdf95
2017-12-18AAPT2: Propagate SPEC_OVERLAYABLE flag to final APKAdam Lesinski
Resources can be marked as overlayable, which means they can be overlaid by runtime resource overlays. This change propagates this state to the final resource table that is installed on device. Future work: - Have the idmap tool respect the overlayable state and ignore entries that overlay anything else. Bug: 64980941 Test: make aapt2_tests Change-Id: Id45b1e141a281be2ee32a4ac3096fcf1114d523b
2017-06-09AAPT2: Clean up tests a bitAdam Lesinski
Since the latest gtest has fixed support for explicit bool operators, remvoe AAPT_ASSERT_* and AAPT_EXPECT_*. Also switch to use NotNull() matchers, which are more legible. Test: make aapt2_tests Change-Id: Idce199ca9d567d70f7aae275fee15e04bb914c9e
2017-03-29AAPT2: Allow arbitrary entry names with aapt2 optimizeAdam Lesinski
Presumably, the apps build fine for the developers, so just feed the existing names through without validation. Validation still exists when building an app from source. Bug: 36051854 Change-Id: Idc64ee91b08dce67d3c28f3c5284a7afa1312df1 Test: run aapt2 optimize on the apks from b/36051854 and build aapt2_tests
2016-10-26AAPT2: Rename to match new styleAdam Lesinski
Use Google3 naming style to match new projects' and open source google projects' style. Preferred to do this in a massive CL so as to avoid style inconsistencies that plague legacy code bases. This is a relatively NEW code base, may as well keep it up to date. Test: name/style refactor - existing tests pass Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
2016-10-19Use Google3 style guide with .clang-formatAdam Lesinski
Test: style change only, builds ok Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
2016-08-26AAPT2: Fix merging of styleables the right wayAdam Lesinski
Styleables should only be merged when processing overlays. This moves the styleable merging code out of ResourceTable and into TableMerger. Change-Id: I3aae05cf4dd875cd25ac2ac744b61194409b2fee
2016-08-19AAPT2: Merge Styleables instead of overriding themAdam Lesinski
Styleables merge in AAPT. Preserve this behavior. Bug:30970091 Change-Id: Ie68ca675aeecd873c0648682182e2fc574e329a0
2016-07-25AAPT2: Change accepted notation for resource names in testsAdam Lesinski
Previously the way to name resources in tests was to use reference notation (@[package:][type/]name). Now we use name notation (no @). Change-Id: I68f0a36562d89cc78c582d128f370d9556c58707
2016-07-13AAPT2: Remove usage of u16stringAdam Lesinski
For legacy reasons, we kept around the use of UTF-16 internally in AAPT2. We don't need this and this CL removes all instances of std::u16string and StringPiece16. The only places still needed are when interacting with the ResTable APIs that only operate in UTF16. Change-Id: I492475b84bb9014fa13bf992cff447ee7a5fe588
2016-04-06AAPT2: Implement XmlActionExecutor to verify manifestAdam Lesinski
Defines a set of actions to perform on XML elements defined by their hierarchy, eg: manifest -> application -> activity. This can be used to easily add rules to check more tags in AndroidManifest.xml Change-Id: I76c6916a98b6403075a7e56e16230979dc6cbee1
2016-02-12AAPT2: Introduce notion of 'product' to ResourceTableAdam Lesinski
This allows us to preserve the various product definitions during the compile phase, and allows us to select the product in the link phase. This allows compiled files to remain product-independent, so that they do not need to be recompiled when switching targets. Bug:25958912 Change-Id: Iaa7eed25c834b67a39cdc9be43613e8b5ab6cdd7
2015-10-22AAPT2: Move comments and source into ValueAdam Lesinski
Values are closely related to where they were defined, so this information should live inside the Value. This also enables comments to be attached to nested Values. Change-Id: Ic7481b5a5f26d0ef248d638e2e29252f88154581
2015-10-16AAPT2: Separate out the various stepsAdam Lesinski
An early refactor. Some ideas became clearer as development continued. Now the various phases are much clearer and more easily reusable. Also added a ton of tests! Change-Id: Ic8f0a70c8222370352e63533b329c40457c0903e
2015-04-15AAPT2: Add library supportAdam Lesinski
Change-Id: I307f56d9631784ab29ee4156d94886f9b2f25b30
2015-04-02AAPT2Adam Lesinski
First checking of AAPT2. The individual phases of AAPT2 work, but there are some missing pieces. For early testing we are missing: - Need to properly mark file references and include them in package - Need to package into zip Final AAPT for apps we are missing: - Need to crush PNGs - Need to parse 9-patches - Need to validate all of AndroidManifest.xml - Need to write align method to align resource tables for splits. Final AAPT for apps + system we are missing: - Need to handle overlays - Need to store comments for R file - Need to handle --shared-lib (dynamic references too). New AAPT features coming: - Need to import compiled libraries - Name mangling - R file generation for library code Change-Id: I95f8a63581b81a1f424ae6fb2c373c883b72c18d