Commit Graph

6633 Commits

Author SHA1 Message Date
TreeHugger Robot
22652e9048 Merge "Do not convert whitespace chars above max char to regular space" 2019-03-11 23:45:02 +00:00
Ashley Rose
0a6dc75371 Merge "InspectionCompanions as nested classes" 2019-03-11 22:12:53 +00:00
Ryan Mitchell
0f32675909 Do not convert whitespace chars above max char to regular space
Using isspace and iswspace on characters above the maximum char value is
undefined. This change makes aapt2 use isspace like aapt and only trims
whitespace characters at or below the maximum char value like aapt2.

Bug: 121017795
Test: aapt2_tests
Change-Id: I015e4b77f0ff53e409e880fcf9ae104ba3444d1a
2019-03-11 11:00:25 -07:00
Andrei-Valentin Onea
f73c5a0b45 Merge "Add extra hidden api related tags" am: cfd72b9386 am: d63ef04944
am: b270bc89cf

Change-Id: I1c949ca80ca5312780906522f5a0af9a5319cfc0
2019-03-09 06:17:39 -08:00
Ashley Rose
fdb5af22aa InspectionCompanions as nested classes
+ Generate inspection companions as MyClass$InspectionCompanion instead
  of MyClass$$InspectionCompanion. This allows the discovery of custom
  inspection companions written as nested classes.
+ Rename GeneratedInspectionCompanionProvider to
  StaticInspectionCompanionProvider to more clearly articulate how it
  function in the new world.
+ StaticInspectionCompanionProvider now explicitly checks if a class it
  discovered implements InspectionCompanion, and returns null instead of
  throwing a ClassCastException.
+ The annotation processor checks for the existence of a nested class
  named InspectionCompanion, and fails the build if a class has both a
  custom InspectionCompanion and @InspectableProperty annotations.

Test: atest --host view-inspector-annotation-processor-test
Bug: 126913705
Change-Id: Ic0d2100ec22420e36f9db44e56c66fe9146eeb0c
2019-03-08 18:27:51 -05:00
Andrei-Valentin Onea
cfd72b9386 Merge "Add extra hidden api related tags" 2019-03-08 16:22:11 +00:00
TreeHugger Robot
b496d6150c Merge "Add --trace_folder to aapt2" 2019-03-07 16:40:03 +00:00
TreeHugger Robot
835d528dba Merge "Make sure Proguard keeps zygote preload class." 2019-03-07 13:56:21 +00:00
Andrei Onea
80a5660238 Add extra hidden api related tags
@SystemApi and @TestApi entries in the whitelist can now be
differentiated from the rest of the apis. @TestApi methods
are implicitly greylisted.

Test: m test-art-host-gtest-hiddenapi_test
Change-Id: Id739f04550842f7b3160685e1635ba20efb223cc
2019-03-07 10:40:52 +00:00
TreeHugger Robot
b32c31d1a9 Merge "Fix aapt2 whitespace diffs from aapt(1)" 2019-03-07 01:42:21 +00:00
Ryan Mitchell
1d358ff5bb Fix aapt2 whitespace diffs from aapt(1)
CDATA blocks were being processed differently in aapt2 so this change
fixes aapt2 to not treat cdata blocks differently and still trime
whitespace.

Also, aapt did not process escapes when compiling xml files. This
change removes over-processing of xml text nodes.

All test strings are what aapt(1) would output.

Test: aapt2_tests
Bug: 124470332
Change-Id: I90ee0c1e5e9208f8a5c60cee93e3ba02712c9b2c
2019-03-06 15:06:49 -08:00
Martijn Coenen
6c83e0c5c9 Make sure Proguard keeps zygote preload class.
Bug: 127262679
Test: atest ProguardRulesTest
Change-Id: Ib082404e08d98b25fcecbf680afb4af37fe2786b
2019-03-06 15:06:17 +01:00
Adrian Roos
084e471703 Merge "apilint: Lint unhidden @IntDef and @LongDef" am: 4435924104 am: cec0f35fcc
am: 748ed1ad44

