summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mike Lockwood <lockwood@android.com> 2011-05-02 17:01:47 -0400
committer Mike Lockwood <lockwood@android.com> 2011-05-02 17:04:19 -0400
commit214f9db054620357c60db48e48339c647a31597f (patch)
tree8735baa085176866ebd016e7adacf333b1d3d4e9
parentf0cae1a3f0243f176fbaa4f708e03141121876d0 (diff)
MediaScanner: Fix bug in "no media" handling logic
Don't let the "no media" status of one directory leak to the remaining files and directories in the same parent. Bug: 4364077 Change-Id: I30943222dc292818cff00ee8169be7a695eed174 Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r--media/libmedia/MediaScanner.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp
index 4e2217588f35..28c8642687d9 100644
--- a/media/libmedia/MediaScanner.cpp
+++ b/media/libmedia/MediaScanner.cpp
@@ -135,20 +135,21 @@ status_t MediaScanner::doProcessDirectory(
}
if (type == DT_REG || type == DT_DIR) {
if (type == DT_DIR) {
+ bool childNoMedia = noMedia;
// set noMedia flag on directories with a name that starts with '.'
// for example, the Mac ".Trashes" directory
if (name[0] == '.')
- noMedia = true;
+ childNoMedia = true;
// report the directory to the client
if (stat(path, &statbuf) == 0) {
- client.scanFile(path, statbuf.st_mtime, 0, true, noMedia);
+ client.scanFile(path, statbuf.st_mtime, 0, true, childNoMedia);
}
// and now process its contents
strcat(fileSpot, "/");
int err = doProcessDirectory(path, pathRemaining - nameLength - 1, client,
- noMedia, exceptionCheck, exceptionEnv);
+ childNoMedia, exceptionCheck, exceptionEnv);
if (err) {
// pass exceptions up - ignore other errors
if (exceptionCheck && exceptionCheck(exceptionEnv)) goto failure;