mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-13 01:17:17 +01:00
313 lines
18 KiB
Java
313 lines
18 KiB
Java
package androidx.work;
|
||
|
||
import android.annotation.SuppressLint;
|
||
import androidx.annotation.RequiresApi;
|
||
import androidx.annotation.RestrictTo;
|
||
import androidx.annotation.VisibleForTesting;
|
||
import androidx.exifinterface.media.ExifInterface;
|
||
import androidx.work.WorkInfo;
|
||
import androidx.work.impl.model.WorkSpec;
|
||
import androidx.work.impl.utils.DurationApi26Impl;
|
||
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
||
import java.time.Duration;
|
||
import java.util.Set;
|
||
import java.util.UUID;
|
||
import java.util.concurrent.TimeUnit;
|
||
import kotlin.Metadata;
|
||
import kotlin.collections.SetsKt;
|
||
import kotlin.jvm.internal.SourceDebugExtension;
|
||
import org.jetbrains.annotations.NotNull;
|
||
import rx.Single$$ExternalSyntheticBUOutline0;
|
||
|
||
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
||
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\"\n\u0002\u0010\u000e\n\u0002\b\r\b&\u0018\u0000 \u00142\u00020\u0001:\u0002\u0013\u0014B%\b\u0000\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\f\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u0007¢\u0006\u0002\u0010\tR\u0014\u0010\u0002\u001a\u00020\u0003X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0011\u0010\f\u001a\u00020\b8G¢\u0006\u0006\u001a\u0004\b\r\u0010\u000eR\u0019\u0010\u0006\u001a\b\u0012\u0004\u0012\u00020\b0\u00078\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0010R\u0013\u0010\u0004\u001a\u00020\u00058\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012¨\u0006\u0015"}, d2 = {"Landroidx/work/WorkRequest;", "", "id", "Ljava/util/UUID;", "workSpec", "Landroidx/work/impl/model/WorkSpec;", "tags", "", "", "(Ljava/util/UUID;Landroidx/work/impl/model/WorkSpec;Ljava/util/Set;)V", "getId", "()Ljava/util/UUID;", "stringId", "getStringId", "()Ljava/lang/String;", "getTags", "()Ljava/util/Set;", "getWorkSpec", "()Landroidx/work/impl/model/WorkSpec;", "Builder", "Companion", "work-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||
/* loaded from: classes14.dex */
|
||
public abstract class WorkRequest {
|
||
public static final long DEFAULT_BACKOFF_DELAY_MILLIS = 30000;
|
||
|
||
@SuppressLint({"MinMaxConstant"})
|
||
public static final long MAX_BACKOFF_MILLIS = 18000000;
|
||
|
||
@SuppressLint({"MinMaxConstant"})
|
||
public static final long MIN_BACKOFF_MILLIS = 10000;
|
||
|
||
@NotNull
|
||
private final UUID id;
|
||
|
||
@NotNull
|
||
private final Set<String> tags;
|
||
|
||
@NotNull
|
||
private final WorkSpec workSpec;
|
||
|
||
public WorkRequest(@NotNull UUID uuid, @NotNull WorkSpec workSpec, @NotNull Set<String> set) {
|
||
uuid.getClass();
|
||
workSpec.getClass();
|
||
set.getClass();
|
||
this.id = uuid;
|
||
this.workSpec = workSpec;
|
||
this.tags = set;
|
||
}
|
||
|
||
@NotNull
|
||
public UUID getId() {
|
||
return this.id;
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@NotNull
|
||
public final String getStringId() {
|
||
String uuid = getId().toString();
|
||
uuid.getClass();
|
||
return uuid;
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@NotNull
|
||
public final Set<String> getTags() {
|
||
return this.tags;
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@NotNull
|
||
public final WorkSpec getWorkSpec() {
|
||
return this.workSpec;
|
||
}
|
||
|
||
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
||
@Metadata(d1 = {"\u0000\u0086\u0001\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010#\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0006\b&\u0018\u0000*\u0012\b\u0000\u0010\u0001*\f\u0012\u0004\u0012\u0002H\u0001\u0012\u0002\b\u00030\u0000*\b\b\u0001\u0010\u0002*\u00020\u00032\u00020\u0004B\u0017\b\u0000\u0012\u000e\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006¢\u0006\u0002\u0010\bJ\u0013\u0010%\u001a\u00028\u00002\u0006\u0010&\u001a\u00020\u0017¢\u0006\u0002\u0010'J\u000b\u0010(\u001a\u00028\u0001¢\u0006\u0002\u0010)J\u000f\u0010*\u001a\u00028\u0001H ¢\u0006\u0004\b+\u0010)J\u0015\u0010,\u001a\u00028\u00002\u0006\u0010-\u001a\u00020.H\u0007¢\u0006\u0002\u0010/J\u001b\u0010,\u001a\u00028\u00002\u0006\u0010-\u001a\u0002002\u0006\u00101\u001a\u000202¢\u0006\u0002\u00103J\u001d\u00104\u001a\u00028\u00002\u0006\u00105\u001a\u0002062\u0006\u0010-\u001a\u00020.H\u0007¢\u0006\u0002\u00107J#\u00104\u001a\u00028\u00002\u0006\u00105\u001a\u0002062\u0006\u00108\u001a\u0002002\u0006\u00101\u001a\u000202¢\u0006\u0002\u00109J\u0013\u0010:\u001a\u00028\u00002\u0006\u0010;\u001a\u00020<¢\u0006\u0002\u0010=J\u0015\u0010>\u001a\u00028\u00002\u0006\u0010?\u001a\u00020@H\u0017¢\u0006\u0002\u0010AJ\u0013\u0010B\u001a\u00028\u00002\u0006\u0010\u000f\u001a\u00020\u0010¢\u0006\u0002\u0010CJ\u0015\u0010D\u001a\u00028\u00002\u0006\u0010-\u001a\u00020.H\u0017¢\u0006\u0002\u0010/J\u001d\u0010D\u001a\u00028\u00002\u0006\u0010-\u001a\u0002002\u0006\u00101\u001a\u000202H\u0016¢\u0006\u0002\u00103J\u0015\u0010E\u001a\u00028\u00002\u0006\u0010F\u001a\u00020GH\u0007¢\u0006\u0002\u0010HJ\u0015\u0010I\u001a\u00028\u00002\u0006\u0010J\u001a\u00020KH\u0007¢\u0006\u0002\u0010LJ\u0013\u0010M\u001a\u00028\u00002\u0006\u0010N\u001a\u00020O¢\u0006\u0002\u0010PJ\u001d\u0010Q\u001a\u00028\u00002\u0006\u0010R\u001a\u0002002\u0006\u00101\u001a\u000202H\u0007¢\u0006\u0002\u00103J\u001d\u0010S\u001a\u00028\u00002\u0006\u0010T\u001a\u0002002\u0006\u00101\u001a\u000202H\u0007¢\u0006\u0002\u00103R\u001a\u0010\t\u001a\u00020\nX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000b\u0010\f\"\u0004\b\r\u0010\u000eR\u001a\u0010\u000f\u001a\u00020\u0010X\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R\u001a\u0010\u0015\u001a\b\u0012\u0004\u0012\u00020\u00170\u0016X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0019R\u0012\u0010\u001a\u001a\u00028\u0000X \u0004¢\u0006\u0006\u001a\u0004\b\u001b\u0010\u001cR\u001a\u0010\u001d\u001a\u00020\u001eX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001f\u0010 \"\u0004\b!\u0010\"R\u001c\u0010\u0005\u001a\n\u0012\u0006\b\u0001\u0012\u00020\u00070\u0006X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b#\u0010$¨\u0006U"}, d2 = {"Landroidx/work/WorkRequest$Builder;", "B", ExifInterface.LONGITUDE_WEST, "Landroidx/work/WorkRequest;", "", "workerClass", "Ljava/lang/Class;", "Landroidx/work/ListenableWorker;", "(Ljava/lang/Class;)V", "backoffCriteriaSet", "", "getBackoffCriteriaSet$work_runtime_release", "()Z", "setBackoffCriteriaSet$work_runtime_release", "(Z)V", "id", "Ljava/util/UUID;", "getId$work_runtime_release", "()Ljava/util/UUID;", "setId$work_runtime_release", "(Ljava/util/UUID;)V", "tags", "", "", "getTags$work_runtime_release", "()Ljava/util/Set;", "thisObject", "getThisObject$work_runtime_release", "()Landroidx/work/WorkRequest$Builder;", "workSpec", "Landroidx/work/impl/model/WorkSpec;", "getWorkSpec$work_runtime_release", "()Landroidx/work/impl/model/WorkSpec;", "setWorkSpec$work_runtime_release", "(Landroidx/work/impl/model/WorkSpec;)V", "getWorkerClass$work_runtime_release", "()Ljava/lang/Class;", "addTag", "tag", "(Ljava/lang/String;)Landroidx/work/WorkRequest$Builder;", JsonPOJOBuilder.DEFAULT_BUILD_METHOD, "()Landroidx/work/WorkRequest;", "buildInternal", "buildInternal$work_runtime_release", "keepResultsForAtLeast", "duration", "Ljava/time/Duration;", "(Ljava/time/Duration;)Landroidx/work/WorkRequest$Builder;", "", "timeUnit", "Ljava/util/concurrent/TimeUnit;", "(JLjava/util/concurrent/TimeUnit;)Landroidx/work/WorkRequest$Builder;", "setBackoffCriteria", "backoffPolicy", "Landroidx/work/BackoffPolicy;", "(Landroidx/work/BackoffPolicy;Ljava/time/Duration;)Landroidx/work/WorkRequest$Builder;", "backoffDelay", "(Landroidx/work/BackoffPolicy;JLjava/util/concurrent/TimeUnit;)Landroidx/work/WorkRequest$Builder;", "setConstraints", "constraints", "Landroidx/work/Constraints;", "(Landroidx/work/Constraints;)Landroidx/work/WorkRequest$Builder;", "setExpedited", "policy", "Landroidx/work/OutOfQuotaPolicy;", "(Landroidx/work/OutOfQuotaPolicy;)Landroidx/work/WorkRequest$Builder;", "setId", "(Ljava/util/UUID;)Landroidx/work/WorkRequest$Builder;", "setInitialDelay", "setInitialRunAttemptCount", "runAttemptCount", "", "(I)Landroidx/work/WorkRequest$Builder;", "setInitialState", "state", "Landroidx/work/WorkInfo$State;", "(Landroidx/work/WorkInfo$State;)Landroidx/work/WorkRequest$Builder;", "setInputData", "inputData", "Landroidx/work/Data;", "(Landroidx/work/Data;)Landroidx/work/WorkRequest$Builder;", "setLastEnqueueTime", "lastEnqueueTime", "setScheduleRequestedAt", "scheduleRequestedAt", "work-runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||
@SourceDebugExtension({"SMAP\nWorkRequest.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WorkRequest.kt\nandroidx/work/WorkRequest$Builder\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,356:1\n1#2:357\n*E\n"})
|
||
public static abstract class Builder<B extends Builder<B, ?>, W extends WorkRequest> {
|
||
private boolean backoffCriteriaSet;
|
||
|
||
@NotNull
|
||
private UUID id;
|
||
|
||
@NotNull
|
||
private final Set<String> tags;
|
||
|
||
@NotNull
|
||
private WorkSpec workSpec;
|
||
|
||
@NotNull
|
||
private final Class<? extends ListenableWorker> workerClass;
|
||
|
||
public Builder(@NotNull Class<? extends ListenableWorker> cls) {
|
||
cls.getClass();
|
||
this.workerClass = cls;
|
||
UUID randomUUID = UUID.randomUUID();
|
||
randomUUID.getClass();
|
||
this.id = randomUUID;
|
||
String uuid = this.id.toString();
|
||
uuid.getClass();
|
||
this.workSpec = new WorkSpec(uuid, cls.getName());
|
||
this.tags = SetsKt.mutableSetOf(cls.getName());
|
||
}
|
||
|
||
@NotNull
|
||
public final B addTag(@NotNull String tag) {
|
||
tag.getClass();
|
||
this.tags.add(tag);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@NotNull
|
||
public final W build() {
|
||
W buildInternal$work_runtime_release = buildInternal$work_runtime_release();
|
||
Constraints constraints = this.workSpec.constraints;
|
||
boolean z = constraints.hasContentUriTriggers() || constraints.getRequiresBatteryNotLow() || constraints.getRequiresCharging() || constraints.getRequiresDeviceIdle();
|
||
WorkSpec workSpec = this.workSpec;
|
||
if (workSpec.expedited) {
|
||
if (z) {
|
||
Single$$ExternalSyntheticBUOutline0.m$3("Expedited jobs only support network and storage constraints");
|
||
return null;
|
||
}
|
||
if (workSpec.initialDelay > 0) {
|
||
Single$$ExternalSyntheticBUOutline0.m$3("Expedited jobs cannot be delayed");
|
||
return null;
|
||
}
|
||
}
|
||
UUID randomUUID = UUID.randomUUID();
|
||
randomUUID.getClass();
|
||
setId(randomUUID);
|
||
return buildInternal$work_runtime_release;
|
||
}
|
||
|
||
@NotNull
|
||
public abstract W buildInternal$work_runtime_release();
|
||
|
||
/* renamed from: getBackoffCriteriaSet$work_runtime_release, reason: from getter */
|
||
public final boolean getBackoffCriteriaSet() {
|
||
return this.backoffCriteriaSet;
|
||
}
|
||
|
||
@NotNull
|
||
/* renamed from: getId$work_runtime_release, reason: from getter */
|
||
public final UUID getId() {
|
||
return this.id;
|
||
}
|
||
|
||
@NotNull
|
||
public final Set<String> getTags$work_runtime_release() {
|
||
return this.tags;
|
||
}
|
||
|
||
@NotNull
|
||
public abstract B getThisObject$work_runtime_release();
|
||
|
||
@NotNull
|
||
/* renamed from: getWorkSpec$work_runtime_release, reason: from getter */
|
||
public final WorkSpec getWorkSpec() {
|
||
return this.workSpec;
|
||
}
|
||
|
||
@NotNull
|
||
public final Class<? extends ListenableWorker> getWorkerClass$work_runtime_release() {
|
||
return this.workerClass;
|
||
}
|
||
|
||
@NotNull
|
||
public final B keepResultsForAtLeast(long duration, @NotNull TimeUnit timeUnit) {
|
||
timeUnit.getClass();
|
||
this.workSpec.minimumRetentionDuration = timeUnit.toMillis(duration);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@NotNull
|
||
public final B setBackoffCriteria(@NotNull BackoffPolicy backoffPolicy, long backoffDelay, @NotNull TimeUnit timeUnit) {
|
||
backoffPolicy.getClass();
|
||
timeUnit.getClass();
|
||
this.backoffCriteriaSet = true;
|
||
WorkSpec workSpec = this.workSpec;
|
||
workSpec.backoffPolicy = backoffPolicy;
|
||
workSpec.setBackoffDelayDuration(timeUnit.toMillis(backoffDelay));
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
public final void setBackoffCriteriaSet$work_runtime_release(boolean z) {
|
||
this.backoffCriteriaSet = z;
|
||
}
|
||
|
||
@NotNull
|
||
public final B setConstraints(@NotNull Constraints constraints) {
|
||
constraints.getClass();
|
||
this.workSpec.constraints = constraints;
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@SuppressLint({"MissingGetterMatchingBuilder"})
|
||
@NotNull
|
||
public B setExpedited(@NotNull OutOfQuotaPolicy policy) {
|
||
policy.getClass();
|
||
WorkSpec workSpec = this.workSpec;
|
||
workSpec.expedited = true;
|
||
workSpec.outOfQuotaPolicy = policy;
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@NotNull
|
||
public final B setId(@NotNull UUID id) {
|
||
id.getClass();
|
||
this.id = id;
|
||
String uuid = id.toString();
|
||
uuid.getClass();
|
||
this.workSpec = new WorkSpec(uuid, this.workSpec);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
public final void setId$work_runtime_release(@NotNull UUID uuid) {
|
||
uuid.getClass();
|
||
this.id = uuid;
|
||
}
|
||
|
||
@NotNull
|
||
public B setInitialDelay(long duration, @NotNull TimeUnit timeUnit) {
|
||
timeUnit.getClass();
|
||
this.workSpec.initialDelay = timeUnit.toMillis(duration);
|
||
if (Long.MAX_VALUE - System.currentTimeMillis() > this.workSpec.initialDelay) {
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
Single$$ExternalSyntheticBUOutline0.m$3("The given initial delay is too large and will cause an overflow!");
|
||
return null;
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@VisibleForTesting
|
||
@NotNull
|
||
public final B setInitialRunAttemptCount(int runAttemptCount) {
|
||
this.workSpec.runAttemptCount = runAttemptCount;
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@VisibleForTesting
|
||
@NotNull
|
||
public final B setInitialState(@NotNull WorkInfo.State state) {
|
||
state.getClass();
|
||
this.workSpec.state = state;
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@NotNull
|
||
public final B setInputData(@NotNull Data inputData) {
|
||
inputData.getClass();
|
||
this.workSpec.input = inputData;
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@VisibleForTesting
|
||
@NotNull
|
||
public final B setLastEnqueueTime(long lastEnqueueTime, @NotNull TimeUnit timeUnit) {
|
||
timeUnit.getClass();
|
||
this.workSpec.lastEnqueueTime = timeUnit.toMillis(lastEnqueueTime);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
||
@VisibleForTesting
|
||
@NotNull
|
||
public final B setScheduleRequestedAt(long scheduleRequestedAt, @NotNull TimeUnit timeUnit) {
|
||
timeUnit.getClass();
|
||
this.workSpec.scheduleRequestedAt = timeUnit.toMillis(scheduleRequestedAt);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
public final void setWorkSpec$work_runtime_release(@NotNull WorkSpec workSpec) {
|
||
workSpec.getClass();
|
||
this.workSpec = workSpec;
|
||
}
|
||
|
||
@RequiresApi(26)
|
||
@NotNull
|
||
public final B keepResultsForAtLeast(@NotNull Duration duration) {
|
||
duration.getClass();
|
||
this.workSpec.minimumRetentionDuration = DurationApi26Impl.toMillisCompat(duration);
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@RequiresApi(26)
|
||
@NotNull
|
||
public final B setBackoffCriteria(@NotNull BackoffPolicy backoffPolicy, @NotNull Duration duration) {
|
||
backoffPolicy.getClass();
|
||
duration.getClass();
|
||
this.backoffCriteriaSet = true;
|
||
WorkSpec workSpec = this.workSpec;
|
||
workSpec.backoffPolicy = backoffPolicy;
|
||
workSpec.setBackoffDelayDuration(DurationApi26Impl.toMillisCompat(duration));
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
|
||
@RequiresApi(26)
|
||
@NotNull
|
||
public B setInitialDelay(@NotNull Duration duration) {
|
||
duration.getClass();
|
||
this.workSpec.initialDelay = DurationApi26Impl.toMillisCompat(duration);
|
||
if (Long.MAX_VALUE - System.currentTimeMillis() > this.workSpec.initialDelay) {
|
||
return getThisObject$work_runtime_release();
|
||
}
|
||
Single$$ExternalSyntheticBUOutline0.m$3("The given initial delay is too large and will cause an overflow!");
|
||
return null;
|
||
}
|
||
}
|
||
}
|