Merge commit 'remotes/korg/cupcake' into cupcake_to_master
diff --git a/Android.mk b/Android.mk
index 1b749a4..4754738 100644
--- a/Android.mk
+++ b/Android.mk
@@ -17,7 +17,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := user development
+LOCAL_MODULE_TAGS := user
 
 LOCAL_SRC_FILES:= \
 	main.c \
diff --git a/main.c b/main.c
index 12ee58e..df08f49 100644
--- a/main.c
+++ b/main.c
@@ -454,15 +454,10 @@
 #endif
             goto noThumbnail;
         }
-        jboolean isCopy;
-        jbyte* thumbnailDataPtr = (*env)->GetByteArrayElements(env, byteArray, &isCopy);
-        memcpy(thumbnailDataPtr, thumbnailPointer, ImageInfo.ThumbnailSize);
+        (*env)->SetByteArrayRegion(env, byteArray, 0, ImageInfo.ThumbnailSize, thumbnailPointer);
 #ifdef SUPERDEBUG
     LOGE("thumbnail size %d\n", ImageInfo.ThumbnailSize);
 #endif
-        if (isCopy == JNI_TRUE) {
-            (*env)->ReleaseByteArrayElements(env, byteArray, thumbnailDataPtr, 0);
-        }
         (*env)->ReleaseStringUTFChars(env, jfilename, filename);
         return byteArray;
     }