diff options
| -rw-r--r-- | runtime/hidden_api.cc | 8 | ||||
| -rw-r--r-- | test/674-hiddenapi/src-ex/ChildClass.java | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/runtime/hidden_api.cc b/runtime/hidden_api.cc index ee518ae1ea..e41d1d3eb9 100644 --- a/runtime/hidden_api.cc +++ b/runtime/hidden_api.cc @@ -40,7 +40,7 @@ namespace hiddenapi { // Note that when flipping this flag, you must also update the expectations of test 674-hiddenapi // as it affects whether or not we warn for light grey APIs that have been added to the exemptions // list. -static constexpr bool kLogAllAccesses = true; +static constexpr bool kLogAllAccesses = false; static inline std::ostream& operator<<(std::ostream& os, AccessMethod value) { switch (value) { @@ -219,7 +219,8 @@ Action GetMemberActionImpl(T* member, // - for non-debuggable apps, there is no distinction between light grey & whitelisted APIs. // - we want to avoid the overhead of checking for exemptions for light greylisted APIs whenever // possible. - if (kLogAllAccesses || action == kDeny || runtime->IsJavaDebuggable()) { + const bool shouldWarn = kLogAllAccesses || runtime->IsJavaDebuggable(); + if (shouldWarn || action == kDeny) { if (member_signature.IsExempted(runtime->GetHiddenApiExemptions())) { action = kAllow; // Avoid re-examining the exemption list next time. @@ -260,7 +261,8 @@ Action GetMemberActionImpl(T* member, MaybeWhitelistMember(runtime, member); // If this action requires a UI warning, set the appropriate flag. - if (action == kAllowButWarnAndToast || runtime->ShouldAlwaysSetHiddenApiWarningFlag()) { + if (shouldWarn && + (action == kAllowButWarnAndToast || runtime->ShouldAlwaysSetHiddenApiWarningFlag())) { runtime->SetPendingHiddenApiWarning(true); } } diff --git a/test/674-hiddenapi/src-ex/ChildClass.java b/test/674-hiddenapi/src-ex/ChildClass.java index 0349e8fe46..d5966cde36 100644 --- a/test/674-hiddenapi/src-ex/ChildClass.java +++ b/test/674-hiddenapi/src-ex/ChildClass.java @@ -91,12 +91,12 @@ public class ChildClass { // Run meaningful combinations of access flags. for (Hiddenness hiddenness : Hiddenness.values()) { final Behaviour expected; - if (isSameBoot || hiddenness == Hiddenness.Whitelist || everythingWhitelisted) { + // Warnings are now disabled whenever access is granted, even for + // greylisted APIs. This is the behaviour for release builds. + if (isSameBoot || hiddenness != Hiddenness.Blacklist || everythingWhitelisted) { expected = Behaviour.Granted; - } else if (hiddenness == Hiddenness.Blacklist) { - expected = Behaviour.Denied; } else { - expected = Behaviour.Warning; + expected = Behaviour.Denied; } for (boolean isStatic : booleanValues) { |