package o; import android.content.ContentResolver; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; import com.bumptech.glide.Glide; import com.bumptech.glide.Registry; import com.bumptech.glide.load.ImageHeaderParser; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.List; import o.InterfaceC12232euN; /* loaded from: classes.dex */ public final class Pxy implements InterfaceC12232euN { private InputStream a; private final FIN b; private final Uri d; @Override // o.InterfaceC12232euN public final void a() { } public static Pxy DM_(Context context, Uri uri, AtO atO) { Opg opg = Glide.a(context).d; List d = Glide.a(context).c.j.c().a.d(); if (!d.isEmpty()) { return new Pxy(uri, new FIN(d, atO, opg, context.getContentResolver())); } throw new Registry.NoImageHeaderParserException(); } private Pxy(Uri uri, FIN fin) { this.d = uri; this.b = fin; } @Override // o.InterfaceC12232euN public final void c(EnumC3495ayd enumC3495ayd, InterfaceC12232euN.IeS ieS) { try { InputStream DS_ = this.b.DS_(this.d); int DR_ = DS_ != null ? this.b.DR_(this.d) : -1; if (DR_ != -1) { DS_ = new WTb(DS_, DR_); } this.a = DS_; ieS.a((InterfaceC12232euN.IeS) DS_); } catch (FileNotFoundException e) { ieS.a((Exception) e); } } @Override // o.InterfaceC12232euN public final void e() { InputStream inputStream = this.a; if (inputStream != null) { try { inputStream.close(); } catch (IOException unused) { } } } @Override // o.InterfaceC12232euN public final Class c() { return InputStream.class; } @Override // o.InterfaceC12232euN public final pNW d() { return pNW.LOCAL; } /* loaded from: classes.dex */ public static class IeS implements AtO { private static final String[] b = {"_data"}; private final ContentResolver c; public IeS(ContentResolver contentResolver) { this.c = contentResolver; } @Override // o.AtO public final Cursor DP_(Uri uri) { return this.c.query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, b, "kind = 1 AND video_id = ?", new String[]{uri.getLastPathSegment()}, null); } } /* loaded from: classes.dex */ public static class LWm implements AtO { private static final String[] a = {"_data"}; private final ContentResolver c; public LWm(ContentResolver contentResolver) { this.c = contentResolver; } @Override // o.AtO public final Cursor DP_(Uri uri) { return this.c.query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, a, "kind = 1 AND image_id = ?", new String[]{uri.getLastPathSegment()}, null); } } }