- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
41 lines
1.6 KiB
Java
41 lines
1.6 KiB
Java
package androidx.work;
|
|
|
|
import android.content.Context;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DelegatingWorkerFactory extends WorkerFactory {
|
|
private final List<WorkerFactory> factories = new CopyOnWriteArrayList();
|
|
|
|
public final void addFactory(WorkerFactory workerFactory) {
|
|
Intrinsics.checkNotNullParameter(workerFactory, "workerFactory");
|
|
this.factories.add(workerFactory);
|
|
}
|
|
|
|
@Override // androidx.work.WorkerFactory
|
|
public final ListenableWorker createWorker(Context appContext, String workerClassName, WorkerParameters workerParameters) {
|
|
String str;
|
|
Intrinsics.checkNotNullParameter(appContext, "appContext");
|
|
Intrinsics.checkNotNullParameter(workerClassName, "workerClassName");
|
|
Intrinsics.checkNotNullParameter(workerParameters, "workerParameters");
|
|
Iterator<T> it = this.factories.iterator();
|
|
while (it.hasNext()) {
|
|
try {
|
|
ListenableWorker createWorker = ((WorkerFactory) it.next()).createWorker(appContext, workerClassName, workerParameters);
|
|
if (createWorker != null) {
|
|
return createWorker;
|
|
}
|
|
} catch (Throwable th) {
|
|
Logger logger = Logger.get();
|
|
str = DelegatingWorkerFactoryKt.TAG;
|
|
logger.error(str, "Unable to instantiate a ListenableWorker (" + workerClassName + ')', th);
|
|
throw th;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|