mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-25 16:42:30 -06:00
43 lines
2 KiB
Java
43 lines
2 KiB
Java
package androidx.work;
|
|
|
|
import android.content.Context;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public abstract class WorkerFactory {
|
|
private static final String TAG = Logger.tagWithPrefix("WorkerFactory");
|
|
|
|
public abstract ListenableWorker createWorker(Context appContext, String workerClassName, WorkerParameters workerParameters);
|
|
|
|
public final ListenableWorker createWorkerWithDefaultFallback(Context appContext, String workerClassName, WorkerParameters workerParameters) {
|
|
Class cls;
|
|
ListenableWorker createWorker = createWorker(appContext, workerClassName, workerParameters);
|
|
if (createWorker == null) {
|
|
try {
|
|
cls = Class.forName(workerClassName).asSubclass(ListenableWorker.class);
|
|
} catch (Throwable th) {
|
|
Logger.get().error(TAG, "Invalid class: " + workerClassName, th);
|
|
cls = null;
|
|
}
|
|
if (cls != null) {
|
|
try {
|
|
createWorker = (ListenableWorker) cls.getDeclaredConstructor(Context.class, WorkerParameters.class).newInstance(appContext, workerParameters);
|
|
} catch (Throwable th2) {
|
|
Logger.get().error(TAG, "Could not instantiate " + workerClassName, th2);
|
|
}
|
|
}
|
|
}
|
|
if (createWorker == null || !createWorker.isUsed()) {
|
|
return createWorker;
|
|
}
|
|
throw new IllegalStateException("WorkerFactory (" + getClass().getName() + ") returned an instance of a ListenableWorker (" + workerClassName + ") which has already been invoked. createWorker() must always return a new instance of a ListenableWorker.");
|
|
}
|
|
|
|
public static WorkerFactory getDefaultWorkerFactory() {
|
|
return new WorkerFactory() { // from class: androidx.work.WorkerFactory.1
|
|
@Override // androidx.work.WorkerFactory
|
|
public ListenableWorker createWorker(Context appContext, String workerClassName, WorkerParameters workerParameters) {
|
|
return null;
|
|
}
|
|
};
|
|
}
|
|
}
|