Commit Graph

5616 Commits

Author SHA1 Message Date
Shane Farmer
0a5b201156 AAPT2: Add a APK filtering.
Allow resource files to be removed from the final artifact based on the
density and locale configuration in the config file. The APK is split
along the density, locale and ABI axis. Each split is generated from the
original APK without modifying the original. The new resource table is
written back to the file system with unneeded assets etc removed.

Test: Unit tests
Test: Manually run optimize command against an APK and inspect results
Test: Installed split searchlite APK (after resigning) and ran on N6

Change-Id: If73597dcfd88c02d2616518585d0e25a5c6a84d1
2017-08-16 19:19:54 +00:00
Adam Lesinski
38ef937bad Merge "AAPT2: Make sure to fail when XML linking fails" 2017-08-15 18:33:47 +00:00
Yi Jin
f32af48069 Fix parsing enum types in incident report tool as well as adding
some additional loggings

Test: manually flashed to device and test calling IncidentManager.java
functions
Change-Id: I69610414edde865b20ba632837f037fbe43f99db
2017-08-11 17:28:12 -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
c0a5e1e600 AAPT2: Make sure to fail when XML linking fails
Bug: 64367402
Test: manual
Change-Id: I3082887f5e449d8d0dac2aad93a834eb346008ba
2017-08-07 11:56:32 -07: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
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
Adam Lesinski
0c80895c20 AAPT2: Document Format.proto
Test: none
Change-Id: I6b05bcdece5a310201d3ab0790a4ea1d23698e96
2017-07-13 09:40:03 -07:00
Adam Lesinski
bb94f32a00 Revert "AAPT2: Auto-version adaptive-icon XML"
This reverts commit 5b7337f77c.

Bug: 63579299
Test: none
Change-Id: Ib617c4edfc16eeae3507b59b2debeae4f8bbf9a5
2017-07-12 07:42:01 -07:00
Adam Lesinski
f903d5f15a AAPT2: Bump version number to v2.18
Test: none
Change-Id: I6e3b4c95a7d7ba416ba368e5b19782dbffa04fd8
2017-07-10 04:19:28 -07:00
TreeHugger Robot
41d8ef907a Merge "Bit: support running all tests in a java package." 2017-07-07 23:28:10 +00:00
Adam Lesinski
fba0cf2950 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-07 13:23:55 -07:00
Adam Lesinski
66ea840038 AAPT2: Accept Java unicode identifiers
Test: make aapt2_tests
Change-Id: I75a0e52d43b1785001bfe120eea7484f7bb4682b
2017-07-07 13:23:55 -07:00
Igor Viarheichyk
10da015d05 Merge "Improved word break for BiDi pseudolocalizer." 2017-07-07 16:42:39 +00:00
Makoto Onuki
164e7967b1 Bit: support running all tests in a java package.
If a target name ends with a period, treat it as a package name
and run with "-e package" instead of "-e class".

Test: bit CtsProviderTestCases:android.provider.cts.contacts.

Change-Id: I3a9a0cbef76f57c46c41bf168b7e94eebecaf671
2017-07-06 16:21:26 -07:00
TreeHugger Robot
5c15e65825 Merge "Have bit grant permissions to installed APKs." 2017-07-06 22:59:47 +00:00
Igor Viarheichyk
4fb6516a55 Improved word break for BiDi pseudolocalizer.
Characted sequences \n and \t are now treated as word separators
by BiDi pseudolocalizer. This solves issues when text rendering
engine breaks a line in the middle of a text chunk marked with
RLM+RLO and PDF+RLM sequences.

Bug:34064580
Change-Id: I52e6018785fae25479fa167440f24c534b0e3253
Fixes:34064580
Test: make aapt2_tests
Test: Run aapt2_tests binary
2017-07-06 15:41:47 -07:00
Adam Lesinski
afcd59b443 Merge "AAPT2: Iterate over UTF-8 string by codepoints" 2017-07-06 22:37:45 +00:00
Adam Lesinski
dfbcd36afd Add adamlesinski@google.com as owner of AAPT2
Test: none
Change-Id: Ief971f7e85050164628d2e25bee888f035a93725
2017-07-06 11:47:17 -07:00