package d1; import android.content.Context; import androidx.work.impl.WorkDatabase; import androidx.work.v; import java.util.UUID; /* loaded from: classes.dex */ public class p implements androidx.work.h { /* renamed from: d, reason: collision with root package name */ private static final String f9027d = androidx.work.m.f("WMFgUpdater"); /* renamed from: a, reason: collision with root package name */ private final e1.a f9028a; /* renamed from: b, reason: collision with root package name */ final b1.a f9029b; /* renamed from: c, reason: collision with root package name */ final c1.q f9030c; class a implements Runnable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ androidx.work.impl.utils.futures.c f9031a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ UUID f9032b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ androidx.work.g f9033c; /* renamed from: d, reason: collision with root package name */ final /* synthetic */ Context f9034d; a(androidx.work.impl.utils.futures.c cVar, UUID uuid, androidx.work.g gVar, Context context) { this.f9031a = cVar; this.f9032b = uuid; this.f9033c = gVar; this.f9034d = context; } @Override // java.lang.Runnable public void run() { try { if (!this.f9031a.isCancelled()) { String uuid = this.f9032b.toString(); v m10 = p.this.f9030c.m(uuid); if (m10 == null || m10.a()) { throw new IllegalStateException("Calls to setForegroundAsync() must complete before a ListenableWorker signals completion of work by returning an instance of Result."); } p.this.f9029b.a(uuid, this.f9033c); this.f9034d.startService(androidx.work.impl.foreground.a.a(this.f9034d, uuid, this.f9033c)); } this.f9031a.p(null); } catch (Throwable th) { this.f9031a.q(th); } } } public p(WorkDatabase workDatabase, b1.a aVar, e1.a aVar2) { this.f9029b = aVar; this.f9028a = aVar2; this.f9030c = workDatabase.B(); } @Override // androidx.work.h public v3.a a(Context context, UUID uuid, androidx.work.g gVar) { androidx.work.impl.utils.futures.c t10 = androidx.work.impl.utils.futures.c.t(); this.f9028a.c(new a(t10, uuid, gVar, context)); return t10; } }