Commit Graph

5575 Commits

Author SHA1 Message Date
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
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
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
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
Jeff Sharkey
5f9dc424b3 Have bit grant permissions to installed APKs.
Otherwise unit tests fail spectacularly when they don't get the
runtime permissions that they expect.

Bug: 63391323
Test: bit FrameworksServicesTests:com.android.server.NetworkPolicyManagerServiceTest
Change-Id: I5307e0456865387ac14178268f543e2007b97096
2017-07-06 12:15:21 -06:00
Adam Lesinski
549e437e14 AAPT2: Iterate over UTF-8 string by codepoints
Iterating over a UTF-8 string by codepoints ensures that
unicode characters do not get sliced. Otherwise the resulting
string could contain malformed characters.

Bug: 62839202
Test: make aapt2_tests
Change-Id: Ia0c44fbceb7dcfa11e77a1a77011da0f5466e342
2017-06-29 18:17:35 -07:00
Adam Lesinski
5b7337f77c AAPT2: Auto-version adaptive-icon XML
Auto version adaptive-icon XML to v26.

This change makes the logic for generating versioned resources
simpler by changing the comparison function of ResTable_config
to evaluate the sdkVersion property last, making configurations
that differ only in sdkVersion next to each other in a sorted vector.

Bug: 62316340
Test: manual (verified output of tools/aapt2/integration-tests/AppOne)
Change-Id: I977d45821722a65d2135efb4693304eacc565c9a
2017-06-28 11:20:17 -07:00
Adam Lesinski
f762df2575 AAPT2: Emit more proguard keep rules for layouts and menus
<fragment> tags in layouts use the class attribute to determine which
Fragment subclass to load, and fallback on android:name if class is not
set.

AAPT2 only emitted a proguard rule for the class attribute for <fragment>,
when it should emit a proguard rule for the android:name attribute as
well.

AAPT2 didn't handle menu XML, so support for actionViewClass,
actionProviderClass and onClick is added.

Bug: 62216174
Test: make aapt2_tests
Change-Id: Ie8675c2bd899a5b51f3661eb0901ab8c9a16fd70
2017-06-28 11:01:59 -07:00
Adam Lesinski
87f1e0fd31 AAPT2: Allow <key-sets> tags in AndroidManifest.xml
Bug: 62839863
Test: make aapt2_tests
Change-Id: Ic38fadf3b204bf603f6770643735635cd1f1df7e
2017-06-28 10:27:06 -07:00
Adam Lesinski
0d81f70104 AAPT2: Honor --custom-package when writing Manifest.java
Bug: 62826426
Test: manual
Change-Id: I517ff5da2ef2a9147ddbfb13b074a1f60550f189
2017-06-27 18:46:58 -07:00
Adam Lesinski
8a3bffea49 AAPT2: Fix issues with parsing integers + floats
If whitespace was present at the end of an integer or float, parsing
would fail.

Bug: 62902869
Test: make aapt2_tests
Change-Id: I6c54f25ad73913d8ea90969fca9de24f726deb96
2017-06-27 12:45:00 -07:00
Shane Farmer
280be34fa6 AAPT2: Update the name of the configuration struct.
Make the Configuration struct name less ambiguous. Also ran clang-format
on the change since some lines were too long and this resulted in a
bigger diff than expected.

Test: built manually
Test: ran existing unit tests
Change-Id: I85e78041fa78d913d47a26c85ad48b05bf935a6a
2017-06-21 16:13:02 -07:00
Shane Farmer
5766943f55 AAPT2: Split APK by ABI.
Added a FilterChain that can apply multiple filter steps to an APK file
as it is being written to disk. The first filter applied is by ABI. If
a library in the APK does not match the filter it is skipped.

Added an AbiFilter that keeps files that are either not native libs or
are for the set of wanted ABIs

Test: ran unit tests locally
Test: ran against an APK with ARM and x68 libs and diffed the results

