History log of /frameworks/base/tools/aapt2/ResourceValues.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
325129964e5b0a9794cf5bb63a2d2d8774ea6a1b 26-Apr-2018 Todd Kennedy <toddke@google.com> Allow using reserved package IDs

Pre-O, the platform treats negative resource IDs [those with
a package ID of 0x80 or higher] as invalid. In order to work
around this limitation, we allow the use of traditionally
reserved resource IDs [those between 0x02 and 0x7E].

Bug: 78041707
Test: ./out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests
Test: ./out/host/linux-x86/nativetest/libandroidfw_tests/libandroidfw_tests
Test: Manual. Create a feature split with a package ID of 0x7E and see it runs and can reference base resources.

Change-Id: I3d9782cc05d3a55e1a2467bf39566788847e1160
/frameworks/base/tools/aapt2/ResourceValues.cpp
a65bbdf43c2c29222e4067e97cc1ec1137fea516 15-Feb-2018 Adam Lesinski <adamlesinski@google.com> AAPT2: Ensure output formats of files are correctly set

When compiling straight to proto from source, the file types
were not set correctly (binary XML or proto XML).

Bug: 73406447
Test: manual
Change-Id: I68c1881a00a2ec1ad58f7ec485af2543d262d076
/frameworks/base/tools/aapt2/ResourceValues.cpp
73bff1e8519bb73f17a801f45977d41b69b5b0d0 09-Dec-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Allow compatible duplicate Attributes

If a resource XML file defines two compatible Attributes, they should
be merged without throwing an error. Ex:

<declare-styleable>
<attr name="conflict" format="string" />
</declare-styleable>

<declare-styleable>
<attr name="conflict" format="string|reference" />
</declare-styleable>

In this case, string|reference and string are the same, so these should
merge correctly.

Bug: 65699599
Test: make aapt2_tests
Test: make AaptBasicTest
Change-Id: I7b0f956d2332f7f0b458acd59ca0a606b2cfdf95
/frameworks/base/tools/aapt2/ResourceValues.cpp
490595a5fc1c3618dbbc2da5d421d10c025fabac 08-Nov-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Workaround for feature splits without namespacing

Android Instant Apps in its current iteration does not use namespaces,
but due to limitations on the Android resource runtime, needs to make
it look like it does.

This is due to a bug that treats any package ID that's not 0x01 or 0x7F
as a shared library. Shared libraries require unique package names.

As a workaround, and since Android Instant Apps can not have a feature
depend on another feature, we can alter the resource package name of a
feature split just before writing it out to disk. This avoids using a
unique package name while linking, thereby avoiding namespace issues.

Bug: 68820737
Test: manual
Change-Id: Ic553ed42656436bbb949393d0248ee7bb9d37860
/frameworks/base/tools/aapt2/ResourceValues.cpp
93190b79d11d874199cfe7258526a48cfc8399fc 03-Nov-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Better debugging output

Test: make aapt2_tests
Change-Id: I7778b773201381538dc1f2e376abee4eb33e44c0
/frameworks/base/tools/aapt2/ResourceValues.cpp
7fd74b5ad1df53b92f08a9aa2f3d445bf7b786fe 20-Oct-2017 Adam Lesinski <adamlesinski@google.com> Merge changes I1a4b3ce5,Id7216e5b

* changes:
AAPT2: Enable building proto artifacts
AAPT2: Define and Implement AAPT Container Format
c2e67f4b5ca13a847689a6b36fc40efa9c0c5301 20-Oct-2017 Adam Lesinski <adamlesinski@google.com> Merge "AAPT2: Ensure strings are sorted by configuration" into oc-mr1-dev am: 8da74b1bfd
am: 5fae742a1e

Change-Id: I7dfb1a020b1c3da9e0af5a7096fda0775751eab3
004511660671511ae88e0e837a6f92db28eadaef 03-Oct-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Define and Implement AAPT Container Format

