Commit Graph

5628 Commits

Author SHA1 Message Date
Steven Moreland
f1cd35cbe1 Merge "Merge "Revert "aapt2_jni: use proper nativehelper headers"" into stage-aosp-master am: e59c1b1b50 am: bc6d35e698 am: 8e22616fb8" into oc-mr1-dev-plus-aosp
am: aa2fa959ee

Change-Id: I1e139e90fafc3c0fd43d3bd08d69c6e493975372
2017-08-12 04:07:25 +00:00
Steven Moreland
d4cb8788f2 Merge "Merge "aapt2_jni: use proper nativehelper headers" into stage-aosp-master am: e17aa09136 am: 1c7ae6507e am: 5c65590564" into oc-mr1-dev-plus-aosp
am: a750dce30b

Change-Id: I2ab40e21bdd678c33ae4287bfc693cdd8bb33ed8
2017-08-12 03:48:38 +00:00
Steven Moreland
4126f4651f Merge "Revert "aapt2_jni: use proper nativehelper headers"" into stage-aosp-master am: e59c1b1b50 am: bc6d35e698
am: 8e22616fb8

Change-Id: Ie23fe137a0cc6df2be34c1c57bb550631654d61b
2017-08-12 03:44:52 +00:00
Steven Moreland
39c5f424b4 Merge "aapt2_jni: use proper nativehelper headers" into stage-aosp-master am: e17aa09136 am: 1c7ae6507e
am: 5c65590564

Change-Id: Ie3c13f03658a2a5ac8fae7edadb4833b86716386
2017-08-12 03:32:29 +00:00
Steven Moreland
8e22616fb8 Merge "Revert "aapt2_jni: use proper nativehelper headers"" into stage-aosp-master am: e59c1b1b50
am: bc6d35e698

Change-Id: Ida9cc1c9c2a64920ce094f2305e2e7bc1abaec1b
2017-08-11 22:17:51 +00:00
Steven Moreland
5c65590564 Merge "aapt2_jni: use proper nativehelper headers" into stage-aosp-master am: e17aa09136
am: 1c7ae6507e

Change-Id: I31224c1a0bef8074c4d569137b3134d28039ee58
2017-08-11 22:06:57 +00:00
Steven Moreland
e59c1b1b50 Merge "Revert "aapt2_jni: use proper nativehelper headers"" into stage-aosp-master 2017-08-11 21:41:00 +00:00
Steven Moreland
fe028b0d0f Revert "aapt2_jni: use proper nativehelper headers"
This reverts commit 8eebd694e5.

Reason for revert: TH skipped PS run

Change-Id: Iab0e71d985819880146476ba3648e8b94201a839
2017-08-11 21:38:39 +00:00
TreeHugger Robot
e17aa09136 Merge "aapt2_jni: use proper nativehelper headers" into stage-aosp-master 2017-08-11 21:35:31 +00:00
Steven Moreland
8eebd694e5 aapt2_jni: use proper nativehelper headers
libnativehelper exports headers under nativehelper. These were
available before incorrectly as global headers in order to give
access to jni.h.

Test: modules using aapt2_jni find headers
Bug: 63762847
Change-Id: Id51354d533bfef66ecd71f5d89599b8adc688c1f
2017-08-11 11:01:23 -07:00
TreeHugger Robot
a27ca01955 Merge "AAPT2: Forward @TestApi in resource comments to JavaDoc" 2017-08-09 18:32:13 +00:00
Adam Lesinski
49f0aa41f1 Merge "AAPT2: Fix windows unicode path issues" 2017-08-08 22:18:55 +00:00
Adam Lesinski
09f4d706d9 AAPT2: Forward @TestApi in resource comments to JavaDoc
Bug: 37894597
Test: make aapt2_tests
Change-Id: I357fb84941bfbb3892a8c46feb47f55b865b6649
2017-08-08 10:51:23 -07:00
Adam Lesinski
e2ba325d27 Merge "AAPT2: Fix typo in Config parsing" 2017-08-08 17:41:00 +00:00
TreeHugger Robot
1c9f0fb7ec Merge "AAPT2: Change proto format to reduce usage of StringPool" 2017-08-08 00:26:31 +00:00
Adam Lesinski
ff9914ee56 Merge "AAPT2: Add targetConfig to AndroidManifest.xml" into oc-mr1-dev
am: a5fc11d78e

