package com.bumptech.glide; import android.R; import android.app.Activity; import android.app.Fragment; import android.content.ComponentCallbacks2; import android.content.ContentResolver; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.ParcelFileDescriptor; import android.util.Log; import android.view.View; import androidx.fragment.app.FragmentActivity; import com.bumptech.glide.Glide; import com.bumptech.glide.Registry; import com.bumptech.glide.load.ImageHeaderParser; import com.bumptech.glide.load.data.ParcelFileDescriptorRewinder; import com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser; import java.io.File; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import o.Box; import o.C10528eGv; import o.C16435oNn; import o.C16601pdN; import o.C17692yuZ; import o.C7054cgz; import o.CqY; import o.Ebx; import o.ExecutorServiceC0913Rjq; import o.FKd; import o.FiA; import o.Fqf; import o.GaF; import o.Hwg; import o.IQy; import o.InterfaceC6871cdb; import o.KtO; import o.KwM; import o.MUS; import o.Opg; import o.PNS; import o.POV; import o.PwL; import o.QYn; import o.Rnh; import o.TAS; import o.TnC; import o.WHP; import o.Wdn; import o.YSJ; import o.YcZ; import o.aBE; import o.gHz; import o.hTD; import o.lYS; import o.oEA; import o.oJm; import o.pOp; import o.qwa; import o.rKc; import o.rWO; import o.raU; import o.sCx; import o.sOU; import o.sqY; import o.tXR; import o.uGJ; import o.wZP; import o.xts; import o.yRS; import o.zFf; /* loaded from: classes.dex */ public class Glide implements ComponentCallbacks2 { private static volatile Glide g; private static volatile boolean j; public final sqY a; public final Fqf c; public final Opg d; public final hTD e; private final Sts f; private final C17692yuZ h; public final tXR i; private final IQy m; public final List b = new ArrayList(); private qwa k = qwa.NORMAL; /* loaded from: classes.dex */ public interface Sts { PNS b(); } @Override // android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { } public static Glide a(Context context) { if (g == null) { GeneratedAppGlideModule d = d(context.getApplicationContext()); synchronized (Glide.class) { if (g == null) { if (j) { throw new IllegalStateException("You cannot call Glide.get() in registerComponents(), use the provided Glide instance instead"); } j = true; oEA oea = new oEA(); Context applicationContext = context.getApplicationContext(); Collections.emptyList(); List e = new QYn(applicationContext).e(); if (d != null && !GeneratedAppGlideModule.d().isEmpty()) { Set> d2 = GeneratedAppGlideModule.d(); Iterator it = e.iterator(); while (it.hasNext()) { if (d2.contains(it.next().getClass())) { it.remove(); } } } if (Log.isLoggable("Glide", 3)) { for (Ebx ebx : e) { } } oea.p = null; for (Ebx ebx2 : e) { } if (oea.r == null) { oea.r = ExecutorServiceC0913Rjq.e(); } if (oea.j == null) { oea.j = ExecutorServiceC0913Rjq.a(); } if (oea.b == null) { oea.b = ExecutorServiceC0913Rjq.d(); } if (oea.n == null) { oea.n = new gHz(new gHz.RVV(applicationContext)); } if (oea.e == null) { oea.e = new PwL(); } if (oea.a == null) { int i = oea.n.a; if (i > 0) { oea.a = new Wdn(i); } else { oea.a = new rWO(); } } if (oea.d == null) { oea.d = new aBE(oea.n.d); } if (oea.f9228o == null) { oea.f9228o = new zFf(oea.n.b); } if (oea.i == null) { oea.i = new Rnh(applicationContext); } if (oea.h == null) { oea.h = new C17692yuZ(oea.f9228o, oea.i, oea.j, oea.r, ExecutorServiceC0913Rjq.b(), oea.b, oea.k); } List> list = oea.c; if (list == null) { oea.c = Collections.emptyList(); } else { oea.c = Collections.unmodifiableList(list); } C16601pdN c16601pdN = new C16601pdN(oea.l); Glide glide = new Glide(applicationContext, oea.h, oea.f9228o, oea.a, oea.d, new tXR(oea.p, c16601pdN), oea.e, oea.m, oea.f, oea.g, oea.c, e, d, c16601pdN); applicationContext.registerComponentCallbacks(glide); g = glide; j = false; } } } return g; } private static GeneratedAppGlideModule d(Context context) { try { return (GeneratedAppGlideModule) Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl").getDeclaredConstructor(Context.class).newInstance(context.getApplicationContext()); } catch (ClassNotFoundException unused) { return null; } catch (IllegalAccessException e) { throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", e); } catch (InstantiationException e2) { throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", e2); } catch (NoSuchMethodException e3) { throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", e3); } catch (InvocationTargetException e4) { throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", e4); } } private Glide(Context context, C17692yuZ c17692yuZ, IQy iQy, sqY sqy, Opg opg, tXR txr, hTD htd, int i, Sts sts, Map, CqY> map, List> list, final List list2, final uGJ ugj, C16601pdN c16601pdN) { this.h = c17692yuZ; this.a = sqy; this.d = opg; this.m = iQy; this.i = txr; this.e = htd; this.f = sts; this.c = new Fqf(context, opg, new TAS.LWm(this, list2, ugj) { // from class: o.efs.5 private List a; private uGJ c; private boolean d; private Glide e; { this.e = this; this.a = list2; this.c = ugj; } /* JADX INFO: Access modifiers changed from: private */ @Override // o.TAS.LWm /* renamed from: a, reason: merged with bridge method [inline-methods] */ public Registry c() { iYP xch; iYP pig; String str; if (this.d) { throw new IllegalStateException("Recursive Registry initialization! In your AppGlideModule and LibraryGlideModules, Make sure you're using the provided Registry rather calling glide.getRegistry()!"); } this.d = true; C1776aOB.a("Glide registry"); try { Glide glide = this.e; List list3 = this.a; sqY sqy2 = glide.a; Opg opg2 = glide.d; Context applicationContext = glide.c.getApplicationContext(); C16601pdN c16601pdN2 = glide.c.f; Registry registry = new Registry(); registry.d(new DefaultImageHeaderParser()); if (Build.VERSION.SDK_INT >= 27) { registry.d(new gYC()); } Resources resources = applicationContext.getResources(); List d = registry.a.d(); if (!d.isEmpty()) { Vni vni = new Vni(applicationContext, d, sqy2, opg2); iYP e = MzD.e(sqy2); List d2 = registry.a.d(); if (!d2.isEmpty()) { NLP nlp = new NLP(d2, resources.getDisplayMetrics(), sqy2, opg2); if (Build.VERSION.SDK_INT >= 28 && c16601pdN2.a.containsKey(oEA.HBt.class)) { pig = new fFD(); xch = new uVi(); } else { xch = new xCH(nlp); pig = new PIG(nlp, opg2); } if (Build.VERSION.SDK_INT >= 28) { str = "BitmapDrawable"; registry.b("Animation", InputStream.class, Drawable.class, new TnC.IeS(new TnC(d, opg2))); registry.b("Animation", ByteBuffer.class, Drawable.class, new TnC.LWm(new TnC(d, opg2))); } else { str = "BitmapDrawable"; } C8997dbR c8997dbR = new C8997dbR(applicationContext); lYS.HBt hBt = new lYS.HBt(resources); lYS.RVV rvv = new lYS.RVV(resources); lYS.LWm lWm = new lYS.LWm(resources); lYS.IeS ieS = new lYS.IeS(resources); Vey vey = new Vey(opg2); QaR qaR = new QaR(); BTR btr = new BTR(); ContentResolver contentResolver = applicationContext.getContentResolver(); registry.d(ByteBuffer.class, new dUW()).d(InputStream.class, new wkW(opg2)).b("Bitmap", ByteBuffer.class, Bitmap.class, xch).b("Bitmap", InputStream.class, Bitmap.class, pig); if (!"robolectric".equals(Build.FINGERPRINT)) { registry.b("Bitmap", ParcelFileDescriptor.class, Bitmap.class, new HnJ(nlp)); } String str2 = str; Registry b = registry.b("Bitmap", ParcelFileDescriptor.class, Bitmap.class, e).b("Bitmap", AssetFileDescriptor.class, Bitmap.class, MzD.c(sqy2)).c(Bitmap.class, Bitmap.class, WHP.RVV.b()).b("Bitmap", Bitmap.class, Bitmap.class, new C1270Zhn()).e(Bitmap.class, vey).b(str2, ByteBuffer.class, BitmapDrawable.class, new NTO(resources, xch)).b(str2, InputStream.class, BitmapDrawable.class, new NTO(resources, pig)).b(str2, ParcelFileDescriptor.class, BitmapDrawable.class, new NTO(resources, e)).e(BitmapDrawable.class, new C16321nUF(sqy2, vey)).b("Animation", InputStream.class, RiR.class, new XRI(d, vni, opg2)).b("Animation", ByteBuffer.class, RiR.class, vni).e(RiR.class, new fON()).c(TTv.class, TTv.class, WHP.RVV.b()).b("Bitmap", TTv.class, Bitmap.class, new bQF(sqy2)); b.b("legacy_append", Uri.class, Drawable.class, c8997dbR); b.b("legacy_append", Uri.class, Bitmap.class, new MiA(c8997dbR, sqy2)); Registry c = b.b((Box.HBt) new C16435oNn.HBt()).c(File.class, ByteBuffer.class, new MUS.LWm()).c(File.class, InputStream.class, new POV.LWm()); c.b("legacy_append", File.class, File.class, new CuL()); c.c(File.class, ParcelFileDescriptor.class, new POV.IeS()).c(File.class, File.class, WHP.RVV.b()).b((Box.HBt) new Hwg.HBt(opg2)); if (!"robolectric".equals(Build.FINGERPRINT)) { registry.b((Box.HBt) new ParcelFileDescriptorRewinder.HBt()); } registry.c(Integer.TYPE, InputStream.class, hBt).c(Integer.TYPE, ParcelFileDescriptor.class, lWm).c(Integer.class, InputStream.class, hBt).c(Integer.class, ParcelFileDescriptor.class, lWm).c(Integer.class, Uri.class, rvv).c(Integer.TYPE, AssetFileDescriptor.class, ieS).c(Integer.class, AssetFileDescriptor.class, ieS).c(Integer.TYPE, Uri.class, rvv).c(String.class, InputStream.class, new sOU.IeS()).c(Uri.class, InputStream.class, new sOU.IeS()).c(String.class, InputStream.class, new sCx.HBt()).c(String.class, ParcelFileDescriptor.class, new sCx.LWm()).c(String.class, AssetFileDescriptor.class, new sCx.IeS()).c(Uri.class, InputStream.class, new KtO.HBt(applicationContext.getAssets())).c(Uri.class, AssetFileDescriptor.class, new KtO.IeS(applicationContext.getAssets())).c(Uri.class, InputStream.class, new rKc.LWm(applicationContext)).c(Uri.class, InputStream.class, new C7054cgz.HBt(applicationContext)); if (Build.VERSION.SDK_INT >= 29) { registry.c(Uri.class, InputStream.class, new wZP.HBt(applicationContext)); registry.c(Uri.class, ParcelFileDescriptor.class, new wZP.IeS(applicationContext)); } Registry c2 = registry.c(Uri.class, InputStream.class, new pOp.IeS(contentResolver)).c(Uri.class, ParcelFileDescriptor.class, new pOp.LWm(contentResolver)).c(Uri.class, AssetFileDescriptor.class, new pOp.RVV(contentResolver)).c(Uri.class, InputStream.class, new C10528eGv.LWm()).c(URL.class, InputStream.class, new oJm.LWm()).c(Uri.class, File.class, new FiA.LWm(applicationContext)).c(IwF.class, InputStream.class, new xts.Sts()).c(byte[].class, ByteBuffer.class, new GaF.HBt()).c(byte[].class, InputStream.class, new GaF.Sts()).c(Uri.class, Uri.class, WHP.RVV.b()).c(Drawable.class, Drawable.class, WHP.RVV.b()); c2.b("legacy_append", Drawable.class, Drawable.class, new C16472ofd()); c2.a(Bitmap.class, BitmapDrawable.class, new wkM(resources)).a(Bitmap.class, byte[].class, qaR).a(Drawable.class, byte[].class, new JNd(sqy2, qaR, btr)).a(RiR.class, byte[].class, btr); iYP b2 = MzD.b(sqy2); registry.b("legacy_append", ByteBuffer.class, Bitmap.class, b2); registry.b("legacy_append", ByteBuffer.class, BitmapDrawable.class, new NTO(resources, b2)); for (Ebx ebx : list3) { } return registry; } throw new Registry.NoImageHeaderParserException(); } throw new Registry.NoImageHeaderParserException(); } finally { C1776aOB.c(); } } }, new KwM(), sts, map, list, c17692yuZ, c16601pdN, i); } /* JADX WARN: Multi-variable type inference failed */ public static YSJ e(View view) { Context context = view.getContext(); if (context == null) { throw new NullPointerException("You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed)."); } tXR txr = a(context).i; if (FKd.a()) { return txr.c(view.getContext().getApplicationContext()); } if (view != null) { if (view.getContext() != null) { Activity Fv_ = tXR.Fv_(view.getContext()); if (Fv_ == null) { return txr.c(view.getContext().getApplicationContext()); } Fragment fragment = null; androidx.fragment.app.Fragment fragment2 = null; if (Fv_ instanceof FragmentActivity) { FragmentActivity fragmentActivity = (FragmentActivity) Fv_; txr.d.clear(); tXR.a(fragmentActivity.getSupportFragmentManager().r(), txr.d); View findViewById = fragmentActivity.findViewById(R.id.content); while (!view.equals(findViewById) && (fragment2 = txr.d.get(view)) == null && (view.getParent() instanceof View)) { view = (View) view.getParent(); } txr.d.clear(); if (fragment2 == null) { return txr.a(fragmentActivity); } if (fragment2.getContext() != null) { if (FKd.a()) { return txr.c(fragment2.getContext().getApplicationContext()); } if (fragment2.getActivity() != null) { raU rau = txr.a; fragment2.getActivity(); } yRS childFragmentManager = fragment2.getChildFragmentManager(); Context context2 = fragment2.getContext(); if (txr.b.a.containsKey(oEA.RVV.class)) { return txr.e.d(context2, a(context2.getApplicationContext()), fragment2.getLifecycle(), childFragmentManager, fragment2.isVisible()); } return txr.c(context2, childFragmentManager, fragment2, fragment2.isVisible()); } throw new NullPointerException("You cannot start a load on a fragment before it is attached or after it is destroyed"); } txr.c.clear(); txr.Fw_(Fv_.getFragmentManager(), txr.c); View findViewById2 = Fv_.findViewById(R.id.content); while (!view.equals(findViewById2) && (fragment = txr.c.get(view)) == null && (view.getParent() instanceof View)) { view = (View) view.getParent(); } txr.c.clear(); if (fragment == null) { return txr.Fz_(Fv_); } if (fragment.getActivity() == null) { throw new IllegalArgumentException("You cannot start a load on a fragment before it is attached"); } if (FKd.a()) { return txr.c(fragment.getActivity().getApplicationContext()); } if (fragment.getActivity() != null) { raU rau2 = txr.a; fragment.getActivity(); } return txr.Fx_(fragment.getActivity(), fragment.getChildFragmentManager(), fragment, fragment.isVisible()); } throw new NullPointerException("Unable to obtain a request manager for a view without a Context"); } throw new NullPointerException("Argument must not be null"); } public final boolean d(YcZ ycZ) { synchronized (this.b) { Iterator it = this.b.iterator(); while (it.hasNext()) { if (it.next().e(ycZ)) { return true; } } return false; } } public static YSJ e(Context context) { if (context != null) { return a(context).i.c(context); } throw new NullPointerException("You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed)."); } public static YSJ c(FragmentActivity fragmentActivity) { if (fragmentActivity != null) { return a(fragmentActivity).i.a(fragmentActivity); } throw new NullPointerException("You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed)."); } @Override // android.content.ComponentCallbacks public void onLowMemory() { FKd.d(); this.m.e(); this.a.e(); this.d.a(); } @Override // android.content.ComponentCallbacks2 public void onTrimMemory(int i) { FKd.d(); synchronized (this.b) { Iterator it = this.b.iterator(); while (it.hasNext()) { it.next().onTrimMemory(i); } } this.m.a(i); this.a.e(i); this.d.a(i); } }