Commit Graph

6243 Commits

Author SHA1 Message Date
Adrian Roos
34b11c92b3 Merge "apilint: Allow parsing 3.0 signature files" 2019-01-29 16:05:21 +00:00
Adrian Roos
cf82e04400 apilint: Allow parsing 3.0 signature files
Test: python apilint_test.py
Change-Id: I59df950229c05329afde93f94efc13adb4640ad7
2019-01-29 15:01:28 +01:00
Treehugger Robot
171c9cdc6a Merge "clang-format ManifestFixer_test.cpp" 2019-01-28 22:15:35 +00:00
Colin Cross
3288553623 clang-format ManifestFixer_test.cpp
Fix formatting errors introduced by Iee2bd9a3981c7d4681509f18b735c6e9e6c1a336.

Test: m checkbuild
Change-Id: I5d9a4cec277e31f4124bff281bf7a52cc97f73e3
Merged-In: I10b27abb8fa8a99a41976c42c4d684b99978b4f9
2019-01-25 21:33:02 +00:00
Colin Cross
bc40469e19 Merge "Replace annotation_processors with plugins" 2019-01-23 20:18:02 +00:00
Colin Cross
a1f8e1ab3d Replace annotation_processors with plugins
The annotation_processors property is deprecated, replace it with
plugins, and use java_plugin for modules that provide annotation
processors.

Bug: 77284273
Test: m checkbuild
Change-Id: I14ed4d81e097510866cbb9a27c72be4426117885
2019-01-22 11:09:51 -08:00
Adrian Roos
258c572d5e apilint: correctly parse enum_constant
Change-Id: I1a243caa3a01837ff989d21926478f20d70372ae
Fixes: 120132045
Test: python apilint_test.py
(cherry picked from commit 373df11baa)
2019-01-22 11:42:39 +01:00
Adrian Roos
d1e3892119 ApiLint: Add operator keyword and property parsing
Also fix up some issues with expression parsing, type use annotations, etc.

Test: python tools/apilint/apilint_test.py
Change-Id: I38145a51470ce6c3e5813a546d681489fd87fc19
(cherry picked from commit 403c8e35d8)
2019-01-22 11:36:38 +01:00
Adrian Roos
5cdfb69429 ApiLint: Add Kotlin-style type support
Test: tools/apilint/apilint_sha.sh HEAD && python tools/apilint/apilint_test.py
Change-Id: Iac1fdabcbeffe57c8288d73b2359e8ce0b2bc3eb
(cherry picked from commit 7884d6b909)
2019-01-22 11:36:37 +01:00
Adrian Roos
1f1b6a8464 ApiLint: Performance improvements for verification
Test: tools/apilint/apilint_sha.sh HEAD
Test: python tools/apilint/apilint_test.py
Change-Id: I90f18181cd0d3c43f176d7c9d1b198f6f5172390
(cherry picked from commit 7f8886a993)
2019-01-22 11:36:37 +01:00
Adrian Roos
e5eeae7c23 ApiLint: Performance improvements for 2.0 signature format parsing
Test: tools/apilint/apilint_sha.sh HEAD
Test: python tools/apilint/apilint_test.py
Change-Id: I76b979dd81702afce6468ac377230e589a25e08f
(cherry picked from commit a30d062775)
2019-01-22 11:36:37 +01:00
Adrian Roos
b787c183a2 ApiLint: Allow parsing 2.0 API signature files
Test: tools/apilint/apilint_sha.sh HEAD
Test: python tools/apilint/apilint_test.py
Change-Id: Id2e1792392b3626746f1ec99f481d0cb27e523a1
(cherry picked from commit d170961b02)
2019-01-22 11:36:37 +01:00
Adrian Roos
038a02992a apilint: Fix API lint issues 2/2
Fixes false positives that occur when a class in current.txt is faulty, and an
entry for that class is then added to system-current.txt.

