Fix inconsistency in ringtone list
Sometimes when ringtone from external storage gets same _id as any ringtone of internal volume, getRingtonePosition(..) matches with the internal one firstly, and the ringtone shown is wrong. Solution is to match the URI of ringtone instead of the _ID so that correct ringtone is chosen. Bug: 172878342 Change-Id: I8fc3e936fe89308d4697eda42088e4fd533ce47c
This commit is contained in:
committed by
Oliver Woodman
parent
05081aa3b0
commit
1903501380
@@ -521,12 +521,12 @@ public class RingtoneManager {
|
||||
public int getRingtonePosition(Uri ringtoneUri) {
|
||||
try {
|
||||
if (ringtoneUri == null) return -1;
|
||||
final long ringtoneId = ContentUris.parseId(ringtoneUri);
|
||||
|
||||
final Cursor cursor = getCursor();
|
||||
cursor.moveToPosition(-1);
|
||||
while (cursor.moveToNext()) {
|
||||
if (ringtoneId == cursor.getLong(ID_COLUMN_INDEX)) {
|
||||
Uri uriFromCursor = getUriFromCursor(mContext, cursor);
|
||||
if (ringtoneUri.equals(uriFromCursor)) {
|
||||
return cursor.getPosition();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user