149 Commits

Author SHA1 Message Date
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
Dan Willemsen
77508b9c19 Rename libprotobuf-cpp-lite_static to libprotobuf-cpp-lite am: 2005edf642
am: 4ee22dd083

Change-Id: I5a9006361b3ded4eaf03b1362a0dfa2aa36fdb2e
2016-08-01 23:46:15 +00:00
Dan Willemsen
4ee22dd083 Rename libprotobuf-cpp-lite_static to libprotobuf-cpp-lite
am: 2005edf642

Change-Id: I48dfa98a54a8680d091cbc403feb30bba35f2efd
2016-08-01 23:39:34 +00:00
Adam Lesinski
3822763bfc Merge "AAPT2: Add script to remove duplicate resource definitions" 2016-08-01 22:05:49 +00:00
Adam Lesinski
bb5a390142 AAPT2: Allow <intent-filter> within <provider> in AndroidManifest.xml
Change-Id: I005120b76679f51039ddc40160c96ead6ab5fa4f
2016-08-01 15:01:08 -07:00
Adam Lesinski
9eff3cd594 AAPT2: Add script to remove duplicate resource definitions
Change-Id: I1577cc35cf1db0a7cf24a072485fc3af14c1d02e
2016-08-01 12:58:17 -07:00
Dan Willemsen
2005edf642 Rename libprotobuf-cpp-lite_static to libprotobuf-cpp-lite
Use the same name for the static and shared libraries so that the module
definitions can be shared.

Change-Id: I1578ee7044689194ae1baea4d71f1b0e8737505f
2016-07-31 22:48:28 -07:00
Sergio Giro
03b95c7df5 Unicode: specify destination length in utf8_to_utf16 methods
Change-Id: I5223caa7d42f4582a982609a898a02043265c6d3
2016-07-29 17:54:30 +01:00
Adam Lesinski
b720bc304e Merge "AAPT2: Add version info and release notes" 2016-07-27 19:53:18 +00:00
Adam Lesinski
ad48bbcbf6 Merge "AAPT2: Change accepted notation for resource names in tests" 2016-07-27 19:52:44 +00:00
Adam Lesinski
f455762ec6 Merge "AAPT2: Add support to specify stable IDs" 2016-07-27 19:52:27 +00:00
Adam Lesinski
0368ebfc29 AAPT2: Add version info and release notes
Bug:30402888
Change-Id: Idb532cc71921eb1cfba31c00a6fb7108e31fddd8
2016-07-26 12:57:21 -07:00
Adam Lesinski
58a20a6482 AAPT2: Change accepted notation for resource names in tests
Previously the way to name resources in tests was to use reference
notation (@[package:][type/]name). Now we use name notation (no @).

Change-Id: I68f0a36562d89cc78c582d128f370d9556c58707
2016-07-25 17:56:58 -07:00
Adam Lesinski
bf0bd0f9ac AAPT2: Add support to specify stable IDs
The --stable-ids flag allows the user to specify a file containing
a list of resource name and resource ID pairs in the form of:

package:type/name = 0xPPTTEEEE

This assigns the given resource the specified ID. It helps ensure
that when adding or removing resources, IDs are assigned in a stable
fashion.

If a package, type, or name is not found, no error or warning is
raised.

Change-Id: Ibc2f4e05cc924be255fedd862d835cb5b18d7584
2016-07-25 16:02:18 -07:00
Alexandria Cornwall
e0af925c8f AAPT2: Convert StringPool flattening to UTF-8
Convert StringPools in resources.arsc and binary XML files to use UTF-8
instead of UTF-16 to save lots of bytes.

Bug: 30053277
Change-Id: I8eb6c78644e51b15f89edadab71cc86f5a851a45
2016-07-25 09:46:38 -07:00
Ivan Gavrilovic
f580d91dab Aapt main dex proguard rules - always keep application
Aapt with -D option was not keeping the application and instrumentation
subclasses, which were instead handled by mainDexClasses.rules. Instead,
include them in the aapt -D output.

