diff options
author | David Daynard <nardholio@gmail.com> | 2013-03-12 18:35:09 -0400 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-03-24 15:55:21 -0700 |
commit | bcf051717a9fab03e032959ac2d3904c45e59ee5 (patch) | |
tree | 436c5fca643287589a6b14a9f10093bc6bc6c186 | |
parent | a35c8f521c9cbb64f3d32df5ded7eab2db2727ee (diff) | |
download | frameworks_av-bcf051717a9fab03e032959ac2d3904c45e59ee5.zip frameworks_av-bcf051717a9fab03e032959ac2d3904c45e59ee5.tar.gz frameworks_av-bcf051717a9fab03e032959ac2d3904c45e59ee5.tar.bz2 |
MediaScanner: Ignore dirs with .noscanandnomtp
Completely ignore directories with .noscanandnomtp files
in them. Placing a .nomedia file will still scan a
directory but exclude it from the media database. This
is so the file may still be presented for MTP purposes.
Placing .noscanandnomtp completely prevents the scan,
which saves considerable processing power and battery
life on systems with numerous media files, but prevents
them from being seen over MTP.
Change-Id: Ibff2a9f2525255a2ac34132eeee36734962fbdd7
-rw-r--r-- | media/libmedia/MediaScanner.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/media/libmedia/MediaScanner.cpp b/media/libmedia/MediaScanner.cpp index 28b5aa7..6ea5b7e 100644 --- a/media/libmedia/MediaScanner.cpp +++ b/media/libmedia/MediaScanner.cpp @@ -139,6 +139,18 @@ MediaScanResult MediaScanner::doProcessDirectory( return MEDIA_SCAN_RESULT_OK; } + // Completely skip all directories containing a ".noscanandnomtp" file + if (pathRemaining >= 15 /* strlen(".noscanandnomtp") */ ) { + strcpy(fileSpot, ".noscanandnomtp"); + if (access(path, F_OK) == 0) { + ALOGV("found .noscanandnomtp, completely skipping"); + return MEDIA_SCAN_RESULT_SKIPPED; + } + + // restore path + fileSpot[0] = 0; + } + // Treat all files as non-media in directories that contain a ".nomedia" file if (pathRemaining >= 8 /* strlen(".nomedia") */ ) { strcpy(fileSpot, ".nomedia"); |