Plumb @TestApi enforcement policy to runtime.
By default access to test APIs would be allowed for instrumented processes only.
Bug: 133832325
Test: manual
Change-Id: Iaa68447c88304b062025c96e8b863a0758b78add
diff --git a/runtime/runtime.h b/runtime/runtime.h
index d71123d..cfa67a8 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -601,6 +601,14 @@
return core_platform_api_policy_;
}
+ void SetTestApiEnforcementPolicy(hiddenapi::EnforcementPolicy policy) {
+ test_api_policy_ = policy;
+ }
+
+ hiddenapi::EnforcementPolicy GetTestApiEnforcementPolicy() const {
+ return test_api_policy_;
+ }
+
void SetHiddenApiExemptions(const std::vector<std::string>& exemptions) {
hidden_api_exemptions_ = exemptions;
}
@@ -1218,6 +1226,9 @@
// Whether access checks on core platform API should be performed.
hiddenapi::EnforcementPolicy core_platform_api_policy_;
+ // Whether access checks on test API should be performed.
+ hiddenapi::EnforcementPolicy test_api_policy_;
+
// List of signature prefixes of methods that have been removed from the blacklist, and treated
// as if whitelisted.
std::vector<std::string> hidden_api_exemptions_;