package o4;

import androidx.work.u;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import java.util.HashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/* JADX INFO: loaded from: classes.dex */
public final class t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ScheduledExecutorService f31418a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final HashMap f31419b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final HashMap f31420c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f31421d;

    static {
        u.e("WorkTimer");
    }

    public t() {
        n0.o oVar = new n0.o(this, 1);
        this.f31419b = new HashMap();
        this.f31420c = new HashMap();
        this.f31421d = new Object();
        this.f31418a = Executors.newSingleThreadScheduledExecutor(oVar);
    }

    public final void a(String str, r rVar) {
        synchronized (this.f31421d) {
            u uVarC = u.c();
            String.format("Starting timer for %s", str);
            uVarC.a(new Throwable[0]);
            b(str);
            s sVar = new s(this, str);
            this.f31419b.put(str, sVar);
            this.f31420c.put(str, rVar);
            this.f31418a.schedule(sVar, TTAdConstant.AD_MAX_EVENT_TIME, TimeUnit.MILLISECONDS);
        }
    }

    public final void b(String str) {
        synchronized (this.f31421d) {
            try {
                if (((s) this.f31419b.remove(str)) != null) {
                    u uVarC = u.c();
                    String.format("Stopping timer for %s", str);
                    uVarC.a(new Throwable[0]);
                    this.f31420c.remove(str);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
