package ඓ.ῲ.K.ᕣ.㿎.ؿ;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import ඓ.ῲ.K.ComponentCallbacks2C1161;
import ඓ.ῲ.K.ᕣ.㿎.AbstractC1146;
import ඓ.ῲ.K.ᕣ.㿎.C1136;

/* renamed from: ඓ.ῲ.K.ᕣ.㿎.ؿ.ῲ  reason: contains not printable characters */
/* compiled from: ThumbFetcher */
public class C1125 implements AbstractC1146<InputStream> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C1129 f4591;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final Uri f4592;

    /* renamed from: 㸾  reason: contains not printable characters */
    public InputStream f4593;

    /* renamed from: ඓ.ῲ.K.ᕣ.㿎.ؿ.ῲ$ῲ  reason: contains not printable characters */
    /* compiled from: ThumbFetcher */
    public static class C1126 implements AbstractC1124 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public static final String[] f4594 = {"_data"};

        /* renamed from: K  reason: contains not printable characters */
        public final ContentResolver f4595;

        public C1126(ContentResolver contentResolver) {
            this.f4595 = contentResolver;
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.ؿ.AbstractC1124
        /* renamed from: K  reason: contains not printable characters */
        public Cursor m3016(Uri uri) {
            String lastPathSegment = uri.getLastPathSegment();
            return this.f4595.query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, f4594, "kind = 1 AND video_id = ?", new String[]{lastPathSegment}, null);
        }
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.㿎.ؿ.ῲ$K  reason: contains not printable characters */
    /* compiled from: ThumbFetcher */
    public static class C1127 implements AbstractC1124 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public static final String[] f4596 = {"_data"};

        /* renamed from: K  reason: contains not printable characters */
        public final ContentResolver f4597;

        public C1127(ContentResolver contentResolver) {
            this.f4597 = contentResolver;
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.ؿ.AbstractC1124
        /* renamed from: K  reason: contains not printable characters */
        public Cursor m3017(Uri uri) {
            String lastPathSegment = uri.getLastPathSegment();
            return this.f4597.query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, f4596, "kind = 1 AND image_id = ?", new String[]{lastPathSegment}, null);
        }
    }

    public C1125(Uri uri, C1129 r2) {
        this.f4592 = uri;
        this.f4591 = r2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static C1125 m3011(Context context, Uri uri, AbstractC1124 r5) {
        return new C1125(uri, new C1129(ComponentCallbacks2C1161.m3105(context).f4668.m1265(), r5, ComponentCallbacks2C1161.m3105(context).f4672, context.getContentResolver()));
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    public void cancel() {
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    /* renamed from: ʬ  reason: contains not printable characters */
    public DataSource m3012() {
        return DataSource.LOCAL;
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    /* renamed from: ῲ  reason: contains not printable characters */
    public void m3013() {
        InputStream inputStream = this.f4593;
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException unused) {
            }
        }
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    /* renamed from: K  reason: contains not printable characters */
    public void m3015(Priority priority, AbstractC1146.AbstractC1147<? super InputStream> k) {
        try {
            InputStream r4 = this.f4591.m3021(this.f4592);
            int r1 = r4 != null ? this.f4591.m3022(this.f4592) : -1;
            if (r1 != -1) {
                r4 = new C1136(r4, r1);
            }
            this.f4593 = r4;
            k.m3069(this.f4593);
        } catch (FileNotFoundException e) {
            if (Log.isLoggable("MediaStoreThumbFetcher", 3)) {
                Log.d("MediaStoreThumbFetcher", "Failed to find thumbnail file", e);
            }
            k.m3068((Exception) e);
        }
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    /* renamed from: K  reason: contains not printable characters */
    public Class<InputStream> m3014() {
        return InputStream.class;
    }
}
