- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
506 lines
21 KiB
Java
506 lines
21 KiB
Java
package androidx.work;
|
|
|
|
import androidx.annotation.IntRange;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.core.util.Consumer;
|
|
import androidx.work.impl.DefaultRunnableScheduler;
|
|
import java.util.concurrent.Executor;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlinx.coroutines.Dispatchers;
|
|
import kotlinx.coroutines.ExecutorsKt;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Configuration {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final int MIN_SCHEDULER_LIMIT = 20;
|
|
private final Clock clock;
|
|
private final int contentUriTriggerWorkersLimit;
|
|
private final String defaultProcessName;
|
|
private final Executor executor;
|
|
private final Consumer<Throwable> initializationExceptionHandler;
|
|
private final InputMergerFactory inputMergerFactory;
|
|
private final boolean isMarkingJobsAsImportantWhileForeground;
|
|
private final boolean isUsingDefaultTaskExecutor;
|
|
private final int maxJobSchedulerId;
|
|
private final int maxSchedulerLimit;
|
|
private final int minJobSchedulerId;
|
|
private final int minimumLoggingLevel;
|
|
private final RunnableScheduler runnableScheduler;
|
|
private final Consumer<Throwable> schedulingExceptionHandler;
|
|
private final Executor taskExecutor;
|
|
private final Tracer tracer;
|
|
private final CoroutineContext workerCoroutineContext;
|
|
private final Consumer<WorkerExceptionInfo> workerExecutionExceptionHandler;
|
|
private final WorkerFactory workerFactory;
|
|
private final Consumer<WorkerExceptionInfo> workerInitializationExceptionHandler;
|
|
|
|
public interface Provider {
|
|
Configuration getWorkManagerConfiguration();
|
|
}
|
|
|
|
@ExperimentalConfigurationApi
|
|
public static /* synthetic */ void isMarkingJobsAsImportantWhileForeground$annotations() {
|
|
}
|
|
|
|
public final Clock getClock() {
|
|
return this.clock;
|
|
}
|
|
|
|
public final int getContentUriTriggerWorkersLimit() {
|
|
return this.contentUriTriggerWorkersLimit;
|
|
}
|
|
|
|
public final String getDefaultProcessName() {
|
|
return this.defaultProcessName;
|
|
}
|
|
|
|
public final Executor getExecutor() {
|
|
return this.executor;
|
|
}
|
|
|
|
public final Consumer<Throwable> getInitializationExceptionHandler() {
|
|
return this.initializationExceptionHandler;
|
|
}
|
|
|
|
public final InputMergerFactory getInputMergerFactory() {
|
|
return this.inputMergerFactory;
|
|
}
|
|
|
|
public final int getMaxJobSchedulerId() {
|
|
return this.maxJobSchedulerId;
|
|
}
|
|
|
|
@IntRange(from = 20, to = 50)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public final int getMaxSchedulerLimit() {
|
|
return this.maxSchedulerLimit;
|
|
}
|
|
|
|
public final int getMinJobSchedulerId() {
|
|
return this.minJobSchedulerId;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public final int getMinimumLoggingLevel() {
|
|
return this.minimumLoggingLevel;
|
|
}
|
|
|
|
public final RunnableScheduler getRunnableScheduler() {
|
|
return this.runnableScheduler;
|
|
}
|
|
|
|
public final Consumer<Throwable> getSchedulingExceptionHandler() {
|
|
return this.schedulingExceptionHandler;
|
|
}
|
|
|
|
public final Executor getTaskExecutor() {
|
|
return this.taskExecutor;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public final Tracer getTracer() {
|
|
return this.tracer;
|
|
}
|
|
|
|
public final CoroutineContext getWorkerCoroutineContext() {
|
|
return this.workerCoroutineContext;
|
|
}
|
|
|
|
public final Consumer<WorkerExceptionInfo> getWorkerExecutionExceptionHandler() {
|
|
return this.workerExecutionExceptionHandler;
|
|
}
|
|
|
|
public final WorkerFactory getWorkerFactory() {
|
|
return this.workerFactory;
|
|
}
|
|
|
|
public final Consumer<WorkerExceptionInfo> getWorkerInitializationExceptionHandler() {
|
|
return this.workerInitializationExceptionHandler;
|
|
}
|
|
|
|
@ExperimentalConfigurationApi
|
|
public final boolean isMarkingJobsAsImportantWhileForeground() {
|
|
return this.isMarkingJobsAsImportantWhileForeground;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public final boolean isUsingDefaultTaskExecutor() {
|
|
return this.isUsingDefaultTaskExecutor;
|
|
}
|
|
|
|
public Configuration(Builder builder) {
|
|
Intrinsics.checkNotNullParameter(builder, "builder");
|
|
CoroutineContext workerContext$work_runtime_release = builder.getWorkerContext$work_runtime_release();
|
|
Executor executor$work_runtime_release = builder.getExecutor$work_runtime_release();
|
|
if (executor$work_runtime_release == null) {
|
|
executor$work_runtime_release = workerContext$work_runtime_release != null ? ConfigurationKt.asExecutor(workerContext$work_runtime_release) : null;
|
|
if (executor$work_runtime_release == null) {
|
|
executor$work_runtime_release = ConfigurationKt.createDefaultExecutor(false);
|
|
}
|
|
}
|
|
this.executor = executor$work_runtime_release;
|
|
this.workerCoroutineContext = workerContext$work_runtime_release == null ? builder.getExecutor$work_runtime_release() != null ? ExecutorsKt.from(executor$work_runtime_release) : Dispatchers.getDefault() : workerContext$work_runtime_release;
|
|
this.isUsingDefaultTaskExecutor = builder.getTaskExecutor$work_runtime_release() == null;
|
|
Executor taskExecutor$work_runtime_release = builder.getTaskExecutor$work_runtime_release();
|
|
this.taskExecutor = taskExecutor$work_runtime_release == null ? ConfigurationKt.createDefaultExecutor(true) : taskExecutor$work_runtime_release;
|
|
Clock clock$work_runtime_release = builder.getClock$work_runtime_release();
|
|
this.clock = clock$work_runtime_release == null ? new SystemClock() : clock$work_runtime_release;
|
|
WorkerFactory workerFactory$work_runtime_release = builder.getWorkerFactory$work_runtime_release();
|
|
this.workerFactory = workerFactory$work_runtime_release == null ? DefaultWorkerFactory.INSTANCE : workerFactory$work_runtime_release;
|
|
InputMergerFactory inputMergerFactory$work_runtime_release = builder.getInputMergerFactory$work_runtime_release();
|
|
this.inputMergerFactory = inputMergerFactory$work_runtime_release == null ? NoOpInputMergerFactory.INSTANCE : inputMergerFactory$work_runtime_release;
|
|
RunnableScheduler runnableScheduler$work_runtime_release = builder.getRunnableScheduler$work_runtime_release();
|
|
this.runnableScheduler = runnableScheduler$work_runtime_release == null ? new DefaultRunnableScheduler() : runnableScheduler$work_runtime_release;
|
|
this.minimumLoggingLevel = builder.getLoggingLevel$work_runtime_release();
|
|
this.minJobSchedulerId = builder.getMinJobSchedulerId$work_runtime_release();
|
|
this.maxJobSchedulerId = builder.getMaxJobSchedulerId$work_runtime_release();
|
|
this.maxSchedulerLimit = builder.getMaxSchedulerLimit$work_runtime_release();
|
|
this.initializationExceptionHandler = builder.getInitializationExceptionHandler$work_runtime_release();
|
|
this.schedulingExceptionHandler = builder.getSchedulingExceptionHandler$work_runtime_release();
|
|
this.workerInitializationExceptionHandler = builder.getWorkerInitializationExceptionHandler$work_runtime_release();
|
|
this.workerExecutionExceptionHandler = builder.getWorkerExecutionExceptionHandler$work_runtime_release();
|
|
this.defaultProcessName = builder.getDefaultProcessName$work_runtime_release();
|
|
this.contentUriTriggerWorkersLimit = builder.getContentUriTriggerWorkersLimit$work_runtime_release();
|
|
this.isMarkingJobsAsImportantWhileForeground = builder.getMarkJobsAsImportantWhileForeground$work_runtime_release();
|
|
Tracer tracer$work_runtime_release = builder.getTracer$work_runtime_release();
|
|
this.tracer = tracer$work_runtime_release == null ? ConfigurationKt.createDefaultTracer() : tracer$work_runtime_release;
|
|
}
|
|
|
|
public static final class Builder {
|
|
private Clock clock;
|
|
private int contentUriTriggerWorkersLimit;
|
|
private String defaultProcessName;
|
|
private Executor executor;
|
|
private Consumer<Throwable> initializationExceptionHandler;
|
|
private InputMergerFactory inputMergerFactory;
|
|
private int loggingLevel;
|
|
private boolean markJobsAsImportantWhileForeground;
|
|
private int maxJobSchedulerId;
|
|
private int maxSchedulerLimit;
|
|
private int minJobSchedulerId;
|
|
private RunnableScheduler runnableScheduler;
|
|
private Consumer<Throwable> schedulingExceptionHandler;
|
|
private Executor taskExecutor;
|
|
private Tracer tracer;
|
|
private CoroutineContext workerContext;
|
|
private Consumer<WorkerExceptionInfo> workerExecutionExceptionHandler;
|
|
private WorkerFactory workerFactory;
|
|
private Consumer<WorkerExceptionInfo> workerInitializationExceptionHandler;
|
|
|
|
public final Clock getClock$work_runtime_release() {
|
|
return this.clock;
|
|
}
|
|
|
|
public final int getContentUriTriggerWorkersLimit$work_runtime_release() {
|
|
return this.contentUriTriggerWorkersLimit;
|
|
}
|
|
|
|
public final String getDefaultProcessName$work_runtime_release() {
|
|
return this.defaultProcessName;
|
|
}
|
|
|
|
public final Executor getExecutor$work_runtime_release() {
|
|
return this.executor;
|
|
}
|
|
|
|
public final Consumer<Throwable> getInitializationExceptionHandler$work_runtime_release() {
|
|
return this.initializationExceptionHandler;
|
|
}
|
|
|
|
public final InputMergerFactory getInputMergerFactory$work_runtime_release() {
|
|
return this.inputMergerFactory;
|
|
}
|
|
|
|
public final int getLoggingLevel$work_runtime_release() {
|
|
return this.loggingLevel;
|
|
}
|
|
|
|
public final boolean getMarkJobsAsImportantWhileForeground$work_runtime_release() {
|
|
return this.markJobsAsImportantWhileForeground;
|
|
}
|
|
|
|
public final int getMaxJobSchedulerId$work_runtime_release() {
|
|
return this.maxJobSchedulerId;
|
|
}
|
|
|
|
public final int getMaxSchedulerLimit$work_runtime_release() {
|
|
return this.maxSchedulerLimit;
|
|
}
|
|
|
|
public final int getMinJobSchedulerId$work_runtime_release() {
|
|
return this.minJobSchedulerId;
|
|
}
|
|
|
|
public final RunnableScheduler getRunnableScheduler$work_runtime_release() {
|
|
return this.runnableScheduler;
|
|
}
|
|
|
|
public final Consumer<Throwable> getSchedulingExceptionHandler$work_runtime_release() {
|
|
return this.schedulingExceptionHandler;
|
|
}
|
|
|
|
public final Executor getTaskExecutor$work_runtime_release() {
|
|
return this.taskExecutor;
|
|
}
|
|
|
|
public final Tracer getTracer$work_runtime_release() {
|
|
return this.tracer;
|
|
}
|
|
|
|
public final CoroutineContext getWorkerContext$work_runtime_release() {
|
|
return this.workerContext;
|
|
}
|
|
|
|
public final Consumer<WorkerExceptionInfo> getWorkerExecutionExceptionHandler$work_runtime_release() {
|
|
return this.workerExecutionExceptionHandler;
|
|
}
|
|
|
|
public final WorkerFactory getWorkerFactory$work_runtime_release() {
|
|
return this.workerFactory;
|
|
}
|
|
|
|
public final Consumer<WorkerExceptionInfo> getWorkerInitializationExceptionHandler$work_runtime_release() {
|
|
return this.workerInitializationExceptionHandler;
|
|
}
|
|
|
|
public final Builder setClock(Clock clock) {
|
|
Intrinsics.checkNotNullParameter(clock, "clock");
|
|
this.clock = clock;
|
|
return this;
|
|
}
|
|
|
|
public final void setClock$work_runtime_release(Clock clock) {
|
|
this.clock = clock;
|
|
}
|
|
|
|
public final void setContentUriTriggerWorkersLimit$work_runtime_release(int i) {
|
|
this.contentUriTriggerWorkersLimit = i;
|
|
}
|
|
|
|
public final Builder setDefaultProcessName(String processName) {
|
|
Intrinsics.checkNotNullParameter(processName, "processName");
|
|
this.defaultProcessName = processName;
|
|
return this;
|
|
}
|
|
|
|
public final void setDefaultProcessName$work_runtime_release(String str) {
|
|
this.defaultProcessName = str;
|
|
}
|
|
|
|
public final Builder setExecutor(Executor executor) {
|
|
Intrinsics.checkNotNullParameter(executor, "executor");
|
|
this.executor = executor;
|
|
return this;
|
|
}
|
|
|
|
public final void setExecutor$work_runtime_release(Executor executor) {
|
|
this.executor = executor;
|
|
}
|
|
|
|
public final Builder setInitializationExceptionHandler(Consumer<Throwable> exceptionHandler) {
|
|
Intrinsics.checkNotNullParameter(exceptionHandler, "exceptionHandler");
|
|
this.initializationExceptionHandler = exceptionHandler;
|
|
return this;
|
|
}
|
|
|
|
public final void setInitializationExceptionHandler$work_runtime_release(Consumer<Throwable> consumer) {
|
|
this.initializationExceptionHandler = consumer;
|
|
}
|
|
|
|
public final Builder setInputMergerFactory(InputMergerFactory inputMergerFactory) {
|
|
Intrinsics.checkNotNullParameter(inputMergerFactory, "inputMergerFactory");
|
|
this.inputMergerFactory = inputMergerFactory;
|
|
return this;
|
|
}
|
|
|
|
public final void setInputMergerFactory$work_runtime_release(InputMergerFactory inputMergerFactory) {
|
|
this.inputMergerFactory = inputMergerFactory;
|
|
}
|
|
|
|
public final void setLoggingLevel$work_runtime_release(int i) {
|
|
this.loggingLevel = i;
|
|
}
|
|
|
|
public final void setMarkJobsAsImportantWhileForeground$work_runtime_release(boolean z) {
|
|
this.markJobsAsImportantWhileForeground = z;
|
|
}
|
|
|
|
@ExperimentalConfigurationApi
|
|
public final Builder setMarkingJobsAsImportantWhileForeground(boolean z) {
|
|
this.markJobsAsImportantWhileForeground = z;
|
|
return this;
|
|
}
|
|
|
|
public final void setMaxJobSchedulerId$work_runtime_release(int i) {
|
|
this.maxJobSchedulerId = i;
|
|
}
|
|
|
|
public final void setMaxSchedulerLimit$work_runtime_release(int i) {
|
|
this.maxSchedulerLimit = i;
|
|
}
|
|
|
|
public final void setMinJobSchedulerId$work_runtime_release(int i) {
|
|
this.minJobSchedulerId = i;
|
|
}
|
|
|
|
public final Builder setMinimumLoggingLevel(int i) {
|
|
this.loggingLevel = i;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setRunnableScheduler(RunnableScheduler runnableScheduler) {
|
|
Intrinsics.checkNotNullParameter(runnableScheduler, "runnableScheduler");
|
|
this.runnableScheduler = runnableScheduler;
|
|
return this;
|
|
}
|
|
|
|
public final void setRunnableScheduler$work_runtime_release(RunnableScheduler runnableScheduler) {
|
|
this.runnableScheduler = runnableScheduler;
|
|
}
|
|
|
|
public final Builder setSchedulingExceptionHandler(Consumer<Throwable> schedulingExceptionHandler) {
|
|
Intrinsics.checkNotNullParameter(schedulingExceptionHandler, "schedulingExceptionHandler");
|
|
this.schedulingExceptionHandler = schedulingExceptionHandler;
|
|
return this;
|
|
}
|
|
|
|
public final void setSchedulingExceptionHandler$work_runtime_release(Consumer<Throwable> consumer) {
|
|
this.schedulingExceptionHandler = consumer;
|
|
}
|
|
|
|
public final Builder setTaskExecutor(Executor taskExecutor) {
|
|
Intrinsics.checkNotNullParameter(taskExecutor, "taskExecutor");
|
|
this.taskExecutor = taskExecutor;
|
|
return this;
|
|
}
|
|
|
|
public final void setTaskExecutor$work_runtime_release(Executor executor) {
|
|
this.taskExecutor = executor;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public final Builder setTracer(Tracer tracer) {
|
|
Intrinsics.checkNotNullParameter(tracer, "tracer");
|
|
this.tracer = tracer;
|
|
return this;
|
|
}
|
|
|
|
public final void setTracer$work_runtime_release(Tracer tracer) {
|
|
this.tracer = tracer;
|
|
}
|
|
|
|
public final void setWorkerContext$work_runtime_release(CoroutineContext coroutineContext) {
|
|
this.workerContext = coroutineContext;
|
|
}
|
|
|
|
public final Builder setWorkerCoroutineContext(CoroutineContext context) {
|
|
Intrinsics.checkNotNullParameter(context, "context");
|
|
this.workerContext = context;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setWorkerExecutionExceptionHandler(Consumer<WorkerExceptionInfo> workerExceptionHandler) {
|
|
Intrinsics.checkNotNullParameter(workerExceptionHandler, "workerExceptionHandler");
|
|
this.workerExecutionExceptionHandler = workerExceptionHandler;
|
|
return this;
|
|
}
|
|
|
|
public final void setWorkerExecutionExceptionHandler$work_runtime_release(Consumer<WorkerExceptionInfo> consumer) {
|
|
this.workerExecutionExceptionHandler = consumer;
|
|
}
|
|
|
|
public final Builder setWorkerFactory(WorkerFactory workerFactory) {
|
|
Intrinsics.checkNotNullParameter(workerFactory, "workerFactory");
|
|
this.workerFactory = workerFactory;
|
|
return this;
|
|
}
|
|
|
|
public final void setWorkerFactory$work_runtime_release(WorkerFactory workerFactory) {
|
|
this.workerFactory = workerFactory;
|
|
}
|
|
|
|
public final Builder setWorkerInitializationExceptionHandler(Consumer<WorkerExceptionInfo> workerExceptionHandler) {
|
|
Intrinsics.checkNotNullParameter(workerExceptionHandler, "workerExceptionHandler");
|
|
this.workerInitializationExceptionHandler = workerExceptionHandler;
|
|
return this;
|
|
}
|
|
|
|
public final void setWorkerInitializationExceptionHandler$work_runtime_release(Consumer<WorkerExceptionInfo> consumer) {
|
|
this.workerInitializationExceptionHandler = consumer;
|
|
}
|
|
|
|
public Builder() {
|
|
this.loggingLevel = 4;
|
|
this.maxJobSchedulerId = Integer.MAX_VALUE;
|
|
this.maxSchedulerLimit = 20;
|
|
this.contentUriTriggerWorkersLimit = 8;
|
|
this.markJobsAsImportantWhileForeground = true;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
public Builder(Configuration configuration) {
|
|
Intrinsics.checkNotNullParameter(configuration, "configuration");
|
|
this.loggingLevel = 4;
|
|
this.maxJobSchedulerId = Integer.MAX_VALUE;
|
|
this.maxSchedulerLimit = 20;
|
|
this.contentUriTriggerWorkersLimit = 8;
|
|
this.markJobsAsImportantWhileForeground = true;
|
|
this.executor = configuration.getExecutor();
|
|
this.workerFactory = configuration.getWorkerFactory();
|
|
this.inputMergerFactory = configuration.getInputMergerFactory();
|
|
this.taskExecutor = configuration.getTaskExecutor();
|
|
this.clock = configuration.getClock();
|
|
this.loggingLevel = configuration.getMinimumLoggingLevel();
|
|
this.minJobSchedulerId = configuration.getMinJobSchedulerId();
|
|
this.maxJobSchedulerId = configuration.getMaxJobSchedulerId();
|
|
this.maxSchedulerLimit = configuration.getMaxSchedulerLimit();
|
|
this.runnableScheduler = configuration.getRunnableScheduler();
|
|
this.initializationExceptionHandler = configuration.getInitializationExceptionHandler();
|
|
this.schedulingExceptionHandler = configuration.getSchedulingExceptionHandler();
|
|
this.workerInitializationExceptionHandler = configuration.getWorkerInitializationExceptionHandler();
|
|
this.workerExecutionExceptionHandler = configuration.getWorkerExecutionExceptionHandler();
|
|
this.defaultProcessName = configuration.getDefaultProcessName();
|
|
this.contentUriTriggerWorkersLimit = configuration.getContentUriTriggerWorkersLimit();
|
|
this.markJobsAsImportantWhileForeground = configuration.isMarkingJobsAsImportantWhileForeground();
|
|
this.tracer = configuration.getTracer();
|
|
}
|
|
|
|
public final Builder setJobSchedulerJobIdRange(int i, int i2) {
|
|
if (i2 - i < 1000) {
|
|
throw new IllegalArgumentException("WorkManager needs a range of at least 1000 job ids.".toString());
|
|
}
|
|
this.minJobSchedulerId = i;
|
|
this.maxJobSchedulerId = i2;
|
|
return this;
|
|
}
|
|
|
|
public final Builder setMaxSchedulerLimit(int i) {
|
|
if (i < 20) {
|
|
throw new IllegalArgumentException("WorkManager needs to be able to schedule at least 20 jobs in JobScheduler.".toString());
|
|
}
|
|
this.maxSchedulerLimit = Math.min(i, 50);
|
|
return this;
|
|
}
|
|
|
|
public final Builder setContentUriTriggerWorkersLimit(int i) {
|
|
this.contentUriTriggerWorkersLimit = Math.max(i, 0);
|
|
return this;
|
|
}
|
|
|
|
public final Configuration build() {
|
|
return new Configuration(this);
|
|
}
|
|
}
|
|
|
|
public static final class Companion {
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
private Companion() {
|
|
}
|
|
}
|
|
}
|