242 Commits

Author SHA1 Message Date
Elliott Hughes
437b8c95a8 Merge "Rely on the platform -std default." am: 66f15cc01b am: 5a989a504a
am: 39ad1b92fa

Change-Id: Iec4bca8e96c776d61c5da5540a74acc6773c2bce
2016-10-08 22:03:56 +00:00
Elliott Hughes
c08e32e0be Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I7180f1eb539ff8cbe33832d010775f053a922946
2016-10-07 15:57:17 -07:00
Adam Lesinski
edba941064 AAPT2: Ensure PNG endianness in 9-patch serialization
9-patch serialization requires PNG endianness

Bug:31942900
Test: manual + added serialization test to libaapt2_tests
Change-Id: Iea521718f88e80d3fa7a8723a47584973738748a
2016-10-04 17:50:19 -07:00
Adam Lesinski
ffa9656223 Merge "AAPT2: Refactor PngCrunching" 2016-10-03 21:22:28 +00:00
Alexandria Cornwall
77788eb4cf AAPT2: Add dominator tree analysis and resource removal
Added dominator tree analysis of resource configurations for each
resource entry to allow deduping of resource entries if:

1. The configuration for the resource entry's value is dominated by
a configuration with an equivalent entry value.

2. All compatible configurations for the entry (those not in conflict
and unrelated by domination with the configuration for the entry's
value) have an equivalent entry value.

Bug: 30051199
Test: make libaapt2_tests && libaapt2_tests
Change-Id: I66468d3014a2d6097a94b039ac1028f9f461c7d3
2016-09-30 18:27:13 -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
Paulo Casanova
b896ae7267 Merge "Added building libaapt2_jni.so." 2016-09-27 21:33:56 +00:00
Paulo Casanova
c7ca55e27b Added building libaapt2_jni.so.
Change-Id: Ica2769c08b4bb5c6cceebb8052c0dd7817ef4586
2016-09-27 18:34:54 +01:00
Adam Lesinski
a0b929d27f AAPT2: Allow <compatible-screens><screen> in AndroidManifest.xml
Change-Id: I1e7c7211be1d9caea4174f7cac067c2565879d04
2016-09-19 09:50:45 -07:00
Adam Lesinski
8c3f31f022 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
2016-09-07 13:45:13 -07:00
Adam Lesinski
5cb0530ca4 AAPT2: Update version and readme
Update version to 2.2 and update readme to reflect added
support for inline complex XML resources.

Change-Id: If825c96541952e95860d34390c6c36704a24129b
2016-09-06 17:34:06 -07:00
Adam Lesinski
871f2f5fc2 Merge "AAPT2: Add Inline Complex XML support" 2016-09-02 18:49:46 +00:00
Adam Lesinski
5eeaaddffd AAPT2: Add Inline Complex XML support
See: https://developer.android.com/guide/topics/resources/complex-xml-resources.html

Change-Id: I8274c85e25cabf90423141c228697e873167d136
2016-08-31 18:32:34 -07:00
Adam Lesinski
96692047e6 Merge "AAPT2: Revert warning when merging packages" 2016-08-31 20:18:19 +00:00
Adam Lesinski
a6ad7d5cc3 Merge "AAPT2 tools: Fix logging in resource file fixer" 2016-08-31 00:55:53 +00:00
Colin Cross
7fd4eb7ff7 Merge "Replace libziparchive-host with libziparchive" am: 611e205bbe am: 8c8bb25089 am: 63dc310e6a
am: e3cd4b394c

Change-Id: Icc088a0cdd6a2ebc2b7bedb719ad7220d947273d
2016-08-31 00:29:35 +00:00
Adam Lesinski
198cb0f048 AAPT2 tools: Fix logging in resource file fixer
Change-Id: I5113012229005c94e466f43a30932ebdc74d76fc
2016-08-30 15:07:50 -07:00
Adam Lesinski
085f495747 AAPT2: Revert warning when merging packages
A compiled ResourceTable may contain multiple packages.
When referencing a framework attribute, for instance,
the compile phase has no idea if that attribute is a USE
or a DECLARATION, like so:

  <declare-styleable name="Foo">
    <item name="android:id" />
  </declare-styleable>

