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

Commit b724ae49 authored by Wenhao Shi's avatar Wenhao Shi Committed by Android (Google) Code Review
Browse files

Merge "Fix error throwing by calling getCount before closing the cursor." into 24D1-dev

parents 9e78e2af 4ca8fd24
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package android.media;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
@@ -573,12 +572,13 @@ public class RingtoneManager {
            FileUtils.closeQuietly(cursor);
            throw new FileNotFoundException("No item found for " + baseUri);
        } else if (cursor.getCount() > 1) {
            int resultCount = cursor.getCount();
            // Find more than 1 result.
            // We are not sure which one is the right ringtone file so just abandon this case.
            FileUtils.closeQuietly(cursor);
            throw new FileNotFoundException(
                    "Find multiple ringtone candidates by title+ringtone_type query: count: "
                            + cursor.getCount());
                            + resultCount);
        }
        if (cursor.moveToFirst()) {
            ringtoneUri = ContentUris.withAppendedId(baseUri, cursor.getLong(0));