Package name and shared user id could be used as part of filename
as prefix by other modules. Limits the length to 223 and reserves
32 for the OS.
Bug: 118768971
Test: atest aapt2_tests
Test: aapt2 link -I android.jar --manifest ManifestLongPackageName.xml
Test: aapt2 link -I android.jar --manifest ManifestLongSharedUserId.xml
Change-Id: Ic4b5b4647b9e253b79b663f4d7a9050f43bb8cf0
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference
Bug: 162364131
Bug: 162536543
Test: aapt2_tests
Change-Id: I4eef925d6319b40a395fc8d59a3f2912a02ca03b
This changes adds the build id to the version printed by "aapt2
version". This change also adds a field to the ResourceTable proto that
specifies the fingerprints of tools used to build the table.
Bug: 123663089
Test: manual
Change-Id: Ifaf33c1e506b68e9f1d921fdbeddf36485e65790
util::mkdirs iteratively creates each directory of a specified path. For
windows, Calling mkdir on only the drive letter or on the extended path
prefix (\?\\) will result in an error. Start after the long path prefix
and the drive letter.
This also changes AAPT2 to use AssetMaanager2 to retrieve symbols from
the symbol table. AssetManager2's zip library uses _wopen to open
windows files.
Bug:123251200
Test: aapt2_tests.exe
Change-Id: I26169d83b22d441485de3c49d63a6c4ed710e292
* Add explicit to conversion constructors/operators
* Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters
Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: Ie02101ea7c422e8add535c111a30a2f21ead0ace
Raw attribute values are not included in xml files when building binary
APKs but they are when building proto APKs. Remove raw attribute values
and create a new convert flag that (--keep-raw-values) that allows raw
value to be kept.
Also added flag to link to keep raw attribute values.
Bug: 115915884
Bug: 116700688
Test: aapt2_tests
Change-Id: Id50136b775b3f43d159ca06181282f6a7b8eaf40
Some tests were not written to run on Windows correctly. Compile also
has a bug that caused using the --zip flag to fail on Windows.
iswspace does count the non breaking space as Whiespace on Windows but
not on Unix based systems
Bug: 117156986
Change-Id: I999375162bdfdf86fb25992ee88e2962ab90b577
Test: aapt2_tests and wine aapt2_tests.exe
Since ResStringPools are encoded using Modified UTF-8, retrieving
strings from the string pool convert the strings to UTF-8 before
returning.
Bug: 114734350
Test: m aapt2_tests
Change-Id: Ib459018186f4c5b40f3f3786425a335ecfb9ed02
When attempting to create directories on different drives, AAPT2 would
fail because it would attempt to call _wmkdir on the drive
(eg. _wmkdir("D:\")). Split on directories after the drive letter
instead.
Bug: 68936311
Test: manual testing using Android Studio
Change-Id: Iad47f466af6f82d4ac402e9bf52853edaa9a5e0b
Added a --zip flag similar to --dir that allows resources to be passed
into "aapt2 compile" using a zip file.
Also refactored Compile.cpp to be easier to mock and test in the future.
Bug: 74574557
Test: aapt2_tests
Change-Id: Idb90cb97e23a219525bdead38220cbf7bc6f3cab
Codepoints that are encoded to 4 bytes in UTF-8 are not allowed in
Modified UTF-8. They instead should be encoded as surrogate pairs in the
same way that CESU-8 allows for surrogate pairs. This will also cause 4
byte UTF-8 codes to be represented in 6 bytes.
Bug: 37140916
Test: aapt2_tests
Change-Id: I155dc24f166139d1d36a16bac088dcfcd59eb321
Change styled string whitespace processing to be like AAPT's was.
Main changes:
- whitespace around tags is preserved.
- tags start exactly where they are supposed to, not off by one.
Bug: 72406283
Test: make aapt2_tests
Change-Id: I4d12728c493efd8c978e2e3d2718b56534ff52ef
Android package names are more strict (ASCII only) than Java package names.
Also fixed an issue where trailing underscores were disallowed in Android
package names.
Bug: 68468089
Test: make aapt2_tests
Change-Id: I1052e9e82b6617db6065ce448d9bf7972bb68d59
Gradle and other build tools that need to frequently interact with aapt2
can use the daemon mode to issue regular CLI commands without paying
the process start cost for each invocation.
Test: manual
Change-Id: I543858ed46496278bad643f0dae688c924ec6c3f
Once switched to using std::string, the mkdirs implementation was
trying to create an empty string when an absolute file path on
linux or macOS was used.
Bug: 62336414
Test: manual
Change-Id: I52f3050b410a923ca48f353b0983667c16d00ee8
Mingw64 was being difficult, so instead of defining a wmain entrypoint,
the command line parameters are parsed manually using built-in Windows
methods that support Unicode. The results are converted to UTF8 and
handled just like the rest of the linux/mac version of the code.
This also removes dependencies on std::istream in favour of a
FileInputStream which calls the appropriate unicode version of
open to read a file.
No speed regressions found on Linux or MacOS.
Bug: 62336414
Bug: 63830502
Test: manual
Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.
Bug: 30407689
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Iaa0a6f18f64cf573bee49dd1466281ea4d37b410
Move the styled strings to a separate section of the StringPool so
that sorting can never mess up the order of Styles.
Bug: 63570514
Test: make aapt2_tests
Change-Id: Id2ce1355b92be1bb31ce0daa7e54ae9b5b6c2ffe
When processing attributes in XML, quotes can't be used to mark a
section as whitespace preserving, so the assumption should be that the
entire string is whitespace preserving, which makes quote characters
literals.
Bug: 62840718
Bug: 62840406
Test: make aapt2_tests
Change-Id: I4afff02148b5b8e78833abf1f323c2f5325d6155
Iterating over a UTF-8 string by codepoints ensures that
unicode characters do not get sliced. Otherwise the resulting
string could contain malformed characters.
Bug: 62839202
Test: make aapt2_tests
Change-Id: Ia0c44fbceb7dcfa11e77a1a77011da0f5466e342
Auto version adaptive-icon XML to v26.
This change makes the logic for generating versioned resources
simpler by changing the comparison function of ResTable_config
to evaluate the sdkVersion property last, making configurations
that differ only in sdkVersion next to each other in a sorted vector.
Bug: 62316340
Test: manual (verified output of tools/aapt2/integration-tests/AppOne)
Change-Id: I977d45821722a65d2135efb4693304eacc565c9a
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
%n is a special value marking a platform independent newline and is
not to be considered a format argument.
Bug: 37132275
Test: make aapt2_tests
Change-Id: I806521e44afe20004344dee9f18ecee6cc7086ea
This change defines some hardcoded rules to degrade
attributes in newer SDKs to specific older attributes.
An attribute with a degrade rule will generate a new XML for the API
in which the attribute resulting from the degradation was introduced.
Since API 22 (Lollipop MR1), attributes are correctly ignored and do
not need to be versioned. In XML files defined for APIs 22+, the
original and degraded attributes coexist in the same XML file.
One such example is paddingHorizontal, introduced in API 26.
paddingHorizontal degrades to paddingLeft and paddingRight, which
were both introduced in API 1.
Bug: 35763493
Test: make aapt2_tests
Change-Id: I4aa8755a9ee2c0cc5afdc55c3d30093fd3a47f3d
Generating splits should be possible to do from the optimize command.
This means that a lot of infrastructure around split APKs can be
shared by both the optimize and link phase.
Bug: 35925830
Change-Id: Ia88b9e4bff300a56353b2f7a4a2547c8eb43a299
Test: manual
Looks like the build system doesn't support assets/ for
resources, so we will re-introduce them in aapt2, even though
we're just copying them around and they would be better
suited for inclusion in the APK when classes.dex gets inserted.
Bug: 35461578
Test: CTS test android.content.res.cts.AssetManager#testAssetOperations should pass
Change-Id: I18361d7367d476806bcf7154ee76df3f0e83b565