This was so because when parsing the previous revison's system-current.txt, we
did not know about the class and thus didn't look for it in current.txt, and
thus never recorded that the error is preexisting.

To avoid that, we track all classes in system-current.txt with a matching entry
in current.txt in the current revision, and later use that to look up all classes we
may have missed when examining the previous revision.

Test: python tools/apilint/apilint_test.py
Change-Id: Ibe09f1159e351e56b35b8816ce0db760de4ef791
(cherry picked from commit 61e3730bc0)
2019-01-22 11:36:36 +01:00
Adrian Roos
5ed42b6a2e apilint: Fix API lint issues
Fixes a bug where only the name instead of the fully qualified name was
considered when looking for a class, which lead to faulty results for inner
classes.

Test: python tools/apilint/apilint_test.py
Change-Id: Ib015669ed3faef21d2bdd16f1e27bc55c8669d70
(cherry picked from commit 2c5cacfd36)
2019-01-22 11:36:36 +01:00
Adrian Roos
6eb57b0f4a API Lint: Add support for base current.txt
Allows specifying a base current.txt and previous.txt file when linting
system-current.txt and test-current.txt to avoid false positive error
messages due to public API members not being duplicated in the respective
non-public APIs

Test: python tools/apilint/apilint.py --base-current=api/current.txt api/system-current.txt
Change-Id: I306a99b1423584ef3fcdc9272a83cb5eacc37227
(cherry picked from commit 7690d0d4ee)
2019-01-22 11:36:36 +01:00
Jeff Sharkey
a8e5df06a0 Guide towards Context.createPackageContextAsUser().
It's a better alternative that should be used instead of adding
new "ForUser" or "AsUser" methods.

Bug: 115654727
Test: manual
Change-Id: I8742c2ef42d743ef69f8f7a91378f498fdc81e43
(cherry picked from commit 86445841ac)
2019-01-22 11:36:36 +01:00
Jeff Sharkey
eff9e228c1 Moar lint rulez!
Bug: 37534642, 116675691, 116798271, 72059458, 111790177
Test: manual
Change-Id: Ib079ae580a827f225be08f90dbdddeee7d341c48
(cherry picked from commit daac37f229)
2019-01-22 11:36:35 +01:00
Siyamed Sinir
0a2e15dd6e Update lint rules for graphics/text package layering
Test: N/A
Bug: 77347886
Change-Id: I907d99b4a1dee0c69b914e55a033d3d9c4eebe56
(cherry picked from commit e23aeb8024)
2019-01-22 11:36:35 +01:00
Jeff Sharkey
40d67f4b6d Handle new current.txt format.
We're starting to see "@interface" show up, so handle them like any
other interface.  We're also seeing more details argument lists
with names and annotations; ignore them for now, since all our
existing lint checks work on the "real" data type.

Verified that it handles new support library current.txt files
without causing any regressions against existing framework
current.txt files.

Test: manual inspection
Bug: 111555356
Change-Id: Id11c3561edd317e4ba1a9b43993fd96d8243e00d
(cherry picked from commit bd26119169)
2019-01-22 11:36:34 +01:00
Jeff Sharkey
fe5ee6e74b Extend lint script to emit API statistics.
Bug: 77588754
Test: manual
Change-Id: I240dba5fae1a8635a4265a1af903517f00dec54c
(cherry picked from commit daa7cf3a36)
2019-01-22 11:36:34 +01:00
David Brazdil
439d3496ed hiddenapi: Support 'core-platform-api' flag
Libcore class members annotated with @CorePlatformApi now generate
a new hiddenapi flag. This is the first of "domain API" flags which
can be used in conjunction with API list flags. Therefore modify
the 'generate_hiddenapi_lists.py' logic to treat them differently.
Specifically, the script marks otherwise unassigned class members
blacklisted. A class member with 'core-platform-api' may still not
be assigned an API list and should be blacklisted.