AAPT Container Format (.apc) is a simple container that
enumerates the various intermediate files that AAPT2 generates
during the compile phase.

The format is defined in formats.md.

For now, continue using the .flat extension for the container file,
and keep making use of the .flata zip for storing multiple files.
This will allow easier integration with existing build systems and allow
the evolution of the APC format to better handle arbitrarily large
files.

Test: make aapt2_tests
Change-Id: Id7216e5b76316bdd683f0fa4eaf2d2da273ba815
/frameworks/base/tools/aapt2/ResourceValues.cpp
8a0b238b1344dae0042bbb17b71c0c3b9b881f22 19-Oct-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Ensure strings are sorted by configuration

Keep strings sorted by configuration so that strings likely
to be selected (all match the same locale, for instance) are
close together.

Bug: 67958501
Test: make aapt2_tests
Change-Id: Id17d93bf2e03ce408a6f619d3ea6dc313e393b76
/frameworks/base/tools/aapt2/ResourceValues.cpp
d3ffa844f5a07756009f019e13806e253d1bb119 28-Sep-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Cleanup Visitors for XML and Values

Test: make aapt2_tests
Change-Id: Ib61f64c155a380115610edeaf2d65e60258a2426
/frameworks/base/tools/aapt2/ResourceValues.cpp
b791721cd1a6154e5582d824f5d20b2c8b8d5ac5 11-Aug-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Define intermediate compiled XML proto

This proto format is meant to encapsulate more information
that is specific to Android and allows for easier validation
and manipulation across tools.

Test: make aapt2_tests
Bug: 65645766
Change-Id: I13bc34a460671fc0a36246be0d287a3d37d244d6
Merged-In: I13bc34a460671fc0a36246be0d287a3d37d244d6
/frameworks/base/tools/aapt2/ResourceValues.cpp
4ffea040641d3b74ab04b6d2d3e78280bc893d5f 11-Aug-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Define intermediate compiled XML proto

This proto format is meant to encapsulate more information
that is specific to Android and allows for easier validation
and manipulation across tools.

Test: make aapt2_tests
Change-Id: I13bc34a460671fc0a36246be0d287a3d37d244d6
/frameworks/base/tools/aapt2/ResourceValues.cpp
5b6ee115489ce93dafce57d7f5ac33564cd6ef52 29-Jul-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Ensure style strings are always first in StringPool

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
/frameworks/base/tools/aapt2/ResourceValues.cpp
060b53d0287f9e685fb5b49b52a864ef85315a22 29-Jul-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Ensure style strings are always first in StringPool

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
/frameworks/base/tools/aapt2/ResourceValues.cpp
3124e7ca0f582c8d54a9b4cf560c25dfef77ac2a 14-Jun-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix issue with enums and integer attributes

When an attribute had the format "enum|integer", and a max or min
allowed value set, any value set for this attribute would have its
enum symbol's value checked against the valid integer range.

This would lead to the following:

android:numColumns="autofit"

being interpreted as an integer value of -1, which violated the minimum
expected value for numColumns, which was 0.

Bug: 62358540
Test: make aapt2_tests
Change-Id: I3150410448a533d3595a08ac6b2966264db874d8
/frameworks/base/tools/aapt2/ResourceValues.cpp
bab4ef56d7803f3a50ccfaca2729509338fcbb23 02-Jun-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Allow undefined resources (placeholders)

A resource defined like so:

<item type="drawable" name="foo" />

should be assigned the value @null.

The only exception is for <string> resources, which are given the
empty string value (since <string></string> is ambiguous). The decision
to use "" is based off the fact that old AAPT used to assign "" to all
undefined resources, even non-string ones.

Bug: 38425050
Test: make aapt2_tests
Change-Id: Ib3e0f6f83d16ddd8b279c9fd44a07a37867b85e9
/frameworks/base/tools/aapt2/ResourceValues.cpp
5924d8c9ab7bd8614e8bd99864903ce9d50f3bf7 31-May-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Allow merging of Style attributes from overlays

