summaryrefslogtreecommitdiffstats
path: root/media/jni/android_media_MediaScanner.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-09-10 14:47:36 -0400
committerMike Lockwood <lockwood@android.com>2010-09-12 23:21:44 -0400
commitc37255d5d0fd9e0ec02b0d7cb5c4b235e200d367 (patch)
tree6feb14e577a8ed66bf2c2afe6b39f47246b9cf49 /media/jni/android_media_MediaScanner.cpp
parent6d000d4eb733fc6ad7fcd27a4022a41f8433306d (diff)
downloadframeworks_base-c37255d5d0fd9e0ec02b0d7cb5c4b235e200d367.zip
frameworks_base-c37255d5d0fd9e0ec02b0d7cb5c4b235e200d367.tar.gz
frameworks_base-c37255d5d0fd9e0ec02b0d7cb5c4b235e200d367.tar.bz2
Media scanner support for tracking files of arbitrary type.
The native media scanner no longer filters files based on file extension. Audio, video, image and playlist files are handled as before, but non-media files are now inserted into the "files" table, which was originally added to support MTP. Change-Id: I9053218fb6d2671a3bb181405c34442b94678afc Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/jni/android_media_MediaScanner.cpp')
-rw-r--r--media/jni/android_media_MediaScanner.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index 273f1af..fd0b233 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -146,7 +146,7 @@ static bool ExceptionCheck(void* env)
}
static void
-android_media_MediaScanner_processDirectory(JNIEnv *env, jobject thiz, jstring path, jstring extensions, jobject client)
+android_media_MediaScanner_processDirectory(JNIEnv *env, jobject thiz, jstring path, jobject client)
{
MediaScanner *mp = (MediaScanner *)env->GetIntField(thiz, fields.context);
@@ -154,27 +154,16 @@ android_media_MediaScanner_processDirectory(JNIEnv *env, jobject thiz, jstring p
jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
return;
}
- if (extensions == NULL) {
- jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
- return;
- }
-
+
const char *pathStr = env->GetStringUTFChars(path, NULL);
if (pathStr == NULL) { // Out of memory
jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
return;
}
- const char *extensionsStr = env->GetStringUTFChars(extensions, NULL);
- if (extensionsStr == NULL) { // Out of memory
- env->ReleaseStringUTFChars(path, pathStr);
- jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
- return;
- }
MyMediaScannerClient myClient(env, client);
- mp->processDirectory(pathStr, extensionsStr, myClient, ExceptionCheck, env);
+ mp->processDirectory(pathStr, myClient, ExceptionCheck, env);
env->ReleaseStringUTFChars(path, pathStr);
- env->ReleaseStringUTFChars(extensions, extensionsStr);
}
static void
@@ -309,9 +298,9 @@ android_media_MediaScanner_native_finalize(JNIEnv *env, jobject thiz)
// ----------------------------------------------------------------------------
static JNINativeMethod gMethods[] = {
- {"processDirectory", "(Ljava/lang/String;Ljava/lang/String;Landroid/media/MediaScannerClient;)V",
+ {"processDirectory", "(Ljava/lang/String;Landroid/media/MediaScannerClient;)V",
(void *)android_media_MediaScanner_processDirectory},
- {"processFile", "(Ljava/lang/String;Ljava/lang/String;Landroid/media/MediaScannerClient;)V",
+ {"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},