package y0; import android.content.Context; import androidx.work.m; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import z0.c; import z0.e; import z0.f; import z0.g; import z0.h; /* loaded from: classes.dex */ public class d implements c.a { /* renamed from: d, reason: collision with root package name */ private static final String f15535d = m.f("WorkConstraintsTracker"); /* renamed from: a, reason: collision with root package name */ private final c f15536a; /* renamed from: b, reason: collision with root package name */ private final z0.c[] f15537b; /* renamed from: c, reason: collision with root package name */ private final Object f15538c; public d(Context context, e1.a aVar, c cVar) { Context applicationContext = context.getApplicationContext(); this.f15536a = cVar; this.f15537b = new z0.c[]{new z0.a(applicationContext, aVar), new z0.b(applicationContext, aVar), new h(applicationContext, aVar), new z0.d(applicationContext, aVar), new g(applicationContext, aVar), new f(applicationContext, aVar), new e(applicationContext, aVar)}; this.f15538c = new Object(); } @Override // z0.c.a public void a(List list) { synchronized (this.f15538c) { ArrayList arrayList = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { String str = (String) it.next(); if (c(str)) { m.c().a(f15535d, String.format("Constraints met for %s", str), new Throwable[0]); arrayList.add(str); } } c cVar = this.f15536a; if (cVar != null) { cVar.f(arrayList); } } } @Override // z0.c.a public void b(List list) { synchronized (this.f15538c) { c cVar = this.f15536a; if (cVar != null) { cVar.b(list); } } } public boolean c(String str) { synchronized (this.f15538c) { for (z0.c cVar : this.f15537b) { if (cVar.d(str)) { m.c().a(f15535d, String.format("Work %s constrained by %s", str, cVar.getClass().getSimpleName()), new Throwable[0]); return false; } } return true; } } public void d(Iterable iterable) { synchronized (this.f15538c) { for (z0.c cVar : this.f15537b) { cVar.g(null); } for (z0.c cVar2 : this.f15537b) { cVar2.e(iterable); } for (z0.c cVar3 : this.f15537b) { cVar3.g(this); } } } public void e() { synchronized (this.f15538c) { for (z0.c cVar : this.f15537b) { cVar.f(); } } } }