Home | History | Annotate | Download | only in jni

Lines Matching refs:env

78 MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) {
79 return (MtpDatabase *)env->GetIntField(database, field_context);
92 MyMtpDatabase(JNIEnv *env, jobject client);
94 void cleanup(JNIEnv *env);
175 static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) {
176 if (env->ExceptionCheck()) {
178 LOGE_EX(env);
179 env->ExceptionClear();
185 MyMtpDatabase::MyMtpDatabase(JNIEnv *env, jobject client)
186 : mDatabase(env->NewGlobalRef(client)),
193 jintArray intArray = env->NewIntArray(3);
197 mIntBuffer = (jintArray)env->NewGlobalRef(intArray);
198 jlongArray longArray = env->NewLongArray(2);
202 mLongBuffer = (jlongArray)env->NewGlobalRef(longArray);
203 jcharArray charArray = env->NewCharArray(256);
207 mStringBuffer = (jcharArray)env->NewGlobalRef(charArray);
210 void MyMtpDatabase::cleanup(JNIEnv *env) {
211 env->DeleteGlobalRef(mDatabase);
212 env->DeleteGlobalRef(mIntBuffer);
213 env->DeleteGlobalRef(mLongBuffer);
214 env->DeleteGlobalRef(mStringBuffer);
226 JNIEnv* env = AndroidRuntime::getJNIEnv();
227 jstring pathStr = env->NewStringUTF(path);
228 MtpObjectHandle result = env->CallIntMethod(mDatabase, method_beginSendObject,
233 env->DeleteLocalRef(pathStr);
234 checkAndClearExceptionFromCallback(env, __FUNCTION__);
240 JNIEnv* env = AndroidRuntime::getJNIEnv();
241 jstring pathStr = env->NewStringUTF(path);
242 env->CallVoidMethod(mDatabase, method_endSendObject, pathStr,
246 env->DeleteLocalRef(pathStr);
247 checkAndClearExceptionFromCallback(env, __FUNCTION__);
253 JNIEnv* env = AndroidRuntime::getJNIEnv();
254 jintArray array = (jintArray)env->CallObjectMethod(mDatabase, method_getObjectList,
259 jint* handles = env->GetIntArrayElements(array, 0);
260 jsize length = env->GetArrayLength(array);
263 env->ReleaseIntArrayElements(array, handles, 0);
264 env->DeleteLocalRef(array);
266 checkAndClearExceptionFromCallback(env, __FUNCTION__);
273 JNIEnv* env = AndroidRuntime::getJNIEnv();
274 int result = env->CallIntMethod(mDatabase, method_getNumObjects,
277 checkAndClearExceptionFromCallback(env, __FUNCTION__);
282 JNIEnv* env = AndroidRuntime::getJNIEnv();
283 jintArray array = (jintArray)env->CallObjectMethod(mDatabase,
288 jint* formats = env->GetIntArrayElements(array, 0);
289 jsize length = env->GetArrayLength(array);
292 env->ReleaseIntArrayElements(array, formats, 0);
293 env->DeleteLocalRef(array);
295 checkAndClearExceptionFromCallback(env, __FUNCTION__);
300 JNIEnv* env = AndroidRuntime::getJNIEnv();
301 jintArray array = (jintArray)env->CallObjectMethod(mDatabase,
306 jint* formats = env->GetIntArrayElements(array, 0);
307 jsize length = env->GetArrayLength(array);
310 env->ReleaseIntArrayElements(array, formats, 0);
311 env->DeleteLocalRef(array);
313 checkAndClearExceptionFromCallback(env, __FUNCTION__);
318 JNIEnv* env = AndroidRuntime::getJNIEnv();
319 jintArray array = (jintArray)env->CallObjectMethod(mDatabase,
324 jint* properties = env->GetIntArrayElements(array, 0);
325 jsize length = env->GetArrayLength(array);
328 env->ReleaseIntArrayElements(array, properties, 0);
329 env->DeleteLocalRef(array);
331 checkAndClearExceptionFromCallback(env, __FUNCTION__);
336 JNIEnv* env = AndroidRuntime::getJNIEnv();
337 jintArray array = (jintArray)env->CallObjectMethod(mDatabase,
342 jint* properties = env->GetIntArrayElements(array, 0);
343 jsize length = env->GetArrayLength(array);
346 env->ReleaseIntArrayElements(array, properties, 0);
347 env->DeleteLocalRef(array);
349 checkAndClearExceptionFromCallback(env, __FUNCTION__);
356 JNIEnv* env = AndroidRuntime::getJNIEnv();
357 jobject list = env->CallObjectMethod(mDatabase, method_getObjectPropertyList,
359 MtpResponseCode result = env->GetIntField(list, field_mResult);
360 int count = env->GetIntField(list, field_mCount);
365 jintArray objectHandlesArray = (jintArray)env->GetObjectField(list, field_mObjectHandles);
366 jintArray propertyCodesArray = (jintArray)env->GetObjectField(list, field_mPropertyCodes);
367 jintArray dataTypesArray = (jintArray)env->GetObjectField(list, field_mDataTypes);
368 jlongArray longValuesArray = (jlongArray)env->GetObjectField(list, field_mLongValues);
369 jobjectArray stringValuesArray = (jobjectArray)env->GetObjectField(list, field_mStringValues);
371 jint* objectHandles = env->GetIntArrayElements(objectHandlesArray, 0);
372 jint* propertyCodes = env->GetIntArrayElements(propertyCodesArray, 0);
373 jint* dataTypes = env->GetIntArrayElements(dataTypesArray, 0);
374 jlong* longValues = (longValuesArray ? env->GetLongArrayElements(longValuesArray, 0) : NULL);
428 jstring stringValue = (jstring)env->GetObjectArrayElement(stringValuesArray, 0);
430 const char* str = env->GetStringUTFChars(stringValue, NULL);
435 env->ReleaseStringUTFChars(stringValue, str);
446 env->ReleaseIntArrayElements(objectHandlesArray, objectHandles, 0);
447 env->ReleaseIntArrayElements(propertyCodesArray, propertyCodes, 0);
448 env->ReleaseIntArrayElements(dataTypesArray, dataTypes, 0);
450 env->ReleaseLongArrayElements(longValuesArray, longValues, 0);
452 env->DeleteLocalRef(objectHandlesArray);
453 env->DeleteLocalRef(propertyCodesArray);
454 env->DeleteLocalRef(dataTypesArray);
456 env->DeleteLocalRef(longValuesArray);
458 env->DeleteLocalRef(stringValuesArray);
461 env->DeleteLocalRef(list);
462 checkAndClearExceptionFromCallback(env, __FUNCTION__);
474 JNIEnv* env = AndroidRuntime::getJNIEnv();
507 stringValue = env->NewStringUTF((const char *)buffer);
515 jint result = env->CallIntMethod(mDatabase, method_setObjectProperty,
518 env->DeleteLocalRef(stringValue);
520 checkAndClearExceptionFromCallback(env, __FUNCTION__);
531 JNIEnv* env = AndroidRuntime::getJNIEnv();
532 jint result = env->CallIntMethod(mDatabase, method_getDeviceProperty,
535 checkAndClearExceptionFromCallback(env, __FUNCTION__);
539 jlong* longValues = env->GetLongArrayElements(mLongBuffer, 0);
541 env->ReleaseLongArrayElements(mLongBuffer, longValues, 0);
576 jchar* str = env->GetCharArrayElements(mStringBuffer, 0);
578 env->ReleaseCharArrayElements(mStringBuffer, str, 0);
586 checkAndClearExceptionFromCallback(env, __FUNCTION__);
597 JNIEnv* env = AndroidRuntime::getJNIEnv();
630 stringValue = env->NewStringUTF((const char *)buffer);
638 jint result = env->CallIntMethod(mDatabase, method_setDeviceProperty,
641 env->DeleteLocalRef(stringValue);
643 checkAndClearExceptionFromCallback(env, __FUNCTION__);
655 JNIEnv* env = AndroidRuntime::getJNIEnv();
656 jobject list = env->CallObjectMethod(mDatabase, method_getObjectPropertyList,
658 checkAndClearExceptionFromCallback(env, __FUNCTION__);
661 int count = env->GetIntField(list, field_mCount);
662 MtpResponseCode result = env->GetIntField(list, field_mResult);
666 jintArray objectHandlesArray = (jintArray)env->GetObjectField(list, field_mObjectHandles);
667 jintArray propertyCodesArray = (jintArray)env->GetObjectField(list, field_mPropertyCodes);
668 jintArray dataTypesArray = (jintArray)env->GetObjectField(list, field_mDataTypes);
669 jlongArray longValuesArray = (jlongArray)env->GetObjectField(list, field_mLongValues);
670 jobjectArray stringValuesArray = (jobjectArray)env->GetObjectField(list, field_mStringValues);
672 jint* objectHandles = env->GetIntArrayElements(objectHandlesArray, 0);
673 jint* propertyCodes = env->GetIntArrayElements(propertyCodesArray, 0);
674 jint* dataTypes = env->GetIntArrayElements(dataTypesArray, 0);
675 jlong* longValues = (longValuesArray ? env->GetLongArrayElements(longValuesArray, 0) : NULL);
715 jstring value = (jstring)env->GetObjectArrayElement(stringValuesArray, i);
716 const char *valueStr = (value ? env->GetStringUTFChars(value, NULL) : NULL);
719 env->ReleaseStringUTFChars(value, valueStr);
723 env->DeleteLocalRef(value);
732 env->ReleaseIntArrayElements(objectHandlesArray, objectHandles, 0);
733 env->ReleaseIntArrayElements(propertyCodesArray, propertyCodes, 0);
734 env->ReleaseIntArrayElements(dataTypesArray, dataTypes, 0);
736 env->ReleaseLongArrayElements(longValuesArray, longValues, 0);
738 env->DeleteLocalRef(objectHandlesArray);
739 env->DeleteLocalRef(propertyCodesArray);
740 env->DeleteLocalRef(dataTypesArray);
742 env->DeleteLocalRef(longValuesArray);
744 env->DeleteLocalRef(stringValuesArray);
747 env->DeleteLocalRef(list);
748 checkAndClearExceptionFromCallback(env, __FUNCTION__);
756 JNIEnv* env = AndroidRuntime::getJNIEnv();
757 jboolean result = env->CallBooleanMethod(mDatabase, method_getObjectInfo,
762 jint* intValues = env->GetIntArrayElements(mIntBuffer, 0);
766 env->ReleaseIntArrayElements(mIntBuffer, intValues, 0);
768 jlong* longValues = env->GetLongArrayElements(mLongBuffer, 0);
772 env->ReleaseLongArrayElements(mLongBuffer, longValues, 0);
779 jchar* str = env->GetCharArrayElements(mStringBuffer, 0);
782 env->ReleaseCharArrayElements(mStringBuffer, str, 0);
810 checkAndClearExceptionFromCallback(env, __FUNCTION__);
849 JNIEnv* env = AndroidRuntime::getJNIEnv();
850 jint result = env->CallIntMethod(mDatabase, method_getObjectFilePath,
853 checkAndClearExceptionFromCallback(env, __FUNCTION__);
857 jchar* str = env->GetCharArrayElements(mStringBuffer, 0);
859 env->ReleaseCharArrayElements(mStringBuffer, str, 0);
861 jlong* longValues = env->GetLongArrayElements(mLongBuffer, 0);
864 env->ReleaseLongArrayElements(mLongBuffer, longValues, 0);
866 checkAndClearExceptionFromCallback(env, __FUNCTION__);
871 JNIEnv* env = AndroidRuntime::getJNIEnv();
872 MtpResponseCode result = env->CallIntMethod(mDatabase, method_deleteFile, (jint)handle);
874 checkAndClearExceptionFromCallback(env, __FUNCTION__);
937 JNIEnv* env = AndroidRuntime::getJNIEnv();
938 jintArray array = (jintArray)env->CallObjectMethod(mDatabase, method_getObjectReferences,
943 jint* handles = env->GetIntArrayElements(array, 0);
944 jsize length = env->GetArrayLength(array);
947 env->ReleaseIntArrayElements(array, handles, 0);
948 env->DeleteLocalRef(array);
950 checkAndClearExceptionFromCallback(env, __FUNCTION__);
956 JNIEnv* env = AndroidRuntime::getJNIEnv();
958 jintArray array = env->NewIntArray(count);
963 jint* handles = env->GetIntArrayElements(array, 0);
966 env->ReleaseIntArrayElements(array, handles, 0);
967 MtpResponseCode result = env->CallIntMethod(mDatabase, method_setObjectReferences,
969 env->DeleteLocalRef(array);
971 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1024 JNIEnv* env = AndroidRuntime::getJNIEnv();
1037 jint ret = env->CallIntMethod(mDatabase, method_getDeviceProperty,
1040 jchar* str = env->GetCharArrayElements(mStringBuffer, 0);
1045 env->ReleaseCharArrayElements(mStringBuffer, str, 0);
1052 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1057 JNIEnv* env = AndroidRuntime::getJNIEnv();
1058 env->CallVoidMethod(mDatabase, method_sessionStarted);
1059 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1063 JNIEnv* env = AndroidRuntime::getJNIEnv();
1064 env->CallVoidMethod(mDatabase, method_sessionEnded);
1065 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1071 android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz)
1073 MyMtpDatabase* database = new MyMtpDatabase(env, thiz);
1074 env->SetIntField(thiz, field_context, (int)database);
1075 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1079 android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz)
1081 MyMtpDatabase* database = (MyMtpDatabase *)env->GetIntField(thiz, field_context);
1082 database->cleanup(env);
1084 env->SetIntField(thiz, field_context, 0);
1085 checkAndClearExceptionFromCallback(env, __FUNCTION__);
1089 android_mtp_MtpPropertyGroup_format_date_time(JNIEnv *env, jobject thiz, jlong seconds)
1093 return env->NewStringUTF(date);
1110 int register_android_mtp_MtpDatabase(JNIEnv *env)
1114 clazz = env->FindClass("android/mtp/MtpDatabase");
1119 method_beginSendObject = env->GetMethodID(clazz, "beginSendObject", "(Ljava/lang/String;IIIJJ)I");
1124 method_endSendObject = env->GetMethodID(clazz, "endSendObject", "(Ljava/lang/String;IIZ)V");
1129 method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I");
1134 method_getNumObjects = env->GetMethodID(clazz, "getNumObjects", "(III)I");
1139 method_getSupportedPlaybackFormats = env->GetMethodID(clazz, "getSupportedPlaybackFormats", "()[I");
1144 method_getSupportedCaptureFormats = env->GetMethodID(clazz, "getSupportedCaptureFormats", "()[I");
1149 method_getSupportedObjectProperties = env->GetMethodID(clazz, "getSupportedObjectProperties", "(I)[I");
1154 method_getSupportedDeviceProperties = env->GetMethodID(clazz, "getSupportedDeviceProperties", "()[I");
1159 method_setObjectProperty = env->GetMethodID(clazz, "setObjectProperty", "(IIJLjava/lang/String;)I");
1164 method_getDeviceProperty = env->GetMethodID(clazz, "getDeviceProperty", "(I[J[C)I");
1169 method_setDeviceProperty = env->GetMethodID(clazz, "setDeviceProperty", "(IJLjava/lang/String;)I");
1174 method_getObjectPropertyList = env->GetMethodID(clazz, "getObjectPropertyList",
1180 method_getObjectInfo = env->GetMethodID(clazz, "getObjectInfo", "(I[I[C[J)Z");
1185 method_getObjectFilePath = env->GetMethodID(clazz, "getObjectFilePath", "(I[C[J)I");
1190 method_deleteFile = env->GetMethodID(clazz, "deleteFile", "(I)I");
1195 method_getObjectReferences = env->GetMethodID(clazz, "getObjectReferences", "(I)[I");
1200 method_setObjectReferences = env->GetMethodID(clazz, "setObjectReferences", "(I[I)I");
1205 method_sessionStarted = env->GetMethodID(clazz, "sessionStarted", "()V");
1210 method_sessionEnded = env->GetMethodID(clazz, "sessionEnded", "()V");
1216 field_context = env->GetFieldID(clazz, "mNativeContext", "I");
1223 clazz = env->FindClass("android/mtp/MtpPropertyList");
1228 field_mCount = env->GetFieldID(clazz, "mCount", "I");
1233 field_mResult = env->GetFieldID(clazz, "mResult", "I");
1238 field_mObjectHandles = env->GetFieldID(clazz, "mObjectHandles", "[I");
1243 field_mPropertyCodes = env->GetFieldID(clazz, "mPropertyCodes", "[I");
1248 field_mDataTypes = env->GetFieldID(clazz, "mDataTypes", "[I");
1253 field_mLongValues = env->GetFieldID(clazz, "mLongValues", "[J");
1258 field_mStringValues = env->GetFieldID(clazz, "mStringValues", "[Ljava/lang/String;");
1264 if (AndroidRuntime::registerNativeMethods(env,
1268 return AndroidRuntime::registerNativeMethods(env,