package g5;

import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import java.io.File;
import java.io.FileNotFoundException;

/* JADX INFO: loaded from: classes.dex */
public final class v implements com.bumptech.glide.load.data.e {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final String[] f26230c = {"_data"};

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Context f26231a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Uri f26232b;

    public v(Context context, Uri uri) {
        this.f26231a = context;
        this.f26232b = uri;
    }

    @Override // com.bumptech.glide.load.data.e
    public final Class a() {
        return File.class;
    }

    @Override // com.bumptech.glide.load.data.e
    public final void b() {
    }

    @Override // com.bumptech.glide.load.data.e
    public final void cancel() {
    }

    @Override // com.bumptech.glide.load.data.e
    public final DataSource d() {
        return DataSource.f5589a;
    }

    @Override // com.bumptech.glide.load.data.e
    public final void e(Priority priority, com.bumptech.glide.load.data.d dVar) {
        Cursor cursorQuery = this.f26231a.getContentResolver().query(this.f26232b, f26230c, null, null, null);
        if (cursorQuery != null) {
            try {
                string = cursorQuery.moveToFirst() ? cursorQuery.getString(cursorQuery.getColumnIndexOrThrow("_data")) : null;
            } finally {
                cursorQuery.close();
            }
        }
        if (!TextUtils.isEmpty(string)) {
            dVar.onDataReady(new File(string));
            return;
        }
        dVar.c(new FileNotFoundException("Failed to find file path for: " + this.f26232b));
    }
}
