diff options
| author | Marco Nelissen <marcone@google.com> | 2011-08-11 16:29:20 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-11 16:29:20 -0700 |
| commit | 5fadf79ef99880d83f0643f8a038ea8da85f6ffd (patch) | |
| tree | 06dabbd759db61290e80f20e93aed6e6a9bb5000 | |
| parent | 388e9389522fe676c9b795df5be979a30666b225 (diff) | |
| parent | bcbddd9342ee5ef48617ce7dcca6c505df3fcf08 (diff) | |
Merge "Only set the ringtones and such if this is the first media scan b/5126979"
| -rw-r--r-- | media/java/android/media/MediaScanner.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/media/java/android/media/MediaScanner.java b/media/java/android/media/MediaScanner.java index 1ba4c4ff943d..2d1761f20309 100644 --- a/media/java/android/media/MediaScanner.java +++ b/media/java/android/media/MediaScanner.java @@ -327,6 +327,8 @@ public class MediaScanner // used when scanning the image database so we know whether we have to prune // old thumbnail files private int mOriginalCount; + /** Whether the database had any entries in it before the scan started */ + private boolean mWasEmptyPriorToScan = false; /** Whether the scanner has set a default sound for the ringer ringtone. */ private boolean mDefaultRingtoneSet; /** Whether the scanner has set a default sound for the notification ringtone. */ @@ -547,6 +549,7 @@ public class MediaScanner return entry; } + @Override public void scanFile(String path, long lastModified, long fileSize, boolean isDirectory, boolean noMedia) { // This is the callback funtion from native codes. @@ -901,19 +904,19 @@ public class MediaScanner mMediaProvider.update(result, values, null, null); } - if (notifications && !mDefaultNotificationSet) { + if (notifications && mWasEmptyPriorToScan && !mDefaultNotificationSet) { if (TextUtils.isEmpty(mDefaultNotificationFilename) || doesPathHaveFilename(entry.mPath, mDefaultNotificationFilename)) { setSettingIfNotSet(Settings.System.NOTIFICATION_SOUND, tableUri, rowId); mDefaultNotificationSet = true; } - } else if (ringtones && !mDefaultRingtoneSet) { + } else if (ringtones && mWasEmptyPriorToScan && !mDefaultRingtoneSet) { if (TextUtils.isEmpty(mDefaultRingtoneFilename) || doesPathHaveFilename(entry.mPath, mDefaultRingtoneFilename)) { setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId); mDefaultRingtoneSet = true; } - } else if (alarms && !mDefaultAlarmSet) { + } else if (alarms && mWasEmptyPriorToScan && !mDefaultAlarmSet) { if (TextUtils.isEmpty(mDefaultAlarmAlertFilename) || doesPathHaveFilename(entry.mPath, mDefaultAlarmAlertFilename)) { setSettingIfNotSet(Settings.System.ALARM_ALERT, tableUri, rowId); @@ -997,6 +1000,7 @@ public class MediaScanner where, selectionArgs, null); if (c != null) { + mWasEmptyPriorToScan = c.getCount() == 0; while (c.moveToNext()) { long rowId = c.getLong(FILES_PRESCAN_ID_COLUMN_INDEX); String path = c.getString(FILES_PRESCAN_PATH_COLUMN_INDEX); |
