diff options
author | Mike Lockwood <lockwood@android.com> | 2011-05-02 17:01:47 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-05-03 21:03:57 -0400 |
commit | 1a65546a55d019335655464ad895361ba9f89252 (patch) | |
tree | 0565d06ba8d5049f7b77ec8fc0bedbde4ce7a207 | |
parent | aeb65d45a93878bba361956b3f3280b36cc48e59 (diff) | |
download | frameworks_av-1a65546a55d019335655464ad895361ba9f89252.zip frameworks_av-1a65546a55d019335655464ad895361ba9f89252.tar.gz frameworks_av-1a65546a55d019335655464ad895361ba9f89252.tar.bz2 |
DO NOT MERGE 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: Ie756ccd06b1962b06143fc02a1a3927c3aba143a
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rw-r--r-- | media/libmedia/MediaScanner.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp index 4e22175..28c8642 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; |