summaryrefslogtreecommitdiff
path: root/tools/hiddenapi/generate_hiddenapi_lists.py
AgeCommit message (Collapse)Author
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
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-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-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-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-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-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