package o; import android.os.Handler; import android.os.Looper; import java.util.concurrent.CancellationException; /* loaded from: classes.dex */ public final class gfY extends AbstractC15075ggc { private volatile gfY _immediate; private final gfY a; private final Handler b; private final boolean e; private final String j; private gfY(Handler handler, String str, boolean z) { super((byte) 0); this.b = handler; this.j = str; this.e = z; this._immediate = z ? this : null; gfY gfy = this._immediate; if (gfy == null) { gfy = new gfY(handler, str, true); this._immediate = gfy; } this.a = gfy; } public /* synthetic */ gfY(Handler handler) { this(handler, (byte) 0); } private gfY(Handler handler, byte b) { this(handler, null, false); } @Override // o.AbstractC15004geU public final boolean c() { return (this.e && C14957gcv.b(Looper.myLooper(), this.b.getLooper())) ? false : true; } @Override // o.AbstractC15004geU public final void d(InterfaceC14912gbn interfaceC14912gbn, Runnable runnable) { if (this.b.post(runnable)) { return; } StringBuilder sb = new StringBuilder("The task was rejected, the handler underlying the dispatcher '"); sb.append(this); sb.append("' was closed"); CancellationException cancellationException = new CancellationException(sb.toString()); InterfaceC15034gfD interfaceC15034gfD = (InterfaceC15034gfD) interfaceC14912gbn.get(InterfaceC15034gfD.d); if (interfaceC15034gfD != null) { interfaceC15034gfD.d(cancellationException); } C15055gfo.a().d(interfaceC14912gbn, runnable); } @Override // o.gfJ, o.AbstractC15004geU public final String toString() { String a = a(); if (a != null) { return a; } String str = this.j; if (str == null) { str = this.b.toString(); } if (!this.e) { return str; } StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(".immediate"); return sb.toString(); } public final boolean equals(Object obj) { return (obj instanceof gfY) && ((gfY) obj).b == this.b; } public final int hashCode() { return System.identityHashCode(this.b); } @Override // o.gfJ public final /* bridge */ /* synthetic */ gfJ e() { return this.a; } }