Merge "Add support for "Audiobooks"."

This commit is contained in:
Jeff Sharkey
2018-12-04 16:58:17 +00:00
committed by Android (Google) Code Review
4 changed files with 29 additions and 7 deletions

View File

@@ -156,7 +156,8 @@ public class MediaScanner implements AutoCloseable {
private static final String NOTIFICATIONS_DIR = "/notifications/";
private static final String ALARMS_DIR = "/alarms/";
private static final String MUSIC_DIR = "/music/";
private static final String PODCAST_DIR = "/podcasts/";
private static final String PODCASTS_DIR = "/podcasts/";
private static final String AUDIOBOOKS_DIR = "/audiobooks/";
public static final String SCANNED_BUILD_PREFS_NAME = "MediaScanBuild";
public static final String LAST_INTERNAL_SCAN_FINGERPRINT = "lastScanFingerprint";
@@ -654,7 +655,7 @@ public class MediaScanner implements AutoCloseable {
// rescan for metadata if file was modified since last scan
if (entry != null && (entry.mLastModifiedChanged || scanAlways)) {
if (noMedia) {
result = endFile(entry, false, false, false, false, false);
result = endFile(entry, false, false, false, false, false, false);
} else {
boolean isaudio = MediaFile.isAudioMimeType(mMimeType);
boolean isvideo = MediaFile.isVideoMimeType(mMimeType);
@@ -679,11 +680,13 @@ public class MediaScanner implements AutoCloseable {
boolean notifications = mScanSuccess &&
(lowpath.indexOf(NOTIFICATIONS_DIR) > 0);
boolean alarms = mScanSuccess && (lowpath.indexOf(ALARMS_DIR) > 0);
boolean podcasts = mScanSuccess && (lowpath.indexOf(PODCAST_DIR) > 0);
boolean podcasts = mScanSuccess && (lowpath.indexOf(PODCASTS_DIR) > 0);
boolean audiobooks = mScanSuccess && (lowpath.indexOf(AUDIOBOOKS_DIR) > 0);
boolean music = mScanSuccess && ((lowpath.indexOf(MUSIC_DIR) > 0) ||
(!ringtones && !notifications && !alarms && !podcasts));
(!ringtones && !notifications && !alarms && !podcasts && !audiobooks));
result = endFile(entry, ringtones, notifications, alarms, music, podcasts);
result = endFile(entry, ringtones, notifications, alarms, podcasts,
audiobooks, music);
}
}
} catch (RemoteException e) {
@@ -957,7 +960,7 @@ public class MediaScanner implements AutoCloseable {
@UnsupportedAppUsage
private Uri endFile(FileEntry entry, boolean ringtones, boolean notifications,
boolean alarms, boolean music, boolean podcasts)
boolean alarms, boolean podcasts, boolean audiobooks, boolean music)
throws RemoteException {
// update database
@@ -1003,6 +1006,7 @@ public class MediaScanner implements AutoCloseable {
values.put(Audio.Media.IS_ALARM, alarms);
values.put(Audio.Media.IS_MUSIC, music);
values.put(Audio.Media.IS_PODCAST, podcasts);
values.put(Audio.Media.IS_AUDIOBOOK, audiobooks);
} else if (MediaFile.isExifMimeType(mMimeType) && !mNoMedia) {
ExifInterface exif = null;
try {