summaryrefslogtreecommitdiff
path: root/openjdkjvmti
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2021-01-12 09:59:16 +0000
committerNicolas Geoffray <ngeoffray@google.com>2021-01-12 13:25:54 +0000
commit46d6fc0e16d65468aa259fadf27ddfeef72987b7 (patch)
treeda2cab50d7ed4037733656ebc656c64f33a5f4d2 /openjdkjvmti
parenta3a828d637507b8300aee6588f4c933a6b96973f (diff)
Revert "Add disable/get/set_hidden_api_enforcement_policy extensions"
This reverts commit c38d94449a0ccfefd396d2e01b571f3e804d9e48. Bug: 175329755 Reason for revert: Fails on redefine-stress Change-Id: Id3b4e504ebfe6b090b06b7f47a3896fe30cdf850
Diffstat (limited to 'openjdkjvmti')
-rw-r--r--openjdkjvmti/ti_class.cc35
-rw-r--r--openjdkjvmti/ti_class.h4
-rw-r--r--openjdkjvmti/ti_extension.cc52
3 files changed, 0 insertions, 91 deletions
diff --git a/openjdkjvmti/ti_class.cc b/openjdkjvmti/ti_class.cc
index 924a0d84d7..c22f38f576 100644
--- a/openjdkjvmti/ti_class.cc
+++ b/openjdkjvmti/ti_class.cc
@@ -56,7 +56,6 @@
#include "gc/heap.h"
#include "gc_root.h"
#include "handle.h"
-#include "hidden_api.h"
#include "jni/jni_env_ext-inl.h"
#include "jni/jni_internal.h"
#include "mirror/array-alloc-inl.h"
@@ -1138,38 +1137,4 @@ jvmtiError ClassUtil::GetSourceDebugExtension(jvmtiEnv* env,
return OK;
}
-jvmtiError ClassUtil::DisableHiddenApiEnforcementPolicy(jvmtiEnv* env) {
- return SetHiddenApiEnforcementPolicy(
- env, static_cast<jint>(art::hiddenapi::EnforcementPolicy::kDisabled));
-}
-
-jvmtiError ClassUtil::GetHiddenApiEnforcementPolicy(jvmtiEnv* env, jint* policy) {
- if (env == nullptr) {
- return ERR(INVALID_ENVIRONMENT);
- } else if (art::Thread::Current() == nullptr) {
- return ERR(UNATTACHED_THREAD);
- } else if (policy == nullptr) {
- return ERR(NULL_POINTER);
- }
- *policy = static_cast<jint>(art::Runtime::Current()->GetHiddenApiEnforcementPolicy());
- return OK;
-}
-
-jvmtiError ClassUtil::SetHiddenApiEnforcementPolicy(jvmtiEnv* env, jint policy) {
- if (env == nullptr) {
- return ERR(INVALID_ENVIRONMENT);
- } else if (art::Thread::Current() == nullptr) {
- return ERR(UNATTACHED_THREAD);
- } else if (policy < static_cast<jint>(art::hiddenapi::EnforcementPolicy::kDisabled) ||
- policy > static_cast<jint>(art::hiddenapi::EnforcementPolicy::kMax)) {
- JVMTI_LOG(INFO, env) << "Bad policy: " << policy << ", must be between "
- << static_cast<jint>(art::hiddenapi::EnforcementPolicy::kDisabled)
- << " and " << static_cast<jint>(art::hiddenapi::EnforcementPolicy::kMax);
- return ERR(ILLEGAL_ARGUMENT);
- }
- art::Runtime::Current()->SetHiddenApiEnforcementPolicy(
- static_cast<art::hiddenapi::EnforcementPolicy>(policy));
- return OK;
-}
-
} // namespace openjdkjvmti
diff --git a/openjdkjvmti/ti_class.h b/openjdkjvmti/ti_class.h
index 229a6ce546..7e427a06f2 100644
--- a/openjdkjvmti/ti_class.h
+++ b/openjdkjvmti/ti_class.h
@@ -93,10 +93,6 @@ class ClassUtil {
static jvmtiError GetSourceDebugExtension(jvmtiEnv* env,
jclass klass,
char** source_debug_extension_ptr);
-
- static jvmtiError DisableHiddenApiEnforcementPolicy(jvmtiEnv* env);
- static jvmtiError GetHiddenApiEnforcementPolicy(jvmtiEnv* env, jint* policy);
- static jvmtiError SetHiddenApiEnforcementPolicy(jvmtiEnv* env, jint policy);
};
} // namespace openjdkjvmti
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index 10ea43a1ee..dd68533523 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -509,58 +509,6 @@ jvmtiError ExtensionUtil::GetExtensionFunctions(jvmtiEnv* env,
if (error != ERR(NONE)) {
return error;
}
- // GetHiddenApiEnforcementPolicy
- error = add_extension(
- reinterpret_cast<jvmtiExtensionFunction>(ClassUtil::GetHiddenApiEnforcementPolicy),
- "com.android.art.misc.get_hidden_api_enforcement_policy",
- "Gets the current hiddenapi enforcement policy. Policy values are defined in"
- " `frameworks/base/core/java/android/content/pm/ApplicationInfo.java` as the"
- " HIDDEN_API_ENFORCEMENT_ static fields. See the comments in `art/runtime/hidden_api.h` for"
- " more information. This should be used with"
- " `com.android.art.misc.set_hidden_api_enforcement_policy` in order to restore the"
- " hidden-api state after temporarily toggling it.",
- {
- { "policy", JVMTI_KIND_OUT, JVMTI_TYPE_JINT, false },
- },
- {
- ERR(NULL_POINTER),
- });
- if (error != ERR(NONE)) {
- return error;
- }
- // SetHiddenApiEnforcementPolicy
- error = add_extension(
- reinterpret_cast<jvmtiExtensionFunction>(ClassUtil::SetHiddenApiEnforcementPolicy),
- "com.android.art.misc.set_hidden_api_enforcement_policy",
- "Sets the hiddenapi enforcement policy to the given value. Policy values are defined in"
- " `frameworks/base/core/java/android/content/pm/ApplicationInfo.java` as the"
- " HIDDEN_API_ENFORCEMENT_ static fields. See the comments in `art/runtime/hidden_api.h` for"
- " more information. This API should always be used sparingly and in conjunction with"
- " `com.android.art.misc.get_hidden_api_enforcement_policy` to temporarily toggle"
- " hidden-api on and off as changes are required.",
- {
- { "policy", JVMTI_KIND_IN, JVMTI_TYPE_JINT, false },
- },
- {
- ERR(ILLEGAL_ARGUMENT),
- });
- if (error != ERR(NONE)) {
- return error;
- }
- // DisableHiddenApiEnforcementPolicy
- error = add_extension(
- reinterpret_cast<jvmtiExtensionFunction>(ClassUtil::DisableHiddenApiEnforcementPolicy),
- "com.android.art.misc.disable_hidden_api_enforcement_policy",
- "Sets the hiddenapi enforcement policy to disabled. This API should always be"
- " used sparingly and in conjunction with"
- " `com.android.art.misc.get_hidden_api_enforcement_policy` and"
- " `com.android.art.misc.set_hidden_api_enforcement_policy` to temporarily"
- " toggle hidden-api on and off as changes are required.",
- {},
- {});
- if (error != ERR(NONE)) {
- return error;
- }
// Copy into output buffer.