package o; import android.util.Log; import com.bumptech.glide.Registry; import com.bumptech.glide.load.engine.GlideException; import java.util.ArrayList; import java.util.List; import java.util.Objects; import o.C1050UnO; import o.C2582ahN; import o.RDy; import o.SCe; import o.XGP; import o.ykj; /* renamed from: o.aua, reason: case insensitive filesystem */ /* loaded from: classes.dex */ final class RunnableC3281aua implements XGP.IeS, Runnable, Comparable>, C1050UnO.Sts { private boolean A; private long B; private volatile boolean C; private jbe D; InterfaceC2545agd c; volatile XGP d; RVV e; Fqf f; final IeS g; int h; LHy i; volatile boolean j; Object k; unA l; int m; boolean n; /* renamed from: o, reason: collision with root package name */ uIA f8527o; ZqN p; InterfaceC2545agd q; EnumC3495ayd r; int s; private pNW u; private Object v; private InterfaceC12232euN w; private Thread x; private InterfaceC2545agd y; private final RDy.Sts> z; final LTe a = new LTe<>(); private final List E = new ArrayList(); private final ykj I = new ykj.LWm(); final Sts b = new Sts<>(); final HBt t = new HBt(); /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$IeS */ /* loaded from: classes.dex */ public interface IeS { InterfaceC1095VmX e(); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$RVV */ /* loaded from: classes.dex */ public interface RVV { void b(Ezi ezi, pNW pnw, boolean z); void c(RunnableC3281aua runnableC3281aua); void d(GlideException glideException); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$ZqN */ /* loaded from: classes.dex */ public enum ZqN { INITIALIZE, SWITCH_TO_SOURCE_SERVICE, DECODE_DATA } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$jbe */ /* loaded from: classes.dex */ public enum jbe { INITIALIZE, RESOURCE_CACHE, DATA_CACHE, SOURCE, ENCODE, FINISHED } @Override // java.lang.Comparable public final /* synthetic */ int compareTo(RunnableC3281aua runnableC3281aua) { RunnableC3281aua runnableC3281aua2 = runnableC3281aua; int ordinal = this.r.ordinal() - runnableC3281aua2.r.ordinal(); return ordinal == 0 ? this.m - runnableC3281aua2.m : ordinal; } /* JADX INFO: Access modifiers changed from: package-private */ public RunnableC3281aua(IeS ieS, RDy.Sts> sts) { this.g = ieS; this.z = sts; } /* JADX INFO: Access modifiers changed from: package-private */ public final void e() { HBt hBt = this.t; synchronized (hBt) { hBt.d = false; hBt.b = false; hBt.e = false; } Sts sts = this.b; sts.b = null; sts.d = null; sts.c = null; this.a.c(); this.C = false; this.f = null; this.q = null; this.l = null; this.r = null; this.f8527o = null; this.e = null; this.D = null; this.d = null; this.x = null; this.c = null; this.v = null; this.u = null; this.w = null; this.B = 0L; this.j = false; this.k = null; this.E.clear(); this.z.d(this); } @Override // java.lang.Runnable public final void run() { InterfaceC12232euN interfaceC12232euN = this.w; try { try { if (this.j) { j(); if (interfaceC12232euN != null) { return; } else { return; } } int i = AnonymousClass5.e[this.p.ordinal()]; if (i == 1) { this.D = c(jbe.INITIALIZE); this.d = d(); f(); } else if (i == 2) { f(); } else if (i == 3) { a(); } else { StringBuilder sb = new StringBuilder("Unrecognized run reason: "); sb.append(this.p); throw new IllegalStateException(sb.toString()); } if (interfaceC12232euN != null) { interfaceC12232euN.e(); } } finally { if (interfaceC12232euN != null) { interfaceC12232euN.e(); } } } catch (oco e) { throw e; } catch (Throwable th) { Log.isLoggable("DecodeJob", 3); if (this.D != jbe.ENCODE) { this.E.add(th); j(); } if (!this.j) { throw th; } throw th; } } private XGP d() { int i = AnonymousClass5.a[this.D.ordinal()]; if (i == 1) { return new vGO(this.a, this); } if (i == 2) { return new C15921jdR(this.a, this); } if (i == 3) { return new LiZ(this.a, this); } if (i == 4) { return null; } StringBuilder sb = new StringBuilder("Unrecognized stage: "); sb.append(this.D); throw new IllegalStateException(sb.toString()); } private void f() { this.x = Thread.currentThread(); this.B = PYC.e(); boolean z = false; while (!this.j && this.d != null && !(z = this.d.c())) { this.D = c(this.D); this.d = d(); if (this.D == jbe.SOURCE) { this.p = ZqN.SWITCH_TO_SOURCE_SERVICE; this.e.c(this); return; } } if ((this.D == jbe.FINISHED || this.j) && !z) { j(); } } private void j() { g(); this.e.d(new GlideException("Failed to load resource", new ArrayList(this.E))); if (this.t.c()) { e(); } } private void g() { Throwable th; this.I.b(); if (!this.C) { this.C = true; return; } if (this.E.isEmpty()) { th = null; } else { List list = this.E; th = list.get(list.size() - 1); } throw new IllegalStateException("Already notified", th); } /* JADX INFO: Access modifiers changed from: package-private */ public final jbe c(jbe jbeVar) { int i = AnonymousClass5.a[jbeVar.ordinal()]; if (i == 1) { if (this.i.c()) { return jbe.DATA_CACHE; } return c(jbe.DATA_CACHE); } if (i == 2) { return this.n ? jbe.FINISHED : jbe.SOURCE; } if (i == 3 || i == 4) { return jbe.FINISHED; } if (i == 5) { if (this.i.e()) { return jbe.RESOURCE_CACHE; } return c(jbe.RESOURCE_CACHE); } throw new IllegalArgumentException("Unrecognized stage: ".concat(String.valueOf(jbeVar))); } @Override // o.XGP.IeS public final void b() { this.p = ZqN.SWITCH_TO_SOURCE_SERVICE; this.e.c(this); } @Override // o.XGP.IeS public final void e(InterfaceC2545agd interfaceC2545agd, Object obj, InterfaceC12232euN interfaceC12232euN, pNW pnw, InterfaceC2545agd interfaceC2545agd2) { this.c = interfaceC2545agd; this.v = obj; this.w = interfaceC12232euN; this.u = pnw; this.y = interfaceC2545agd2; this.A = interfaceC2545agd != this.a.d().get(0); if (Thread.currentThread() != this.x) { this.p = ZqN.DECODE_DATA; this.e.c(this); } else { a(); } } @Override // o.XGP.IeS public final void b(InterfaceC2545agd interfaceC2545agd, Exception exc, InterfaceC12232euN interfaceC12232euN, pNW pnw) { interfaceC12232euN.e(); GlideException glideException = new GlideException("Fetching data failed", exc); Class c = interfaceC12232euN.c(); glideException.c = interfaceC2545agd; glideException.b = pnw; glideException.e = c; this.E.add(glideException); if (Thread.currentThread() != this.x) { this.p = ZqN.SWITCH_TO_SOURCE_SERVICE; this.e.c(this); } else { f(); } } private void a() { Ezi ezi; if (Log.isLoggable("DecodeJob", 2)) { long j = this.B; Objects.toString(this.v); Objects.toString(this.c); Objects.toString(this.w); PYC.e(j); } iYo iyo = null; try { ezi = b(this.w, this.v, this.u); } catch (GlideException e) { InterfaceC2545agd interfaceC2545agd = this.y; pNW pnw = this.u; e.c = interfaceC2545agd; e.b = pnw; e.e = null; this.E.add(e); ezi = null; } if (ezi == null) { f(); return; } pNW pnw2 = this.u; boolean z = this.A; if (ezi instanceof WJU) { ((WJU) ezi).c(); } if (this.b.c != null) { iyo = iYo.e(ezi); ezi = iyo; } g(); this.e.b(ezi, pnw2, z); this.D = jbe.ENCODE; try { if (this.b.c != null) { Sts sts = this.b; try { this.g.e().b(sts.b, new AWA(sts.d, sts.c, this.l)); sts.c.j(); } catch (Throwable th) { sts.c.j(); throw th; } } if (this.t.a()) { e(); } } finally { if (iyo != null) { iyo.j(); } } } private Ezi b(InterfaceC12232euN interfaceC12232euN, Data data, pNW pnw) throws GlideException { if (data != null) { try { long e = PYC.e(); LTe lTe = this.a; Ezi d = d(data, pnw, lTe.a.j.c().b(data.getClass(), lTe.g, lTe.m)); if (Log.isLoggable("DecodeJob", 2)) { PYC.e(e); } return d; } finally { interfaceC12232euN.e(); } } interfaceC12232euN.e(); return null; } private Ezi d(Data data, pNW pnw, C1239YsJ c1239YsJ) throws GlideException { unA una = this.l; boolean z = pnw == pNW.RESOURCE_DISK_CACHE || this.a.c; wrW wrw = NLP.d; Boolean bool = (Boolean) (una.d.containsKey(wrw) ? una.d.get(wrw) : wrw.a); if (bool == null || (bool.booleanValue() && !z)) { una = new unA(); una.d.a(this.l.d); una.d.put(NLP.d, Boolean.valueOf(z)); } unA una2 = una; Box d = this.f.j.c().e.d(data); try { return c1239YsJ.e(d, una2, this.s, this.h, new LWm(this, pnw)); } finally { d.b(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$5, reason: invalid class name */ /* loaded from: classes.dex */ public static /* synthetic */ class AnonymousClass5 { static final int[] a; static final int[] d; static final int[] e; static { int[] iArr = new int[XQd.values().length]; d = iArr; try { iArr[XQd.SOURCE.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { d[XQd.TRANSFORMED.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } int[] iArr2 = new int[jbe.values().length]; a = iArr2; try { iArr2[jbe.RESOURCE_CACHE.ordinal()] = 1; } catch (NoSuchFieldError unused3) { } try { a[jbe.DATA_CACHE.ordinal()] = 2; } catch (NoSuchFieldError unused4) { } try { a[jbe.SOURCE.ordinal()] = 3; } catch (NoSuchFieldError unused5) { } try { a[jbe.FINISHED.ordinal()] = 4; } catch (NoSuchFieldError unused6) { } try { a[jbe.INITIALIZE.ordinal()] = 5; } catch (NoSuchFieldError unused7) { } int[] iArr3 = new int[ZqN.values().length]; e = iArr3; try { iArr3[ZqN.INITIALIZE.ordinal()] = 1; } catch (NoSuchFieldError unused8) { } try { e[ZqN.SWITCH_TO_SOURCE_SERVICE.ordinal()] = 2; } catch (NoSuchFieldError unused9) { } try { e[ZqN.DECODE_DATA.ordinal()] = 3; } catch (NoSuchFieldError unused10) { } } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$LWm */ /* loaded from: classes.dex */ public final class LWm implements C2582ahN.Sts { private final pNW b; private RunnableC3281aua e; LWm(RunnableC3281aua runnableC3281aua, pNW pnw) { this.e = runnableC3281aua; this.b = pnw; } @Override // o.C2582ahN.Sts public final Ezi e(Ezi ezi) { Ezi ezi2; wfh wfhVar; XQd xQd; InterfaceC2545agd vwL; RunnableC3281aua runnableC3281aua = this.e; pNW pnw = this.b; Class cls = ezi.e().getClass(); nuW nuw = null; if (pnw != pNW.RESOURCE_DISK_CACHE) { wfh b = runnableC3281aua.a.b(cls); wfhVar = b; ezi2 = b.b(runnableC3281aua.f, ezi, runnableC3281aua.s, runnableC3281aua.h); } else { ezi2 = ezi; wfhVar = null; } if (!ezi.equals(ezi2)) { ezi.b(); } if (runnableC3281aua.a.a.j.c().c.e(ezi2.d()) == null) { xQd = XQd.NONE; } else { nuw = runnableC3281aua.a.a.j.c().c.e(ezi2.d()); if (nuw != null) { xQd = nuw.d(runnableC3281aua.l); } else { throw new Registry.NoResultEncoderAvailableException(ezi2.d()); } } nuW nuw2 = nuw; LTe lTe = runnableC3281aua.a; InterfaceC2545agd interfaceC2545agd = runnableC3281aua.c; List> b2 = lTe.b(); int size = b2.size(); boolean z = false; int i = 0; while (true) { if (i >= size) { break; } if (b2.get(i).e.equals(interfaceC2545agd)) { z = true; break; } i++; } if (!runnableC3281aua.i.c(!z, pnw, xQd)) { return ezi2; } if (nuw2 == null) { throw new Registry.NoResultEncoderAvailableException(ezi2.e().getClass()); } int i2 = AnonymousClass5.d[xQd.ordinal()]; if (i2 == 1) { vwL = new VwL(runnableC3281aua.c, runnableC3281aua.q); } else if (i2 == 2) { vwL = new Ajc(runnableC3281aua.a.a.d, runnableC3281aua.c, runnableC3281aua.q, runnableC3281aua.s, runnableC3281aua.h, wfhVar, cls, runnableC3281aua.l); } else { throw new IllegalArgumentException("Unknown strategy: ".concat(String.valueOf(xQd))); } iYo e = iYo.e(ezi2); Sts sts = runnableC3281aua.b; sts.b = vwL; sts.d = nuw2; sts.c = e; return e; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$HBt */ /* loaded from: classes.dex */ public static class HBt { boolean b; boolean d; boolean e; HBt() { } final boolean a() { boolean z; synchronized (this) { this.d = true; z = this.b; } return z; } final boolean c() { boolean z; synchronized (this) { this.e = true; z = this.b; } return z; } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean b() { boolean z; synchronized (this) { z = true; this.b = true; if (!this.e) { if (!this.d) { z = false; } } } return z; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.aua$Sts */ /* loaded from: classes.dex */ public static class Sts { InterfaceC2545agd b; iYo c; nuW d; Sts() { } } @Override // o.C1050UnO.Sts public final ykj c() { return this.I; } }