summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-07-13 14:33:13 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-13 14:33:13 -0700
commitfd909a774cb384b139c5e360cadb2681c3f48c29 (patch)
tree73d46113ed06e9173308fb9e28c38f4f418f3144
parentafcec44d5f664b44b6b3a02e401d09267fee5603 (diff)
parent45aaa2a345292bb6d600822db602f25e261c0e50 (diff)
downloadframeworks_base-fd909a774cb384b139c5e360cadb2681c3f48c29.zip
frameworks_base-fd909a774cb384b139c5e360cadb2681c3f48c29.tar.gz
frameworks_base-fd909a774cb384b139c5e360cadb2681c3f48c29.tar.bz2
Merge "MediaScanner: fix breakage in updates"
-rw-r--r--media/java/android/media/MediaScanner.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index e8ddd2d..e89be08 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -835,6 +835,9 @@ public class MediaScanner
}
}
+ // For inserts we always use the file URI so we can insert in bulk.
+ // For updates we compute the URI based on the media type.
+ Uri tableUri = mFilesUri;
Uri result = null;
if (rowId == 0) {
if (mMtpObjectHandle != 0) {
@@ -850,7 +853,7 @@ public class MediaScanner
if (mFileInserter != null) {
result = mFileInserter.insert(values);
} else {
- result = mMediaProvider.insert(mFilesUri, values);
+ result = mMediaProvider.insert(tableUri, values);
}
if (result != null) {
@@ -858,8 +861,18 @@ public class MediaScanner
entry.mRowId = rowId;
}
} else {
+ if (!mNoMedia) {
+ if (MediaFile.isVideoFileType(mFileType)) {
+ tableUri = mVideoUri;
+ } else if (MediaFile.isImageFileType(mFileType)) {
+ tableUri = mImagesUri;
+ } else if (MediaFile.isAudioFileType(mFileType)) {
+ tableUri = mAudioUri;
+ }
+ }
+
// updated file
- result = ContentUris.withAppendedId(mFilesUri, rowId);
+ result = ContentUris.withAppendedId(tableUri, rowId);
// path should never change, and we want to avoid replacing mixed cased paths
// with squashed lower case paths
values.remove(MediaStore.MediaColumns.DATA);
@@ -909,19 +922,19 @@ public class MediaScanner
if (notifications && !mDefaultNotificationSet) {
if (TextUtils.isEmpty(mDefaultNotificationFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultNotificationFilename)) {
- setSettingIfNotSet(Settings.System.NOTIFICATION_SOUND, mFilesUri, rowId);
+ setSettingIfNotSet(Settings.System.NOTIFICATION_SOUND, tableUri, rowId);
mDefaultNotificationSet = true;
}
} else if (ringtones && !mDefaultRingtoneSet) {
if (TextUtils.isEmpty(mDefaultRingtoneFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultRingtoneFilename)) {
- setSettingIfNotSet(Settings.System.RINGTONE, mFilesUri, rowId);
+ setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId);
mDefaultRingtoneSet = true;
}
} else if (alarms && !mDefaultAlarmSet) {
if (TextUtils.isEmpty(mDefaultAlarmAlertFilename) ||
doesPathHaveFilename(entry.mPath, mDefaultAlarmAlertFilename)) {
- setSettingIfNotSet(Settings.System.ALARM_ALERT, mFilesUri, rowId);
+ setSettingIfNotSet(Settings.System.ALARM_ALERT, tableUri, rowId);
mDefaultAlarmSet = true;
}
}