Change-Id: I3fb901d3de3513e85f2a2763a8e4487a28ed4881
2017-06-21 14:10:23 -07:00
TreeHugger Robot
ea2945f416 Merge "AAPT2: Read config from disk" 2017-06-19 22:03:14 +00:00
Shane Farmer
b102727771 AAPT2: Read config from disk
Implement the todo left from last change to read the contents of the
configuration file from disk. Since this is an operation that may fail
the API was changed to take return a Maybe to indicate errors reading
the file.

Test: unit test for error condition
Test: ran aapt2 optimize with the new code path wired in

Change-Id: I93d532b4a57af9520231225eee4fc5f2b1a046b9
2017-06-19 12:49:48 -07:00
Adam Lesinski
b73f397412 Merge "AAPT2: Fix issue with enums and integer attributes" 2017-06-15 21:40:42 +00:00
Adam Lesinski
3124e7ca0f AAPT2: Fix issue with enums and integer attributes
When an attribute had the format "enum|integer", and a max or min
allowed value set, any value set for this attribute would have its
enum symbol's value checked against the valid integer range.

This would lead to the following:

android:numColumns="autofit"

being interpreted as an integer value of -1, which violated the minimum
expected value for numColumns, which was 0.

Bug: 62358540
Test: make aapt2_tests
Change-Id: I3150410448a533d3595a08ac6b2966264db874d8
2017-06-15 11:14:47 -07:00
Adam Lesinski
9cac43b995 Merge "AAPT2: Disable locale domination for deduping" 2017-06-13 20:48:24 +00:00
TreeHugger Robot
6f813612e0 Merge "ASM Priority Boost Tool" 2017-06-13 20:46:53 +00:00
Adam Lesinski
e38567480b 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-06-13 11:00:04 -07:00
TreeHugger Robot
24acdf8a11 Merge "AAPT2: Clean up tests a bit" 2017-06-13 00:00:48 +00:00
yawanng
e725325270 Revert work around clang-tidy segmentation fault.
Bug: 34740546
Test: build with WITH_TIDY=1 and
WITH_TIDY_CHECKS="*,-readability-*,-google-readability-*,-google-runtime-references"

Change-Id: Ie0885744bdf07d1a66792b61d8a49305162bcd71
2017-06-12 09:45:47 -07:00
Adam Lesinski
a45893a5c5 AAPT2: Clean up tests a bit
Since the latest gtest has fixed support for
explicit bool operators, remvoe AAPT_ASSERT_* and AAPT_EXPECT_*.

Also switch to use NotNull() matchers, which are more legible.

Test: make aapt2_tests
Change-Id: Idce199ca9d567d70f7aae275fee15e04bb914c9e
2017-06-09 14:57:07 -07:00
Adam Lesinski
48a7659454 AAPT2: Mark version 2.17 and update readme
Test: none
Change-Id: I6429b1c3acbcbf2244a5a5c95bc48a5d66bdaebe
2017-06-08 18:13:01 +00:00
Alan Leung
93db63059a ASM Priority Boost Tool
This tool is a replacement for the Jack plugin that allows injection
of static method calls before lock enter and exit.

A common use case would be to boost a thread's priority as soon as
it acquires a heavily contented lock and resetting the priority upon
release.

This tool is meant to be optionally invoked from /build/core/ rules
during the build process.

Test: JUnit Tests / resulting image on a bullhead.

Change-Id: If400414a0bf50f03768a1de2ebee42086a9d701f
2017-06-07 14:22:22 -07:00
Adam Lesinski
b9f0548341 AAPT2: Do not interpret %n as a format specifier in string resources
%n is a special value marking a platform independent newline and is
not to be considered a format argument.

Bug: 37132275
Test: make aapt2_tests
Change-Id: I806521e44afe20004344dee9f18ecee6cc7086ea
2017-06-06 20:02:38 +00:00
Adam Lesinski
7a917a27ef AAPT2: Allow <layout> in <activity> tag in AndroidManifest.xml
Bug: 62189611
Test: make AaptTestAppOne
Change-Id: Ic090e4a002b24f2289f47dfba7439638e5848062
2017-06-06 18:14:48 +00:00
Adam Lesinski
bab4ef56d7 AAPT2: Allow undefined resources (placeholders)
A resource defined like so:

<item type="drawable" name="foo" />