Change-Id: Iccbb4042411822a0c489a8f7622747a8dd23df4e
2019-03-06 05:16:17 -08:00
Adrian Roos
3478239c56 apilint: Lint unhidden @IntDef and @LongDef
@IntDefs and @LongDefs cannot be stored in a .class file, because the constant
names are lost. Instead, they are packaged out-of-band.

Therefore, they should never be in the API.

Test: python tools/apilint/apilint.py api/current.txt
Change-Id: If22e0cf7db0bb90dae6174bf546f2ec8be4e5458
2019-03-06 13:40:03 +01:00
TreeHugger Robot
380edb9e1e Merge "Resource ID support for view inspector" 2019-03-06 00:57:38 +00:00
Adrian Roos
710cd3fa9e Merge "Apilint: No longer flag interface callbacks" am: 26968d81f8 am: 834803b3e2
am: 56630bdc77

Change-Id: Ide1805b754700cebac02b8cb03576bb3c130db3e
2019-03-05 16:57:03 -08:00
Adrian Roos
e72da268fd Merge "apilint: decorator-based verifier registration" am: 6e16eb107d am: b3662ec299
am: 5eae9a4096

Change-Id: I174c6e70882aeb941512d208b43f3555512986af
2019-03-05 16:49:36 -08:00
Adrian Roos
7d9c3bf7de Merge "Apilint: lint for URL/URI" am: 1d50b63cee am: 3236806e68
am: 4895861d0f

Change-Id: Ia5b3f78217cdcaa992572ea092451f1c46abc26d
2019-03-05 16:42:06 -08:00
Fabien Sanglard
2d34e76dac Add --trace_folder to aapt2
Add a tracing API and instrument key functions in order to profile
aapt2 bottleneck. The API allows to generate systrace fragment files.

Impact on performance is neglibible with each Trace requiring less
than 1us and the final Flush operation at the end of a command
requiring around 40us.

Bug: None
Test: None
Change-Id: I51b564d3694e9384679f43b878b32295527dddf6
2019-03-05 15:09:27 -08:00
Ashley Rose
e8914812c9 Resource ID support for view inspector
This allows for inspectors to do special handling on values known to be
resource IDs, such as converting them to a string format.

+ Add PropertyMapper#mapResourceId(String, int) and
  PropertyReader#readResourceId(int, int)
+ Add RESOURCE_ID to @InspectableProperty.ValueType
+ Add code generation support in the annotation processor, and value
  type inference for accessors annotated with a resource ID annotation
  like @AnyRes.

Bug: 127348933
Test: atest --host view-inspector-annotation-processor-test
Change-Id: I132aea319dcddf51c553057c036ce5609e3c381a
2019-03-05 17:16:14 -05:00
Adrian Roos
26968d81f8 Merge "Apilint: No longer flag interface callbacks" 2019-03-05 18:15:44 +00:00
Adrian Roos
cdb8167051 Apilint: No longer flag interface callbacks
With default interfaces, this is no longer necessary.

Test: python apilint_test.py
Change-Id: Ifa9ba24511a82797089934009d9096c3a589e7f6
2019-03-05 18:13:42 +00:00
Adrian Roos
93bafc4495 apilint: decorator-based verifier registration
Registers verifiers via a decorator to avoid error-prone registration
elsewhere.

Test: Run apilint before and after the change, verify identical output
Change-Id: I77ae47a2f3f1a486bb78d3167f8439ade6fc28ab
2019-03-05 18:31:37 +01:00
Adrian Roos
6721a67e4d Merge changes Icc2810f5,Ib0ad635e am: 1435ace8da am: 79f115fddd
am: c2966e8512

