package o; import android.graphics.drawable.Drawable; import com.bumptech.glide.load.engine.GlideException; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes.dex */ public final class sDD implements InterfaceFutureC1911aRr, InterfaceC6871cdb { private static final LWm e = new LWm(); private GlideException a; private final boolean b; private final int c; private boolean d; private boolean f; private final LWm g; private boolean h; private R i; private PXc j; /* renamed from: o, reason: collision with root package name */ private final int f9263o; @Override // o.YcZ public final void FU_(Drawable drawable) { } @Override // o.Lco public final void a() { } @Override // o.YcZ public final void avx_(Drawable drawable) { } @Override // o.Lco public final void c() { } @Override // o.YcZ public final void c(QTj qTj) { } @Override // o.Lco public final void d() { } public sDD() { this(PKIFailureInfo.systemUnavail, PKIFailureInfo.systemUnavail, e); } private sDD(int i, int i2, LWm lWm) { this.f9263o = PKIFailureInfo.systemUnavail; this.c = PKIFailureInfo.systemUnavail; this.b = true; this.g = lWm; } @Override // java.util.concurrent.Future public final boolean cancel(boolean z) { synchronized (this) { if (isDone()) { return false; } this.d = true; notifyAll(); PXc pXc = null; if (z) { PXc pXc2 = this.j; this.j = null; pXc = pXc2; } if (pXc != null) { pXc.c(); } return true; } } @Override // java.util.concurrent.Future public final boolean isCancelled() { boolean z; synchronized (this) { z = this.d; } return z; } @Override // java.util.concurrent.Future public final boolean isDone() { boolean z; synchronized (this) { if (!this.d && !this.f) { z = this.h; } } return z; } @Override // java.util.concurrent.Future public final R get() throws InterruptedException, ExecutionException { try { return d((Long) null); } catch (TimeoutException e2) { throw new AssertionError(e2); } } @Override // java.util.concurrent.Future public final R get(long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException { return d(Long.valueOf(timeUnit.toMillis(j))); } @Override // o.YcZ public final void e(QTj qTj) { qTj.e(this.f9263o, this.c); } @Override // o.YcZ public final void d(PXc pXc) { synchronized (this) { this.j = pXc; } } @Override // o.YcZ public final PXc b() { PXc pXc; synchronized (this) { pXc = this.j; } return pXc; } @Override // o.YcZ public final void avy_(Drawable drawable) { synchronized (this) { } } @Override // o.YcZ public final void d(R r) { synchronized (this) { } } private R d(Long l) throws ExecutionException, InterruptedException, TimeoutException { synchronized (this) { if (this.b && !isDone()) { FKd.c(); } if (this.d) { throw new CancellationException(); } if (this.h) { throw new ExecutionException(this.a); } if (this.f) { return this.i; } if (l == null) { wait(0L); } else if (l.longValue() > 0) { long currentTimeMillis = System.currentTimeMillis(); long longValue = l.longValue() + currentTimeMillis; while (!isDone() && currentTimeMillis < longValue) { wait(longValue - currentTimeMillis); currentTimeMillis = System.currentTimeMillis(); } } if (Thread.interrupted()) { throw new InterruptedException(); } if (this.h) { throw new ExecutionException(this.a); } if (this.d) { throw new CancellationException(); } if (!this.f) { throw new TimeoutException(); } return this.i; } } public final String toString() { PXc pXc; String str; StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("[status="); String obj = sb.toString(); synchronized (this) { pXc = null; if (this.d) { str = "CANCELLED"; } else if (this.h) { str = "FAILURE"; } else if (this.f) { str = "SUCCESS"; } else { str = "PENDING"; pXc = this.j; } } if (pXc != null) { StringBuilder sb2 = new StringBuilder(); sb2.append(obj); sb2.append(str); sb2.append(", request=["); sb2.append(pXc); sb2.append("]]"); return sb2.toString(); } StringBuilder sb3 = new StringBuilder(); sb3.append(obj); sb3.append(str); sb3.append("]"); return sb3.toString(); } /* loaded from: classes.dex */ static class LWm { LWm() { } } @Override // o.InterfaceC6871cdb public final boolean b(GlideException glideException) { synchronized (this) { this.h = true; this.a = glideException; notifyAll(); } return false; } @Override // o.InterfaceC6871cdb public final boolean e(R r) { synchronized (this) { this.f = true; this.i = r; notifyAll(); } return false; } }