Merge "MediaStore should reflect state on disk."
diff --git a/core/java/android/provider/MediaStore.java b/core/java/android/provider/MediaStore.java
index 457453f..c4e2b12 100644
--- a/core/java/android/provider/MediaStore.java
+++ b/core/java/android/provider/MediaStore.java
@@ -1338,7 +1338,7 @@
public static final String insertImage(ContentResolver cr, Bitmap source,
String title, String description) {
ContentValues values = new ContentValues();
- values.put(Images.Media.TITLE, title);
+ values.put(Images.Media.DISPLAY_NAME, title);
values.put(Images.Media.DESCRIPTION, description);
values.put(Images.Media.MIME_TYPE, "image/jpeg");
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java
index 90cfc53..4eed12f 100644
--- a/media/java/android/media/MediaScanner.java
+++ b/media/java/android/media/MediaScanner.java
@@ -902,6 +902,7 @@
map.put(MediaStore.MediaColumns.SIZE, mFileSize);
map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType);
map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm);
+ map.putNull(MediaStore.MediaColumns.HASH);
String resolution = null;
if (mWidth > 0 && mHeight > 0) {
@@ -934,7 +935,7 @@
}
} else if (MediaFile.isImageMimeType(mMimeType)) {
// FIXME - add DESCRIPTION
- } else if (mScanSuccess && MediaFile.isAudioMimeType(mMimeType)) {
+ } else if (MediaFile.isAudioMimeType(mMimeType)) {
map.put(Audio.Media.ARTIST, (mArtist != null && mArtist.length() > 0) ?
mArtist : MediaStore.UNKNOWN_STRING);
map.put(Audio.Media.ALBUM_ARTIST, (mAlbumArtist != null &&
@@ -950,10 +951,6 @@
map.put(Audio.Media.DURATION, mDuration);
map.put(Audio.Media.COMPILATION, mCompilation);
}
- if (!mScanSuccess) {
- // force mediaprovider to not determine the media type from the mime type
- map.put(Files.FileColumns.MEDIA_TYPE, 0);
- }
}
return map;
}
@@ -1056,7 +1053,7 @@
Uri tableUri = mFilesUri;
int mediaType = FileColumns.MEDIA_TYPE_NONE;
MediaInserter inserter = mMediaInserter;
- if (mScanSuccess && !mNoMedia) {
+ if (!mNoMedia) {
if (MediaFile.isVideoMimeType(mMimeType)) {
tableUri = mVideoUri;
mediaType = FileColumns.MEDIA_TYPE_VIDEO;
@@ -1131,7 +1128,7 @@
// with squashed lower case paths
values.remove(MediaStore.MediaColumns.DATA);
- if (mScanSuccess && !mNoMedia) {
+ if (!mNoMedia) {
// Changing media type must be done as separate update
if (mediaType != entry.mMediaType) {
final ContentValues mediaTypeValues = new ContentValues();