ResourcePathShortener appends one digit at the end of colliding short
file names to disambiguate them. This cl sorts the list of file paths so
that colliding files always get the same disambiguating digit from one
run to the next rather than possibly alternating.
Test: make aapt2_tests
Change-Id: I983a1448c21f2c79d7cdb1de232e7758c04fc256
It does not make sense for aapt2 to calculate the optimal number of
chars in the shortened path when it only depends on the number of
resources rather than anything apk specific. This cl precalculates the
number of chars and uses if conditions instead.
Test: manual testing + aapt2_tests still passes.
Change-Id: If2dc86952a6b6e01ce02dc42754c037d07d57325
aapt2 optimize --enable-resource-path-shortening should ignore res/color
resources since android uses the path while loading them. This cl fixes
a bug where res/color-* (eg: res/color-v21) resource paths are shortened
when they should not be.
Test: make aapt2_tests
Bug: b/75965637
Change-Id: Ibbc3fe4d2e6bd4f31765a5aa85980907dc013ecd
Android resource loader uses the file path to check if a resource is a
ColorStateList. Path shortening removed that part of the path and thus
broke the resource loader of APKs optimized with path shortening. This
cl skips path shortening for resources under "res/color/"
Test: make aapt2_tests
Bug: b/75965637
Change-Id: If94dfa398efd81522d4faed157afd35f6dabe856
This CL allows aapt2 to obfuscate resource paths within the output apk
and move resources to shorter obfuscated paths. This reduces apk size
when there is a large number of resources since the path metadata exists
in 4 places in the apk.
This CL adds two arguments to aapt2, one to enable resource path
obfuscation and one to point to a path to output the path map to (for
later debugging).
Test: make aapt2_tests
Bug: b/75965637
Change-Id: I9cacafe1d17800d673566b2d61b0b88f3fb8d60c