When scanning a single file, take .nomedia into account
Make scanSingleFile behave the same way as scanMtpFile, by taking into
account whether there's a .nomedia file guarding the file being scanned.
Without this, downloaded (or otherwise explicitly scanned) images/video/music
will appear in Gallery and Music even if a .nomedia file is hiding them.
Change-Id: Ib9ad4bda1b9a942f79a37ccd8e6a54d57710f528
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 619e71c..726e6de 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -1359,7 +1359,7 @@
// always scan the file, so we can return the content://media Uri for existing files
return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(),
- false, true, false);
+ false, true, MediaScanner.isNoMediaPath(path));
} catch (RemoteException e) {
Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e);
return null;