package kotlinx.coroutines;

import h.u.g;

/* JADX INFO: compiled from: CoroutineContext.kt */
/* JADX INFO: loaded from: classes.dex */
public final class l0 extends h.u.a implements i2<String> {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final a f1090f = new a(null);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final long f1091e;

    /* JADX INFO: compiled from: CoroutineContext.kt */
    public static final class a implements g.c<l0> {
        private a() {
        }

        public /* synthetic */ a(h.x.d.h hVar) {
            this();
        }
    }

    public l0(long j2) {
        super(f1090f);
        this.f1091e = j2;
    }

    public final long H() {
        return this.f1091e;
    }

    @Override // kotlinx.coroutines.i2
    /* JADX INFO: renamed from: J, reason: merged with bridge method [inline-methods] */
    public void m(h.u.g gVar, String str) {
        Thread.currentThread().setName(str);
    }

    @Override // kotlinx.coroutines.i2
    /* JADX INFO: renamed from: K, reason: merged with bridge method [inline-methods] */
    public String D(h.u.g gVar) {
        String strH;
        m0 m0Var = (m0) gVar.b(m0.f1094f);
        String str = "coroutine";
        if (m0Var != null && (strH = m0Var.H()) != null) {
            str = strH;
        }
        Thread threadCurrentThread = Thread.currentThread();
        String name = threadCurrentThread.getName();
        int iU = h.c0.q.U(name, " @", 0, false, 6, null);
        if (iU < 0) {
            iU = name.length();
        }
        StringBuilder sb = new StringBuilder(str.length() + iU + 10);
        if (name == null) {
            throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
        }
        String strSubstring = name.substring(0, iU);
        h.x.d.k.c(strSubstring, "(this as java.lang.Strin…ing(startIndex, endIndex)");
        sb.append(strSubstring);
        sb.append(" @");
        sb.append(str);
        sb.append('#');
        sb.append(H());
        h.r rVar = h.r.a;
        String string = sb.toString();
        h.x.d.k.c(string, "StringBuilder(capacity).…builderAction).toString()");
        threadCurrentThread.setName(string);
        return name;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        return (obj instanceof l0) && this.f1091e == ((l0) obj).f1091e;
    }

    public int hashCode() {
        return defpackage.b.a(this.f1091e);
    }

    public String toString() {
        return "CoroutineId(" + this.f1091e + ')';
    }
}
