package defpackage;

import android.content.Context;
import androidx.work.impl.foreground.b;
import java.util.UUID;

/* JADX INFO: loaded from: classes.dex */
class esa implements Runnable {
    public final /* synthetic */ pm8 a;
    public final /* synthetic */ UUID b;
    public final /* synthetic */ wh3 c;
    public final /* synthetic */ Context d;
    public final /* synthetic */ fsa e;

    public esa(fsa fsaVar, pm8 pm8Var, UUID uuid, wh3 wh3Var, Context context) {
        this.e = fsaVar;
        this.a = pm8Var;
        this.b = uuid;
        this.c = wh3Var;
        this.d = context;
    }

    @Override // java.lang.Runnable
    public final void run() {
        Context context = this.d;
        wh3 wh3Var = this.c;
        fsa fsaVar = this.e;
        pm8 pm8Var = this.a;
        try {
            if (!pm8Var.isCancelled()) {
                String string = this.b.toString();
                lta ltaVarJ = fsaVar.c.j(string);
                if (ltaVarJ == null || ltaVarJ.b.a()) {
                    throw new IllegalStateException("Calls to setForegroundAsync() must complete before a ListenableWorker signals completion of work by returning an instance of Result.");
                }
                fsaVar.b.a(string, wh3Var);
                context.startService(b.b(context, uua.a(ltaVarJ), wh3Var));
            }
            pm8Var.h(null);
        } catch (Throwable th) {
            pm8Var.i(th);
        }
    }
}
