Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a2fb51a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Automerger Merge Worker
Browse files

Merge "Use the try catch to deal with the StaleDataException." am: 1fa847ad...

Merge "Use the try catch to deal with the StaleDataException." am: 1fa847ad am: 15698dd3 am: 4b16237a am: d715c91c

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1433917

Change-Id: I910b327fba414ae7ce3574acc078a0af40756b87
parents 3a0dd0df d715c91c
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.StaleDataException;
import android.net.Uri;
import android.os.Environment;
import android.os.FileUtils;
@@ -492,9 +493,14 @@ public class RingtoneManager {
    public Uri getRingtoneUri(int position) {
        // use cursor directly instead of requerying it, which could easily
        // cause position to shuffle.
        try {
            if (mCursor == null || !mCursor.moveToPosition(position)) {
                return null;
            }
        } catch (StaleDataException | IllegalStateException e) {
            Log.e(TAG, "Unexpected Exception has been catched.", e);
            return null;
        }

        return getUriFromCursor(mContext, mCursor);
    }