package ph;

import android.os.ParcelFileDescriptor;
import android.util.Log;
import com.bumptech.glide.load.data.d;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import net.sqlcipher.database.SQLiteDatabase;
import ph.n;

/* loaded from: classes4.dex */
public class g implements n {

    /* renamed from: a, reason: collision with root package name */
    private final d f32673a;

    /* loaded from: classes4.dex */
    public static class a implements o {

        /* renamed from: a, reason: collision with root package name */
        private final d f32674a;

        public a(d dVar) {
            this.f32674a = dVar;
        }

        @Override // ph.o
        public final void d() {
        }

        @Override // ph.o
        public final n e(r rVar) {
            return new g(this.f32674a);
        }
    }

    /* loaded from: classes4.dex */
    public static class b extends a {

        /* loaded from: classes4.dex */
        class a implements d {
            a() {
            }

            @Override // ph.g.d
            public Class a() {
                return ParcelFileDescriptor.class;
            }

            @Override // ph.g.d
            /* renamed from: d, reason: merged with bridge method [inline-methods] */
            public void b(ParcelFileDescriptor parcelFileDescriptor) {
                parcelFileDescriptor.close();
            }

            @Override // ph.g.d
            /* renamed from: e, reason: merged with bridge method [inline-methods] */
            public ParcelFileDescriptor c(File file) {
                return ParcelFileDescriptor.open(file, SQLiteDatabase.CREATE_IF_NECESSARY);
            }
        }

        public b() {
            super(new a());
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class c implements com.bumptech.glide.load.data.d {

        /* renamed from: p, reason: collision with root package name */
        private final File f32675p;

        /* renamed from: q, reason: collision with root package name */
        private final d f32676q;

        /* renamed from: r, reason: collision with root package name */
        private Object f32677r;

        c(File file, d dVar) {
            this.f32675p = file;
            this.f32676q = dVar;
        }

        @Override // com.bumptech.glide.load.data.d
        public Class a() {
            return this.f32676q.a();
        }

        @Override // com.bumptech.glide.load.data.d
        public void b() {
            Object obj = this.f32677r;
            if (obj != null) {
                try {
                    this.f32676q.b(obj);
                } catch (IOException unused) {
                }
            }
        }

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

        @Override // com.bumptech.glide.load.data.d
        public jh.a d() {
            return jh.a.LOCAL;
        }

        @Override // com.bumptech.glide.load.data.d
        public void e(com.bumptech.glide.g gVar, d.a aVar) {
            try {
                Object c10 = this.f32676q.c(this.f32675p);
                this.f32677r = c10;
                aVar.f(c10);
            } catch (FileNotFoundException e10) {
                if (Log.isLoggable("FileLoader", 3)) {
                    Log.d("FileLoader", "Failed to open file", e10);
                }
                aVar.c(e10);
            }
        }
    }

    /* loaded from: classes4.dex */
    public interface d {
        Class a();

        void b(Object obj);

        Object c(File file);
    }

    /* loaded from: classes4.dex */
    public static class e extends a {

        /* loaded from: classes4.dex */
        class a implements d {
            a() {
            }

            @Override // ph.g.d
            public Class a() {
                return InputStream.class;
            }

            @Override // ph.g.d
            /* renamed from: d, reason: merged with bridge method [inline-methods] */
            public void b(InputStream inputStream) {
                inputStream.close();
            }

            @Override // ph.g.d
            /* renamed from: e, reason: merged with bridge method [inline-methods] */
            public InputStream c(File file) {
                return new FileInputStream(file);
            }
        }

        public e() {
            super(new a());
        }
    }

    public g(d dVar) {
        this.f32673a = dVar;
    }

    @Override // ph.n
    /* renamed from: c, reason: merged with bridge method [inline-methods] */
    public n.a b(File file, int i10, int i11, jh.h hVar) {
        return new n.a(new di.b(file), new c(file, this.f32673a));
    }

    @Override // ph.n
    /* renamed from: d, reason: merged with bridge method [inline-methods] */
    public boolean a(File file) {
        return true;
    }
}