Bug: 119068555
Test: m appcompat
Change-Id: I2b67e7a619677e853c87bc2da934410458ce4d14
2019-01-19 15:57:36 +00:00
David Brazdil
17d16e84da hiddenapi: Expect public/private API as CSV
Refactor of `hiddenapi` changed the output format of public/private API
lists to a single CSV file. Change API list generation accordingly.

In order to avoid special-casing this CSV file, it is treated the same
as the CSV files produced by `class2greylist`. The merging rules are
relaxed so that signatures in CSV files are not checked against
a pre-initialized set of all signatures (previously generated from the
public/private API files). This should not lead to build errors as the
CSV files are always auto-generated, and a missing/extra signature will
be caught by `hiddenapi`.

API lists in frameworks/base/config are processed later and checked
that they are a subset of the signatures in CSV.

Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: I33f2cbaa15f2d423a75e6ca64abe1c5b0c40c86f
2019-01-19 15:57:36 +00:00
yaochen
213e8cf8af Merge "Add a struct wrapper for bytes fields in stats_log cpp APIs." 2019-01-11 19:02:29 +00:00
Yao Chen
037ad04df7 Add a struct wrapper for bytes fields in stats_log cpp APIs.
To avoid conflict between statslog.write() function signatures for

Atom1 {
  Foo foo = 1 [logMode=bytes];
}

and

Atom2 {
  string bar = 1;
  int64 arg2 = 2;
}

Bug: 122571213
Test: manually tested with new atoms.

Change-Id: Ied0f0bd81cef8d0964f571e921f47022301157d9
Merged-In: Ied0f0bd81cef8d0964f571e921f47022301157d9
(cherry picked from Ied0f0bd81cef8d0964f571e921f47022301157d9)
2019-01-10 17:26:26 -08:00
Chih-Hung Hsieh
93561ab3b9 Fix/suppress tools google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Remove redundant explicit of copy constructors

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: Ic11c22c59beb7aa32b878a23315b1036ca4e3c6a
2019-01-10 19:52:49 +00:00
Tor Norbye
0f2dc8d0f0 118395019: Hide constants and methods in StatsLogInternal
This CL updates the code generator which creates the
hidden StatsLogInternal class to explicitly hide
the generated constants and write methods as well.

The intent of this class was for everything to be hidden,
but it turns out that public methods and fields in
hidden classes which are extended by a public class also
ends up in the SDK, even though they don't appear in the
signature file. StringBuilder#setLength(int) is an
example of this.

Bug: 118395019
Test: make sdk
Change-Id: I97e510e8155ee50ade653f6abeb5479c7ca9029d
2019-01-08 14:20:31 -08:00
Chih-Hung Hsieh
1fc78e1814 Fix/suppress aapt/aapt2 google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Use NOLINT or NOLINTNEXTLINE to suppress warnings on intended converters

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: Ie02101ea7c422e8add535c111a30a2f21ead0ace
2019-01-04 17:38:13 +00:00
Chih-hung Hsieh
6af0e228f3 Merge "Fix/suppress incident* google-explicit-constructor warnings" 2018-12-21 16:30:12 +00:00
Treehugger Robot
0d7970f4e9 Merge "Statsd: Enable host_supported for libstatslog" 2018-12-20 22:05:58 +00:00
Chih-Hung Hsieh
7a88a938d2 Fix/suppress incident* google-explicit-constructor warnings
* Add explicit to conversion constructors/operators
* Remove redundant explicit of copy constructors

Bug: 28341362
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor
Change-Id: I26a11bb798d25605577269ed340e97afc8566960
2018-12-20 13:45:04 -08:00
Jack He
34a892d2f5 Statsd: Enable host_supported for libstatslog
* libutils must be used as a static library when compiled on host
* Host does not have Android system properties and hence we cannot
  use <cutils/properties.h>. In fact, properties.cpp is not even
  compiled on host for libcutils. Therefore, this CL adds a check
  for __ANDROID__ macro before including <sys/propoerties.h> and
  before calling properties_get_bool()
