package v0; import android.content.Context; import android.os.Build; import androidx.work.impl.WorkDatabase; import androidx.work.impl.background.systemalarm.SystemAlarmService; import androidx.work.impl.background.systemjob.SystemJobService; import androidx.work.m; import c1.p; import c1.q; import com.igaworks.ssp.SSPErrorCode; import java.util.Iterator; import java.util.List; /* loaded from: classes.dex */ public abstract class f { /* renamed from: a, reason: collision with root package name */ private static final String f14800a = m.f("Schedulers"); static e a(Context context, j jVar) { if (Build.VERSION.SDK_INT >= 23) { x0.m mVar = new x0.m(context, jVar); d1.g.a(context, SystemJobService.class, true); m.c().a(f14800a, "Created SystemJobScheduler and enabled SystemJobService", new Throwable[0]); return mVar; } e c10 = c(context); if (c10 != null) { return c10; } androidx.work.impl.background.systemalarm.f fVar = new androidx.work.impl.background.systemalarm.f(context); d1.g.a(context, SystemAlarmService.class, true); m.c().a(f14800a, "Created SystemAlarmScheduler", new Throwable[0]); return fVar; } public static void b(androidx.work.b bVar, WorkDatabase workDatabase, List list) { if (list == null || list.size() == 0) { return; } q B = workDatabase.B(); workDatabase.c(); try { List f10 = B.f(bVar.h()); List t10 = B.t(SSPErrorCode.EXCEPTION); if (f10 != null && f10.size() > 0) { long currentTimeMillis = System.currentTimeMillis(); Iterator it = f10.iterator(); while (it.hasNext()) { B.c(((p) it.next()).f3397a, currentTimeMillis); } } workDatabase.r(); if (f10 != null && f10.size() > 0) { p[] pVarArr = (p[]) f10.toArray(new p[f10.size()]); Iterator it2 = list.iterator(); while (it2.hasNext()) { e eVar = (e) it2.next(); if (eVar.c()) { eVar.a(pVarArr); } } } if (t10 == null || t10.size() <= 0) { return; } p[] pVarArr2 = (p[]) t10.toArray(new p[t10.size()]); Iterator it3 = list.iterator(); while (it3.hasNext()) { e eVar2 = (e) it3.next(); if (!eVar2.c()) { eVar2.a(pVarArr2); } } } finally { workDatabase.g(); } } private static e c(Context context) { try { e eVar = (e) Class.forName("androidx.work.impl.background.gcm.GcmScheduler").getConstructor(Context.class).newInstance(context); m.c().a(f14800a, String.format("Created %s", "androidx.work.impl.background.gcm.GcmScheduler"), new Throwable[0]); return eVar; } catch (Throwable th) { m.c().a(f14800a, "Unable to create GCM Scheduler", th); return null; } } }