package com.bumptech.glide; import android.content.ComponentCallbacks2; import android.content.Context; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import f2.c; import f2.m; import f2.q; import f2.r; import f2.t; import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; /* loaded from: classes.dex */ public class k implements ComponentCallbacks2, m { /* renamed from: l, reason: collision with root package name */ private static final i2.f f4171l = (i2.f) i2.f.h0(Bitmap.class).N(); /* renamed from: m, reason: collision with root package name */ private static final i2.f f4172m = (i2.f) i2.f.h0(d2.c.class).N(); /* renamed from: n, reason: collision with root package name */ private static final i2.f f4173n = (i2.f) ((i2.f) i2.f.i0(s1.j.f13868c).U(g.LOW)).b0(true); /* renamed from: a, reason: collision with root package name */ protected final com.bumptech.glide.b f4174a; /* renamed from: b, reason: collision with root package name */ protected final Context f4175b; /* renamed from: c, reason: collision with root package name */ final f2.l f4176c; /* renamed from: d, reason: collision with root package name */ private final r f4177d; /* renamed from: e, reason: collision with root package name */ private final q f4178e; /* renamed from: f, reason: collision with root package name */ private final t f4179f; /* renamed from: g, reason: collision with root package name */ private final Runnable f4180g; /* renamed from: h, reason: collision with root package name */ private final f2.c f4181h; /* renamed from: i, reason: collision with root package name */ private final CopyOnWriteArrayList f4182i; /* renamed from: j, reason: collision with root package name */ private i2.f f4183j; /* renamed from: k, reason: collision with root package name */ private boolean f4184k; class a implements Runnable { a() { } @Override // java.lang.Runnable public void run() { k kVar = k.this; kVar.f4176c.b(kVar); } } private class b implements c.a { /* renamed from: a, reason: collision with root package name */ private final r f4186a; b(r rVar) { this.f4186a = rVar; } @Override // f2.c.a public void a(boolean z10) { if (z10) { synchronized (k.this) { this.f4186a.e(); } } } } public k(com.bumptech.glide.b bVar, f2.l lVar, q qVar, Context context) { this(bVar, lVar, qVar, new r(), bVar.g(), context); } private void x(j2.h hVar) { boolean w10 = w(hVar); i2.c c10 = hVar.c(); if (w10 || this.f4174a.p(hVar) || c10 == null) { return; } hVar.e(null); c10.clear(); } public j i(Class cls) { return new j(this.f4174a, this, cls, this.f4175b); } public j j() { return i(Bitmap.class).a(f4171l); } public j k() { return i(Drawable.class); } public void l(j2.h hVar) { if (hVar == null) { return; } x(hVar); } List m() { return this.f4182i; } synchronized i2.f n() { return this.f4183j; } l o(Class cls) { return this.f4174a.i().e(cls); } @Override // android.content.ComponentCallbacks public void onConfigurationChanged(Configuration configuration) { } @Override // f2.m public synchronized void onDestroy() { this.f4179f.onDestroy(); Iterator it = this.f4179f.j().iterator(); while (it.hasNext()) { l((j2.h) it.next()); } this.f4179f.i(); this.f4177d.b(); this.f4176c.a(this); this.f4176c.a(this.f4181h); m2.k.u(this.f4180g); this.f4174a.s(this); } @Override // android.content.ComponentCallbacks public void onLowMemory() { } @Override // f2.m public synchronized void onStart() { t(); this.f4179f.onStart(); } @Override // f2.m public synchronized void onStop() { s(); this.f4179f.onStop(); } @Override // android.content.ComponentCallbacks2 public void onTrimMemory(int i10) { if (i10 == 60 && this.f4184k) { r(); } } public j p(String str) { return k().v0(str); } public synchronized void q() { this.f4177d.c(); } public synchronized void r() { q(); Iterator it = this.f4178e.a().iterator(); while (it.hasNext()) { ((k) it.next()).q(); } } public synchronized void s() { this.f4177d.d(); } public synchronized void t() { this.f4177d.f(); } public synchronized String toString() { return super.toString() + "{tracker=" + this.f4177d + ", treeNode=" + this.f4178e + "}"; } protected synchronized void u(i2.f fVar) { this.f4183j = (i2.f) ((i2.f) fVar.clone()).b(); } synchronized void v(j2.h hVar, i2.c cVar) { this.f4179f.k(hVar); this.f4177d.g(cVar); } synchronized boolean w(j2.h hVar) { i2.c c10 = hVar.c(); if (c10 == null) { return true; } if (!this.f4177d.a(c10)) { return false; } this.f4179f.l(hVar); hVar.e(null); return true; } k(com.bumptech.glide.b bVar, f2.l lVar, q qVar, r rVar, f2.d dVar, Context context) { this.f4179f = new t(); a aVar = new a(); this.f4180g = aVar; this.f4174a = bVar; this.f4176c = lVar; this.f4178e = qVar; this.f4177d = rVar; this.f4175b = context; f2.c a10 = dVar.a(context.getApplicationContext(), new b(rVar)); this.f4181h = a10; if (m2.k.p()) { m2.k.t(aVar); } else { lVar.b(this); } lVar.b(a10); this.f4182i = new CopyOnWriteArrayList(bVar.i().c()); u(bVar.i().d()); bVar.o(this); } }