summaryrefslogtreecommitdiff
path: root/runtime/hidden_api_test.cc
diff options
context:
space:
mode:
author David Brazdil <dbrazdil@google.com> 2019-01-09 10:04:45 +0000
committer David Brazdil <dbrazdil@google.com> 2019-01-09 10:04:45 +0000
commitc5a96e4a8ea9f78135c5cd3df7e1fc965104182e (patch)
tree662506a68d056c382f6882b65bb28dd3f09366d7 /runtime/hidden_api_test.cc
parent5d938ef154f504ada9c8fc9c9361fe69aabbe8b9 (diff)
Do not enter hidden API slow path when policy==Disabled
After a recent refactor the hidden API access check logic would enter slow path when the enforcement policy is set to kDisabled. This did not affect correctness but could have a performance impact. Moreover, a debuggable process would see logcat warnings printed for every such access despite it being granted. This caused occasional logcat buffer overflows in killswitch CTS tests and their resulting flakiness. The patch exits from ShouldDenyAccessToMember early if policy is kDisabled and adds a DCHECK in ShouldDenyAccessToMemberImpl to assert slow path is not entered under the policy. Test: m test-art-host-gtest-hidden_api_test Change-Id: I217d9914d2645af11ce84c03a0ed778a82bc760f
Diffstat (limited to 'runtime/hidden_api_test.cc')
-rw-r--r--runtime/hidden_api_test.cc7
1 files changed, 0 insertions, 7 deletions
diff --git a/runtime/hidden_api_test.cc b/runtime/hidden_api_test.cc
index 595f0779e2..1f83c052eb 100644
--- a/runtime/hidden_api_test.cc
+++ b/runtime/hidden_api_test.cc
@@ -100,13 +100,6 @@ class HiddenApiTest : public CommonRuntimeTest {
TEST_F(HiddenApiTest, CheckGetActionFromRuntimeFlags) {
ScopedObjectAccess soa(self_);
- runtime_->SetHiddenApiEnforcementPolicy(hiddenapi::EnforcementPolicy::kDisabled);
- ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::Whitelist()), false);
- ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::Greylist()), false);
- ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::GreylistMaxP()), false);
- ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::GreylistMaxO()), false);
- ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::Blacklist()), false);
-
runtime_->SetHiddenApiEnforcementPolicy(hiddenapi::EnforcementPolicy::kJustWarn);
ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::Whitelist()), false);
ASSERT_EQ(ShouldDenyAccess(hiddenapi::ApiList::Greylist()), false);