diff options
| author | 2020-09-28 18:39:06 +0000 | |
|---|---|---|
| committer | 2020-09-28 18:39:06 +0000 | |
| commit | f76a30ec4ce57da3edc5036243a397693d9ce8ab (patch) | |
| tree | b290aa34a66be64926f5a657e92f88f66f644428 | |
| parent | 9e6e2bec8f660ecc5cf6d0186a5c652eddfae9b2 (diff) | |
| parent | d46e1f5aff4d76499564a9e544ab1639b83d22c7 (diff) | |
Merge "Move jniGetReferent to its only user (framework)." am: a1cf11bf2c am: ef69882388 am: 1c3e4e38df am: 919eb49bfa am: d46e1f5aff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1437075
Change-Id: I7518562dbecaf49389f65a9288f5be234a760772
| -rw-r--r-- | core/jni/core_jni_helpers.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/jni/core_jni_helpers.h b/core/jni/core_jni_helpers.h index d629e0dae6dd..013c65faa241 100644 --- a/core/jni/core_jni_helpers.h +++ b/core/jni/core_jni_helpers.h @@ -90,6 +90,12 @@ static inline int RegisterMethodsOrDie(JNIEnv* env, const char* className, return res; } +static inline jobject jniGetReferent(JNIEnv* env, jobject ref) { + jclass cls = FindClassOrDie(env, "java/lang/ref/Reference"); + jmethodID get = GetMethodIDOrDie(env, cls, "get", "()Ljava/lang/Object;"); + return env->CallObjectMethod(ref, get); +} + /** * Read the specified field from jobject, and convert to std::string. * If the field cannot be obtained, return defaultValue. |