summaryrefslogtreecommitdiff
path: root/openjdkjvmti/ti_extension.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2021-01-12 13:57:42 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2021-01-13 14:05:16 +0000
commit1a0e292b9bb60be76a666ca86046db1492a345d4 (patch)
tree5ba5d147ecb1733073e12ca040366aaa893d9d2f /openjdkjvmti/ti_extension.cc
parentf8567b535dcc4618f0ee76e5b8716d296681197b (diff)
Revert^2 "Add disable/get/set_hidden_api_enforcement_policy extensions"
This reverts commit 46d6fc0e16d65468aa259fadf27ddfeef72987b7. The test, 2038, is incompatible with redefine stress due to class redefinition disabling most hidden-api checks. This adds the appropriate skips to knownfailures.json. Reason for revert: Add 2038 to redefine-stress knownfailures.json Test: ./test.py --host --redefine-host Bug: 175329755 Change-Id: I6c8f0f6fc468db85368ecc9fbb2372677b529383
Diffstat (limited to 'openjdkjvmti/ti_extension.cc')
-rw-r--r--openjdkjvmti/ti_extension.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/openjdkjvmti/ti_extension.cc b/openjdkjvmti/ti_extension.cc
index dd68533523..10ea43a1ee 100644
--- a/openjdkjvmti/ti_extension.cc
+++ b/openjdkjvmti/ti_extension.cc
@@ -509,6 +509,58 @@ 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.