Change-Id: I5a781f7b86d91208aaf7bdfe70c7674597de775d
2019-03-05 09:16:35 -08:00
Adrian Roos
56ff784385 Apilint: lint for URL/URI
Test: python apilint_test.py
Change-Id: Iebe3b48df7ed69e0b5f5ff372b72f68ca9f8efec
2019-03-05 17:57:56 +01:00
Adrian Roos
1435ace8da Merge changes Icc2810f5,Ib0ad635e
* changes:
  Apilint: report all implemented interfaces and fix false positives Test: python apilint_test.py
  Apilint: properly parse packages with numbers
2019-03-05 16:43:24 +00:00
TreeHugger Robot
b5766bd50a Merge "Support for @InspectableProperty on public fields" 2019-03-04 18:49:35 +00:00
Ashley Rose
89d6bce3af Support for @InspectableProperty on public fields
+ Add a field target to @InspectableProperty
+ Refactor PlatformInspectableProcessor to process annotated fields and
  generate InspectionCompanions that read fields.
+ Require that all inspectable getters and fields be public.
+ Make some hidden getters added to View for inspection public.

Test: atest --host view-inspector-annotation-processor-tests
Bug: 126913705
Change-Id: I0c012f42794885f17a397a2e3dd541b3aa4c2634
2019-03-01 19:31:01 -05:00
Paul Duffin
ae3b4c44fb Merge "Switch android.test and junit classes to use UnsupportedAppUsage" am: 7bb0bcd305 am: b5ccf0e21c
am: d75f1793e6

Change-Id: I7a7c34980507393ec855c9e161ca0a922ed57fe4
2019-03-01 07:08:14 -08:00
Paul Duffin
997fa46197 Switch android.test and junit classes to use UnsupportedAppUsage
The UnsupportedAppUsage annotations could not be added directly to the
java files in src/ as they have to be built against the current api
which does not include the annotation. Instead this uses the same
technique as used for libcore/ojluni files and adds the annotations to
stub files (in hiddenapi/src) which are built as part of the
android.test.base-hiddenapi target. That target is added to a special
whitelist in build/soong/java/config/config.go which causes the
hiddenapi information to be extracted from the target.

Also, updates the preupload check to prevent anymore entries being
added to the config/hiddenapi-greylist.txt for android.test or junit
classes.

Bug: 73711752
Test: m cts-hiddenapi_flags-csv and check that it contained the
        correct entries even though they had been removed from
	config/hiddenapi-greylist.txt
Change-Id: Ifaf15d2751f54cb03f8402b866a0ee4da7acc4d2
2019-03-01 10:39:16 +00:00
TreeHugger Robot
b637c6ae6d Merge "Make bit able to run gtest native tests." 2019-02-28 18:11:00 +00:00
Adrian Roos
a9424139e2 Merge "Apilint: Lint missing nullability annotations" am: d6a886a500 am: 1ca78f6ee4
am: 10b2fbf85b

Change-Id: If0a9397d444b1709e3cd51741d02cff5bcfb826d
2019-02-28 07:57:38 -08:00
Joe Onorato
6c97f4908c Make bit able to run gtest native tests.
The output parsing isn't ideal, so these are a bit more spammy
than I'd like, but at least they build, install and run without
the manual glop.

Test: bit incidentd_test
Change-Id: I3c34a4ebbf661f612b4b0f8b4e05cade8669b5a6
2019-02-28 09:20:27 -05:00
Adrian Roos
02e18ddf13 Apilint: report all implemented interfaces and fix false positives
Test: python apilint_test.py
2019-02-28 12:46:23 +01:00
Adrian Roos
d9871b14df Apilint: properly parse packages with numbers
Test: python apilint_tests.py
Change-Id: Ib0ad635e3994bbcbfecefddbd4899c3551ab65cf
2019-02-28 12:46:23 +01:00
Adrian Roos
80545ef56d Apilint: Lint missing nullability annotations
Also adds support for limited range blame parsing.

