summaryrefslogtreecommitdiff
path: root/tools/hiddenapi
AgeCommit message (Collapse)Author
2021-04-15Move hiddenapi sort preupload tools to tools/platform-compatPaul Duffin
Bug: 179354495 Test: try and upload changes to hiddenapi flag files Change-Id: Iedc21893bbc62adaaca4de353d022e77fc70ace2
2021-04-14Generalize tools/hiddenapi/checksorted_sha.shPaul Duffin
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
2021-04-14Remove com.android.i18n.phonenumbers from libcore packagesPaul Duffin
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
2021-04-07Update hiddenapi preupload checks to handle new locationPaul Duffin
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
2021-04-07Improve hiddenapi exclude.sh scriptPaul Duffin
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
2021-04-07Add OWNERS file to tools/hiddenapiPaul Duffin
Bug: 179354495 Test: m nothing Change-Id: I54159f3c32fc8a0a094243178315ca0d249b64cf
2021-04-01Fix presubmit for hidden api.Yury Khmel
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)
2021-02-09Move hiddenapi tools used by build/soong into build/soongPaul Duffin
Bug: 177317659 Test: m nothing build/soong/scripts/hiddenapi/generate_hiddenapi_lists_test.py Change-Id: I72386e5343215864cd3af9c102fff16a5715b2ca
2021-02-09Fix lint errors in tools/hiddenapiPaul Duffin
Bug: 177317659 Test: tools/hiddenapi/generate_hiddenapi_lists_test.py Change-Id: I7fe52319a80d929d43fdec913d2e7f155de96549
2021-02-09Fix generate_hiddenapi_lists_test.pyPaul Duffin
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
2020-10-26Clarify error message when signature in list.txt does not exist.Mathew Inwood
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
2020-10-22Support adding custom tags to APIs.Mathew Inwood
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
2020-08-07Drop deprecated API lists from csv merge scriptAndrei Onea
Only support the new API list names. Bug: 162500436 Test: build and check hiddenapi-flags.csv Change-Id: I5e3c2f8d14524d59dd65d26ce5196efcc15d6d8e
2020-07-30Update language to comply with Android's inclusive language guidanceAleksei Kalinov
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
2020-05-20Add support for greylist-max-r signatures.Artur Satayev
Bug: 156307884 Test: m Change-Id: I66f8e48817d16bad5b306b91323bf0cdf42dbabe
2020-02-19Use argparse in merge_csv.py.Artur Satayev
- 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
2020-01-29Use py3 features in merge_csv.py.Artur Satayev
- 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
2020-01-10Make extract_package() work for toplevel classes.Tobias Thierer
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
2019-11-15Blacklist @TestApis by default.Artur Satayev
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
2019-05-01hiddenapi: Support greylist-max-qDavid Brazdil
Test: set maxTargetSdk=Q on an API, compiles, check hiddenapi-flags.csv Change-Id: I990972d652d4f4bc578592a9b3d9954f93b1ab9f
2019-04-01Automatically greylist code in 3P packagesAndrei Onea
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
2019-03-07Add extra hidden api related tagsAndrei Onea
@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-01Switch android.test and junit classes to use UnsupportedAppUsagePaul Duffin
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-01-19hiddenapi: Support 'core-platform-api' flagDavid Brazdil
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-19hiddenapi: Expect public/private API as CSVDavid Brazdil
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
2018-12-10Switch last c.a.i18n.phonenumbers hiddenapi entries to annotationsPaul Duffin
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-11-29hiddenapi: Add constants for 'greylist-max-p'David Brazdil
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-29Turn hidden API lists into a single CSVDavid Brazdil
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-29Prevent hiddenapi entries being added for libcore related projectsPaul Duffin
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-10-17Merge "Merge hidden API metadata into a single CSV file."Mathew Inwood
2018-10-16Fix issue with sort_api.shPaul Duffin
Should use -ne not -neq. Test: run script manually Bug: 115609023 Change-Id: I337ed43be1f9250e6c2b2c88d97c68a5c9e8941c
2018-10-16Merge hidden API metadata into a single CSV file.Mathew Inwood
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
2018-10-15Add new "max-sdk-p blacklist".Mathew Inwood
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
2018-09-21Add serialization methods to whitelist not light greylistPaul Duffin
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
2018-09-14Don't fail if there are no comments.Mathew Inwood
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
2018-09-11Revert "Check in P dark greylist, use it for hidden API list generation"David Brazdil
This reverts commit 3cc74c71ef907a76547424aea6597f7b2907e9fb. We saw app crashes due stricter classification of non-SDK APIs. Bug: 115284625 Bug: 113881436 Test: phone boots Change-Id: I689d0fbf66fabeffa5032e13f2f1f314c50b6cc5
2018-09-06Ignore comment lines in hidden api listsDavid Brazdil
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
2018-09-06Check in P dark greylist, use it for hidden API list generationDavid Brazdil
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
2018-08-30Rewrite hidden API list generation in PythonDavid Brazdil
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
2018-07-26Remove class2greylist from frameworks/base.Mathew Inwood
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
2018-07-25Update annotation name in class2greylist.Mathew Inwood
Annotation was added with name @UnsupportedAppUsage after Android API council discussion. Bug: 110868826 Test: m class2greylist Change-Id: I63ad61e97c5e8fdebfcead9e4ee5b060a60f97c7
2018-07-23Add new "class2greylist" tool.Mathew Inwood
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
2018-05-08Add presubmit hook for hidden API lists.David Brazdil
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)