124 Commits

Author SHA1 Message Date
George Burgess IV
ea4423b181 Merge "Fix a static-analyzer warning."
am: 63b4f6f5db

Change-Id: I85fd6d25733d59da76eb0bab381fdbd3b5a0430d
2016-10-20 19:19:15 +00:00
George Burgess IV
56f5f7b79b 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
2016-10-13 15:52:34 -07:00
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
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
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
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
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
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
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
Sergio Giro
49c410bc48 Merge "Add bound checks to utf16_to_utf8" into nyc-mr1-dev 2016-07-11 12:11:31 +00: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
fee32d4d5f Allow uses-library under <application>
Bug:29106952
Change-Id: I2e780323d86e7050038d34426a30e66a4bbfcc23
2016-06-02 23:57:55 +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
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
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
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
Chih-Hung Hsieh
c6baf563ba Fix google-explicit-constructor warnings.
Bug: 28341362
Change-Id: Ibdd6a210bb7ff228e3624cc319169f77aca3b51e
2016-04-27 11:38:12 -07:00
Adam Lesinski
5ff3ad6312 SettingsLib: Build with AAPT2
Bug:22775504
Change-Id: I2e5015235384d124418d32186daa190f38e1c5b3
2016-04-14 14:45:21 -07:00
Adam Lesinski
626b3dbf74 AAPT2: Clean up R JavaDoc generation
- Don't generate private attributes in public R.java
- Strip out @SystemApi from comment when generating @android.annotation.SystemApi
- Only emit a single line (up to the first period) of an attribute's comment within
  a styleable's attribute table.

Change-Id: Id6316a6861540325934133958939a12074ad4428
2016-04-07 16:26:14 -07:00
Adam Lesinski
f22df48067 Merge "AAPT2: Enable windows build and make sure it builds" into nyc-dev 2016-04-07 17:03:55 +00:00
Adam Lesinski
c728c3daba AAPT2: Allow <protected-broadcast> and <eat-comment> in AndroidManifest.xml
Change-Id: I38c49a2a31e560dec963d44d94e067035fd59150
2016-04-06 17:40:25 -07:00
Adam Lesinski
803c7c8079 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
2016-04-06 16:24:02 -07:00
Adam Lesinski
cc5609d8e4 AAPT2: Implement XmlActionExecutor to verify manifest
Defines a set of actions to perform on XML elements defined by their
hierarchy, eg: manifest -> application -> activity.

This can be used to easily add rules to check more tags in AndroidManifest.xml

Change-Id: I76c6916a98b6403075a7e56e16230979dc6cbee1
2016-04-06 11:37:05 -07:00
Adam Lesinski
3524a23edb AAPT2: Add option to add JavaDoc annotations to Java classes
Change-Id: I7ee8c20cdd91380927a65c41097ffd3a6ffa2df5
2016-04-04 12:42:05 -07:00
Adam Lesinski
6cbfb1de49 AAPT2: Change how we generate Java classes
Previously we would be writing out the Manifest.java file as we
processed the AndroidManifest.xml. This would lead to empty
Manifest classes if there were no permissions or permission groups
defined in the AndroidManifest.xml.

This would pose problems for processes that checked for public classes
and considered them part of the API (support lib).

Now we collect the structure of the Java class in memory before deciding
if a file should be created.

Change-Id: I6b909f28d74356414c6ef5ad005180d6ea5e44ca
2016-03-31 16:43:04 -07:00
Andrew Johnson
08a3fa7dea Merge "Removing assignments to localeScriptWasComputed in aapt." into nyc-dev 2016-03-31 13:52:10 +00:00
Andrew Johnson
299e488ee2 Removing assignments to localeScriptWasComputed in aapt.
On certain devices running Android M with unknown vendor
modifications. Setting the localeScriptWasComputed bit in
the resource parameters struct causes the translations
for many languages to fail to load. The app then
defaults to English.

This has been reported on the following devices:
Motorola XT1086, XT1096, and XT1586, HTC One, and Huawei
MediaPad 10 LINK.

