diff options
| -rw-r--r-- | runtime/native/dalvik_system_VMRuntime.cc | 5 | ||||
| -rw-r--r-- | test/674-hiddenapi/src-ex/ChildClass.java | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc index 9ba51c2026..12332d2c59 100644 --- a/runtime/native/dalvik_system_VMRuntime.cc +++ b/runtime/native/dalvik_system_VMRuntime.cc @@ -185,6 +185,10 @@ static jboolean VMRuntime_isNativeDebuggable(JNIEnv*, jobject) { return Runtime::Current()->IsNativeDebuggable(); } +static jboolean VMRuntime_isJavaDebuggable(JNIEnv*, jobject) { + return Runtime::Current()->IsJavaDebuggable(); +} + static jobjectArray VMRuntime_properties(JNIEnv* env, jobject) { DCHECK(WellKnownClasses::java_lang_String != nullptr); @@ -709,6 +713,7 @@ static JNINativeMethod gMethods[] = { NATIVE_METHOD(VMRuntime, getTargetHeapUtilization, "()F"), FAST_NATIVE_METHOD(VMRuntime, isDebuggerActive, "()Z"), FAST_NATIVE_METHOD(VMRuntime, isNativeDebuggable, "()Z"), + NATIVE_METHOD(VMRuntime, isJavaDebuggable, "()Z"), NATIVE_METHOD(VMRuntime, nativeSetTargetHeapUtilization, "(F)V"), FAST_NATIVE_METHOD(VMRuntime, newNonMovableArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"), FAST_NATIVE_METHOD(VMRuntime, newUnpaddedArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"), diff --git a/test/674-hiddenapi/src-ex/ChildClass.java b/test/674-hiddenapi/src-ex/ChildClass.java index d5966cde36..db3ba6d8bf 100644 --- a/test/674-hiddenapi/src-ex/ChildClass.java +++ b/test/674-hiddenapi/src-ex/ChildClass.java @@ -87,16 +87,21 @@ public class ChildClass { ChildClass.everythingWhitelisted = everythingWhitelisted; boolean isSameBoot = (isParentInBoot == isChildInBoot); + boolean isDebuggable = VMRuntime.getRuntime().isJavaDebuggable(); // Run meaningful combinations of access flags. for (Hiddenness hiddenness : Hiddenness.values()) { final Behaviour expected; // 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) { + if (isSameBoot || everythingWhitelisted || hiddenness == Hiddenness.Whitelist) { expected = Behaviour.Granted; - } else { + } else if (hiddenness == Hiddenness.Blacklist) { expected = Behaviour.Denied; + } else if (isDebuggable) { + expected = Behaviour.Warning; + } else { + expected = Behaviour.Granted; } for (boolean isStatic : booleanValues) { |