Stops it being specific to frameworks/base. This change works because
$2 is $(REPO_ROOT) and $(REPO_ROOT)/frameworks/base is the same as $PWD
when this script is used in the frameworks/base repo.
Also removes boot/ from the path that identifies hidden API flag files.
This keeps the directory structure needed in the repositories into
which hidden API flag files will be moved simple by removing the need
to have a boot/ directory. The hiddenapi/ directory is required as the
files need their own separate OWNERS file.
A follow up change will move this file into tools/platform-compat to
allow it to be used by other repos.
Bug: 177892522
Test: try and upload changes to hiddenapi flag files
Change-Id: Ifb3690e7c596249fda84eff82f5a53f0b1b6f991
The com.android.i18n.phonenumbers is not used by any libcore code and
is no longer managed by the libcore team.
Bug: 177892522
Test: n/a
Change-Id: Ib445e652746a8b9b42c6bee7d27a062d6b62a4ec
The config/hiddenapi-*.txt files have moved so this change updates the
preupload scripts to match their new location.
Test: Modify the boot/hiddenapi/hiddenapi-*.txt files in various ways
to verify the scripts fail.
Change-Id: I725458e809d9871b2c21bc4e18f62441aaa775a9
Changes:
* Adds a missing package for libcore.
* Splits the android.icu package out into a new I18N team.
* Corrects and splits the conscrypt package out into a new CONSCRYPT
team.
* Fixes some issues that arose due to multiple teams.
* Reports multiple issues instead of stopping at the first one.
* Only reports issues with additions/changes not removals.
Bug: 177892522
Test: tools/hiddenapi/exclude.sh <SHA>
Ran it on a number of different commits with different
changes.
Change-Id: I44740a28a56a26ee7fba3ed691d9da34f4effa8a
grep returns 1 for if nothing was found. This fails presubmit hook due
to bash handling "set -e" Looks like grep not found is valid case.
This fixes this issue by bypassing grep exit code.
Test: Locally
Bug: 161351699
Merged-In: I39e926a348a0fb8f4040f86034affdb4204faac5
Change-Id: I39e926a348a0fb8f4040f86034affdb4204faac5
(cherry picked from commit e6a5253f1262acce5d8156867ffddc276a706c3d)
This change fixes the following tests which were broken by a previous
change (change id I5e3c2f8d14524d59dd65d26ce5196efcc15d6d8e):
* test_assign
* test_parse_and_merge_csv
Bug: 177317659
Test: tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: If29c65794e258a3871269a0214a10980613542e6
The previous error didn't really explain the problem from the users point
of view.
Test: modify hiddenapi-unsupported.txt and build
Change-Id: I6f551343db84b20b32a963dccddf10cd08ea2be7
Refactor the argument parsing code to support more flexible options.
Now, instead of:
--unsupported-ignore-conflicts apis.txt
We do:
--unsupported apis.txt --ignore-conflicts
And similarly for --packages. Flags now come in groups, starting with
one of ALL_FLAGS and continuing to the next such flag. Any of
--ignore-conflicts, --package or --tag X apply to the previous one of
ALL_FLAGS.
Also add the --tag flag used to tag APIs with a custom flag. This is
used to tag removed APIs as such.
Test: m -j out/soong/hiddenapi/hiddenapi-flags.csv
Bug: 171300342
Change-Id: I59e6c365c46282f4489d71e7acac2ae43e5907d2
The binary uses flags to mean both command-line parameter names
and the API names, used in files and internally in the class.
Internal representation and command-line parameter names are updated to
use more inclusive language. However, the output file produced by
`generate_csv` function still uses old flags. Format update in
the input/output files is out of scope for this change
and will be updated in the follow-up changelist.
See https://source.android.com/setup/contribute/respectful-code for
reference.
Bug: 161896447
Test: python3 generate_hiddenapi_lists_test.py
Change-Id: I36c85ce04b89ba3e4eee319f95511110d2c4374e
- Allow passing list of explicit fieldnames, instead of sorting header names.
- Allow passing a single zip file with all CSV files to merge.
Bug: 145132366
Test: diff -w out/soong/hiddenapi/hiddenapi-greylist.csv
Change-Id: I7c6db369069452293c15eec290c635fb3879275d
- Use csv.QUOTE_MINIMAL strategy to only quote fields with special characters.
- Open file as 'r', not 'rb'.
- Use 'unix' dialect for '\n' as line terminator, instead of \r\n.
Bug: 145132366
Test: diff -w out/soong/hiddenapi/hiddenapi-greylist.csv
Change-Id: I888f3219beee5b83e53f05589a90a05f93399fe3
Before this CL, classes in the unnamed package, such as
L$r8$backportedMethods$utility$Objects$2$checkIndex
(which looks like it is generated by R8 for Objects.checkIndex() calls)
were breaking the build because extract_package was incorrectly assuming
that there would always be a '/' in the identifier string.
Test: Build that previously broke is now working.
Change-Id: Ice78d6b31c4f38a3c9d529bc6156d625d19bcacf
If the signature has @UnsupportedAppUsage or @SystemApi annotation as well, those take precedence and the API would either be whitelisted or greylisted accordingly. All other, "pure" @TestApi signatures would be blacklisted and only allowed access in instrumented processes.
Test: manual
Bug: 133832325
Change-Id: I4684929caed8be7c42c91fed33ddd2a3b67ae19b
generate_hidden_api_lists now receives a file containing package names
which need to be greylisted (although it could be made to work with any
api list required).
Also took the opportunity to clean up the tests to reflect the more
strict code.
Bug: 129387816
Test: m appcompat
Test: frameworks/base/tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: I619f8581d166aa48eda572bc0053d8739d6420eb
@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
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
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
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
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
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
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
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
Add a python script to merge the CSV files, dealing with the fact that the
source columns may differ due to the annotation properties present in the
source.
Add this new file and the existing greylist.txt files as dependencies of
the 'dist' target, so that they appear as artifacts on the build server.
This allows them to be processed later by reading them from the build
server.
Test: m out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Bug: 117314178
Change-Id: Ib9e5da90e4c32333a3f4f02ee7f159f77086ae5e
This will contain greylist entries accessible by apps with a
targetSdkVersion of less than Q. Currently empty, will be populated in
follow up CLs.
For now, these APIs are just merged into the light greylist at build time,
pending support in the runtime for implementing the correct runtime
behavior.
Also fix a bug in sort_api.sh so it deals with empty API lists
correctly.
Bug: 115609023
Test: m
Change-Id: I213874062f393f96d120648a934ae5ad7aba93af
Checked the contents of the hiddenapi lists before and after the change
and the methods were definitely moved from light greylist to the
whitelist.
Flashed the device and checked the log and did not see anything out of
the ordinary.
Test: frameworks/base/tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: I9b4b2426251e99495f65ae02a3c2c32ce6966625
Grep exits with non-zero if it find no matches. But it doesn't matter in
this case, so just carry on.
Test: frameworks/base/tools/hiddenapi/sort_api.sh \
Test: frameworks/base/config/hiddenapi-light-greylist.txt
Change-Id: I7c219ee617f7dfa3cff5232ab979cc4ba38ebbfd
It is sometimes useful to add comments at the top of a source file. This
patch changes hidden API list generation to ignore lines beginning with
a hash.
Note that due to the sorting constraints on hidden API lists, comments
can be only at the top of the files.
Test: m appcompat
Change-Id: I1bc6fd44d1b1f10a5adc45093d7f7ed5a0c5a54f
We want to preserve the same semantics as P wrt dark greylist. This will
eventually become the "blacklist for target SDK >= P".
Bug: 113881436
Test: phone boots
Change-Id: I3bb72102e1d054eb0f2cae089ab633a0bc2bb276
Generating hidden API lists has grown in complexity and the original
Makefile rule has become a bottleneck for build times. Rewrite the
logic in Python.
Bug: 113278235
Bug: 73736106
Test: frameworks/base/tools/hiddenapi/generate_hiddenapi_lists_test.py
Change-Id: I63f03133d70260d06c55f482b844a4980dc6f734
It's moving to a new home under art/tools, since it is needed by
branches which don't include frameworks/base.
Bug: 110868826
Test: Build master-art branch
Change-Id: Ice8324db52ae1e7e2ac6734e45874a66de935c9a
Annotation was added with name @UnsupportedAppUsage after Android API
council discussion.
Bug: 110868826
Test: m class2greylist
Change-Id: I63ad61e97c5e8fdebfcead9e4ee5b060a60f97c7
This extracts signatures of methods that have the @UsedByApps annotation
for generating the greylist. It will be integrated into the build to
replace many members on greylist.txt.
Test: $ atest class2greylisttest
Bug: 110868826
Change-Id: Ifaf5859b60076c051de6be5a912ef70734330ce7
Check that they're sorted as expected and contain no duplicates.
The sort order now uses:
$ LC_COLLATE=C sort -f
So that non-alphanumeric characters are not ignored, giving a more
intuitive sort order. the '-f' means ignore case.
Also sort the existing lists accordingly.
Test: repo upload
Bug: 64382372
Merged-In: I52b884da33a9a46455df6747a215683d9d3c3218
Change-Id: Icc124fd8ceb3f001a9c11bbf40e0a111910c6b39
(cherry picked from commit e5dc64d4281dd9f38c2b585202e26ae4278fcfc5)