Merge "Move jniGetReferent to its only user (framework)." am: a1cf11bf2c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1437075

Change-Id: I4cdd07b387f19ac6b1777194767e68123c362bef
This commit is contained in:
Nicolas Geoffray
2020-09-28 16:58:19 +00:00
committed by Automerger Merge Worker

View File

@@ -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.