Change-Id: Ia3b89fc2edd45d379c4d06f0bf674716646fcb3d
2016-07-20 15:38:48 +01:00
Adam Lesinski
87675ada47 AAPT2: Erase version qualifiers for resources <= minSdk
When resources share the same configuration, they are much more
clustered in the resulting resources.arsc, which makes for smaller
APKs. Strip version qualifiers for resources <= minSdk so that
they get clustered.

Bug:30050641
Change-Id: I80371b179761501fb7cc41f5f5ac67ffde2fc677
2016-07-15 18:04:56 -07:00
Sergio Giro
1deedbacc3 Add bound checks to utf16_to_utf8
Test: ran libaapt2_tests64
Bug: 29250543
Change-Id: I1ebc017af623b6514cf0c493e8cd8e1d59ea26c3
(cherry picked from commit 4781057e78f63e0e99af109cebf3b6a78f4bfbb6)
2016-07-14 13:27:53 +00:00
Adam Lesinski
d0f116b619 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
2016-07-13 17:45:28 -07:00
Sergio Giro
fb5cfc3543 Merge \\"Add bound checks to utf16_to_utf8\\" into nyc-mr1-dev am: 49c410bc48
am: daad138428

Change-Id: I5a660dccb76e823736a59e50904a7279a97ef849
2016-07-12 01:46:30 +00:00
Sergio Giro
49c410bc48 Merge "Add bound checks to utf16_to_utf8" into nyc-mr1-dev 2016-07-11 12:11:31 +00:00
Adam Lesinski
71965e898e 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
2016-07-07 17:17:55 -07:00
Sergio Giro
4781057e78 Add bound checks to utf16_to_utf8
Test: ran libaapt2_tests64
Bug: 29250543
Change-Id: I1ebc017af623b6514cf0c493e8cd8e1d59ea26c3
2016-07-02 17:46:20 +01:00
Adam Lesinski
e1fda9aec4 AAPT2: Encode empty attribute string values
Due to another bug, empty strings in XML files
were encoded as NULLs. This was only needed for
encoding missing namespace URIs. Attribute
values should remain empty strings.

Bug:29939875
Bug:29462255
Change-Id: I3897661d85865c88bb2b7cf1495da16c30f7272e
2016-07-01 14:51:51 -07:00
Adam Lesinski
5e8fa3a248 AAPT2: Improve diff command
Change-Id: Ia1e2f8482c7192ef50126b61bed7975297332767
2016-06-29 21:56:58 -07:00
Adam Lesinski
fb6312fe93 AAPT2: Add version collapsing
When an app specifies (or imports) resources with various
configurations for different SDK versions, specifying
a minSdk will make many of those resources unreachable.

Version collapsing will prune out the resources specified
for SDK versions less than the minSdk.

If, however, there is no exact matching resource for the
minSdk version, the next smallest SDK version is kept.

Change-Id: Ic7bcab6c59d65c97c67c8767358abb57cdec60a4
2016-06-29 17:02:19 -07:00
Roozbeh Pournader
112373006f Remove LocaleValue::toDirName() from AAPT2
There was no user, and the code was incorrect too.

Bug: 25599046
Change-Id: I50d14f58995ac611385a6fb17661a357bf473687
2016-06-24 17:01:07 -07:00
Adam Lesinski
1e21ff00b0 AAPT2: accept argument file list for -R
Bug:29462255
Change-Id: Ia83919a3e7de7fe2056a3f7613621972cccd49cb
2016-06-24 14:57:58 -07:00
Adam Lesinski
5d84ad5487 AAPT2: Allow <meta-data> in <application> tag
Change-Id: Ica3e7d5c1ce587eba58d8171e0f8d5cdb598e7b3
2016-06-23 13:18:16 -07:00
Adam Lesinski
b2106687e1 Fix pseudolocalizer at end of string
The accent pseudolocalizer would incorrectly process
the byte after the end of the string, which would end
up inserting null characters into the resulting
output.

