summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2012-06-06 13:37:50 -0700
committerMarco Nelissen <marcone@google.com>2012-06-06 13:59:24 -0700
commit81e85bbf671f228600fba059e30cb22565bcfe9d (patch)
tree6e4dbbf147d923baba659b24b000cd602a1df4cf /media/java
parenta2c628fb402610ce65371fb06d5adaf7eaf9df9b (diff)
downloadframeworks_base-81e85bbf671f228600fba059e30cb22565bcfe9d.zip
frameworks_base-81e85bbf671f228600fba059e30cb22565bcfe9d.tar.gz
frameworks_base-81e85bbf671f228600fba059e30cb22565bcfe9d.tar.bz2
Ensure we compute display name when needed
Since the media scanner no longer uses an in memory cache, it always found an entry for files inserted via MTP, which made it follow a different code path than before, which in turn made the media provider skip computing the display name column. By clearing the row id in the media scanner when handling an mtp request, we steer it back to the correct code path. b/6297105 b/6525450 Change-Id: I624522b176a0057d246ce3040598af255b00a141
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/media/MediaScanner.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index c6c1ccb..6f8b809 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -523,6 +523,13 @@ public class MediaScanner
try {
FileEntry entry = beginFile(path, mimeType, lastModified,
fileSize, isDirectory, noMedia);
+
+ // if this file was just inserted via mtp, set the rowid to zero
+ // (even though it already exists in the database), to trigger
+ // the correct code path for updating its entry
+ if (mMtpObjectHandle != 0) {
+ entry.mRowId = 0;
+ }
// rescan for metadata if file was modified since last scan
if (entry != null && (entry.mLastModifiedChanged || scanAlways)) {
if (noMedia) {