package g.a;

import f.w.g;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;

/* JADX INFO: compiled from: CoroutineContext.kt */
/* JADX INFO: loaded from: classes.dex */
@IgnoreJRERequirement
public final class f0 extends f.w.a implements h2<String> {

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

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

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

        public /* synthetic */ a(f.z.d.g gVar) {
            this();
        }
    }

    public f0(long j2) {
        super(f4027f);
        this.f4028b = j2;
    }

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

    public int hashCode() {
        return Long.hashCode(this.f4028b);
    }

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

    public final long w() {
        return this.f4028b;
    }

    @Override // g.a.h2
    /* JADX INFO: renamed from: x, reason: merged with bridge method [inline-methods] */
    public void j(f.w.g gVar, String str) {
        Thread.currentThread().setName(str);
    }

    @Override // g.a.h2
    /* JADX INFO: renamed from: y, reason: merged with bridge method [inline-methods] */
    public String r(f.w.g gVar) {
        String strW;
        g0 g0Var = (g0) gVar.get(g0.f4030f);
        if (g0Var == null || (strW = g0Var.w()) == null) {
            strW = "coroutine";
        }
        Thread threadCurrentThread = Thread.currentThread();
        String name = threadCurrentThread.getName();
        int iA = f.e0.t.A(name, " @", 0, false, 6, null);
        if (iA < 0) {
            iA = name.length();
        }
        StringBuilder sb = new StringBuilder(strW.length() + iA + 10);
        String strSubstring = name.substring(0, iA);
        f.z.d.k.d(strSubstring, "this as java.lang.String…ing(startIndex, endIndex)");
        sb.append(strSubstring);
        sb.append(" @");
        sb.append(strW);
        sb.append('#');
        sb.append(this.f4028b);
        String string = sb.toString();
        f.z.d.k.d(string, "StringBuilder(capacity).…builderAction).toString()");
        threadCurrentThread.setName(string);
        return name;
    }
}
