summaryrefslogtreecommitdiff
path: root/libartbase/base/hiddenapi_flags.h
diff options
context:
space:
mode:
author Artur Satayev <satayev@google.com> 2019-10-31 14:59:26 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2019-11-07 15:23:32 +0000
commit267366ca19e7b71a63d3c4a02976cc56a6e58adc (patch)
tree063ef118f770096ac667f5b4c7d22b75693896c0 /libartbase/base/hiddenapi_flags.h
parentfa2b2d35255515accd0aa69193aa5e72b009e38e (diff)
Only allow access to @TestApi signatures in instrumented processes.
Note that the check is for "pure" @TestApi signatures, i.e. those that are on blacklist. If the signature is also annotated with @SystemApi or @UnsupportedApiUsage then it would not be on blacklist. Bug: 133832325 Test: manual Change-Id: I546fb42495331efd638d9def924ef33da0c80182
Diffstat (limited to 'libartbase/base/hiddenapi_flags.h')
-rw-r--r--libartbase/base/hiddenapi_flags.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libartbase/base/hiddenapi_flags.h b/libartbase/base/hiddenapi_flags.h
index cd0bc7578c..a9a903b71f 100644
--- a/libartbase/base/hiddenapi_flags.h
+++ b/libartbase/base/hiddenapi_flags.h
@@ -290,6 +290,16 @@ class ApiList {
// Returns true when no ApiList is specified and no domain_api flags either.
bool IsEmpty() const { return (GetValue() == Value::kInvalid) && (GetDomainApis() == 0); }
+ // Returns true if the ApiList is on blacklist.
+ bool IsBlacklisted() const {
+ return GetValue() == Value::kBlacklist;
+ }
+
+ // Returns true if the ApiList is a test API.
+ bool IsTestApi() const {
+ return helper::MatchesBitMask(helper::ToBit(DomainApi::kTestApi), dex_flags_);
+ }
+
// Returns the maximum target SDK version allowed to access this ApiList.
SdkVersion GetMaxAllowedSdkVersion() const { return kMaxSdkVersions[GetIntValue()]; }