This change works around the issue by never setting
localeScriptWasComputed in aapt and instead always
writing the default value of false.

Bug: 27872476
Change-Id: Id638d1d0e5f9dcb1c02e65d67667d76174c69b9e
2016-03-30 20:24:48 -04:00
Ying Wang
5e92c429ec Fix compilation using javac.
We still need to be able to compile all the Java source code in the tree
using javac, though the compiled code never ends up running on device.

Bug: 25958912
Change-Id: Id76663cdf768db579517515d7b7f51519b515fa8
2016-03-30 10:33:47 -07:00
Adam Lesinski
52db414176 Merge "AAPT2: statically link protobuf library" into nyc-dev 2016-03-11 21:33:34 +00:00
Adam Lesinski
330c57dbd1 Merge "AAPT2: Add descriptions of Attributes in Styleables for R.java" into nyc-dev 2016-03-11 09:16:44 +00:00
Adam Lesinski
7656554f91 AAPT2: Add descriptions of Attributes in Styleables for R.java
Change-Id: I69e7b73cbdfe4baf502348397435c501ae29ff5e
2016-03-11 00:22:52 -08:00
Adam Lesinski
f4ab612684 AAPT2: statically link protobuf library
Change-Id: I0bce42dfef2f11181c6407839875c97f88445dbd
2016-03-11 07:20:49 +00:00
Adam Lesinski
96917c25f0 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
2016-03-09 13:23:12 -08:00
Adam Lesinski
c53244db5e Remove accidentally committed core dump file
Change-Id: I610abfbce62585c25e98b5c36ac9f496861e66e7
2016-03-04 22:30:32 -08:00
Adam Lesinski
74605cd402 AAPT2: Emit proper doclava comments in R.java
Bug:25958912
Change-Id: I663f2eb5bd54e3c3288ce9bc186c928f0a014f93
2016-03-04 20:06:05 -08:00
Adam Lesinski
626a69f345 AAPT2: Support --no-version-vectors
Change-Id: I8029b2f9e2f7ab8e37a49565f95210f47a7be609
2016-03-04 17:02:42 -08:00
Adam Lesinski
64587af817 AAPT2: Support building, linking, and merging static libraries
Android static libraries are like APKs but they contain much more debugging
and source information. We need to treat them differently in 3 ways:

1) When building a static library, we skip things like ID assignment and
   product/config stripping. Source information is emitted as well.
2) When building a static library and linking against another
   static library, we don't want to merge, we want to simply reference.
3) When building an app that uses static libraries, we want to merge
   the static library under the same package with or without mangling.

Bug:25958912
Change-Id: I425e032857936a3e83173c1edc2a6cdc6020b842
2016-03-04 14:39:01 -08:00
Roozbeh Pournader
7960898f6f Fix script-related parts of locale resource matching
Previously, a bit was kept to find if the script of a locale was
explicitly "provided" in a resource. This was not backward
compatible, and failed in some edge cases when the package was
created with older versions of AAPT that did not set the bit.

The cases would happen when the old resource had an explicit script
specified in its locale, but since the "provided" bit was not set in
the package, we would assume that the script was computed by us.

This CL replaces the "provided" bit with a "computed" bit, so the
default value of the bit (set to "false" for old packages) would be
correct.

Bug: 27156990
Change-Id: I99e7f1ad8f70c90e25ab3640ed34cc1a6f8d1d64
2016-03-03 15:19:37 -08:00
Adam Lesinski
144c5eabe5 AAPT2: Fix segfault when showing error in 9-patch
Change-Id: I8f457212efc27480758a7157455d98b5e316f772
2016-03-01 09:05:11 -08:00
Adam Lesinski
355f285ffd 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
2016-02-17 18:17:25 -08:00
Adam Lesinski
5f7c461be6 AAPT2: Fix source output when error occurs in style
We were serializing the wrong Source when writing to protobuf

Change-Id: Ib65e962ebc1244ddf4af0e5666aaaebe5f7864a8
2016-02-12 23:38:08 -08:00
Adam Lesinski
e4bb9eb5af 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
2016-02-12 22:21:48 -08:00