Skip to content

Commit f13d450

Browse files
committed
Send "compilation" tag when inserting into the database.
It's not actually inserted into the database, but the media provider uses it for disambiguating albums. b/3311831 Change-Id: Idb630866e960338ce2795dcc128cafaf6c9c27f2
1 parent ba77a3f commit f13d450

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

media/java/android/media/MediaScanner.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ private class MyMediaScannerClient implements MediaScannerClient {
402402
private long mLastModified;
403403
private long mFileSize;
404404
private String mWriter;
405+
private int mCompilation;
405406

406407
public FileCacheEntry beginFile(String path, String mimeType, long lastModified, long fileSize) {
407408

@@ -486,6 +487,7 @@ public FileCacheEntry beginFile(String path, String mimeType, long lastModified,
486487
mPath = path;
487488
mLastModified = lastModified;
488489
mWriter = null;
490+
mCompilation = 0;
489491

490492
return entry;
491493
}
@@ -596,6 +598,8 @@ public void handleStringTag(String name, String value) {
596598
mDuration = parseSubstring(value, 0, 0);
597599
} else if (name.equalsIgnoreCase("writer") || name.startsWith("writer;")) {
598600
mWriter = value.trim();
601+
} else if (name.equalsIgnoreCase("compilation")) {
602+
mCompilation = parseSubstring(value, 0, 0);
599603
}
600604
}
601605

@@ -646,6 +650,7 @@ private ContentValues toValues() {
646650
}
647651
map.put(Audio.Media.TRACK, mTrack);
648652
map.put(Audio.Media.DURATION, mDuration);
653+
map.put(Audio.Media.COMPILATION, mCompilation);
649654
}
650655
return map;
651656
}

0 commit comments

Comments
 (0)