Change-Id: I5cdabd6b0272d94073f06e180b8cbe7abafa3888
2016-06-23 13:03:15 -07:00
Adam Lesinski
32852a575b AAPT2: Use hash map for StringPool indices
Hash map has better locality and average case performance

Change-Id: Ic2d111c3cff1d5c0e7e9cbe36714669e6508c275
2016-06-18 01:10:34 +00:00
Adam Lesinski
5fcfdab573 Merge "Allow uses-library under <application>" into nyc-mr1-dev am: c878fb0cb8
am: b80680af78

* commit 'b80680af787dfb27e5a4b1b0edae8502373c4935':
  Allow uses-library under <application>

Change-Id: I078857ace29f7f35b9efbee99f4278b7c7ba9c9e
2016-06-03 00:44:51 +00:00
Adam Lesinski
fee32d4d5f Allow uses-library under <application>
Bug:29106952
Change-Id: I2e780323d86e7050038d34426a30e66a4bbfcc23
2016-06-02 23:57:55 +00:00
Michael Wright
0935d0132b Merge "Stop emitting javadoc for @removed attributes." into nyc-dev am: c4033e7c66 am: 1d10d94396
am: fab894efde

* commit 'fab894efdece38ec9f3df1adedf79eb148bc6bda':
  Stop emitting javadoc for @removed attributes.

Change-Id: Icbaa4eb19326d2ec41be78016665553a1b7beef0
2016-05-16 13:33:17 +00:00
Michael Wright
fab894efde Merge "Stop emitting javadoc for @removed attributes." into nyc-dev am: c4033e7c66
am: 1d10d94396

* commit '1d10d9439635dd19fbb581d852dc0bf7bace364a':
  Stop emitting javadoc for @removed attributes.

Change-Id: Iefa1290cea72c3ddecb57157e61c39af7ce8383b
2016-05-16 13:29:52 +00:00
Michael Wright
365eaeef5f Merge "Stop emitting javadoc for @removed attributes." into nyc-dev
am: c4033e7c66

* commit 'c4033e7c668abc1e671a130f70f58f885c63b176':
  Stop emitting javadoc for @removed attributes.

Change-Id: If48d0299c6d4d7179a366d902f23ada17315e42c
2016-05-16 13:26:58 +00:00
Adam Lesinski
33e74b7ece Merge "AAPT2: Add diff command" into nyc-mr1-dev am: 1a1461058e
am: 894f96a117

* commit '894f96a117a9ba942b9486317f6852c7472443a6':
  AAPT2: Add diff command

Change-Id: Ic53915ac3c04d151f55c159a170d46da7a1f6c17
2016-05-11 00:11:55 +00:00
Michael Wright
feaf99fa1b 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
2016-05-09 14:51:41 +01:00
Chih-Hung Hsieh
d53e3bed1c Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: I080090d50f1a368a4e7c1a0732297bb6a295e34f
2016-05-03 10:02:51 -07:00
Adam Lesinski
458b877488 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
2016-04-30 01:36:12 +00:00
Adam Lesinski
5fcf5d4fec Merge "AAPT2: Accept a file with arguments when argument list is too long" into nyc-dev am: 28d6c1e493 am: 461be97e30
am: e59d48398f

* commit 'e59d48398f983b822191ea3096499bdd0793840a':
  AAPT2: Accept a file with arguments when argument list is too long

Change-Id: Iad1d2b91109b0d1c78739c3fa3f31da5e0704f12
2016-04-28 20:05:24 +00:00
Adam Lesinski
c51562cf5a AAPT2: Accept a file with arguments when argument list is too long
Bug:22775504
Change-Id: Ife73d4e4611016c9ee7b56264bc6a765c54beba3
2016-04-28 11:14:38 -07:00
Rohit Agrawal
e49bb30dab AAPT2: ProGuard config for components in main dex.
Create an analogue of "aapt2 --proguard" which outputs a proguard
configuration that keeps only components which need to be in the main
dex.

Bug: 27383099

Change-Id: I61d652bfcdfc18e1614e852bd6f7540efd15f780
2016-04-22 14:40:40 -07:00