• Home
  • History
  • Annotate
  • only in /frameworks/base/tools/aapt2/util/
History log of /frameworks/base/tools/aapt2/util/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
2354b568379fe31ba4e774f7a92d4c685a60a2ab 27-May-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Follow symlinks when compiling

Bug: 62144459
Test: make AaptSymlinkTest
Change-Id: Idb3ab1ece17c52bb4fd174ec4c08a9e173289e55
iles.cpp
c744ae8aca97edfb2422598ea620e8219449fa9b 18-May-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Implement attribute compat versioning

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
til.h
d0f492db038c6210c1138865d816bfb134376538 04-Apr-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Share split functionality between link and optimize

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
til.h
b39ad7c9f66877f92ea8583aa8b7b5a8daa6031e 13-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Add -A (assets) support

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
iles.cpp
iles.h
ac6edc501b61e14e3b70ccbbd4d8ed112d92b96c 03-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix escaping sequence processing in XML parsing

Bug: 35483813
Test: make aapt2_tests
Change-Id: I68baba17ab3639c220b734a2a68d86aad0dedf8c
til.h
c8f71aa67ea599cb80205496cb67e9e7a121299c 08-Feb-2017 Adam Lesinski <adamlesinski@google.com> Add ResTable_sparseTypeEntry support

Benchmarks on bullhead-userdebug show that there is a negligent
performance impact when using sparse entries on a 30% loaded
sparse type of 1000 resources.

Benchmark Time CPU Iterations
-----------------------------------------------------------------------------------
BM_SparseEntryGetResourceSparseLarge 255 ns 254 ns 2751408
BM_SparseEntryGetResourceNotSparseLarge 254 ns 254 ns 2756534

Bug: 27381711
Test: make libandroidfw_tests aapt2_tests
Change-Id: I051ea22f2f6b2bc3696e446adc9e2a34be18009f
igBuffer.cpp
igBuffer.h
d5083f6f6b9bc76bbe64052bcec639eee752a321 17-Jan-2017 Adam Lesinski <adamlesinski@google.com> Move StringPiece to libandroidfw

libandroidfw needs to make use of StringPiece, so
move it to libandroidfw and update all code referencing
StringPiece in aapt2.

Test: make libandroidfw_tests libaapt2_tests
Change-Id: I68d7f0fc7c651b048d9d1f5e7971f10ef5349fa1
iles.cpp
iles.h
tringPiece.h
tringPiece_test.cpp
til.cpp
til.h
til_test.cpp
ce5e56e243d262a9b65459c3bd0bb9eaadd40628 22-Oct-2016 Adam Lesinski <adamlesinski@google.com> 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
igBuffer.cpp
igBuffer.h
igBuffer_test.cpp
iles.cpp
iles.h
iles_test.cpp
mmutableMap.h
aybe.h
aybe_test.cpp
tringPiece.h
tringPiece_test.cpp
til.cpp
til.h
til_test.cpp
092db3c88ae5f2ba1b34516666c2b87ed7404965 20-Oct-2016 George Burgess IV <gbiv@google.com> Merge "Fix a static-analyzer warning." am: 63b4f6f5db am: ea4423b181
am: 281e9f30c0

Change-Id: If34a4265ceb5bc6f4bf31c35e82270f90e970457
cacb28f2d60858106e2819cc7d95a65e8bda890b 19-Oct-2016 Adam Lesinski <adamlesinski@google.com> Use Google3 style guide with .clang-format

Test: style change only, builds ok
Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
igBuffer.h
iles.h
mmutableMap.h
aybe.h
tringPiece.h
ypeTraits.h
til.h
56f5f7b79bca91d6b241d35be0f4bf56155cf855 12-Oct-2016 George Burgess IV <gbiv@google.com> Fix a static-analyzer warning.

