package o;

import android.os.Handler;
import android.os.Looper;
import java.util.concurrent.CancellationException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class BE extends AbstractC2842wn implements InterfaceC0405Pq {
    public final Handler m;
    public final String n;

    /* renamed from: o, reason: collision with root package name */
    public final boolean f52o;
    public final BE p;

    public BE(Handler handler, String str, boolean z) {
        this.m = handler;
        this.n = str;
        this.f52o = z;
        this.p = z ? this : new BE(handler, str, true);
    }

    @Override // o.InterfaceC0405Pq
    public final void G(long j, C2448sg c2448sg) {
        RunnableC0890cD runnableC0890cD = new RunnableC0890cD(9, c2448sg, this);
        if (j > 4611686018427387903L) {
            j = 4611686018427387903L;
        }
        if (this.m.postDelayed(runnableC0890cD, j)) {
            c2448sg.w(new C1590je(5, this, runnableC0890cD));
        } else {
            X(c2448sg.p, runnableC0890cD);
        }
    }

    @Override // o.AbstractC2842wn
    public final void T(InterfaceC2747vn interfaceC2747vn, Runnable runnable) {
        if (this.m.post(runnable)) {
            return;
        }
        X(interfaceC2747vn, runnable);
    }

    @Override // o.AbstractC2842wn
    public final boolean V(InterfaceC2747vn interfaceC2747vn) {
        return (this.f52o && F3.c(Looper.myLooper(), this.m.getLooper())) ? false : true;
    }

    public final void X(InterfaceC2747vn interfaceC2747vn, Runnable runnable) {
        AbstractC0752ap.s(interfaceC2747vn, new CancellationException("The task was rejected, the handler underlying the dispatcher '" + this + "' was closed"));
        C2468sq c2468sq = AbstractC1903ms.a;
        ExecutorC1232fq.m.T(interfaceC2747vn, runnable);
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof BE)) {
            return false;
        }
        BE be = (BE) obj;
        return be.m == this.m && be.f52o == this.f52o;
    }

    public final int hashCode() {
        return System.identityHashCode(this.m) ^ (this.f52o ? 1231 : 1237);
    }

    @Override // o.AbstractC2842wn
    public final String toString() {
        BE be;
        String str;
        C2468sq c2468sq = AbstractC1903ms.a;
        BE be2 = AbstractC2139pN.a;
        if (this == be2) {
            str = "Dispatchers.Main";
        } else {
            try {
                be = be2.p;
            } catch (UnsupportedOperationException unused) {
                be = null;
            }
            str = this == be ? "Dispatchers.Main.immediate" : null;
        }
        if (str != null) {
            return str;
        }
        String string = this.n;
        if (string == null) {
            string = this.m.toString();
        }
        return this.f52o ? AbstractC2462sn.i(string, ".immediate") : string;
    }

    @Override // o.InterfaceC0405Pq
    public final InterfaceC2567ts u(long j, Ef0 ef0, InterfaceC2747vn interfaceC2747vn) {
        if (j > 4611686018427387903L) {
            j = 4611686018427387903L;
        }
        if (this.m.postDelayed(ef0, j)) {
            return new AE(0, this, ef0);
        }
        X(interfaceC2747vn, ef0);
        return C2713vS.l;
    }

    public BE(Handler handler) {
        this(handler, null, false);
    }
}