Change-Id: Id751b5a4c087fa062a31e88e153302a326fe34a8
2017-08-07 22:28:43 +00:00
Adam Lesinski
e5ebdc3c97 Merge "AAPT2: Ensure style strings are always first in StringPool" into oc-mr1-dev
am: 0dcfee3154

Change-Id: Id820dff95bf26f0186f64b31a14f4032bd3f76ec
2017-08-07 22:25:35 +00:00
Adam Lesinski
0853500201 AAPT2: Change proto format to reduce usage of StringPool
The StringPool class is a binary blob and makes it difficult to
modify the proto files from external tools (like bundle-tool).

Size increase of full build is negligible.

Test: make aapt2_tests
Change-Id: I984755170c315730ab751b51133f8fb2f614f6af
2017-08-07 11:45:46 -07:00
Adam Lesinski
13c0c74888 AAPT2: Fix typo in Config parsing
The 'any' syntax of a configuration is rarely used so this has not been
an issue in the field.

Test: none
Change-Id: Icb9cb2d5ad061e3ea1c43dc1cd7ca2f222965cdc
2017-08-07 10:53:55 -07:00
Adam Lesinski
dc901a6318 Merge "AAPT2: Disable locale domination for deduping" into oc-dr1-dev
am: 242c22c900

Change-Id: I8fa65b89f1f10fe8920aa45d14c7b917b6bc74d8
2017-08-07 17:43:05 +00:00
Adam Lesinski
55f2761fc8 AAPT2: Add targetConfig to AndroidManifest.xml
Splits may include more/different configurations than they
were originally specified to include. This happens, for instance,
when a particular requested density doesn't exist. A fallback density
resource is chosen for the split.

This makes programmatic configuration targetting difficult, as the APK
may report that it has resources for multiple densities, while it was
meant to target only a specific density.

This change encodes a comma separated list of the intended configurations
for the split in an attribute called 'targetConfig' on the <manifest> tag of
AndroidManifest.xml.

Test: manual
Change-Id: I3167e9341a434abc34ed2ddb8f740762b40b1ab7
2017-08-04 17:32:32 -07:00
Adam Lesinski
5b6ee11548 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
2017-08-04 17:29:13 -07:00
Adam Lesinski
907399187e AAPT2: Disable locale domination for deduping
Locale deduping isn't straightforward, as parenting rules
change between platform versions and the selection
preference of a specific locale variant over the default
configuration lead to incorrect results at runtime.

Bug: 62409213
Test: make aapt2_tests
Change-Id: Iec8f1cfba7ae43c847d163529891fdc15f3db826
2017-08-04 17:23:14 -07:00
TreeHugger Robot
61cf5b68b5 Merge "Fix clang-tidy performance warnings in aapt2." 2017-08-04 17:17:45 +00:00
Colin Cross
028dd39daf Merge "Move inserted method after end of try block" am: b080b22a17 am: a413870ef5 am: 4a3caf1719 am: 3a40330f3f
am: fd3326f3d3

Change-Id: I63f13e5957180e4bc332d8f8c1e29508806a49f0
2017-08-04 16:43:35 +00:00
Colin Cross
fd3326f3d3 Merge "Move inserted method after end of try block" am: b080b22a17 am: a413870ef5 am: 4a3caf1719
am: 3a40330f3f

Change-Id: Iae9e94011fe4ad232e049a7e18defed9c2cc2ce6
2017-08-04 16:31:31 +00:00
Colin Cross
3a40330f3f Merge "Move inserted method after end of try block" am: b080b22a17 am: a413870ef5
am: 4a3caf1719

