package o;

import com.google.android.gms.common.internal.Preconditions;
import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Cr0 extends FutureTask implements Comparable {
    public final long l;
    public final boolean m;
    public final String n;

    /* renamed from: o, reason: collision with root package name */
    public final /* synthetic */ Fr0 f70o;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Cr0(Fr0 fr0, Runnable runnable, boolean z, String str) {
        super(runnable, null);
        this.f70o = fr0;
        Preconditions.checkNotNull(str);
        long andIncrement = Fr0.k.getAndIncrement();
        this.l = andIncrement;
        this.n = str;
        this.m = z;
        if (andIncrement == Long.MAX_VALUE) {
            Nq0 nq0 = ((Kr0) fr0.a).f;
            Kr0.l(nq0);
            nq0.f.b("Tasks index overflow");
        }
    }

    @Override // java.lang.Comparable
    public final int compareTo(Object obj) {
        Cr0 cr0 = (Cr0) obj;
        boolean z = cr0.m;
        boolean z2 = this.m;
        if (z2 != z) {
            return !z2 ? 1 : -1;
        }
        long j = cr0.l;
        long j2 = this.l;
        if (j2 < j) {
            return -1;
        }
        if (j2 > j) {
            return 1;
        }
        Nq0 nq0 = ((Kr0) this.f70o.a).f;
        Kr0.l(nq0);
        nq0.g.c(Long.valueOf(j2), "Two tasks share the same index. index");
        return 0;
    }

    @Override // java.util.concurrent.FutureTask
    public final void setException(Throwable th) {
        Nq0 nq0 = ((Kr0) this.f70o.a).f;
        Kr0.l(nq0);
        nq0.f.c(th, this.n);
        super.setException(th);
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Cr0(Fr0 fr0, Callable callable, boolean z) {
        super(callable);
        this.f70o = fr0;
        Preconditions.checkNotNull("Task exception on worker thread");
        long andIncrement = Fr0.k.getAndIncrement();
        this.l = andIncrement;
        this.n = "Task exception on worker thread";
        this.m = z;
        if (andIncrement == Long.MAX_VALUE) {
            Nq0 nq0 = ((Kr0) fr0.a).f;
            Kr0.l(nq0);
            nq0.f.b("Tasks index overflow");
        }
    }
}