Previously style overlays would completely override an existing style.
To be compatible with AAPT, styles now merge with the overlay, allowing
the overlay's attributes and parent to take precedence.

Bug: 38355988
Test: make aapt2_tests
Change-Id: Id25c7240050a43e6a4a177c6e3d51e048d0cceb5
/frameworks/base/tools/aapt2/ResourceValues.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
/frameworks/base/tools/aapt2/ResourceValues.cpp
8f7c550e20a6edbc9af7bb48675afaf8bcb3783f 03-Mar-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix Plural::Equals() method

Test: make aapt2_tests
Bug: 35902437
Change-Id: I8797f89af58876f891f0b0c5cce85fd7781c4e24
/frameworks/base/tools/aapt2/ResourceValues.cpp
b5dc4bd49a036e3403ca17e961d2c8e13e038295 23-Feb-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Few tweaks to get shared-libraries working

Test: manual (building shared support library demo)
Change-Id: I4730645aa92ba1893baf67ffe35fbd4aac0f8e46
/frameworks/base/tools/aapt2/ResourceValues.cpp
7542162cb1b1fd2ce8a26dd7f3fedc8de8160d38 07-Jan-2017 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix pseudolocalization to respect <xliff:g>

The XLIFF 'g' tag specifies content that should NOT be translated.
AAPT2's pseudolocalization process should respect it.

Bug:34064599
Test: make libandroidfw_tests
Change-Id: Ice437d7f0ff246730ee04896fd035e2d846148fb
/frameworks/base/tools/aapt2/ResourceValues.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
/frameworks/base/tools/aapt2/ResourceValues.cpp
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
/frameworks/base/tools/aapt2/ResourceValues.cpp
5c3464c75fc517c0306a4ffd39c59671ccfde544 25-Aug-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix merging of styleables the right way

Styleables should only be merged when processing overlays.
This moves the styleable merging code out of ResourceTable
and into TableMerger.

Change-Id: I3aae05cf4dd875cd25ac2ac744b61194409b2fee
/frameworks/base/tools/aapt2/ResourceValues.cpp
8197cc460e02c6445434eace435e3d38ebe475c6 19-Aug-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Merge Styleables instead of overriding them

Styleables merge in AAPT. Preserve this behavior.

Bug:30970091
Change-Id: Ie68ca675aeecd873c0648682182e2fc574e329a0
/frameworks/base/tools/aapt2/ResourceValues.cpp
36c73a595910e96f3552f938eeb81d46356067a1 11-Aug-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Expose split support to command line

Bug:30445078
Change-Id: If4b8530dba71b9059b8e62c04757da99c1119d22
/frameworks/base/tools/aapt2/ResourceValues.cpp
5e8fa3a24835a1ad39f758f630a61c83133eabf8 28-Jun-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Improve diff command

Change-Id: Ia1e2f8482c7192ef50126b61bed7975297332767
/frameworks/base/tools/aapt2/ResourceValues.cpp
458b877488c12ea4336d8fc00a95d9c0298bd6d0 25-Apr-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Add diff command

Adds the diff command and various small fixes to issues
discovered when diffing old AAPT built APKs with new AAPT2
built APKS.

Bug:22775504
Change-Id: I682a7fe1cf4b3efa7cbd5d18b333cf2d1046fe1b
/frameworks/base/tools/aapt2/ResourceValues.cpp
355f285ffd000f6cfe76680eb22d010546d124bb 14-Feb-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Implement density stripping and initial Split support

When a preferred density is supplied, the closest matching densities
will be selected, the rest stripped from the APK.

Split support will be enabled in a later CL. Command line support is still
needed, but the foundation is ready.

Bug:25958912
Change-Id: I56d599806b4ec4ffa24e17aad48d47130ca05c08
/frameworks/base/tools/aapt2/ResourceValues.cpp
59e04c6f92da584b322c87072f18e6cab4de4c60 05-Feb-2016 Adam Lesinski <adamlesinski@google.com> AAPT2: Switch to protobuf for intermediate format