* On host, statsd logging will be disabled since host does not
  use statsd for anything

Fixes: 121294178
Test: test drive statsd
Change-Id: I838ff02468c650c5f7d85e68fa5008b98f08ce8c
2018-12-20 00:56:15 -08:00
Mathew Inwood
cfc7952cc8 Include annotation property values in output.
When editing annotations, we want the ability *not* to overwrite any
existing annotation properties already in place. Include any properties
set on the annotation in the output, so that the edit_annotations script
can know that they're there.

The annotation properties are encoded like URL query parameters for
convenience; it makes them easy to encode here & subsequently decode on
the other side (in Python).

Test: m framework-annotation-proc & inspect output.

(cherry picked from commit bd7077065c)

Merged-In: I71fb1215ad2790751be336b4955c163bb323a4a6
Change-Id: I0b33e2b379076346ce258d93a9225a9143b7d91a
2018-12-20 07:47:29 +00:00
Chih-Hung Hsieh
a1b644e88c Fix performance-for-range-copy warnings
Bug: 30413223
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,performance*
Change-Id: Ie481e88025a7a1f3abde8ff63420d5ccd8577e52
2018-12-17 20:00:55 +00:00
Yao Chen
d66ecfccf6 Add byte size of the bytes fields to statslog c++ APIs.
The proto binary data can contain '\0's and in the native layer,
the current liblog api would convert that into string and thus
the data is truncated.

This CL adds a "size_t bytes_field_len" after the bytes fields so that
we can correctly pass the data from JAVA to native.

Java StatsLog.write() APIs remain the same

Bug: 120635548
Test: test_drive with atom 103
Change-Id: I34f1c4ddd6a4ec5f3604b0c67a47a5399e3c6ddd
Merged-In: I34f1c4ddd6a4ec5f3604b0c67a47a5399e3c6ddd
(cherry picked from commit 1fe9f59498)
2018-12-15 13:52:47 -08:00
Yao Chen
2822b4f42f Skip writing message field in an atom if it's empty
Test: unit test added
Bug: 120635548
Change-Id: I825b1ce526944a20fe65705508ad180ece37492c
Merged-In: I825b1ce526944a20fe65705508ad180ece37492c
(cherry picked from commit 8e6f998300)
2018-12-15 13:52:27 -08:00
Yao Chen
8b71c74894 Allow atoms to log fields in bytes format.
There are an increasing number of requests to log data in complex format to statsd, while the data
is not expected to be parsed or aggregated by statsd and only to be uploaded as events.

Instead of making an exception for each of these cases in a hard coded way, this CL add a feature to
annotate these field in atoms.proto and the stats-log-api-gen tool will produce byte array
interfaces for them.

Note that log_msg does not have byte array type, and only has string type, when statsd receives the
log, these fields are in string type. Only when the atom is written to proto, we will check if this
field should be bytes field and write it to protobuf in message format.

Change-Id: If53dd95c5826710c76d7fe982bf951a435dfc738
Merged-In: If53dd95c5826710c76d7fe982bf951a435dfc738
Fix: 118386797
Bug: 120635548
Test: unit test & manual test
(cherry picked from commit bbdd67d19f)
2018-12-15 13:51:08 -08:00
Chih-hung Hsieh
20b64c4bc7 Merge "Fix cert-dcl16-c clang-tidy warnings." 2018-12-12 02:58:22 +00:00
Chih-Hung Hsieh
054dab1d47 Fix cert-dcl16-c clang-tidy warnings.
Bug: 120614316
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c
Change-Id: I2dc262d3407aafa969e921236dc3fc3ae60eb9d4
2018-12-11 11:27:17 -08:00
Paul Duffin
352956b07e Switch last c.a.i18n.phonenumbers hiddenapi entries to annotations
Previous changes could not remove these entries as they are implicit
methods, i.e. are not present in the source, and so could not be
annotated. That is no longer true and so these entries can now be
removed.