If this file is compiled with the package 'android', then this
is a declaration. If it is compiled with the package 'com.foo',
this is a reference that must resolve at link time.

Since this is common, warning that the package 'android' is being
ignored during the merge phase is incorrect behaviour.

The warning was antroduced in ag/1363992

Change-Id: I09254d79ac379439face177eb724df882d1d0ce1
2016-08-30 14:25:51 -07:00
Adam Lesinski
5c3464c75f 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
2016-08-26 19:40:50 -07:00
Colin Cross
e3cd4b394c Merge "Replace libziparchive-host with libziparchive" am: 611e205bbe am: 8c8bb25089
am: 63dc310e6a

Change-Id: I645d077dd656f84446f77fd91c169fd7b977e661
2016-08-26 20:40:27 +00:00
Colin Cross
9a1a3bcb16 Replace libziparchive-host with libziparchive
libziparchive-host is no longer necessary, and mixing libziparchive-host
and libziparchive can cause ODR violations.

Change-Id: I623c0c5579e28f26a6e1db7bd953f33ed1ca68cd
2016-08-26 11:15:17 -07:00
Martijn Coenen
2cc64692ce Merge changes from topic 'utf' am: 0a357a1a73 am: de8a6a66f6
am: 1657493c22

Change-Id: Ie675738a4f9042929d1ffb5e1ffcc7bbb5c7b217
2016-08-25 20:31:31 +00:00
Sergio Giro
d90d8d615a Add bound checks to utf16_to_utf8
Test: ran libaapt2_tests64
Bug: 29250543
Change-Id: I1ebc017af623b6514cf0c493e8cd8e1d59ea26c3
(cherry picked from commit 4781057e78f63e0e99af109cebf3b6a78f4bfbb6)
2016-08-25 12:19:12 +02:00
Sergio Giro
8f7b8a1f6c Unicode: specify destination length in utf8_to_utf16 methods
Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
2016-08-25 12:04:40 +02:00
Adam Lesinski
8197cc460e AAPT2: Merge Styleables instead of overriding them
Styleables merge in AAPT. Preserve this behavior.

