summaryrefslogtreecommitdiffstats
path: root/media/jni/android_media_MediaScanner.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:43 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:05:43 -0800
commitf013e1afd1e68af5e3b868c26a653bbfb39538f8 (patch)
tree7ad6c8fd9c7b55f4b4017171dec1cb760bbd26bf /media/jni/android_media_MediaScanner.cpp
parente70cfafe580c6f2994c4827cd8a534aabf3eb05c (diff)
downloadframeworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.zip
frameworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.tar.gz
frameworks_base-f013e1afd1e68af5e3b868c26a653bbfb39538f8.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'media/jni/android_media_MediaScanner.cpp')
-rw-r--r--media/jni/android_media_MediaScanner.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 76202d3..8764a70 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -189,6 +189,25 @@ android_media_MediaScanner_processFile(JNIEnv *env, jobject thiz, jstring path,
}
}
+static void
+android_media_MediaScanner_setLocale(JNIEnv *env, jobject thiz, jstring locale)
+{
+ MediaScanner *mp = (MediaScanner *)env->GetIntField(thiz, fields.context);
+
+ if (locale == NULL) {
+ jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
+ return;
+ }
+ const char *localeStr = env->GetStringUTFChars(locale, NULL);
+ if (localeStr == NULL) { // Out of memory
+ jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
+ return;
+ }
+ mp->setLocale(localeStr);
+
+ env->ReleaseStringUTFChars(locale, localeStr);
+}
+
static jbyteArray
android_media_MediaScanner_extractAlbumArt(JNIEnv *env, jobject thiz, jobject fileDescriptor)
{
@@ -254,6 +273,7 @@ static JNINativeMethod gMethods[] = {
(void *)android_media_MediaScanner_processDirectory},
{"processFile", "(Ljava/lang/String;Ljava/lang/String;Landroid/media/MediaScannerClient;)V",
(void *)android_media_MediaScanner_processFile},
+ {"setLocale", "(Ljava/lang/String;)V", (void *)android_media_MediaScanner_setLocale},
{"extractAlbumArt", "(Ljava/io/FileDescriptor;)[B", (void *)android_media_MediaScanner_extractAlbumArt},
{"native_setup", "()V", (void *)android_media_MediaScanner_native_setup},
{"native_finalize", "()V", (void *)android_media_MediaScanner_native_finalize},