Without needing to conform to the runtime data format,
it is much easier to add new features such as debugging symbols
and carrying over product data to link time.

This also simplifies the runtime format parser and serializer,
which will change much less frequently than the protobuf intermediate
format.

Change-Id: I209787bbf087db0a58a534cb8511c51d21133e00
/frameworks/base/tools/aapt2/ResourceValues.cpp
393b5f0d6130d3848dd82075986a5cf40c09ce44 17-Dec-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Port AAPT pseudolocalization to AAPT2

Pseudolocalization happens at the compile phase. Pseudolocalized
values are weak, such that manually specified values will take precedence.

Change-Id: I5e064ce0d270c9f4f9022f75aecedab9d45bc980
/frameworks/base/tools/aapt2/ResourceValues.cpp
24b8ff0faf7c59323d0171cdd825ca09e712aa1e 16-Dec-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Fix references to private parent

Change-Id: Id4697551b6c8cb6167f562de593006ae3c6158c0
/frameworks/base/tools/aapt2/ResourceValues.cpp
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
/frameworks/base/tools/aapt2/ResourceValues.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
/frameworks/base/tools/aapt2/ResourceValues.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
/frameworks/base/tools/aapt2/ResourceValues.cpp
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
/frameworks/base/tools/aapt2/ResourceValues.cpp
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
/frameworks/base/tools/aapt2/ResourceValues.cpp
bdaa092a193d8ddccbd9ad8434be97878e6ded59 09-May-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: inferred style parent processing

Change-Id: I8fbc4feef16b6039cf4c526fcfb767dc75a9c131
/frameworks/base/tools/aapt2/ResourceValues.cpp
330edcdf1316ed599fe0eb16a64330821fd92f18 05-May-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Support static lib referencing static lib

When a static library A references static library B,
and app C references both A and B, we get the following symbol merging,
symbols from library B get imported twice.

We must only check that symbol references to library B are valid
when building library A. We should only merge all the symbols
when building final app C.

Change-Id: I23cba33b0901dcbb5328d9c9dfaa6a979c073c36
/frameworks/base/tools/aapt2/ResourceValues.cpp
6ff19664f9279023c96e5a65c3059e1ef4beac0f 01-May-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Record public status in a more robust way

This allows us to store the source and comments of a resource's
public declaration and avoids issues where there is no default
configuration for a publicly declared resource (like with drawables
of various densities) and AAPT2 mistakenly took this as an error.

Change-Id: I07a2fe9f551daefcce842f205fb219d2fa453ebc
/frameworks/base/tools/aapt2/ResourceValues.cpp
769de98f2dd41bfe39a1c9f76aefd1ad58942733 11-Apr-2015 Adam Lesinski <adamlesinski@google.com> AAPT2: Add library support

Change-Id: I307f56d9631784ab29ee4156d94886f9b2f25b30
/frameworks/base/tools/aapt2/ResourceValues.cpp
6f6ceb7e1456698b1f33e04536bfb3227f9fcfcb 14-Nov-2014 Adam Lesinski <adamlesinski@google.com> AAPT2

First checking of AAPT2. The individual phases of AAPT2 work, but there
are some missing pieces.

For early testing we are missing:
- Need to properly mark file references and include them in package
- Need to package into zip

Final AAPT for apps we are missing:
- Need to crush PNGs
- Need to parse 9-patches
- Need to validate all of AndroidManifest.xml
- Need to write align method to align resource tables for splits.

Final AAPT for apps + system we are missing:
- Need to handle overlays
- Need to store comments for R file
- Need to handle --shared-lib (dynamic references too).

New AAPT features coming:
- Need to import compiled libraries
- Name mangling
- R file generation for library code

Change-Id: I95f8a63581b81a1f424ae6fb2c373c883b72c18d
/frameworks/base/tools/aapt2/ResourceValues.cpp