/libnativehelper/ |
D | JNIHelp.c | 52 static jmethodID FindMethod(JNIEnv* env, in FindMethod() argument 58 jclass clazz = (*env)->FindClass(env, className); in FindMethod() 59 jmethodID methodId = (*env)->GetMethodID(env, clazz, methodName, descriptor); in FindMethod() 60 (*env)->DeleteLocalRef(env, clazz); in FindMethod() 64 static bool AppendJString(JNIEnv* env, jstring text, struct ExpandableString* dst) { in AppendJString() argument 65 const char* utfText = (*env)->GetStringUTFChars(env, text, NULL); in AppendJString() 70 (*env)->ReleaseStringUTFChars(env, text, utfText); in AppendJString() 79 static bool GetExceptionSummary(JNIEnv* env, jthrowable thrown, struct ExpandableString* dst) { in GetExceptionSummary() argument 81 jclass exceptionClass = (*env)->GetObjectClass(env, thrown); // Always succeeds in GetExceptionSummary() 82 jmethodID getName = FindMethod(env, "java/lang/Class", "getName", "()Ljava/lang/String;"); in GetExceptionSummary() [all …]
|
D | JNIPlatformHelp.c | 23 static int GetBufferPosition(JNIEnv* env, jobject nioBuffer) { in GetBufferPosition() argument 24 return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_position(env)); in GetBufferPosition() 27 static int GetBufferLimit(JNIEnv* env, jobject nioBuffer) { in GetBufferLimit() argument 28 return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer_limit(env)); in GetBufferLimit() 31 static int GetBufferElementSizeShift(JNIEnv* env, jobject nioBuffer) { in GetBufferElementSizeShift() argument 32 return(*env)->GetIntField(env, nioBuffer, JniConstants_NioBuffer__elementSizeShift(env)); in GetBufferElementSizeShift() 35 jobject jniCreateFileDescriptor(JNIEnv* env, int fd) { in jniCreateFileDescriptor() argument 36 jobject fileDescriptor = (*env)->NewObject(env, in jniCreateFileDescriptor() 37 JniConstants_FileDescriptorClass(env), in jniCreateFileDescriptor() 38 JniConstants_FileDescriptor_init(env)); in jniCreateFileDescriptor() [all …]
|
D | file_descriptor_jni.c | 26 static void EnsureArgumentIsFileDescriptor(JNIEnv* env, jobject instance) { in EnsureArgumentIsFileDescriptor() argument 28 jclass jifd = JniConstants_FileDescriptorClass(env); in EnsureArgumentIsFileDescriptor() 29 ALOG_ALWAYS_FATAL_IF(!(*env)->IsInstanceOf(env, instance, jifd), in EnsureArgumentIsFileDescriptor() 33 JNIEXPORT _Nullable jobject AFileDescriptor_create(JNIEnv* env) { in AFileDescriptor_create() argument 34 return (*env)->NewObject(env, in AFileDescriptor_create() 35 JniConstants_FileDescriptorClass(env), in AFileDescriptor_create() 36 JniConstants_FileDescriptor_init(env)); in AFileDescriptor_create() 39 JNIEXPORT int AFileDescriptor_getFD(JNIEnv* env, jobject fileDescriptor) { in AFileDescriptor_getFD() argument 40 EnsureArgumentIsFileDescriptor(env, fileDescriptor); in AFileDescriptor_getFD() 41 return (*env)->GetIntField(env, fileDescriptor, JniConstants_FileDescriptor_descriptor(env)); in AFileDescriptor_getFD() [all …]
|
D | JniConstants.h | 31 jclass JniConstants_FileDescriptorClass(JNIEnv* env); 32 jclass JniConstants_NIOAccessClass(JNIEnv* env); 33 jclass JniConstants_NioBufferClass(JNIEnv* env); 41 jmethodID JniConstants_FileDescriptor_init(JNIEnv* env); 42 jmethodID JniConstants_NIOAccess_getBaseArray(JNIEnv* env); 43 jmethodID JniConstants_NIOAccess_getBaseArrayOffset(JNIEnv* env); 44 jmethodID JniConstants_NioBuffer_array(JNIEnv* env); 45 jmethodID JniConstants_NioBuffer_arrayOffset(JNIEnv* env); 53 jfieldID JniConstants_FileDescriptor_descriptor(JNIEnv* env); 54 jfieldID JniConstants_NioBuffer_address(JNIEnv* env); [all …]
|
D | JNIHelpCompat.c | 33 int jniGetFDFromFileDescriptor_QR(JNIEnv* env, jobject fileDescriptor) { in jniGetFDFromFileDescriptor_QR() argument 40 jclass fileDescriptorClass = (*env)->FindClass(env, "java/io/FileDescriptor"); in jniGetFDFromFileDescriptor_QR() 41 g_descriptorFieldID = (*env)->GetFieldID(env, fileDescriptorClass, "descriptor", "I"); in jniGetFDFromFileDescriptor_QR() 42 (*env)->DeleteLocalRef(env, fileDescriptorClass); in jniGetFDFromFileDescriptor_QR() 45 return (*env)->GetIntField(env, fileDescriptor, g_descriptorFieldID); in jniGetFDFromFileDescriptor_QR() 48 jint jniGetFDFromFileDescriptor(JNIEnv* env, jobject fileDescriptor) { in jniGetFDFromFileDescriptor() argument 49 return jniGetFDFromFileDescriptor_QR(env, fileDescriptor); in jniGetFDFromFileDescriptor()
|
D | JniConstants.c | 80 static jclass FindClass(JNIEnv* env, const char* signature, bool androidOnly) { 81 jclass cls = (*env)->FindClass(env, signature); 86 return (*env)->NewGlobalRef(env, cls); 89 static jmethodID FindMethod(JNIEnv* env, jclass cls, in FindMethod() argument 93 method = (*env)->GetStaticMethodID(env, cls, name, signature); in FindMethod() 95 method = (*env)->GetMethodID(env, cls, name, signature); in FindMethod() 101 static jfieldID FindField(JNIEnv* env, jclass cls, in FindField() argument 105 field = (*env)->GetStaticFieldID(env, cls, name, signature); in FindField() 107 field = (*env)->GetFieldID(env, cls, name, signature); in FindField() 138 void EnsureInitialized(JNIEnv* env) { in EnsureInitialized() argument [all …]
|
/libnativehelper/tests_mts/jni/ |
D | jni_helper_jni.cpp | 31 extern "C" int jniGetFDFromFileDescriptor_QR(JNIEnv* env, jobject fileDescriptor); 35 void AssertionError(JNIEnv* env, const char* format, ...) { in AssertionError() argument 45 ScopedLocalRef<jclass> jlaeClass(env, env->FindClass("java/lang/AssertionError")); in AssertionError() 47 env->GetMethodID(jlaeClass.get(), "<init>", "(Ljava/lang/String;Ljava/lang/Throwable;)V"); in AssertionError() 48 ScopedLocalRef<jstring> message(env, env->NewStringUTF(messageBuffer)); in AssertionError() 49 jobject jlae = env->NewObject(jlaeClass.get(), init, message.get(), nullptr); in AssertionError() 50 env->Throw(reinterpret_cast<jthrowable>(jlae)); in AssertionError() 53 static void throwException(JNIEnv* env, jclass /*clazz*/, jstring className, jstring message) { in throwException() argument 54 ScopedUtfChars c(env, className); in throwException() 55 ScopedUtfChars m(env, message); in throwException() [all …]
|
/libnativehelper/include/nativehelper/ |
D | JNIHelp.h | 43 int jniRegisterNativeMethods(C_JNIEnv* env, 62 int jniThrowException(C_JNIEnv* env, const char* className, const char* msg); 78 int jniThrowExceptionFmt(C_JNIEnv* env, const char* className, const char* fmt, va_list args); 83 int jniThrowNullPointerException(C_JNIEnv* env, const char* msg); 88 int jniThrowRuntimeException(C_JNIEnv* env, const char* msg); 93 int jniThrowIOException(C_JNIEnv* env, int errnum); 98 jobject jniGetReferent(C_JNIEnv* env, jobject ref); 104 jstring jniCreateString(C_JNIEnv* env, const jchar* unicodeChars, jsize len); 113 jobjectArray jniCreateStringArray(C_JNIEnv* env, size_t count); 119 void jniLogException(C_JNIEnv* env, int priority, const char* tag, jthrowable exception); [all …]
|
D | toStringArray.h | 28 jobjectArray toStringArray(JNIEnv* env, size_t count, StringVisitor&& visitor) { in toStringArray() argument 29 C_JNIEnv* c_env = static_cast<C_JNIEnv*>(&env->functions); in toStringArray() 30 ScopedLocalRef<jobjectArray> result(env, jniCreateStringArray(c_env, count)); in toStringArray() 35 ScopedLocalRef<jstring> s(env, env->NewStringUTF(visitor(i))); in toStringArray() 36 if (env->ExceptionCheck()) { in toStringArray() 39 env->SetObjectArrayElement(result.get(), i, s.get()); in toStringArray() 40 if (env->ExceptionCheck()) { in toStringArray() 47 inline jobjectArray toStringArray(JNIEnv* env, const std::vector<std::string>& strings) { in toStringArray() argument 48 return toStringArray(env, strings.size(), [&strings](size_t i) { return strings[i].c_str(); }); in toStringArray() 51 inline jobjectArray toStringArray(JNIEnv* env, const char* const* strings) { in toStringArray() argument [all …]
|
D | JNIHelpCompat.h | 52 int jniGetFDFromFileDescriptor(C_JNIEnv* env, jobject fileDescriptor); 74 int jniGetFDFromFileDescriptor_QR(C_JNIEnv* env, jobject fileDescriptor); 84 inline int jniGetFDFromFileDescriptor(JNIEnv* env, jobject fileDescriptor) { in jniGetFDFromFileDescriptor() argument 85 return jniGetFDFromFileDescriptor(&env->functions, fileDescriptor); in jniGetFDFromFileDescriptor() 88 inline int jniGetFDFromFileDescriptor_QR(JNIEnv* env, jobject fileDescriptor) { in jniGetFDFromFileDescriptor_QR() argument 89 return jniGetFDFromFileDescriptor_QR(&env->functions, fileDescriptor); in jniGetFDFromFileDescriptor_QR()
|
/libnativehelper/include_platform/nativehelper/ |
D | JNIPlatformHelp.h | 36 jobject jniCreateFileDescriptor(C_JNIEnv* env, int fd); 41 int jniGetFDFromFileDescriptor(C_JNIEnv* env, jobject fileDescriptor); 47 void jniSetFileDescriptorOfFD(C_JNIEnv* env, jobject fileDescriptor, int value); 56 jarray jniGetNioBufferBaseArray(C_JNIEnv* env, jobject nioBuffer); 66 jint jniGetNioBufferBaseArrayOffset(C_JNIEnv* env, jobject nioBuffer); 76 jlong jniGetNioBufferFields(C_JNIEnv* env, 90 jlong jniGetNioBufferPointer(C_JNIEnv* env, jobject nioBuffer); 105 inline jobject jniCreateFileDescriptor(JNIEnv* env, int fd) { in jniCreateFileDescriptor() argument 106 return jniCreateFileDescriptor(&env->functions, fd); in jniCreateFileDescriptor() 109 inline int jniGetFDFromFileDescriptor(JNIEnv* env, jobject fileDescriptor) { in jniGetFDFromFileDescriptor() argument [all …]
|
/libnativehelper/header_only_include/nativehelper/ |
D | nativehelper_utils.h | 32 static inline int jniThrowNullPointerException(JNIEnv* env) { in jniThrowNullPointerException() argument 33 if (env->ExceptionCheck()) { in jniThrowNullPointerException() 35 env->ExceptionClear(); in jniThrowNullPointerException() 38 jclass e_class = env->FindClass("java/lang/NullPointerException"); in jniThrowNullPointerException() 43 if (env->ThrowNew(e_class, nullptr) != JNI_OK) { in jniThrowNullPointerException() 44 env->DeleteLocalRef(e_class); in jniThrowNullPointerException() 48 env->DeleteLocalRef(e_class); in jniThrowNullPointerException()
|
D | scoped_bytes.h | 32 ScopedBytes(JNIEnv* env, jobject object) in ScopedBytes() argument 33 : mEnv(env), mObject(object), mByteArray(nullptr), mPtr(nullptr) in ScopedBytes() 38 jclass byteArrayClass = env->FindClass("[B"); in ScopedBytes() 69 ScopedBytesRO(JNIEnv* env, jobject object) : ScopedBytes<true>(env, object) {} in ScopedBytesRO() argument 77 ScopedBytesRW(JNIEnv* env, jobject object) : ScopedBytes<false>(env, object) {} in ScopedBytesRW() argument
|
D | scoped_string_chars.h | 36 ScopedStringChars(JNIEnv* env, jstring s) : env_(env), string_(s), size_(0) { in ScopedStringChars() argument 39 jniThrowNullPointerException(env); in ScopedStringChars() 41 chars_ = env->GetStringChars(string_, nullptr); in ScopedStringChars() 43 size_ = env->GetStringLength(string_); in ScopedStringChars()
|
D | scoped_local_ref.h | 29 ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) { in ScopedLocalRef() argument 35 explicit ScopedLocalRef(JNIEnv* env) : mEnv(env), mLocalRef(nullptr) { in ScopedLocalRef() argument
|
D | scoped_utf_chars.h | 37 ScopedUtfChars(JNIEnv* env, jstring s) : env_(env), string_(s) { in ScopedUtfChars() argument 40 jniThrowNullPointerException(env); in ScopedUtfChars() 42 utf_chars_ = env->GetStringUTFChars(s, nullptr); in ScopedUtfChars()
|
D | scoped_primitive_array.h | 44 explicit Scoped ## NAME ## ArrayRO(JNIEnv* env) \ 45 : mEnv(env), mJavaArray(nullptr), mRawArray(nullptr), mSize(0) {} \ 46 Scoped ## NAME ## ArrayRO(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \ 47 : mEnv(env) { \ 104 explicit Scoped ## NAME ## ArrayRW(JNIEnv* env) \ 105 : mEnv(env), mJavaArray(nullptr), mRawArray(nullptr) {} \ 106 Scoped ## NAME ## ArrayRW(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \ 107 : mEnv(env), mJavaArray(javaArray), mRawArray(nullptr) { \
|
D | scoped_local_frame.h | 25 explicit ScopedLocalFrame(JNIEnv* env) : mEnv(env) { in ScopedLocalFrame() argument
|
/libnativehelper/tests/ |
D | scoped_bytes_test.cpp | 21 void TestCompilationScopedBytesRO(JNIEnv* env) { in TestCompilationScopedBytesRO() argument 23 ScopedBytesRO sb(env, o); in TestCompilationScopedBytesRO() 27 void TestCompilationScopedBytesRW(JNIEnv* env) { in TestCompilationScopedBytesRW() argument 29 ScopedBytesRW sb(env, o); in TestCompilationScopedBytesRW()
|
D | scoped_primitive_array_test.cpp | 21 void TestScopedPrimitiveArrayRO(JNIEnv* env, jbooleanArray array) { in TestScopedPrimitiveArrayRO() argument 22 ScopedBooleanArrayRO sba(env, array); in TestScopedPrimitiveArrayRO() 28 void TestCompilationRW(JNIEnv* env, jintArray array) { in TestCompilationRW() argument 29 ScopedIntArrayRW sba(env, array); in TestCompilationRW()
|
D | scoped_local_frame_test.cpp | 21 void TestScopedLocalFrame(JNIEnv* env) { in TestScopedLocalFrame() argument 22 ScopedLocalFrame slf(env); in TestScopedLocalFrame()
|
D | scoped_utf_chars_test.cpp | 21 void TestCompilationScopedUtfChars(JNIEnv* env, jstring s) { in TestCompilationScopedUtfChars() argument 22 ScopedUtfChars suc(env, s); in TestCompilationScopedUtfChars()
|
D | scoped_local_ref_test.cpp | 21 void TestScopedLocalRef(JNIEnv* env) { in TestScopedLocalRef() argument 22 ScopedLocalRef<jarray> slr1(env); in TestScopedLocalRef()
|
/libnativehelper/include/android/ |
D | file_descriptor_jni.h | 50 jobject AFileDescriptor_create(JNIEnv* env) __INTRODUCED_IN(31); 65 int AFileDescriptor_getFD(JNIEnv* env, jobject fileDescriptor) __INTRODUCED_IN(31); 82 void AFileDescriptor_setFD(JNIEnv* env, jobject fileDescriptor, int fd) __INTRODUCED_IN(31);
|
/libnativehelper/tests/jni_gtest/base/nativehelper/ |
D | jni_gtest.h | 102 void DestroyJNIEnv(JNIEnv* env) { in DestroyJNIEnv() argument 103 delete env->functions; in DestroyJNIEnv() 104 delete env; in DestroyJNIEnv() local
|