package o; import android.graphics.Bitmap; import android.net.Uri; import android.os.Handler; import com.squareup.picasso.Picasso; import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.util.Iterator; import java.util.List; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; import o.AbstractC12987fNZ; import o.fNN; /* renamed from: o.fNx, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class RunnableC13011fNx implements Runnable { public List a; Future b; public final fNW c; public Exception d; public AbstractC13013fNz e; int f; public Picasso.HBt g; final String h; final int i; public final Picasso j; Picasso.LWm k; final AbstractC12987fNZ l; public Bitmap m; int n; /* renamed from: o, reason: collision with root package name */ final int f9102o = s.incrementAndGet(); private fNB t; private int u; private C13022fOc x; private fNH y; private static final Object p = new Object(); private static final ThreadLocal r = new ThreadLocal() { // from class: o.fNx.4 @Override // java.lang.ThreadLocal protected final /* synthetic */ StringBuilder initialValue() { return new StringBuilder("Picasso-"); } }; private static final AtomicInteger s = new AtomicInteger(); private static final AbstractC12987fNZ q = new AbstractC12987fNZ() { // from class: o.fNx.3 @Override // o.AbstractC12987fNZ public final boolean d(fNW fnw) { return true; } @Override // o.AbstractC12987fNZ public final AbstractC12987fNZ.Sts c(fNW fnw, int i) throws IOException { throw new IllegalStateException("Unrecognized type of request: ".concat(String.valueOf(fnw))); } }; private static boolean b(boolean z, int i, int i2, int i3, int i4) { return !z || (i3 != 0 && i > i3) || (i4 != 0 && i2 > i4); } private RunnableC13011fNx(Picasso picasso, fNH fnh, fNB fnb, C13022fOc c13022fOc, AbstractC13013fNz abstractC13013fNz, AbstractC12987fNZ abstractC12987fNZ) { this.j = picasso; this.y = fnh; this.t = fnb; this.x = c13022fOc; this.e = abstractC13013fNz; this.h = abstractC13013fNz.c; this.c = abstractC13013fNz.g; this.k = abstractC13013fNz.g.j; this.i = abstractC13013fNz.e; this.f = abstractC13013fNz.f; this.l = abstractC12987fNZ; this.n = abstractC12987fNZ.e(); } /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: Can't wrap try/catch for region: R(7:(2:64|65)|(9:(5:74|75|(2:77|(1:79))|84|(2:86|87)(1:88))|(7:109|110|(4:112|113|114|(3:116|117|118)(1:209))(1:213)|119|(7:121|122|124|(1:140)(1:131)|(2:133|(2:136|(1:138)))|139|(0))|145|(16:(1:148)(1:177)|(1:150)(1:176)|151|(3:153|(1:155)(2:161|(1:163)(1:164))|156)(2:165|(3:167|(1:169)(2:171|(1:173)(1:174))|170)(1:175))|157|(1:159)|160|99|(2:101|102)(1:108)|103|104|(1:106)|75|(0)|84|(0)(0))(2:178|(7:(1:181)(1:193)|182|(1:184)(1:192)|185|(1:187)(1:191)|188|(1:190))(1:(5:(1:199)(1:207)|200|(1:202)(1:206)|203|(1:205)))))(1:97)|103|104|(0)|75|(0)|84|(0)(0))|89|90|98|99|(0)(0)) */ /* JADX WARN: Code restructure failed: missing block: B:215:0x0421, code lost: r0 = th; */ /* JADX WARN: Removed duplicated region for block: B:101:0x03cb A[Catch: all -> 0x0421, TRY_LEAVE, TryCatch #0 {all -> 0x0421, blocks: (B:99:0x03bf, B:101:0x03cb, B:118:0x01aa, B:122:0x02af, B:133:0x02ce, B:138:0x02e0, B:145:0x02e6, B:148:0x02ee, B:150:0x02fb, B:151:0x0300, B:153:0x0305, B:156:0x0325, B:157:0x0364, B:159:0x036a, B:161:0x0317, B:163:0x031e, B:164:0x0321, B:167:0x0333, B:170:0x0350, B:171:0x0344, B:173:0x0349, B:174:0x034c, B:176:0x02fe, B:177:0x02f4, B:178:0x0372, B:181:0x037c, B:182:0x0381, B:184:0x0384, B:185:0x0389, B:188:0x0390, B:190:0x0396, B:192:0x0387, B:193:0x037f, B:199:0x03a4, B:200:0x03a9, B:202:0x03ac, B:203:0x03b1, B:205:0x03b8, B:206:0x03af, B:207:0x03a7, B:209:0x021c), top: B:90:0x0145 }] */ /* JADX WARN: Removed duplicated region for block: B:106:0x03da A[Catch: all -> 0x041f, TryCatch #5 {all -> 0x041f, blocks: (B:75:0x03e7, B:77:0x03ed, B:79:0x03fb, B:104:0x03d4, B:106:0x03da), top: B:103:0x03d4 }] */ /* JADX WARN: Removed duplicated region for block: B:108:0x03d1 */ /* JADX WARN: Removed duplicated region for block: B:138:0x02e0 A[Catch: all -> 0x0421, TryCatch #0 {all -> 0x0421, blocks: (B:99:0x03bf, B:101:0x03cb, B:118:0x01aa, B:122:0x02af, B:133:0x02ce, B:138:0x02e0, B:145:0x02e6, B:148:0x02ee, B:150:0x02fb, B:151:0x0300, B:153:0x0305, B:156:0x0325, B:157:0x0364, B:159:0x036a, B:161:0x0317, B:163:0x031e, B:164:0x0321, B:167:0x0333, B:170:0x0350, B:171:0x0344, B:173:0x0349, B:174:0x034c, B:176:0x02fe, B:177:0x02f4, B:178:0x0372, B:181:0x037c, B:182:0x0381, B:184:0x0384, B:185:0x0389, B:188:0x0390, B:190:0x0396, B:192:0x0387, B:193:0x037f, B:199:0x03a4, B:200:0x03a9, B:202:0x03ac, B:203:0x03b1, B:205:0x03b8, B:206:0x03af, B:207:0x03a7, B:209:0x021c), top: B:90:0x0145 }] */ /* JADX WARN: Removed duplicated region for block: B:77:0x03ed A[Catch: all -> 0x041f, TryCatch #5 {all -> 0x041f, blocks: (B:75:0x03e7, B:77:0x03ed, B:79:0x03fb, B:104:0x03d4, B:106:0x03da), top: B:103:0x03d4 }] */ /* JADX WARN: Removed duplicated region for block: B:86:0x040d */ /* JADX WARN: Removed duplicated region for block: B:88:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final android.graphics.Bitmap aBc_() throws java.io.IOException { /* Method dump skipped, instructions count: 1088 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.RunnableC13011fNx.aBc_():android.graphics.Bitmap"); } /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: Code restructure failed: missing block: B:37:0x0010, code lost: if (r0.remove(r7) != false) goto L9; */ /* JADX WARN: Removed duplicated region for block: B:30:0x0063 */ /* JADX WARN: Removed duplicated region for block: B:33:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void c(o.AbstractC13013fNz r7) { /* r6 = this; o.fNz r0 = r6.e if (r0 != r7) goto L8 r0 = 0 r6.e = r0 goto L12 L8: java.util.List r0 = r6.a if (r0 == 0) goto L5d boolean r0 = r0.remove(r7) if (r0 == 0) goto L5d L12: o.fNW r0 = r7.g com.squareup.picasso.Picasso$LWm r0 = r0.j com.squareup.picasso.Picasso$LWm r1 = r6.k if (r0 != r1) goto L5d com.squareup.picasso.Picasso$LWm r0 = com.squareup.picasso.Picasso.LWm.LOW java.util.List r1 = r6.a r2 = 0 if (r1 == 0) goto L29 boolean r1 = r1.isEmpty() if (r1 != 0) goto L29 r1 = 1 goto L2a L29: r1 = r2 L2a: o.fNz r3 = r6.e if (r3 != 0) goto L31 if (r1 != 0) goto L31 goto L5b L31: if (r3 == 0) goto L37 o.fNW r0 = r3.g com.squareup.picasso.Picasso$LWm r0 = r0.j L37: if (r1 == 0) goto L5b java.util.List r1 = r6.a int r1 = r1.size() L3f: if (r2 >= r1) goto L5b java.util.List r3 = r6.a java.lang.Object r3 = r3.get(r2) o.fNz r3 = (o.AbstractC13013fNz) r3 o.fNW r3 = r3.g com.squareup.picasso.Picasso$LWm r3 = r3.j int r4 = r3.ordinal() int r5 = r0.ordinal() if (r4 <= r5) goto L58 r0 = r3 L58: int r2 = r2 + 1 goto L3f L5b: r6.k = r0 L5d: com.squareup.picasso.Picasso r0 = r6.j boolean r0 = r0.f if (r0 == 0) goto L76 o.fNW r7 = r7.g java.lang.String r7 = r7.c() java.lang.String r0 = "from " java.lang.String r0 = o.C13025fOf.e(r6, r0) java.lang.String r1 = "Hunter" java.lang.String r2 = "removed" o.C13025fOf.d(r1, r2, r7, r0) L76: return */ throw new UnsupportedOperationException("Method not decompiled: o.RunnableC13011fNx.c(o.fNz):void"); } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean b() { Future future; if (this.e != null) { return false; } List list = this.a; return (list == null || list.isEmpty()) && (future = this.b) != null && future.cancel(false); } private static Bitmap aBb_(List list, Bitmap bitmap) { int size = list.size(); int i = 0; while (i < size) { InterfaceC13024fOe interfaceC13024fOe = list.get(i); try { Bitmap aBE_ = interfaceC13024fOe.aBE_(bitmap); if (aBE_ == null) { StringBuilder sb = new StringBuilder("Transformation "); sb.append(interfaceC13024fOe.d()); sb.append(" returned null after "); sb.append(i); sb.append(" previous transformation(s).\n\nTransformation list:\n"); Iterator it = list.iterator(); while (it.hasNext()) { sb.append(it.next().d()); sb.append('\n'); } Picasso.d.post(new Runnable(sb) { // from class: o.fNx.5 private StringBuilder b; { this.b = sb; } @Override // java.lang.Runnable public final void run() { throw new NullPointerException(this.b.toString()); } }); return null; } if (aBE_ == bitmap && bitmap.isRecycled()) { Picasso.d.post(new Runnable(interfaceC13024fOe) { // from class: o.fNx.2 private InterfaceC13024fOe b; { this.b = interfaceC13024fOe; } @Override // java.lang.Runnable public final void run() { StringBuilder sb2 = new StringBuilder("Transformation "); sb2.append(this.b.d()); sb2.append(" returned input Bitmap but recycled it."); throw new IllegalStateException(sb2.toString()); } }); return null; } if (aBE_ != bitmap && !bitmap.isRecycled()) { Picasso.d.post(new Runnable(interfaceC13024fOe) { // from class: o.fNx.10 private InterfaceC13024fOe d; { this.d = interfaceC13024fOe; } @Override // java.lang.Runnable public final void run() { StringBuilder sb2 = new StringBuilder("Transformation "); sb2.append(this.d.d()); sb2.append(" mutated input Bitmap but failed to recycle the original."); throw new IllegalStateException(sb2.toString()); } }); return null; } i++; bitmap = aBE_; } catch (RuntimeException e) { Picasso.d.post(new Runnable(interfaceC13024fOe, e) { // from class: o.fNx.1 private InterfaceC13024fOe c; private RuntimeException e; { this.c = interfaceC13024fOe; this.e = e; } @Override // java.lang.Runnable public final void run() { StringBuilder sb2 = new StringBuilder("Transformation "); sb2.append(this.c.d()); sb2.append(" crashed with exception."); throw new RuntimeException(sb2.toString(), this.e); } }); return null; } } return bitmap; } /* JADX INFO: Access modifiers changed from: package-private */ public static RunnableC13011fNx d(Picasso picasso, fNH fnh, fNB fnb, C13022fOc c13022fOc, AbstractC13013fNz abstractC13013fNz) { fNW fnw = abstractC13013fNz.g; List list = picasso.h; int size = list.size(); for (int i = 0; i < size; i++) { AbstractC12987fNZ abstractC12987fNZ = list.get(i); if (abstractC12987fNZ.d(fnw)) { return new RunnableC13011fNx(picasso, fnh, fnb, c13022fOc, abstractC13013fNz, abstractC12987fNZ); } } return new RunnableC13011fNx(picasso, fnh, fnb, c13022fOc, abstractC13013fNz, q); } @Override // java.lang.Runnable public final void run() { StringWriter stringWriter; C13022fOc c13022fOc; String str; String hexString; String str2 = "Picasso-Idle"; try { try { try { try { try { fNW fnw = this.c; Uri uri = fnw.r; if (uri != null) { hexString = String.valueOf(uri.getPath()); } else { hexString = Integer.toHexString(fnw.k); } StringBuilder sb = r.get(); sb.ensureCapacity(hexString.length() + 8); sb.replace(8, sb.length(), hexString); Thread.currentThread().setName(sb.toString()); if (this.j.f) { C13025fOf.d("Hunter", "executing", C13025fOf.e(this)); } Bitmap aBc_ = aBc_(); this.m = aBc_; if (aBc_ == null) { Handler handler = this.y.g; handler.sendMessage(handler.obtainMessage(6, this)); } else { Handler handler2 = this.y.g; handler2.sendMessage(handler2.obtainMessage(4, this)); } } catch (Throwable th) { th = th; Thread.currentThread().setName(str2); throw th; } } catch (fNN.LWm e) { str = "Picasso-Idle"; if (!fNO.e(e.c) || e.b != 504) { this.d = e; } Handler handler3 = this.y.g; handler3.sendMessage(handler3.obtainMessage(6, this)); } } catch (Exception e2) { this.d = e2; Handler handler4 = this.y.g; handler4.sendMessage(handler4.obtainMessage(6, this)); } str = "Picasso-Idle"; } catch (IOException e3) { str = "Picasso-Idle"; this.d = e3; Handler handler5 = this.y.g; handler5.sendMessageDelayed(handler5.obtainMessage(5, this), 500L); } catch (OutOfMemoryError e4) { try { stringWriter = new StringWriter(); c13022fOc = this.x; str = "Picasso-Idle"; } catch (Throwable th2) { th = th2; Thread.currentThread().setName(str2); throw th; } try { C13023fOd c13023fOd = new C13023fOd(c13022fOc.a.a(), c13022fOc.a.c(), c13022fOc.e, c13022fOc.g, c13022fOc.f, c13022fOc.m, c13022fOc.k, c13022fOc.b, c13022fOc.c, c13022fOc.d, c13022fOc.h, c13022fOc.j, c13022fOc.l, System.currentTimeMillis()); PrintWriter printWriter = new PrintWriter(stringWriter); printWriter.println("===============BEGIN PICASSO STATS ==============="); printWriter.println("Memory Cache Stats"); printWriter.print(" Max Cache Size: "); printWriter.println(c13023fOd.f); printWriter.print(" Cache Size: "); printWriter.println(c13023fOd.h); printWriter.print(" Cache % Full: "); printWriter.println((int) Math.ceil((c13023fOd.h / c13023fOd.f) * 100.0f)); printWriter.print(" Cache Hits: "); printWriter.println(c13023fOd.b); printWriter.print(" Cache Misses: "); printWriter.println(c13023fOd.e); printWriter.println("Network Stats"); printWriter.print(" Download Count: "); printWriter.println(c13023fOd.i); printWriter.print(" Total Download Size: "); printWriter.println(c13023fOd.j); printWriter.print(" Average Download Size: "); printWriter.println(c13023fOd.c); printWriter.println("Bitmap Stats"); printWriter.print(" Total Bitmaps Decoded: "); printWriter.println(c13023fOd.g); printWriter.print(" Total Bitmap Size: "); printWriter.println(c13023fOd.k); printWriter.print(" Total Transformed Bitmaps: "); printWriter.println(c13023fOd.f9103o); printWriter.print(" Total Transformed Bitmap Size: "); printWriter.println(c13023fOd.l); printWriter.print(" Average Bitmap Size: "); printWriter.println(c13023fOd.a); printWriter.print(" Average Transformed Bitmap Size: "); printWriter.println(c13023fOd.d); printWriter.println("===============END PICASSO STATS ==============="); printWriter.flush(); this.d = new RuntimeException(stringWriter.toString(), e4); Handler handler6 = this.y.g; handler6.sendMessage(handler6.obtainMessage(6, this)); } catch (Throwable th3) { th = th3; str2 = str; Thread.currentThread().setName(str2); throw th; } } Thread.currentThread().setName(str); } catch (Throwable th4) { th = th4; } } }