diff options
| author | 2019-10-31 12:12:00 +0000 | |
|---|---|---|
| committer | 2019-11-15 16:54:14 +0000 | |
| commit | 44036a76899fbc44cc367dd763c1496e1e60899c (patch) | |
| tree | c27d2bda06151e8eeae7098a3db7bb3957064a19 | |
| parent | 1695301cc944259d6df9589b6b51189d145dd62d (diff) | |
Blacklist @TestApis by default.
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
| -rwxr-xr-x | tools/hiddenapi/generate_hiddenapi_lists.py | 2 | ||||
| -rwxr-xr-x | tools/hiddenapi/generate_hiddenapi_lists_test.py | 18 |
2 files changed, 13 insertions, 7 deletions
diff --git a/tools/hiddenapi/generate_hiddenapi_lists.py b/tools/hiddenapi/generate_hiddenapi_lists.py index e883c6bed755..46105f4d66b0 100755 --- a/tools/hiddenapi/generate_hiddenapi_lists.py +++ b/tools/hiddenapi/generate_hiddenapi_lists.py @@ -241,8 +241,6 @@ class FlagsDict: flags = csv[1:] if (FLAG_PUBLIC_API in flags) or (FLAG_SYSTEM_API in flags): flags.append(FLAG_WHITELIST) - elif FLAG_TEST_API in flags: - flags.append(FLAG_GREYLIST) self._dict[csv[0]].update(flags) def assign_flag(self, flag, apis, source="<unknown>"): diff --git a/tools/hiddenapi/generate_hiddenapi_lists_test.py b/tools/hiddenapi/generate_hiddenapi_lists_test.py index 4dc880b107d3..55c3a7d718db 100755 --- a/tools/hiddenapi/generate_hiddenapi_lists_test.py +++ b/tools/hiddenapi/generate_hiddenapi_lists_test.py @@ -53,14 +53,22 @@ class TestHiddenapiListGeneration(unittest.TestCase): # Test new additions. flags.parse_and_merge_csv([ 'A,' + FLAG_GREYLIST, - 'B,' + FLAG_BLACKLIST + ',' + FLAG_GREYLIST_MAX_O ]) - self.assertEqual(flags.generate_csv(), - [ 'A,' + FLAG_GREYLIST, - 'B,' + FLAG_BLACKLIST + "," + FLAG_GREYLIST_MAX_O ]) + 'B,' + FLAG_BLACKLIST + ',' + FLAG_GREYLIST_MAX_O, + 'C,' + FLAG_SYSTEM_API + ',' + FLAG_WHITELIST, + 'D,' + FLAG_GREYLIST+ ',' + FLAG_TEST_API, + 'E,' + FLAG_BLACKLIST+ ',' + FLAG_TEST_API, + ]) + self.assertEqual(flags.generate_csv(), [ + 'A,' + FLAG_GREYLIST, + 'B,' + FLAG_BLACKLIST + "," + FLAG_GREYLIST_MAX_O, + 'C,' + FLAG_SYSTEM_API + ',' + FLAG_WHITELIST, + 'D,' + FLAG_GREYLIST+ ',' + FLAG_TEST_API, + 'E,' + FLAG_BLACKLIST+ ',' + FLAG_TEST_API, + ]) # Test unknown flag. with self.assertRaises(AssertionError): - flags.parse_and_merge_csv([ 'C,foo' ]) + flags.parse_and_merge_csv([ 'Z,foo' ]) def test_assign_flag(self): flags = FlagsDict() |