package defpackage;

import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

/* renamed from: ˊᐧ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1325 extends AbstractC5460 {

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public static final AtomicLong f5433 = new AtomicLong(Long.MIN_VALUE);

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final C3295 f5434;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final Semaphore f5435;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final Object f5436;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final C3295 f5437;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final LinkedBlockingQueue f5438;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final PriorityBlockingQueue f5439;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public C3881 f5440;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public C3881 f5441;

    public C1325(C4205 c4205) {
        super(c4205);
        this.f5436 = new Object();
        this.f5435 = new Semaphore(2);
        this.f5439 = new PriorityBlockingQueue();
        this.f5438 = new LinkedBlockingQueue();
        this.f5434 = new C3295(this, "Thread death: Uncaught exception on worker thread");
        this.f5437 = new C3295(this, "Thread death: Uncaught exception on network thread");
    }

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final void m4042() {
        if (Thread.currentThread() == this.f5441) {
            return;
        }
        ᵹˉᵞ.ᵳٴᵶ("Call expected from worker thread");
    }

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public final void m4043(Runnable runnable) {
        m11098();
        ᵩʛʽ.ᵝᵵᵺ(runnable);
        m4044(new C4324(this, runnable, false, "Task exception on worker thread"));
    }

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public final void m4044(C4324 c4324) {
        synchronized (this.f5436) {
            try {
                PriorityBlockingQueue priorityBlockingQueue = this.f5439;
                priorityBlockingQueue.add(c4324);
                C3881 c3881 = this.f5441;
                if (c3881 == null) {
                    C3881 c38812 = new C3881(this, "Measurement Worker", priorityBlockingQueue);
                    this.f5441 = c38812;
                    c38812.setUncaughtExceptionHandler(this.f5434);
                    this.f5441.start();
                } else {
                    c3881.m8534();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final C4324 m4045(Callable callable) {
        m11098();
        C4324 c4324 = new C4324(this, callable, false);
        if (Thread.currentThread() != this.f5441) {
            m4044(c4324);
            return c4324;
        }
        if (!this.f5439.isEmpty()) {
            C1736 c1736 = ((C4205) ((ᵢˇᵭ) this).ᵧᵾˀˈ).f15715;
            C4205.m9132(c1736);
            c1736.f6934.m6038("Callable skipped the worker queue.");
        }
        c4324.run();
        return c4324;
    }

    /* renamed from: ᵙᵢᵨᵳ, reason: contains not printable characters */
    public final void m4046(Runnable runnable) {
        m11098();
        m4044(new C4324(this, runnable, true, "Task exception on worker thread"));
    }

    @Override // defpackage.AbstractC5460
    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final boolean mo4047() {
        return false;
    }

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public final void m4048(Runnable runnable) {
        m11098();
        C4324 c4324 = new C4324(this, runnable, false, "Task exception on network thread");
        synchronized (this.f5436) {
            try {
                LinkedBlockingQueue linkedBlockingQueue = this.f5438;
                linkedBlockingQueue.add(c4324);
                C3881 c3881 = this.f5440;
                if (c3881 == null) {
                    C3881 c38812 = new C3881(this, "Measurement Network", linkedBlockingQueue);
                    this.f5440 = c38812;
                    c38812.setUncaughtExceptionHandler(this.f5437);
                    this.f5440.start();
                } else {
                    c3881.m8534();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public final void m4049() {
        if (Thread.currentThread() != this.f5441) {
            return;
        }
        ᵹˉᵞ.ᵳٴᵶ("Call not expected from worker thread");
    }

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final void m4050() {
        if (Thread.currentThread() == this.f5440) {
            return;
        }
        ᵹˉᵞ.ᵳٴᵶ("Call expected from network thread");
    }

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final C4324 m4051(Callable callable) {
        m11098();
        C4324 c4324 = new C4324(this, callable, true);
        if (Thread.currentThread() == this.f5441) {
            c4324.run();
            return c4324;
        }
        m4044(c4324);
        return c4324;
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final boolean m4052() {
        return Thread.currentThread() == this.f5441;
    }

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public final Object m4053(AtomicReference atomicReference, long j, String str, Runnable runnable) {
        synchronized (atomicReference) {
            C1325 c1325 = ((C4205) ((ᵢˇᵭ) this).ᵧᵾˀˈ).f15698;
            C4205.m9132(c1325);
            c1325.m4043(runnable);
            try {
                atomicReference.wait(j);
            } catch (InterruptedException unused) {
                C1736 c1736 = ((C4205) ((ᵢˇᵭ) this).ᵧᵾˀˈ).f15715;
                C4205.m9132(c1736);
                C2319 c2319 = c1736.f6934;
                StringBuilder sb = new StringBuilder(str.length() + 24);
                sb.append("Interrupted waiting for ");
                sb.append(str);
                c2319.m6038(sb.toString());
                return null;
            }
        }
        Object obj = atomicReference.get();
        if (obj == null) {
            C1736 c17362 = ((C4205) ((ᵢˇᵭ) this).ᵧᵾˀˈ).f15715;
            C4205.m9132(c17362);
            c17362.f6934.m6038("Timed out waiting for ".concat(str));
        }
        return obj;
    }
}