Bug:30970091
Change-Id: Ie68ca675aeecd873c0648682182e2fc574e329a0
2016-08-19 13:29:40 -07:00
Adam Lesinski
aa0255da28 AAPT2: Add tool to fix positional argument issues
Change-Id: Ie8f733b70d561667cd25b38fb4c09d0837ef9b7f
2016-08-18 14:05:44 -07:00
Alexandria Cornwall
a7cc3f1d79 AAPT2: Add support to strip namespaces from XML
The --no-xml-namespaces flag will strip namespace information from
compiled binary XML files in res/* (excluding res/raw/*) and
AndroidManifest.xml. It will also strip URI information from compiled
binary XML files in res/* (excluding res/raw/* and AndroidManifest.xml).

AndroidManifest.xml URI information is retained due to PackageParser, which
requires the Android URI for intent filters.

Bug: 29115919
Change-Id: I90cad6ed39ce02a69776f55314c1d4f38ad1aabe
2016-08-17 11:01:05 -07:00
TreeHugger Robot
e42bc0587f Merge "Fix clang-tidy warnings in aapt and aapt2." 2016-08-15 21:10:23 +00:00
TreeHugger Robot
1d740812e6 Merge "AAPT2: Expose split support to command line" 2016-08-15 20:46:38 +00:00
Chih-Hung Hsieh
470f8fcb5c 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
2016-08-15 12:32:51 -07:00
Adam Lesinski
36c73a5959 AAPT2: Expose split support to command line
Bug:30445078
Change-Id: If4b8530dba71b9059b8e62c04757da99c1119d22
2016-08-15 12:14:26 -07:00
Chih-Hung Hsieh
84717d4118 resolve merge conflicts of 17bd236 to stage-aosp-master am: b3d46b44a3
am: c76aa69207

Change-Id: I6bb066d131dde297612c5dcbf5051f4964e62a8b
2016-08-12 19:35:08 +00:00
Chih-Hung Hsieh
c76aa69207 resolve merge conflicts of 17bd236 to stage-aosp-master
am: b3d46b44a3

Change-Id: I5123493e165c4d2ab74cf045e5fb8181886dce62
2016-08-12 19:30:02 +00:00
Alexandria Cornwall
c34027ec3d Merge "AAPT2: Fix resource type id symbol merging" 2016-08-12 19:27:32 +00:00
Chih-Hung Hsieh
b3d46b44a3 resolve merge conflicts of 17bd236 to stage-aosp-master
Change-Id: I08d4500aaa378b08d41e8d046c62101e08dbfba8
2016-08-12 11:44:16 -07:00
Chih-Hung Hsieh
8bd37ba458 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
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1

Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
Merged-In: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
2016-08-11 15:20:10 -07:00
Chih-Hung Hsieh
9b8528fee4 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
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1

Change-Id: Id6d21961f313a1ad92b15a37fdaa5be9e8ab48e1
2016-08-11 15:16:41 -07:00
Alexandria Cornwall
6a1f8dbd51 AAPT2: Fix resource type id symbol merging
By the looks of things, AAPT2 should be able to merge public type and entry
symbols iff their types and resource IDs match.

Change-Id: Ie99071418aa89aad56de5e5b96e98b96d0d15d7a
2016-08-11 14:46:27 -07:00
Alexandria Cornwall
8eefa04826 Merge "AAPT2: Reorder link steps" 2016-08-11 18:33:02 +00:00
Alexandria Cornwall
637b4820dc AAPT2: Reorder link steps
AAPT2's link steps were writing the res/* files before optimizations to the
resource table were performed (such as version collapsing). This was causing
unreferenced res/* files to remain in the archive, even though they're no
longer necessary.

Bug: 30705740
Change-Id: I50d7943ef7429b14e46587093855c15d54038299
2016-08-11 09:53:16 -07:00
TreeHugger Robot
b80b6dabcb Merge "AAPT2: Parse coreApp in <manifest> as boolean" 2016-08-10 19:52:24 +00:00
Adam Lesinski
6b17d2cec2 AAPT2: Parse coreApp in <manifest> as boolean
Bug:30751662
Change-Id: I283be5725426ee084944c1921df40d1bd6188028
2016-08-10 11:37:06 -07:00
Alexandria Cornwall
f6762fc22a AAPT2: Merge binary XML file attributes
AAPT2 generates extra versions of XML binaries based on the sdkVersion
that attributes were introduced, up to v21. This should only happen for
sdkVersions that are > minSdkVersion, as everything else can be included
in the main configuration (e.g. "layout" instead of "layout-v4").

This change handles the merging of XML binary sdkVersions that were created
implicitly.

Bug: 30705740
Change-Id: I854843dd6dbaca52896cea0c24c70c900cec3e8e
2016-08-09 13:23:03 -07:00
Adam Lesinski
9756dec248 AAPT2: Add default no-compress extensions
Change-Id: Iff0820993059bcab59208b07601b2c6d8d953c89
2016-08-08 12:41:45 -07:00
Alexandria Cornwall
a9ff14098b AAPT2: Strip dedicated tools namespace from XML
Android has a dedicated XML namespace dedicated for tools that should not be
included in the final APK. AAPT strips this out, but the feature was missing
from AAPT2. See: http://tools.android.com/tech-docs/tools-attributes

Bug: 29115919
Change-Id: I8f4fc79e6c8592a313a691134e44d16fd91f36ed
2016-08-03 10:02:15 -07:00
Sergio Giro
e55e65c993 Merge "Unicode: specify destination length in utf8_to_utf16 methods" 2016-08-02 18:48:19 +00:00
Adam Lesinski
bad90c3888 AAPT2: Add missing error statement
Change-Id: I955ba6f151d68db02c3dc16d121994fb553dcea8
2016-08-02 11:39:17 -07:00
Adam Lesinski
39df2f25dc Merge "Move utility scripts to tools/" 2016-08-02 17:17:15 +00:00
Adam Lesinski
98bda74eb5 Move utility scripts to tools/
Change-Id: Iddb755f3cec0a32801128b4eb20f2c185b0cc626
2016-08-02 10:15:33 -07:00
Dan Willemsen
3b16cf057a Rename libprotobuf-cpp-lite_static to libprotobuf-cpp-lite am: 2005edf642 am: 4ee22dd083
am: 77508b9c19

Change-Id: Ifb0fef3c2dfaef7b19e2f03dbbdce41431a51a2f
2016-08-02 02:36:20 +00:00