Loading media/java/android/mtp/MtpDatabase.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1036,7 +1036,7 @@ public class MtpDatabase { } } // used by the JNI code // used by the JNI code private int mNativeContext; private long mNativeContext; private native final void native_setup(); private native final void native_setup(); private native final void native_finalize(); private native final void native_finalize(); Loading media/java/android/mtp/MtpDevice.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -237,7 +237,7 @@ public final class MtpDevice { } } // used by the JNI code // used by the JNI code private int mNativeContext; private long mNativeContext; private native boolean native_open(String deviceName, int fd); private native boolean native_open(String deviceName, int fd); private native void native_close(); private native void native_close(); Loading media/java/android/mtp/MtpServer.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ package android.mtp; */ */ public class MtpServer implements Runnable { public class MtpServer implements Runnable { private int mNativeContext; // accessed by native methods private long mNativeContext; // accessed by native methods static { static { System.loadLibrary("media_jni"); System.loadLibrary("media_jni"); Loading media/jni/android_mtp_MtpDatabase.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ static jfieldID field_mStringValues; MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) { MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) { return (MtpDatabase *)env->GetIntField(database, field_context); return (MtpDatabase *)env->GetLongField(database, field_context); } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -1075,17 +1075,17 @@ static void android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz) android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz) { { MyMtpDatabase* database = new MyMtpDatabase(env, thiz); MyMtpDatabase* database = new MyMtpDatabase(env, thiz); env->SetIntField(thiz, field_context, (int)database); env->SetLongField(thiz, field_context, (jlong)database); checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } static void static void android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz) android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz) { { MyMtpDatabase* database = (MyMtpDatabase *)env->GetIntField(thiz, field_context); MyMtpDatabase* database = (MyMtpDatabase *)env->GetLongField(thiz, field_context); database->cleanup(env); database->cleanup(env); delete database; delete database; env->SetIntField(thiz, field_context, 0); env->SetLongField(thiz, field_context, 0); checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } Loading Loading @@ -1217,7 +1217,7 @@ int register_android_mtp_MtpDatabase(JNIEnv *env) return -1; return -1; } } field_context = env->GetFieldID(clazz, "mNativeContext", "I"); field_context = env->GetFieldID(clazz, "mNativeContext", "J"); if (field_context == NULL) { if (field_context == NULL) { ALOGE("Can't find MtpDatabase.mNativeContext"); ALOGE("Can't find MtpDatabase.mNativeContext"); return -1; return -1; Loading media/jni/android_mtp_MtpDevice.cpp +16 −15 Original line number Original line Diff line number Diff line Loading @@ -88,7 +88,7 @@ static jfieldID field_objectInfo_keywords; MtpDevice* get_device_from_object(JNIEnv* env, jobject javaDevice) MtpDevice* get_device_from_object(JNIEnv* env, jobject javaDevice) { { return (MtpDevice*)env->GetIntField(javaDevice, field_context); return (MtpDevice*)env->GetLongField(javaDevice, field_context); } } static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { Loading @@ -106,15 +106,15 @@ android_mtp_MtpDevice_open(JNIEnv *env, jobject thiz, jstring deviceName, jint f { { const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL); const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL); if (deviceNameStr == NULL) { if (deviceNameStr == NULL) { return false; return JNI_FALSE; } } MtpDevice* device = MtpDevice::open(deviceNameStr, fd); MtpDevice* device = MtpDevice::open(deviceNameStr, fd); env->ReleaseStringUTFChars(deviceName, deviceNameStr); env->ReleaseStringUTFChars(deviceName, deviceNameStr); if (device) if (device) env->SetIntField(thiz, field_context, (int)device); env->SetLongField(thiz, field_context, (jlong)device); return (device != NULL); return (jboolean)(device != NULL); } } static void static void Loading @@ -124,7 +124,7 @@ android_mtp_MtpDevice_close(JNIEnv *env, jobject thiz) if (device) { if (device) { device->close(); device->close(); delete device; delete device; env->SetIntField(thiz, field_context, 0); env->SetLongField(thiz, field_context, 0); } } } } Loading Loading @@ -356,10 +356,11 @@ static jboolean android_mtp_MtpDevice_delete_object(JNIEnv *env, jobject thiz, jint object_id) android_mtp_MtpDevice_delete_object(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device && device->deleteObject(object_id)) { return device->deleteObject(object_id); return JNI_TRUE; else } else { return NULL; return JNI_FALSE; } } } static jlong static jlong Loading @@ -367,7 +368,7 @@ android_mtp_MtpDevice_get_parent(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device) return device->getParent(object_id); return (jlong)device->getParent(object_id); else else return -1; return -1; } } Loading @@ -377,7 +378,7 @@ android_mtp_MtpDevice_get_storage_id(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device) return device->getStorageID(object_id); return (jlong)device->getStorageID(object_id); else else return -1; return -1; } } Loading @@ -389,15 +390,15 @@ android_mtp_MtpDevice_import_file(JNIEnv *env, jobject thiz, jint object_id, jst if (device) { if (device) { const char *destPathStr = env->GetStringUTFChars(dest_path, NULL); const char *destPathStr = env->GetStringUTFChars(dest_path, NULL); if (destPathStr == NULL) { if (destPathStr == NULL) { return false; return JNI_FALSE; } } bool result = device->readObject(object_id, destPathStr, AID_SDCARD_RW, 0664); jboolean result = device->readObject(object_id, destPathStr, AID_SDCARD_RW, 0664); env->ReleaseStringUTFChars(dest_path, destPathStr); env->ReleaseStringUTFChars(dest_path, destPathStr); return result; return result; } } return false; return JNI_FALSE; } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -618,7 +619,7 @@ int register_android_mtp_MtpDevice(JNIEnv *env) ALOGE("Can't find android/mtp/MtpDevice"); ALOGE("Can't find android/mtp/MtpDevice"); return -1; return -1; } } field_context = env->GetFieldID(clazz, "mNativeContext", "I"); field_context = env->GetFieldID(clazz, "mNativeContext", "J"); if (field_context == NULL) { if (field_context == NULL) { ALOGE("Can't find MtpDevice.mNativeContext"); ALOGE("Can't find MtpDevice.mNativeContext"); return -1; return -1; Loading Loading
media/java/android/mtp/MtpDatabase.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1036,7 +1036,7 @@ public class MtpDatabase { } } // used by the JNI code // used by the JNI code private int mNativeContext; private long mNativeContext; private native final void native_setup(); private native final void native_setup(); private native final void native_finalize(); private native final void native_finalize(); Loading
media/java/android/mtp/MtpDevice.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -237,7 +237,7 @@ public final class MtpDevice { } } // used by the JNI code // used by the JNI code private int mNativeContext; private long mNativeContext; private native boolean native_open(String deviceName, int fd); private native boolean native_open(String deviceName, int fd); private native void native_close(); private native void native_close(); Loading
media/java/android/mtp/MtpServer.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -22,7 +22,7 @@ package android.mtp; */ */ public class MtpServer implements Runnable { public class MtpServer implements Runnable { private int mNativeContext; // accessed by native methods private long mNativeContext; // accessed by native methods static { static { System.loadLibrary("media_jni"); System.loadLibrary("media_jni"); Loading
media/jni/android_mtp_MtpDatabase.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -77,7 +77,7 @@ static jfieldID field_mStringValues; MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) { MtpDatabase* getMtpDatabase(JNIEnv *env, jobject database) { return (MtpDatabase *)env->GetIntField(database, field_context); return (MtpDatabase *)env->GetLongField(database, field_context); } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -1075,17 +1075,17 @@ static void android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz) android_mtp_MtpDatabase_setup(JNIEnv *env, jobject thiz) { { MyMtpDatabase* database = new MyMtpDatabase(env, thiz); MyMtpDatabase* database = new MyMtpDatabase(env, thiz); env->SetIntField(thiz, field_context, (int)database); env->SetLongField(thiz, field_context, (jlong)database); checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } static void static void android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz) android_mtp_MtpDatabase_finalize(JNIEnv *env, jobject thiz) { { MyMtpDatabase* database = (MyMtpDatabase *)env->GetIntField(thiz, field_context); MyMtpDatabase* database = (MyMtpDatabase *)env->GetLongField(thiz, field_context); database->cleanup(env); database->cleanup(env); delete database; delete database; env->SetIntField(thiz, field_context, 0); env->SetLongField(thiz, field_context, 0); checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } Loading Loading @@ -1217,7 +1217,7 @@ int register_android_mtp_MtpDatabase(JNIEnv *env) return -1; return -1; } } field_context = env->GetFieldID(clazz, "mNativeContext", "I"); field_context = env->GetFieldID(clazz, "mNativeContext", "J"); if (field_context == NULL) { if (field_context == NULL) { ALOGE("Can't find MtpDatabase.mNativeContext"); ALOGE("Can't find MtpDatabase.mNativeContext"); return -1; return -1; Loading
media/jni/android_mtp_MtpDevice.cpp +16 −15 Original line number Original line Diff line number Diff line Loading @@ -88,7 +88,7 @@ static jfieldID field_objectInfo_keywords; MtpDevice* get_device_from_object(JNIEnv* env, jobject javaDevice) MtpDevice* get_device_from_object(JNIEnv* env, jobject javaDevice) { { return (MtpDevice*)env->GetIntField(javaDevice, field_context); return (MtpDevice*)env->GetLongField(javaDevice, field_context); } } static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { static void checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodName) { Loading @@ -106,15 +106,15 @@ android_mtp_MtpDevice_open(JNIEnv *env, jobject thiz, jstring deviceName, jint f { { const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL); const char *deviceNameStr = env->GetStringUTFChars(deviceName, NULL); if (deviceNameStr == NULL) { if (deviceNameStr == NULL) { return false; return JNI_FALSE; } } MtpDevice* device = MtpDevice::open(deviceNameStr, fd); MtpDevice* device = MtpDevice::open(deviceNameStr, fd); env->ReleaseStringUTFChars(deviceName, deviceNameStr); env->ReleaseStringUTFChars(deviceName, deviceNameStr); if (device) if (device) env->SetIntField(thiz, field_context, (int)device); env->SetLongField(thiz, field_context, (jlong)device); return (device != NULL); return (jboolean)(device != NULL); } } static void static void Loading @@ -124,7 +124,7 @@ android_mtp_MtpDevice_close(JNIEnv *env, jobject thiz) if (device) { if (device) { device->close(); device->close(); delete device; delete device; env->SetIntField(thiz, field_context, 0); env->SetLongField(thiz, field_context, 0); } } } } Loading Loading @@ -356,10 +356,11 @@ static jboolean android_mtp_MtpDevice_delete_object(JNIEnv *env, jobject thiz, jint object_id) android_mtp_MtpDevice_delete_object(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device && device->deleteObject(object_id)) { return device->deleteObject(object_id); return JNI_TRUE; else } else { return NULL; return JNI_FALSE; } } } static jlong static jlong Loading @@ -367,7 +368,7 @@ android_mtp_MtpDevice_get_parent(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device) return device->getParent(object_id); return (jlong)device->getParent(object_id); else else return -1; return -1; } } Loading @@ -377,7 +378,7 @@ android_mtp_MtpDevice_get_storage_id(JNIEnv *env, jobject thiz, jint object_id) { { MtpDevice* device = get_device_from_object(env, thiz); MtpDevice* device = get_device_from_object(env, thiz); if (device) if (device) return device->getStorageID(object_id); return (jlong)device->getStorageID(object_id); else else return -1; return -1; } } Loading @@ -389,15 +390,15 @@ android_mtp_MtpDevice_import_file(JNIEnv *env, jobject thiz, jint object_id, jst if (device) { if (device) { const char *destPathStr = env->GetStringUTFChars(dest_path, NULL); const char *destPathStr = env->GetStringUTFChars(dest_path, NULL); if (destPathStr == NULL) { if (destPathStr == NULL) { return false; return JNI_FALSE; } } bool result = device->readObject(object_id, destPathStr, AID_SDCARD_RW, 0664); jboolean result = device->readObject(object_id, destPathStr, AID_SDCARD_RW, 0664); env->ReleaseStringUTFChars(dest_path, destPathStr); env->ReleaseStringUTFChars(dest_path, destPathStr); return result; return result; } } return false; return JNI_FALSE; } } // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading @@ -618,7 +619,7 @@ int register_android_mtp_MtpDevice(JNIEnv *env) ALOGE("Can't find android/mtp/MtpDevice"); ALOGE("Can't find android/mtp/MtpDevice"); return -1; return -1; } } field_context = env->GetFieldID(clazz, "mNativeContext", "I"); field_context = env->GetFieldID(clazz, "mNativeContext", "J"); if (field_context == NULL) { if (field_context == NULL) { ALOGE("Can't find MtpDevice.mNativeContext"); ALOGE("Can't find MtpDevice.mNativeContext"); return -1; return -1; Loading