Change-Id: Ib6c4527df0f575217bad0c7e1f2a6b50f203beb7
2017-08-04 16:18:57 +00:00
Colin Cross
a413870ef5 Merge "Move inserted method after end of try block"
am: b080b22a17

Change-Id: Ie23cd33f1910de23bb651fb27fcca71507269bdf
2017-08-04 16:06:02 +00:00
Colin Cross
cebc382d5f Move inserted method after end of try block
Methods inserted at the end of a synchronized {} block also need to
be outside of the implicit try{} block.  Make sure the next
instruction is the virtual end label for the try block, and put
the inserted method after the label.

Bug: 64301866
Test: locked_region_code_injection test
Test: m -j checkbuild
Change-Id: I6626aa45580b4df692e02fc6127a2947a6075e2e
2017-08-03 20:55:37 -07:00
Adam Lesinski
efeb7af13b AAPT2: Fix windows unicode path issues
Mingw64 was being difficult, so instead of defining a wmain entrypoint,
the command line parameters are parsed manually using built-in Windows
methods that support Unicode. The results are converted to UTF8 and
handled just like the rest of the linux/mac version of the code.

This also removes dependencies on std::istream in favour of a
FileInputStream which calls the appropriate unicode version of
open to read a file.

No speed regressions found on Linux or MacOS.

Bug: 62336414
Bug: 63830502
Test: manual
Change-Id: I597da51e33729ed1b98bf246e7e773337fd3fee8
2017-08-03 17:33:52 -07:00
Makoto Onuki
079f8e802b Merge "Bit: Don't ignore errors and crashes" into oc-mr1-dev am: 437e43ed1f
am: d3cafac64d

Change-Id: I2723ca82a18e3c9ac507e6a7113618c1850f577a
2017-08-04 00:12:38 +00:00
Chih-Hung Hsieh
4dc5812dc0 Fix clang-tidy performance warnings in aapt2.
* Use const reference parameter type to avoid unnecessary copy.
* Use more efficient overloaded string methods.

Bug: 30407689
Bug: 30411878
Test: build with WITH_TIDY=1
Change-Id: Iaa0a6f18f64cf573bee49dd1466281ea4d37b410
2017-08-03 16:28:10 -07:00
Makoto Onuki
6fb2c9718c Bit: Don't ignore errors and crashes
Bit used to only see success results and failures (== assertion failures?),
and didn't see "errors" (other exceptions) and test process crashes.

Fixed it.

Now it also returns an error status code if there was a test failure.

Bug 64292779
Test: manual

Change-Id: Iaba93910d32abfc615ae595746a0e9be1108583a
2017-08-02 14:49:30 -07:00
Adam Lesinski
292cece3b2 Merge "AAPT2: Ensure style strings are always first in StringPool" 2017-08-01 19:56:09 +00:00
Adam Lesinski
060b53d028 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
2017-07-31 17:46:28 -07:00
Adam Lesinski
18dc03a9fd Cherry-pick from master: AAPT2: Fix JavaDoc first sentence extraction.
The old algorithm for detecting the first sentence of a JavaDoc comment
looked for the first occurence of '.'. This does not work when code or a
{@link android.R.styleable} link is encountered in the first sentence.

Switch to checking for whitespace characters after the '.' character.

Bug: 62900335
Test: make aapt2_tests , make ds-docs
Original change-Id: I8238f6a6304c9c2f92e2e576ca8962a59c2b20ea

Change-Id: Ie272d0d793d157f2a30f3ead20b2b53976661d33
2017-07-27 17:22:09 -07:00
Adam Lesinski
74468583b3 Merge "AAPT2: Fix processing of quotes in XML" into oc-dr1-dev
am: 16cfd497f5

