To achieve this ParseResourceConfig is extracted to Utils.cpp and tests
are moved from Optimize_test.cpp to Util_test.cpp.
Bug: b/249793372
Test: Util_test, Convert_test
Change-Id: I5a0458e3834d5ea62c96013abc14527285e895e0
This CL introduces DeduplicateItemsResEntryWriter which stores unique
pairs of entry and value and deduplicates a new pair based of this data
before writing it into the buffer.
Bug: b/249793372
Test: ResEntriesWriter_test, TableFlattener_test
Change-Id: I938a3425a87bfad9853e59193680de2050a95bd2
ResEntryWriter is responsible to write pairs of entry+value into binary
buffers and allows easy customization how and where entries are written.
This is no-op refactoring and all existing tests should pass.
Bug: b/249793372
Test: Existing tests
Change-Id: Ica98a25aeb49cc96cad28547c462b36316a8adb6
`android::util::Utf16ToUtf8()` actually returns a `std::string` due to
the actual conversion to Utf8. `ParseResourceNamedType()` operates on a
`StringPiece` of `converted` (the `std::string` returned from that
call), and stashes it away for later use. Of course, by the time we're
using the `StringPiece` in `parsed_type`, `converted` has already gone
out of scope and is invalid to access.
Bug: http://b/250827883
Test: ./art/test/testrunner/run_build_test_target.py -j80 art-asan
Change-Id: Iea71a5cc84b7dfa96e7dcb549435f8394770a4df
ResourcePathShortener is a part of Obfuscator. Obfuscator will not
only shorten the path but also handle obfuscating resource names.
Format C++ code by clang-format.
Bug: 228192695
Test: atest aapt2_test idmap2_test
Change-Id: I27b4b1af44061e3cd8a6717ffd46b8a187cdc41d
This helps solve three problems:
* obfuscation maps are now documented.
* obfuscation maps will not require hand-rolled parsers.
* no additional plumbing will be required for future
optimizations---plumbing individual mapping files in Bazel for
ProGuard, aapt2, etc. has been a pain.
Bug: 153201806
Test: make aapt2
Change-Id: Ie3829834527e8875d768ae28242d3aeca28c6db2
This allows to use sparse encoding for APKs that do not specify minSdk
version inside. This is common for split APKs generated by bundletool
when Android App Bundle (AAB) is split into multiple APKs.
Bug: b/223394605
Test: TableFlattener_test
Change-Id: I2a99a611f855cffbcea20018d869e1eb54d1b3d5
aapt2 disable sparse encoding when sdk < 32
Bug: 197642721
Test: Updated and verified affected atests pass
Change-Id: I839978207eb30f958f5d695cf8dea7f0dad1312f
aapt2 enable sparse encoding when sdk is not set.
Bug: 197642721
Test: Added new unit test and verified all tests pass
Change-Id: Ib58941d98eafe8e543d50054c9d36a51d7977c71
The text of CDATA in XML document should be escaped before the CDATA
text is printed.
Dump xmltree command use XmlPrinter inheriting from xml:ConstVisitor.
To fix issue, it only needs to modify
XmlPrinter::Visit(const xml::Text).
Bug: 140373430
Test: aapt2 dump xmltree --file res/xml/test.xml app_debug.apk
Change-Id: I4f43120b4fbc2ea7136fb51fdeb24e254b94c60f
At the moment aapt2 dumps information from the latest <uses-sdk> element
but uses all of them to detect target SDK which affects implied
permissions. Use only the latest one for detecting targetSdk as well.
Bug: b/243145989
Test: Dump_test
Change-Id: I70f828f1845ab070fa84c5297af12df24e7068dc
Logic is synchronised with 'aapt':
* use 'android.media.*' intents for 'camera' component detection;
* use only 'lib/' under root to parse supported archs.
Bug: b/243145989
Test: Dump_test.cpp
Change-Id: I90fbe802a97a4382e3021b344d0c5e9708563389
Once the build process finds one overlayable resource entry is not in
the list of collapse name exemption, the build process outputs the
resource name automatically and gives a warning message to notify the
developers.
Bug: 228192695
Test: atest aapt2_test
Change-Id: I989b75343d803b059c902baa088590fce7237211
Add the scaffolding for teaching the package parser to reject a package
if its manifest specifies a set of prefixes, and the device fingerprint
does not start with one of the prefixes.
Bug: b/232475788
Test: m
Change-Id: I9f3f3d3ad96332d2d65fbf6f58c7ce35992bcd7e
Leverage the existing mechanism for validating the locale format to verify whether the locale format of the compiled localeConfig file follows the BCP47 reqular expressions
Bug: 208943132
Test: 1. atest aapt2_tests
2. Build the app bundle with the local aapt2 in the Android Studio
a. Make sure the app can be built pass with AGP 7.3.0-alpha06.
b. Make sure the app can be built pass by using the local aapt2 with gradle: set the android.aapt2FromMavenOverride=<path> variable in gradle.properties.
c. Revove the property above in gradle.properties then apply AGP 7.3.0-alpha07. Make sure the appt2 shows error(AAPT: error: failed to load XML file: No such file or directory) when building the app.
d. Add the locale aapt2 with gradle: set the android.aapt2FromMavenOverride=<path> variable in gradle.properties. Make sure the app can be built pass.
Change-Id: Ifa4b9123d36f9c2d450fdf16e1f52963962d7d81
This reverts commit c90f42c80f.
Reason for revert: Introduces the escaping *into the APKs*; as mentioned in b/140373430#comment3 the Right Way to dump XML is via textproto.
Fix: 222745626
Bug: 140373430
Change-Id: I775b8a304e76a83934c36886c17cf23560914d21
Merged-In: I775b8a304e76a83934c36886c17cf23560914d21
(cherry picked from commit 27e9a4a85f)
This reverts commit c90f42c80f.
Reason for revert: Introduces the escaping *into the APKs*; as mentioned in b/140373430#comment3 the Right Way to dump XML is via textproto.
Fix: 222745626
Bug: 140373430
Change-Id: I775b8a304e76a83934c36886c17cf23560914d21
* changes:
Implementation of 'aapt2 apkinfo' command.
Extend DumpManifest unit to export badging data into proto.
Split ManifestExtractor to Extract and Print methods.
Tests for 'aapt2 dump badging' command.