2021-08-09 22:50:52 +00:00
|
|
|
package c.f.j.p;
|
|
|
|
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import androidx.core.os.EnvironmentCompat;
|
|
|
|
import c.f.d.d.f;
|
|
|
|
import c.f.j.h.d;
|
|
|
|
import c.f.j.j.e;
|
|
|
|
import c.f.j.j.h;
|
|
|
|
import c.f.j.j.i;
|
|
|
|
import c.f.j.p.c0;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
|
|
import com.facebook.common.internal.Supplier;
|
|
|
|
import com.facebook.common.references.CloseableReference;
|
|
|
|
import com.facebook.common.util.ExceptionWithNoStacktrace;
|
|
|
|
import com.facebook.imagepipeline.decoder.DecodeException;
|
|
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
|
|
import java.io.Closeable;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public class n implements v0<CloseableReference<c.f.j.j.c>> {
|
|
|
|
public final c.f.d.g.a a;
|
|
|
|
public final Executor b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-08-31 07:21:49 +00:00
|
|
|
public final c.f.j.h.b f498c;
|
2021-08-09 22:50:52 +00:00
|
|
|
public final c.f.j.h.c d;
|
|
|
|
public final v0<e> e;
|
|
|
|
public final boolean f;
|
|
|
|
public final boolean g;
|
|
|
|
public final boolean h;
|
|
|
|
public final int i;
|
|
|
|
public final c.f.j.e.a j;
|
|
|
|
public final Runnable k = null;
|
|
|
|
public final Supplier<Boolean> l;
|
|
|
|
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public class a extends c {
|
|
|
|
public a(n nVar, l<CloseableReference<c.f.j.j.c>> lVar, w0 w0Var, boolean z2, int i) {
|
|
|
|
super(lVar, w0Var, z2, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public int o(e eVar) {
|
|
|
|
return eVar.f();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public i p() {
|
|
|
|
return new h(0, false, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public synchronized boolean w(e eVar, int i) {
|
|
|
|
if (b.f(i)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return this.g.f(eVar, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public class b extends c {
|
|
|
|
public final d i;
|
|
|
|
public final c.f.j.h.c j;
|
|
|
|
public int k = 0;
|
|
|
|
|
|
|
|
public b(n nVar, l<CloseableReference<c.f.j.j.c>> lVar, w0 w0Var, d dVar, c.f.j.h.c cVar, boolean z2, int i) {
|
|
|
|
super(lVar, w0Var, z2, i);
|
|
|
|
this.i = dVar;
|
|
|
|
Objects.requireNonNull(cVar);
|
|
|
|
this.j = cVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public int o(e eVar) {
|
|
|
|
return this.i.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public i p() {
|
|
|
|
return this.j.a(this.i.e);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.n.c
|
|
|
|
public synchronized boolean w(e eVar, int i) {
|
|
|
|
boolean f = this.g.f(eVar, i);
|
|
|
|
if ((b.f(i) || b.m(i, 8)) && !b.m(i, 4) && e.t(eVar)) {
|
|
|
|
eVar.w();
|
|
|
|
if (eVar.k == c.f.i.b.a) {
|
|
|
|
if (!this.i.b(eVar)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
int i2 = this.i.e;
|
|
|
|
int i3 = this.k;
|
|
|
|
if (i2 <= i3) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (i2 < this.j.b(i3) && !this.i.g) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
this.k = i2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public abstract class c extends p<e, CloseableReference<c.f.j.j.c>> {
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-08-31 07:21:49 +00:00
|
|
|
public final w0 f499c;
|
2021-08-09 22:50:52 +00:00
|
|
|
public final y0 d;
|
|
|
|
public final c.f.j.d.b e;
|
|
|
|
public boolean f = false;
|
|
|
|
public final c0 g;
|
|
|
|
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public class a implements c0.c {
|
|
|
|
public final /* synthetic */ w0 a;
|
|
|
|
public final /* synthetic */ int b;
|
|
|
|
|
|
|
|
public a(n nVar, w0 w0Var, int i) {
|
|
|
|
this.a = w0Var;
|
|
|
|
this.b = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.c0.c
|
|
|
|
public void a(e eVar, int i) {
|
|
|
|
boolean z2;
|
|
|
|
String str;
|
|
|
|
long j;
|
|
|
|
c.f.j.j.c cVar;
|
|
|
|
Exception e;
|
|
|
|
int i2 = i;
|
|
|
|
if (eVar != null) {
|
2021-08-31 07:21:49 +00:00
|
|
|
w0 w0Var = c.this.f499c;
|
2021-08-09 22:50:52 +00:00
|
|
|
eVar.w();
|
|
|
|
w0Var.d("image_format", eVar.k.b);
|
|
|
|
if (n.this.f || !b.m(i2, 16)) {
|
|
|
|
ImageRequest e2 = this.a.e();
|
2021-08-31 07:21:49 +00:00
|
|
|
if (n.this.g || !c.f.d.l.b.e(e2.f2256c)) {
|
2021-08-09 22:50:52 +00:00
|
|
|
eVar.p = AnimatableValueParser.c0(e2.j, e2.i, eVar, this.b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Objects.requireNonNull(this.a.g().w);
|
|
|
|
c cVar2 = c.this;
|
|
|
|
Objects.requireNonNull(cVar2);
|
|
|
|
eVar.w();
|
|
|
|
if (eVar.k == c.f.i.b.a || !b.f(i)) {
|
|
|
|
synchronized (cVar2) {
|
|
|
|
z2 = cVar2.f;
|
|
|
|
}
|
|
|
|
if (!z2 && e.t(eVar)) {
|
|
|
|
eVar.w();
|
|
|
|
c.f.i.c cVar3 = eVar.k;
|
|
|
|
String str2 = cVar3 != null ? cVar3.b : EnvironmentCompat.MEDIA_UNKNOWN;
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
eVar.w();
|
|
|
|
sb.append(eVar.n);
|
|
|
|
sb.append("x");
|
|
|
|
eVar.w();
|
|
|
|
sb.append(eVar.o);
|
|
|
|
String sb2 = sb.toString();
|
|
|
|
String valueOf = String.valueOf(eVar.p);
|
|
|
|
boolean e3 = b.e(i);
|
|
|
|
boolean z3 = e3 && !b.m(i2, 8);
|
|
|
|
boolean m = b.m(i2, 4);
|
2021-08-31 07:21:49 +00:00
|
|
|
c.f.j.d.e eVar2 = cVar2.f499c.e().i;
|
2021-08-09 22:50:52 +00:00
|
|
|
if (eVar2 != null) {
|
|
|
|
str = eVar2.a + "x" + eVar2.b;
|
|
|
|
} else {
|
|
|
|
str = EnvironmentCompat.MEDIA_UNKNOWN;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
c0 c0Var = cVar2.g;
|
|
|
|
synchronized (c0Var) {
|
|
|
|
j = c0Var.j - c0Var.i;
|
|
|
|
}
|
2021-08-31 07:21:49 +00:00
|
|
|
String valueOf2 = String.valueOf(cVar2.f499c.e().f2256c);
|
2021-08-09 22:50:52 +00:00
|
|
|
int f = (z3 || m) ? eVar.f() : cVar2.o(eVar);
|
|
|
|
i p = (z3 || m) ? h.a : cVar2.p();
|
2021-08-31 07:21:49 +00:00
|
|
|
cVar2.d.e(cVar2.f499c, "DecodeProducer");
|
2021-08-09 22:50:52 +00:00
|
|
|
try {
|
|
|
|
cVar = cVar2.t(eVar, f, p);
|
|
|
|
try {
|
|
|
|
if (eVar.p != 1) {
|
|
|
|
i2 |= 16;
|
|
|
|
}
|
2021-08-31 07:21:49 +00:00
|
|
|
cVar2.d.j(cVar2.f499c, "DecodeProducer", cVar2.n(cVar, j, p, e3, str2, sb2, str, valueOf));
|
2021-08-09 22:50:52 +00:00
|
|
|
cVar2.v(eVar, cVar);
|
|
|
|
cVar2.s(cVar, i2);
|
|
|
|
} catch (Exception e4) {
|
|
|
|
e = e4;
|
2021-08-31 07:21:49 +00:00
|
|
|
cVar2.d.k(cVar2.f499c, "DecodeProducer", e, cVar2.n(cVar, j, p, e3, str2, sb2, str, valueOf));
|
2021-08-09 22:50:52 +00:00
|
|
|
cVar2.u(true);
|
|
|
|
cVar2.b.c(e);
|
|
|
|
}
|
|
|
|
} catch (DecodeException e5) {
|
|
|
|
e a = e5.a();
|
|
|
|
c.f.d.e.a.o("ProgressiveDecoder", "%s, {uri: %s, firstEncodedBytes: %s, length: %d}", e5.getMessage(), valueOf2, a.d(10), Integer.valueOf(a.f()));
|
|
|
|
throw e5;
|
|
|
|
} catch (Exception e6) {
|
|
|
|
e = e6;
|
|
|
|
cVar = null;
|
2021-08-31 07:21:49 +00:00
|
|
|
cVar2.d.k(cVar2.f499c, "DecodeProducer", e, cVar2.n(cVar, j, p, e3, str2, sb2, str, valueOf));
|
2021-08-09 22:50:52 +00:00
|
|
|
cVar2.u(true);
|
|
|
|
cVar2.b.c(e);
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
eVar.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: DecodeProducer */
|
|
|
|
public class b extends e {
|
|
|
|
public final /* synthetic */ boolean a;
|
|
|
|
|
|
|
|
public b(n nVar, boolean z2) {
|
|
|
|
this.a = z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.x0
|
|
|
|
public void a() {
|
|
|
|
if (this.a) {
|
|
|
|
c cVar = c.this;
|
|
|
|
cVar.u(true);
|
|
|
|
cVar.b.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.e, c.f.j.p.x0
|
|
|
|
public void b() {
|
2021-08-31 07:21:49 +00:00
|
|
|
if (c.this.f499c.p()) {
|
2021-08-09 22:50:52 +00:00
|
|
|
c.this.g.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public c(l<CloseableReference<c.f.j.j.c>> lVar, w0 w0Var, boolean z2, int i) {
|
|
|
|
super(lVar);
|
2021-08-31 07:21:49 +00:00
|
|
|
this.f499c = w0Var;
|
2021-08-09 22:50:52 +00:00
|
|
|
this.d = w0Var.o();
|
|
|
|
c.f.j.d.b bVar = w0Var.e().h;
|
|
|
|
this.e = bVar;
|
|
|
|
this.g = new c0(n.this.b, new a(n.this, w0Var, i), bVar.b);
|
|
|
|
w0Var.f(new b(n.this, z2));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.p, c.f.j.p.b
|
|
|
|
public void g() {
|
|
|
|
q();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.p, c.f.j.p.b
|
|
|
|
public void h(Throwable th) {
|
|
|
|
r(th);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: finally extract failed */
|
|
|
|
@Override // c.f.j.p.b
|
|
|
|
public void i(Object obj, int i) {
|
|
|
|
e eVar = (e) obj;
|
|
|
|
try {
|
|
|
|
c.f.j.r.b.b();
|
|
|
|
boolean e = b.e(i);
|
|
|
|
if (e) {
|
|
|
|
if (eVar == null) {
|
|
|
|
ExceptionWithNoStacktrace exceptionWithNoStacktrace = new ExceptionWithNoStacktrace("Encoded image is null.");
|
|
|
|
u(true);
|
|
|
|
this.b.c(exceptionWithNoStacktrace);
|
|
|
|
} else if (!eVar.s()) {
|
|
|
|
ExceptionWithNoStacktrace exceptionWithNoStacktrace2 = new ExceptionWithNoStacktrace("Encoded image is not valid.");
|
|
|
|
u(true);
|
|
|
|
this.b.c(exceptionWithNoStacktrace2);
|
|
|
|
}
|
|
|
|
c.f.j.r.b.b();
|
|
|
|
}
|
|
|
|
if (w(eVar, i)) {
|
|
|
|
boolean m = b.m(i, 4);
|
2021-08-31 07:21:49 +00:00
|
|
|
if (e || m || this.f499c.p()) {
|
2021-08-09 22:50:52 +00:00
|
|
|
this.g.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
c.f.j.r.b.b();
|
|
|
|
} catch (Throwable th) {
|
|
|
|
c.f.j.r.b.b();
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.p, c.f.j.p.b
|
|
|
|
public void j(float f) {
|
|
|
|
this.b.a(f * 0.99f);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<String, String> n(c.f.j.j.c cVar, long j, i iVar, boolean z2, String str, String str2, String str3, String str4) {
|
2021-08-31 07:21:49 +00:00
|
|
|
if (!this.d.g(this.f499c, "DecodeProducer")) {
|
2021-08-09 22:50:52 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
String valueOf = String.valueOf(j);
|
2021-08-31 07:21:49 +00:00
|
|
|
String valueOf2 = String.valueOf(((h) iVar).f463c);
|
2021-08-09 22:50:52 +00:00
|
|
|
String valueOf3 = String.valueOf(z2);
|
|
|
|
if (cVar instanceof c.f.j.j.d) {
|
|
|
|
Bitmap bitmap = ((c.f.j.j.d) cVar).l;
|
|
|
|
HashMap hashMap = new HashMap(8);
|
|
|
|
hashMap.put("bitmapSize", bitmap.getWidth() + "x" + bitmap.getHeight());
|
|
|
|
hashMap.put("queueTime", valueOf);
|
|
|
|
hashMap.put("hasGoodQuality", valueOf2);
|
|
|
|
hashMap.put("isFinal", valueOf3);
|
|
|
|
hashMap.put("encodedImageSize", str2);
|
|
|
|
hashMap.put("imageFormat", str);
|
|
|
|
hashMap.put("requestedImageSize", str3);
|
|
|
|
hashMap.put("sampleSize", str4);
|
|
|
|
hashMap.put("byteCount", bitmap.getByteCount() + "");
|
|
|
|
return new f(hashMap);
|
|
|
|
}
|
|
|
|
HashMap hashMap2 = new HashMap(7);
|
|
|
|
hashMap2.put("queueTime", valueOf);
|
|
|
|
hashMap2.put("hasGoodQuality", valueOf2);
|
|
|
|
hashMap2.put("isFinal", valueOf3);
|
|
|
|
hashMap2.put("encodedImageSize", str2);
|
|
|
|
hashMap2.put("imageFormat", str);
|
|
|
|
hashMap2.put("requestedImageSize", str3);
|
|
|
|
hashMap2.put("sampleSize", str4);
|
|
|
|
return new f(hashMap2);
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract int o(e eVar);
|
|
|
|
|
|
|
|
public abstract i p();
|
|
|
|
|
|
|
|
public final void q() {
|
|
|
|
u(true);
|
|
|
|
this.b.d();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void r(Throwable th) {
|
|
|
|
u(true);
|
|
|
|
this.b.c(th);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void s(c.f.j.j.c cVar, int i) {
|
|
|
|
CloseableReference.c cVar2 = n.this.j.a;
|
|
|
|
Class<CloseableReference> cls = CloseableReference.i;
|
|
|
|
CloseableReference closeableReference = null;
|
|
|
|
Throwable th = null;
|
|
|
|
if (cVar != null) {
|
|
|
|
c.f.d.h.f<Closeable> fVar = CloseableReference.k;
|
|
|
|
if (cVar2.b()) {
|
|
|
|
th = new Throwable();
|
|
|
|
}
|
|
|
|
closeableReference = CloseableReference.I(cVar, fVar, cVar2, th);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
u(b.e(i));
|
|
|
|
this.b.b(closeableReference, i);
|
|
|
|
} finally {
|
|
|
|
if (closeableReference != null) {
|
|
|
|
closeableReference.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final c.f.j.j.c t(e eVar, int i, i iVar) {
|
|
|
|
n nVar = n.this;
|
|
|
|
boolean z2 = nVar.k != null && nVar.l.get().booleanValue();
|
|
|
|
try {
|
2021-08-31 07:21:49 +00:00
|
|
|
return n.this.f498c.a(eVar, i, iVar, this.e);
|
2021-08-09 22:50:52 +00:00
|
|
|
} catch (OutOfMemoryError e) {
|
|
|
|
if (z2) {
|
|
|
|
n.this.k.run();
|
|
|
|
System.gc();
|
2021-08-31 07:21:49 +00:00
|
|
|
return n.this.f498c.a(eVar, i, iVar, this.e);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void u(boolean z2) {
|
|
|
|
synchronized (this) {
|
|
|
|
if (z2) {
|
|
|
|
if (!this.f) {
|
|
|
|
this.b.a(1.0f);
|
|
|
|
this.f = true;
|
|
|
|
this.g.a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void v(e eVar, c.f.j.j.c cVar) {
|
2021-08-31 07:21:49 +00:00
|
|
|
w0 w0Var = this.f499c;
|
2021-08-09 22:50:52 +00:00
|
|
|
eVar.w();
|
|
|
|
w0Var.d("encoded_width", Integer.valueOf(eVar.n));
|
2021-08-31 07:21:49 +00:00
|
|
|
w0 w0Var2 = this.f499c;
|
2021-08-09 22:50:52 +00:00
|
|
|
eVar.w();
|
|
|
|
w0Var2.d("encoded_height", Integer.valueOf(eVar.o));
|
2021-08-31 07:21:49 +00:00
|
|
|
this.f499c.d("encoded_size", Integer.valueOf(eVar.f()));
|
2021-08-09 22:50:52 +00:00
|
|
|
if (cVar instanceof c.f.j.j.b) {
|
|
|
|
Bitmap f = ((c.f.j.j.b) cVar).f();
|
2021-08-31 07:21:49 +00:00
|
|
|
this.f499c.d("bitmap_config", String.valueOf(f == null ? null : f.getConfig()));
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
if (cVar != null) {
|
2021-08-31 07:21:49 +00:00
|
|
|
cVar.e(this.f499c.a());
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract boolean w(e eVar, int i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public n(c.f.d.g.a aVar, Executor executor, c.f.j.h.b bVar, c.f.j.h.c cVar, boolean z2, boolean z3, boolean z4, v0<e> v0Var, int i, c.f.j.e.a aVar2, Runnable runnable, Supplier<Boolean> supplier) {
|
|
|
|
Objects.requireNonNull(aVar);
|
|
|
|
this.a = aVar;
|
|
|
|
Objects.requireNonNull(executor);
|
|
|
|
this.b = executor;
|
|
|
|
Objects.requireNonNull(bVar);
|
2021-08-31 07:21:49 +00:00
|
|
|
this.f498c = bVar;
|
2021-08-09 22:50:52 +00:00
|
|
|
Objects.requireNonNull(cVar);
|
|
|
|
this.d = cVar;
|
|
|
|
this.f = z2;
|
|
|
|
this.g = z3;
|
|
|
|
Objects.requireNonNull(v0Var);
|
|
|
|
this.e = v0Var;
|
|
|
|
this.h = z4;
|
|
|
|
this.i = i;
|
|
|
|
this.j = aVar2;
|
|
|
|
this.l = supplier;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: finally extract failed */
|
|
|
|
@Override // c.f.j.p.v0
|
|
|
|
public void b(l<CloseableReference<c.f.j.j.c>> lVar, w0 w0Var) {
|
|
|
|
try {
|
|
|
|
c.f.j.r.b.b();
|
2021-08-31 07:21:49 +00:00
|
|
|
this.e.b(!c.f.d.l.b.e(w0Var.e().f2256c) ? new a(this, lVar, w0Var, this.h, this.i) : new b(this, lVar, w0Var, new d(this.a), this.d, this.h, this.i), w0Var);
|
2021-08-09 22:50:52 +00:00
|
|
|
c.f.j.r.b.b();
|
|
|
|
} catch (Throwable th) {
|
|
|
|
c.f.j.r.b.b();
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|