Bug: 124882145
Test: python apilint_test.py
Change-Id: Idbc7f67eeff27902c37ec482278f5888781c6e78
2019-02-28 12:46:04 +01:00
Adrian Roos
606210ec8b Merge "Apilint: Enforce final builders" am: 2886d307bd am: bb74d55781
am: 77864f7dac

Change-Id: I9e3684b3a4548350e006b27f5d13f8fafb766075
2019-02-28 02:28:53 -08:00
Adrian Roos
deb0ff2bf4 Apilint: Enforce final builders
Test: run apilint
Bug: 124883027
Change-Id: I7f2866e46bc40be60487846b2af9f8fd7edb7623
2019-02-28 09:54:08 +00:00
Adrian Roos
b610eccf3c Merge "apilint: Correctly parse packages with annotations" am: 57b5479a6b am: 436fe4c8f0
am: f9050da20f

Change-Id: Ib3eaf5ca57cc03dbcbb70bdac73a96b77c22fd32
2019-02-27 08:32:43 -08:00
Adrian Roos
57b5479a6b Merge "apilint: Correctly parse packages with annotations" 2019-02-27 15:50:21 +00:00
Ryan Mitchell
1b05ef9cc1 Merge "Sort inputs to compile and link" 2019-02-26 21:48:08 +00:00
Ryan Mitchell
f22ed8dc0e Sort inputs to compile and link
This change sorts the input files of compile and link and also traverses
directories in sorted order in FileCollection::Create. This change
attempts to fix non-determinism issues with aapt2.

Bug: 122518436
Test: builds
Change-Id: I615b8d7f1117e3850366760f16672f0cf5b02070
2019-02-26 17:40:30 +00:00
Adrian Roos
b1faa0bf5b apilint: Correctly parse packages with annotations
Test: python apilint_test.py
Change-Id: Ifce9fe3836b2bb46b0d0a255b912fd8bf0195621
2019-02-26 11:54:40 +01:00
TreeHugger Robot
c0a6d77625 Merge "Fix long paths on Windows" 2019-02-25 21:06:17 +00:00
Siarhei Vishniakou
457b1601e1 Update VirtualKeyMap usage
Since the VirtualKeyMap has been refactored, updated the
validation tool to use the new signature.

Bug: 113575658
Test: atest libinput_tests inputflinger_tests

Change-Id: Ifb0eb5b2913020f1e1402dcb6a36c9038c345807
2019-02-20 16:26:12 -06:00
Ryan Mitchell
a55dc2ed6b Fix long paths on Windows
util::mkdirs iteratively creates each directory of a specified path. For
windows, Calling mkdir on only the drive letter or on the extended path
prefix (\?\\) will result in an error. Start after the long path prefix
and the drive letter.

This also changes AAPT2 to use AssetMaanager2 to retrieve symbols from
the symbol table. AssetManager2's zip library uses _wopen to open
windows files.

Bug:123251200
Test: aapt2_tests.exe
Change-Id: I26169d83b22d441485de3c49d63a6c4ed710e292
2019-02-20 09:46:00 -08:00
Izabela Orlowska
a1dea5f915 Merge "AAPT2: allow regexes for extensions to not compress" 2019-02-20 12:55:58 +00:00
Izabela Orlowska
0faba5fdfa AAPT2: allow regexes for extensions to not compress
Change-Id: I09d2ad1d1466643ca7628c6480224e16b9002ee5
Fixes: 67575899
Test: added + manual
2019-02-20 10:36:43 +00:00
Sasha Smundak
2f2e353f79 Merge "Convert Android.mk file to Android.bp" am: a81d64e940 am: efa1d26538
am: 8e0d9d8473

Change-Id: Ic6d75ff8e072f9f3eb6ca472bea0122ac220075a
2019-02-19 10:57:08 -08:00
Ryan Mitchell
975c6e2d26 Merge "Fix seg faul when parsing invalid <plurals>" 2019-02-19 18:09:56 +00:00