package o; import android.content.ComponentCallbacks2; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.view.View; import com.airbnb.deeplinkdispatch.UrlTreeKt; import com.bumptech.glide.Glide; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; import o.InterfaceC17714zBx; /* loaded from: classes.dex */ public class YSJ implements ComponentCallbacks2, Lco { private static final PNS i; final zZV a; final GRm b; final CopyOnWriteArrayList> c; Glide d; final ySr e; private final InterfaceC17714zBx f; private final Runnable g; private boolean h; private Context j; private PNS k; private final InterfaceC17301vdx n; @Override // android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { } @Override // android.content.ComponentCallbacks public void onLowMemory() { } @Override // android.content.ComponentCallbacks2 public void onTrimMemory(int i2) { } static { PNS c = new PNS().c(Bitmap.class); c.j = true; i = c; new PNS().c(RiR.class).j = true; new PNS().a(LHy.d).d(EnumC3495ayd.LOW).p(); } public YSJ(Glide glide, zZV zzv, InterfaceC17301vdx interfaceC17301vdx, Context context) { this(glide, zzv, interfaceC17301vdx, new ySr(), glide.e, context); } private YSJ(Glide glide, zZV zzv, InterfaceC17301vdx interfaceC17301vdx, ySr ysr, hTD htd, Context context) { this.b = new GRm(); Runnable runnable = new Runnable(this) { // from class: o.YSJ.2 private YSJ c; { this.c = this; } @Override // java.lang.Runnable public final void run() { this.c.a.e(this.c); } }; this.g = runnable; this.d = glide; this.a = zzv; this.n = interfaceC17301vdx; this.e = ysr; this.j = context; InterfaceC17714zBx d = htd.d(context.getApplicationContext(), new HBt(this, ysr)); this.f = d; if (FKd.a()) { FKd.e(runnable); } else { zzv.e(this); } zzv.e(d); this.c = new CopyOnWriteArrayList<>(glide.c.c); PNS d2 = glide.c.d(); synchronized (this) { this.k = d2.d().c(); } synchronized (glide.b) { if (glide.b.contains(this)) { throw new IllegalStateException("Cannot register already registered manager"); } glide.b.add(this); } } @Override // o.Lco public final void a() { synchronized (this) { synchronized (this) { ySr ysr = this.e; ysr.d = false; for (PXc pXc : FKd.b(ysr.e)) { if (!pXc.j() && !pXc.h()) { pXc.a(); } } ysr.a.clear(); } } this.b.a(); } @Override // o.Lco public final void c() { synchronized (this) { synchronized (this) { ySr ysr = this.e; ysr.d = true; for (PXc pXc : FKd.b(ysr.e)) { if (pXc.h()) { pXc.f(); ysr.a.add(pXc); } } } } this.b.c(); } @Override // o.Lco public final void d() { synchronized (this) { this.b.d(); for (YcZ ycZ : FKd.b(this.b.b)) { if (ycZ != null) { c(ycZ); } } this.b.b.clear(); ySr ysr = this.e; Iterator it = FKd.b(ysr.e).iterator(); while (it.hasNext()) { ysr.d((PXc) it.next()); } ysr.a.clear(); this.a.b(this); this.a.b(this.f); FKd.a(this.g); Glide glide = this.d; synchronized (glide.b) { if (!glide.b.contains(this)) { throw new IllegalStateException("Cannot unregister not yet registered manager"); } glide.b.remove(this); } } } public final Cdw b() { return new Cdw(this.d, this, Bitmap.class, this.j).b(i); } public final void c(YcZ ycZ) { boolean e = e(ycZ); PXc b = ycZ.b(); if (e || this.d.d(ycZ) || b == null) { return; } ycZ.d((PXc) null); b.c(); } public final boolean e(YcZ ycZ) { synchronized (this) { PXc b = ycZ.b(); if (b == null) { return true; } if (!this.e.d(b)) { return false; } this.b.b.remove(ycZ); ycZ.d((PXc) null); return true; } } /* JADX INFO: Access modifiers changed from: package-private */ public final PNS e() { PNS pns; synchronized (this) { pns = this.k; } return pns; } public String toString() { String obj; synchronized (this) { StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("{tracker="); sb.append(this.e); sb.append(", treeNode="); sb.append(this.n); sb.append(UrlTreeKt.componentParamSuffix); obj = sb.toString(); } return obj; } /* loaded from: classes.dex */ class HBt implements InterfaceC17714zBx.Sts { private YSJ d; private final ySr e; HBt(YSJ ysj, ySr ysr) { this.d = ysj; this.e = ysr; } @Override // o.InterfaceC17714zBx.Sts public final void d(boolean z) { if (z) { synchronized (this.d) { ySr ysr = this.e; for (PXc pXc : FKd.b(ysr.e)) { if (!pXc.j() && !pXc.d()) { pXc.c(); if (!ysr.d) { pXc.a(); } else { ysr.a.add(pXc); } } } } } } } /* loaded from: classes.dex */ public static class IeS extends RqC { @Override // o.YcZ public final void avy_(Drawable drawable) { } @Override // o.YcZ public final void d(Object obj) { } public IeS(View view) { super(view); } } public final Cdw Du_(Drawable drawable) { return new Cdw(this.d, this, Drawable.class, this.j).Ds_(drawable); } public final Cdw c(String str) { return new Cdw(this.d, this, Drawable.class, this.j).a(str); } public final Cdw d(byte[] bArr) { return new Cdw(this.d, this, Drawable.class, this.j).e(bArr); } }