Commit Graph

6260 Commits

Author SHA1 Message Date
Andrei-Valentin Onea
cfd72b9386 Merge "Add extra hidden api related tags" 2019-03-08 16:22:11 +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
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
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
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
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
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
deb0ff2bf4 Apilint: Enforce final builders
Test: run apilint
Bug: 124883027
Change-Id: I7f2866e46bc40be60487846b2af9f8fd7edb7623
2019-02-28 09:54:08 +00:00
Adrian Roos
57b5479a6b Merge "apilint: Correctly parse packages with annotations" 2019-02-27 15:50:21 +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
Sasha Smundak
a0994a80d1 Convert Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: treehugger
Change-Id: I89cb31814f1442c91c31e5b867501d768679230e
2019-02-15 10:52:57 -08:00
Sasha Smundak
31754eb5df Convert Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332340
Test: treehugger
Change-Id: I52416790e1e4493dd4fe57404095351b8d37ea22
2019-02-11 14:58:20 -08:00
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