should be assigned the value @null.

The only exception is for <string> resources, which are given the
empty string value (since <string></string> is ambiguous). The decision
to use "" is based off the fact that old AAPT used to assign "" to all
undefined resources, even non-string ones.

Bug: 38425050
Test: make aapt2_tests
Change-Id: Ib3e0f6f83d16ddd8b279c9fd44a07a37867b85e9
2017-06-02 16:48:38 -07:00
Adam Lesinski
127f10037b Merge "AAPT2: Allow any value type for <item> without format attr" into oc-dev am: 1ac325e4d5
am: 3c860ed41d

Change-Id: I44719ae4d742b518f59c9c9bbc226ec9773ce365
2017-06-02 03:04:42 +00:00
Adam Lesinski
3c860ed41d Merge "AAPT2: Allow any value type for <item> without format attr" into oc-dev
am: 1ac325e4d5

Change-Id: I1b1180f2b33a077b2c46a8466c58d83ed618576e
2017-06-02 02:35:07 +00:00
Adam Lesinski
e597d68d33 AAPT2: Allow any value type for <item> without format attr
TO bring AAPT2 behavior in-line with AAPT, <item> has a default
format of "any", and only becomes restricted with an explicit format
attribute.

Bug: 62260121
Test: make aapt2_tests
Change-Id: Ife416f520e6c2710bb30e3ba3f2d4463794bfa06
2017-06-01 17:16:44 -07:00
TreeHugger Robot
95cad98ad5 Merge "AAPT2: XML configuration file parser." 2017-06-01 07:20:59 +00:00
Shane Farmer
74cdea34cd AAPT2: XML configuration file parser.
The XML file is parsed with the aapt::xml::XmlDom parser and actions are
used for the elements we are interested in. This means that there are
cases where a user could add aditional tags/elements to the document
that are technically invalid (acording to the schema) but are ignored by
the parser. This allows us to be more lenient which probably isn't a bad
thing.

Documents have the namespace stripped before processing as the
XmlActionExecutor ignores any elements with a namespace. The namespace
is validated before being removed.

The test cases are all based off the previous example XML file.

Test: Unit tests

Change-Id: I86d7e0dc6347ace3eaa60c1842d59f3cd0d4f749
2017-05-31 16:18:31 -07:00
Shane Farmer
7eded65454 AAPT2: XML schema and an example configuraiton
The current iteration of the schema allows for both Split and Optimize
commands running off the same file. A split command is multiple optimize
command, and an optimize is a split with only a single artifact. To
combine the two, a single file with one or more artifacts can be passed
to either command. If multiple artifiacts are used for an optimize
command, the required artifact can be specified on the command line. A
configuration with only a single artifact can be used with either
command to get the same result.

Change-Id: Ie48eda6e2f9f8bf25d75ef7bcc3b3401a2d3e8eb
Bugs: 37847908
Test: xmllint --noout --schema aapt2.xsd example/config.xml
2017-05-31 16:05:07 -07:00
Adam Lesinski
7a5b406805 Merge "AAPT2: Update --no-version-vector list" into oc-dev am: f296105e22
am: ad227a8086

Change-Id: Ie60160136d6bbca607ce98cd675ffed984b2debc
2017-05-31 21:26:17 +00:00
Adam Lesinski
eac0410e5d Merge "AAPT2: Allow merging of Style attributes from overlays" into oc-dev am: f42c86660d
am: b5cdbdfcf8

Change-Id: Ifabd2f220f96f9dc4942c2cc65b24da6f2d90b13
2017-05-31 21:23:46 +00:00
Adam Lesinski
ad227a8086 Merge "AAPT2: Update --no-version-vector list" into oc-dev
am: f296105e22

Change-Id: I0cde63dfd73b50debdc56f549f7adb1318f05309
2017-05-31 21:15:32 +00:00
Adam Lesinski
b5cdbdfcf8 Merge "AAPT2: Allow merging of Style attributes from overlays" into oc-dev
am: f42c86660d

Change-Id: I4a52a16fff3d544d8d7d63d8a482ba7e2111d01a
2017-05-31 21:12:58 +00:00