frameworks/base/tools/aapt2/util/Files.cpp:81:21: warning: Null pointer
passed as an argument to a 'nonnull' parameter
while ((entry = readdir(dir))) {

Bug: None.
Test: Warning no longer appears.
Change-Id: If242598405e995928378ce317a2e909654e1e985
iles.cpp
21efb6827cede06c2ab708de6cdb64d052dddcce 15-Sep-2016 Adam Lesinski <adamlesinski@google.com> 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
igBuffer.cpp
igBuffer.h
tringPiece.h
8c3f31f022f7e094fd227ef0c2987e0846cb3e43 07-Sep-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix issue with styled string indices

Styled strings use spans to denote which part
is styled (<b>, <i>, etc). Spans are simply a range
of indices into the original string.

In Java, we use String and its internal representation, meaning
we must encode the indices using UTF16 lengths.

When the internal AAPT2 representation of strings switched to UTF8,
the indices also began to index into the UTF8 string.

This change reverts the indices to use UTF16 lengths.

Bug:31170115
Change-Id: I07b8b5b67d2542c7e0a855b601cdbd3ac4ebffb0
til.cpp
til.h
d90d8d615a99ad9f75e2911e98a166b396a89053 28-Jun-2016 Sergio Giro <sgiro@google.com> Add bound checks to utf16_to_utf8

Test: ran libaapt2_tests64
Bug: 29250543
Change-Id: I1ebc017af623b6514cf0c493e8cd8e1d59ea26c3
(cherry picked from commit 4781057e78f63e0e99af109cebf3b6a78f4bfbb6)
til.cpp
8f7b8a1f6c5808ea205bfb3294a313e2bcaedf7f 21-Jul-2016 Sergio Giro <sgiro@google.com> Unicode: specify destination length in utf8_to_utf16 methods

Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
til.cpp
e42bc0587f82b42c466c1fc6baefc7113021fc4f 15-Aug-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Fix clang-tidy warnings in aapt and aapt2."
470f8fcb5c0c59b28b5f73ee011a797b05085da7 15-Aug-2016 Chih-Hung Hsieh <chh@google.com> Fix clang-tidy warnings in aapt and aapt2.

* Add explicit keyword to conversion constructors.
* Add NOLINT(implicit) comments for implicit conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
* Add NOLINT to suppress wrong clang-tidy warnings on macros.
Test: build with WITH_TIDY=1

Change-Id: Ibfafb23d9be463b4072745a51a6d9f1812dcac45
igBuffer.h
iles.h
aybe.h
tringPiece.h
til.h
36c73a595910e96f3552f938eeb81d46356067a1 11-Aug-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Expose split support to command line

Bug:30445078
Change-Id: If4b8530dba71b9059b8e62c04757da99c1119d22
til.h
03b95c7df5fb577fa6e4c133dcdbc85c880d86b4 21-Jul-2016 Sergio Giro <sgiro@google.com> Unicode: specify destination length in utf8_to_utf16 methods

Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
til.cpp
d0f116b619feede0cfdb647157ce5ab4d50a1c46 09-Jul-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Remove usage of u16string

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
iles.cpp
tringPiece_test.cpp
til.cpp
til.h
til_test.cpp
fb5cfc3543e7905476f3602b854f8458d7927422 12-Jul-2016 Sergio Giro <sgiro@google.com> Merge \\"Add bound checks to utf16_to_utf8\\" into nyc-mr1-dev am: 49c410bc48
am: daad138428

Change-Id: I5a660dccb76e823736a59e50904a7279a97ef849
71965e898ecb2d53972a98e63b3e3fdbe96542dc 08-Jul-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix fully qualified java class verification

Proguard rules would be ignored for components defined
in AndroidManifest.xml for android:name attributes if
they didn't start with '.'.

Change-Id: I029b5a2f224f4daf155b73a2a4dcd940dd43372e
til.cpp
til_test.cpp
4781057e78f63e0e99af109cebf3b6a78f4bfbb6 28-Jun-2016 Sergio Giro <sgiro@google.com> Add bound checks to utf16_to_utf8

Test: ran libaapt2_tests64
Bug: 29250543
Change-Id: I1ebc017af623b6514cf0c493e8cd8e1d59ea26c3
til.cpp
5e8fa3a24835a1ad39f758f630a61c83133eabf8 28-Jun-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Improve diff command

Change-Id: Ia1e2f8482c7192ef50126b61bed7975297332767
aybe.h
32852a575bbd79caaabb701cf5b76571516bb6c5 15-Jun-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Use hash map for StringPool indices

Hash map has better locality and average case performance

Change-Id: Ic2d111c3cff1d5c0e7e9cbe36714669e6508c275
tringPiece.h
feaf99fa1b7563f15dbd4211718a6cfb7a3cc3c8 06-May-2016 Michael Wright <michaelwr@google.com> Stop emitting javadoc for @removed attributes.

We need the attributes to remain public because people might still be
linking against them, but we don't want them showing up in the
documentation any more. Them showing up in the documentation also had
the side effect that it would accidentally mark the parent class of
attributes as @removed, which was not intended.

Bug: 28663748

Change-Id: I2f6eb09455fddf1086e6b24bc3bea5292e8e32b7
tringPiece.h
tringPiece_test.cpp
c51562cf5acda7849a34c4ae2a88077c068859c0 28-Apr-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Accept a file with arguments when argument list is too long

Bug:22775504
Change-Id: Ife73d4e4611016c9ee7b56264bc6a765c54beba3
iles.cpp
iles.h
803c7c807969bea1f1c50f348832f5b60ad05d8e 07-Apr-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Enable windows build and make sure it builds

Mingw32 4.8 is kind of picky with macros and some complicated template
stuff. Luckily there was another way to represent the
SFINAE code that works on all platforms. Yay!

Change-Id: Idc2e38f47bfdc57b394550bfa0f53cc0b825df25
iles.cpp
aybe.h
96917c25f09bb2f33e22f20cdfa4ece8f310b084 09-Mar-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix file::mkdirs when given absolute paths

file::mkdirs would try to extract the first part of the
path '/path' which would be the empty string ''. Mkdir would
fail creating the empty string directory.

Change-Id: Ice8ba92135f145f52f3663499a2c49eebe797328
iles.cpp
iles.h
iles_test.cpp
e4bb9eb5af5b0899dc0921d5580220b20e15bd5a 13-Feb-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Introduce notion of 'product' to ResourceTable

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
omparators.h
52364f7ae31716d7827ea8f8566f4a28bd30a921 11-Jan-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Variety of small fixes to get the build working

- Add option to rename package in AndroidManifest.xml
- Support default versionName and versionCode
- Accept True and False as valid booleans

Change-Id: I400e350b9dcd0fd1c197d1929144299c7823617d
iles.cpp
til.cpp
til_test.cpp
7ff3ee19f4b831a526baf4b928d1ac172d070d82 15-Dec-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Respect format attribute of <item> tag

An <item> is a general tag that can override certain behavior. For
instance, this is allowed:

<item name="foo" type="integer" format="float">0.4</item>

Even though without the format attribute, this would be illegal.

Change-Id: I8133ce59e14719a70d7476a1464c3f564c435289
mmutableMap.h
ypeTraits.h
a6fe345be955368a13aea76aefb4db821aad11df 10-Dec-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix overlay support

Supports the <add-resource> tag and mimics old AAPT behavior of
not allowing new resources defined unless <add-resource> was used
or --auto-add-overlay was specified.

Change-Id: I9b461137357617ade37fd7045b418b8e6450b9c4
aybe.h
aybe_test.cpp
28cacf091ad2b1c2749e77f590e9523e58735252 23-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Record source/comments for compound values' children

Values like styles or arrays have children which need to have
their source and comments preserved.

Change-Id: I6fc713ba36627e6d66c7930b4080cc1403bac207
til.h
a587065721053ad54e34f484868142407d59512d 21-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Verify min/max attr fields

Integers are now checked to see if they fall in the range
of min/max for the attribute they are assigned.

Change-Id: I42c435b15fd3f0bd23691c83efccce4ad5973276
aybe.h
aybe_test.cpp
467f171315f9c2037fcd3eb5edcfabc40671bf7b 17-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fail compiling when private symbols are referenced

Also moved some XML specific stuff into its own directory,
and refactored ReferenceLinker a bit.

Change-Id: I912247a82023c1bbf72dc191fbdaf62858cbec0c
til.cpp
til.h
cf95a580149ec03588b1c75f036c924730f83615 17-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix tokenizer to deal with the separator as last char

When the separator was the last character, the tokenizer would skip
the empty string, which is wrong.

Change-Id: I64ceb4e8d4ac48ee41d40781ab5785a3bc61b24d
til.h
til_test.cpp
b274e35abfbbd09e0fce983a215c11522c56cce2 07-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix inclusion of comments in R.java javadoc

Comments weren't being copied when merged from the various
resource tables.

Also refactored the JavaClassGenerator to omit a class
if no entries exist for it.

Change-Id: I6eaa89b7b3715bc05403635a2baf0d1db3efd142
omparators.h
b23f1e077b02a1d62bcf5e34655e8dc979e124fa 03-Nov-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Verify positional Java String format arguments in strings

Change-Id: Id415969035a0d5712857c0e11e140155566a960c
til.cpp
til.h
til_test.cpp
3b4cd94034ff3e5567a2ba6da35d640ff61db4b9 31-Oct-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Add support for comments in R.java

Change-Id: Iaa5f3b75bf7de9dbf458fa5c452f7312989f4c4f
til.cpp
til.h
ca5638fd85098c3d0a699492751043545f75553a 21-Oct-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Support generating Manifest.java

This includes comments from AndroidManifest.xml.

Change-Id: I412d9ecb12bad20a49a683d6b3bea4a0be1235ae
tringPiece.h
e78fd617ec60139a973a01925fa7adad31febb39 22-Oct-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Move comments and source into Value

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
omparators.h
1ab598f46c3ff520a67f9d80194847741f3467ab 14-Aug-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Separate out the various steps

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
igBuffer.cpp
igBuffer.h
igBuffer_test.cpp
iles.cpp
iles.h
aybe.h
aybe_test.cpp
tringPiece.h
tringPiece_test.cpp
til.cpp
til.h
til_test.cpp