This was tested by making and then manually checking that the generated
out/target/common/obj/PACKAGING/hiddenapi-light-greylist.txt was the
same (after sorting) before and after this change.

Bug: 117818301
Bug: 119861512
Test: as above
Change-Id: Ic33c693f50cac011332c5ba5a5c0e2b6562e6ef8
2018-12-10 16:05:54 +00:00
David Brazdil
ec62f08f8c Merge "hiddenapi: Add constants for 'greylist-max-p'" 2018-12-04 10:07:59 +00:00
Jeff Sharkey
aaaf1b7a88 People don't read warnings.
Bug: 113136846
Test: manual
Change-Id: If7e313b4f0fa90875795b24817553bbd9a8c60ff
2018-12-03 10:58:42 -07:00
David Brazdil
5cd148fc7a hiddenapi: Add constants for 'greylist-max-p'
New category of hidden API has been created. Update the script
generate_hiddenapi_lists.py with the new flag name.

Test: m, phone boots
Change-Id: I79e5478678880939e20e500cb8dad9b2a56fc84f
2018-11-29 15:43:02 +00:00
David Brazdil
89bf0f28bf Turn hidden API lists into a single CSV
Maintaining multiple text files has become too cumbersome as adding
each new category of API requires changes across many projects.
This patch changes generate_hiddenapi_lists.py to produce a single
CSV file in the format:

  <api_signature>,<flag1>,...,<flagN>

It can accept legacy API list files as input (for existing
frameworks/base/config/hiddenapi-*.txt files) as well as per-package
CSVs produced by class2greylist.

Test: m, check lists have not changed
Test: phone boots
Test: tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: Iebcef426ec93ea1d72b662bbff91d4e068fa0a70
2018-11-29 15:43:01 +00:00
Paul Duffin
00537c15e8 Prevent hiddenapi entries being added for libcore related projects
The libcore related projects (see below) have been (mostly) switched
over to use UnsupportedAppUsage annotations, This change will prevent
entries for those projects being added to a config/hiddenapi-* file.

* libcore
* external/bouncycastle
* external/conscrypt
* external/icu
* external/okhttp
* external/libphonenumber - still has a couple of entries in
      config/hiddenapi-light-greylist.txt due to limitations in
      UnsupportedAppUsage/class2greylist.

Tested by attempting to upload the file with entries for libcore
projects and without those entries and checking that the behavior
is expected.

Test: see above
Bug: 117818301
Change-Id: I67a30b307e12e842b28cfb2160fab0029868fa06
2018-11-29 09:41:56 +00:00
Mark Salyzyn
d100107806 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-11-14 15:54:32 -08:00
Chih-Hung Hsieh
e8abd06776 Allow implicit-fallthrough warnings locally.
It will be a global error by default.

Test: make checkbuild
Bug: 112564944
Change-Id: I26616fd50ccf3639fa7c01d850a14d079273ede7
Exempt-From-Owner-Approval: do not block on new warnings
2018-10-22 09:56:12 -07:00
Mathew Inwood
3ffa1cad11 Merge "Merge hidden API metadata into a single CSV file."
am: 5037a7eb93

Change-Id: I0efce89576b0ca7ae90d49de3455466a866521de
2018-10-17 10:35:39 -07:00
Mathew Inwood
5037a7eb93 Merge "Merge hidden API metadata into a single CSV file." 2018-10-17 09:20:04 +00:00
Dan Willemsen
9b767e275e Merge "Stop using DIST_DIR directly, use dist-for-goals instead"
am: a8f2601d28

Change-Id: Iabb2ddb086dda71887c3d50152db50f813c9556a
2018-10-16 17:43:35 -07:00
Treehugger Robot
a8f2601d28 Merge "Stop using DIST_DIR directly, use dist-for-goals instead" 2018-10-17 00:18:07 +00:00