summaryrefslogtreecommitdiffstats
path: root/media/jni/android_media_MediaScanner.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-12-16 12:54:24 -0800
committerMike Lockwood <lockwood@android.com>2010-12-16 15:35:36 -0800
commit076e05b488e40fdd946f0d35137fe66a576efe09 (patch)
treec2b732777b51e1f6d8ba92047c2446bd0f2d0582 /media/jni/android_media_MediaScanner.cpp
parentdcaa10cd361a543cfa93bbb5c53444f437bd07a4 (diff)
downloadframeworks_base-076e05b488e40fdd946f0d35137fe66a576efe09.zip
frameworks_base-076e05b488e40fdd946f0d35137fe66a576efe09.tar.gz
frameworks_base-076e05b488e40fdd946f0d35137fe66a576efe09.tar.bz2
MediaScanner: Add support for scanning empty directories
Currently the media scanner does not create database entries for directories unless they contain a file that is scanned. Fixing this so we provide a consistent view of the world to MTP. Change-Id: Ia776acfeae23192183e7192d63cdc34d830ea889 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.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/media/jni/android_media_MediaScanner.cpp b/media/jni/android_media_MediaScanner.cpp
index fd0b233..a5176fa 100644
--- a/media/jni/android_media_MediaScanner.cpp
+++ b/media/jni/android_media_MediaScanner.cpp
@@ -62,7 +62,7 @@ public:
}
else {
mScanFileMethodID = env->GetMethodID(mediaScannerClientInterface, "scanFile",
- "(Ljava/lang/String;JJ)V");
+ "(Ljava/lang/String;JJZ)V");
mHandleStringTagMethodID = env->GetMethodID(mediaScannerClientInterface, "handleStringTag",
"(Ljava/lang/String;Ljava/lang/String;)V");
mSetMimeTypeMethodID = env->GetMethodID(mediaScannerClientInterface, "setMimeType",
@@ -78,12 +78,14 @@ public:
}
// returns true if it succeeded, false if an exception occured in the Java code
- virtual bool scanFile(const char* path, long long lastModified, long long fileSize)
+ virtual bool scanFile(const char* path, long long lastModified,
+ long long fileSize, bool isDirectory)
{
jstring pathStr;
if ((pathStr = mEnv->NewStringUTF(path)) == NULL) return false;
- mEnv->CallVoidMethod(mClient, mScanFileMethodID, pathStr, lastModified, fileSize);
+ mEnv->CallVoidMethod(mClient, mScanFileMethodID, pathStr, lastModified,
+ fileSize, isDirectory);
mEnv->DeleteLocalRef(pathStr);
return (!mEnv->ExceptionCheck());