Change-Id: Ibe24c4b8750d02774456d6c2d638655ece4c7ffd
2017-07-27 20:04:15 +00:00
Adam Lesinski
7e638bceb9 Merge "AAPT2: Fix JavaDoc first sentence extraction." 2017-07-27 18:15:18 +00:00
Adam Lesinski
c895688488 AAPT2: Fix processing of quotes in XML
When processing attributes in XML, quotes can't be used to mark a
section as whitespace preserving, so the assumption should be that the
entire string is whitespace preserving, which makes quote characters
literals.

Bug: 62840718
Bug: 62840406
Test: make aapt2_tests
Change-Id: I4afff02148b5b8e78833abf1f323c2f5325d6155
2017-07-26 20:41:34 +00:00
TreeHugger Robot
7ad5d91eb0 Merge "AAPT2: Add navigation type" 2017-07-26 02:13:09 +00:00
Adam Lesinski
3b84124edc AAPT2: Add navigation type
Test: build succeeds
Change-Id: I7d49366c7cc4a93c29bad4cb9f13eec23ad05bd2
2017-07-25 17:16:53 -07:00
Yunlian Jiang
7a757a0f08 fix a memory leak.
This fixes a memory leak
 warning: Potential leak of memory pointed to by 'buffer' [clang-analyzer-unix.Malloc]

Bug:None
Test: The warning is gone.
Change-Id: I50bfd9f7d70964da0f1808b73fc6554831020214
2017-07-25 16:19:19 -07:00
Adam Lesinski
e967d3f6ac AAPT2: Fix JavaDoc first sentence extraction.
The old algorithm for detecting the first sentence of a JavaDoc comment
looked for the first occurence of '.'. This does not work when code or a
{@link android.R.styleable} link is encountered in the first sentence.

Switch to checking for whitespace characters after the '.' character.

Bug: 62900335
Test: make aapt2_tests
Change-Id: I8238f6a6304c9c2f92e2e576ca8962a59c2b20ea
2017-07-25 15:53:15 -07:00
TreeHugger Robot
6d72a4ea80 Merge "AAPT2: Add targetConfig to AndroidManifest.xml" 2017-07-25 03:18:27 +00:00
Adam Lesinski
3d6323961c AAPT2: Add targetConfig to AndroidManifest.xml
Splits may include more/different configurations than they
were originally specified to include. This happens, for instance,
when a particular requested density doesn't exist. A fallback density
resource is chosen for the split.

This makes programmatic configuration targetting difficult, as the APK
may report that it has resources for multiple densities, while it was
meant to target only a specific density.

This change encodes a comma separated list of the intended configurations
for the split in an attribute called 'targetConfig' on the <manifest> tag of
AndroidManifest.xml.

Test: manual
Change-Id: I3167e9341a434abc34ed2ddb8f740762b40b1ab7
2017-07-24 17:08:32 -07:00
Shane Farmer
1a21b8c041 AAPT2: Update ReplacePlaceholder for artifact name parser
Update the artifact name parser to ensure that duplicate placeholders
are treated as an error.

Also applied suggested changes from ag/2447777.

Test: ran unit tests
Change-Id: Iab8fd9d9b81aa3008177141256ecd16ef04b0c34
2017-07-25 00:01:18 +00:00
TreeHugger Robot
ac6efa3ae2 Merge "AAPT2: Document Format.proto" 2017-07-24 19:29:38 +00:00
Jeff Sharkey
6d626c24e3 Merge "Let's get a constant for O_MR1." 2017-07-20 03:20:22 +00:00
Jeff Sharkey
7beabc264b Let's get a constant for O_MR1.
Test: none
Exempt-From-Owner-Approval: HULK SMASH!
Change-Id: I440ebae4d0891d9044bbbfb5beaaaa98639aea98
2017-07-20 03:19:33 +00:00
Shane Farmer
9f0e7f1dba AAPT2: Parse artifact names from template.
Add a helper method to convert a templated artifact name to file name
based on the values present in an Artifact struct. The Artifact
validates that all required template paramters are present.

Test: Unit tests
Change-Id: Id97ff606bb41c72a31c2d769104966be9cbca1a0
2017-07-18 20:32:54 +00:00