7 Commits

Author SHA1 Message Date
Fabien Sanglard
2d34e76dac Add --trace_folder to aapt2
Add a tracing API and instrument key functions in order to profile
aapt2 bottleneck. The API allows to generate systrace fragment files.

Impact on performance is neglibible with each Trace requiring less
than 1us and the final Flush operation at the end of a command
requiring around 40us.

Bug: None
Test: None
Change-Id: I51b564d3694e9384679f43b878b32295527dddf6
2019-03-05 15:09:27 -08:00
Adam Lesinski
60d9c2fd55 AAPT2: improve some error messages
Test: manual
Change-Id: I11c96f8c825ffd43b7f68cb24f2c0746d75845f5
2017-05-23 19:57:33 +00:00
Adam Lesinski
cc73e990e5 AAPT2: Ignore trailing data after IEND chunk in PNG
libpng seems to do the same, so our chunk filter should not care what
comes after.

Bug: 38169876
Test: manual
Change-Id: I020ddfe29ac3eb4d5ef9ace5611c6f6497de443d
2017-05-15 13:07:32 -07:00
Adam Lesinski
06460ef0d7 AAPT2: Fix up file IO
This also enables an AAPT behavior that CTS tests have
come to depend on.

Small files that compress negatively (get larger) are stored
uncompressed. Some CTS tests assume this and try to open these
files by mmapping them, which is only possible if they are
uncompressed.

Bug: 35461578
Test: make aapt2_tests
Change-Id: Id622a6150fe72477ad65d67d1bad897a8ee2ffb9
2017-03-20 16:53:46 -07:00
Adam Lesinski
ce5e56e243 AAPT2: Rename to match new style
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-26 19:30:23 -07:00
Adam Lesinski
cacb28f2d6 Use Google3 style guide with .clang-format
Test: style change only, builds ok
Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
2016-10-19 12:18:14 -07:00
Adam Lesinski
21efb6827c AAPT2: Refactor PngCrunching
PngCrunching now has a slightly better heuristic of choosing to encode
an image as a palette or RGB. For small images, RGB compresses much better
than a palette.

The original PNG is used as-is (minus some optional chunks being stripped)
if the resulting crunched PNG is larger than the original.

9-patch handling is abstracted away from PNGs, paving the way
for other 9-patches, like WebP.

TODO: handle PNGs with 9-patch chunks already present, which
should just be passed through. This will allow for 3rd party
tools to generate 9-patches.

TODO: implement cheap transparency: when one color is used to represent
transparent, and all other colors are opaque.

Bug:30053276
Change-Id: I5167f53b91d1efa462d9f03d6b9108d9b541c0c1
2016-09-29 15:28:52 -07:00