diff options
author | 2024-10-31 17:44:48 +0000 | |
---|---|---|
committer | 2025-01-28 00:46:55 -0800 | |
commit | b3ca9f3c87bc935ae56e7647c91e2158971fb47d (patch) | |
tree | 6675a899ee6dbfe899c3c360867245ac2c996b6f /runtime/hidden_api_test.cc | |
parent | 162e2634caca054659a829df1040ee052b900c34 (diff) |
Log info about the caller and callee in hiddenapi denial messages.
If enforcement is enabled then log as error instead of warning.
Also add "hiddenapi:" prefix to all log messages to make it easier to
search for them.
Test: Boot and check errors in logcat
Test: 674-hiddenapi 690-hiddenapi-same-name-methods 691-hiddenapi-proxy
817-hiddenapi 822-hiddenapi-future 999-redefine-hiddenapi
2038-hiddenapi-jvmti-ext 2270-mh-internal-hiddenapi-use
on host and target
Bug: 377676642
Change-Id: Ib4f790d7ab4850d398639c64f55be0d14c5c0408
Diffstat (limited to 'runtime/hidden_api_test.cc')
-rw-r--r-- | runtime/hidden_api_test.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/hidden_api_test.cc b/runtime/hidden_api_test.cc index 444ad0bd48..28f1d28c1f 100644 --- a/runtime/hidden_api_test.cc +++ b/runtime/hidden_api_test.cc @@ -188,11 +188,17 @@ class HiddenApiTest : public CommonRuntimeTest { } bool ShouldDenyAccess(hiddenapi::ApiList list) REQUIRES_SHARED(Locks::mutator_lock_) { + // This is only used for log messages, so its state doesn't matter. + const hiddenapi::AccessContext placeholder_context(/* is_trusted= */ false); + // Choose parameters such that there are no side effects (AccessMethod::kNone) // and that the member is not on the exemptions list (here we choose one which // is not even in boot class path). return ShouldDenyAccessToMemberImpl(/* member= */ class1_field1_, list, + /* runtime_flags= */ 0, + /* caller_context= */ placeholder_context, + /* callee_context= */ placeholder_context, /* access_method= */ hiddenapi::AccessMethod::kNone); } |