package androidx.work; import android.annotation.SuppressLint; import android.net.NetworkRequest; import android.net.Uri; import android.os.Build; import androidx.annotation.RequiresApi; import androidx.annotation.RestrictTo; import androidx.room.ColumnInfo; import androidx.room.Ignore; import androidx.work.impl.utils.DurationApi26Impl; import androidx.work.impl.utils.NetworkRequest30; import androidx.work.impl.utils.NetworkRequestCompat; import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor; import java.time.Duration; import java.util.LinkedHashSet; import java.util.Set; import java.util.concurrent.TimeUnit; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.collections.SetsKt__SetsKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; /* loaded from: classes.dex */ public final class Constraints { public static final Companion Companion = new Companion(null); public static final Constraints NONE = new Constraints(null, false, false, false, 15, null); @ColumnInfo(name = "trigger_max_content_delay") private final long contentTriggerMaxDelayMillis; @ColumnInfo(name = "trigger_content_update_delay") private final long contentTriggerUpdateDelayMillis; @ColumnInfo(name = "content_uri_triggers") private final Set contentUriTriggers; @ColumnInfo(defaultValue = "x''", name = "required_network_request") private final NetworkRequestCompat requiredNetworkRequestCompat; @ColumnInfo(name = "required_network_type") private final NetworkType requiredNetworkType; @ColumnInfo(name = "requires_battery_not_low") private final boolean requiresBatteryNotLow; @ColumnInfo(name = "requires_charging") private final boolean requiresCharging; @ColumnInfo(name = "requires_device_idle") private final boolean requiresDeviceIdle; @ColumnInfo(name = "requires_storage_not_low") private final boolean requiresStorageNotLow; @RequiresApi(24) public final long getContentTriggerMaxDelayMillis() { return this.contentTriggerMaxDelayMillis; } @RequiresApi(24) public final long getContentTriggerUpdateDelayMillis() { return this.contentTriggerUpdateDelayMillis; } @RequiresApi(24) public final Set getContentUriTriggers() { return this.contentUriTriggers; } public final NetworkRequestCompat getRequiredNetworkRequestCompat$work_runtime_release() { return this.requiredNetworkRequestCompat; } public final NetworkType getRequiredNetworkType() { return this.requiredNetworkType; } public final boolean requiresBatteryNotLow() { return this.requiresBatteryNotLow; } public final boolean requiresCharging() { return this.requiresCharging; } @RequiresApi(23) public final boolean requiresDeviceIdle() { return this.requiresDeviceIdle; } public final boolean requiresStorageNotLow() { return this.requiresStorageNotLow; } @RequiresApi(21) public final NetworkRequest getRequiredNetworkRequest() { return this.requiredNetworkRequestCompat.getNetworkRequest(); } public /* synthetic */ Constraints(NetworkType networkType, boolean z, boolean z2, boolean z3, int i, DefaultConstructorMarker defaultConstructorMarker) { this((i & 1) != 0 ? NetworkType.NOT_REQUIRED : networkType, (i & 2) != 0 ? false : z, (i & 4) != 0 ? false : z2, (i & 8) != 0 ? false : z3); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ @SuppressLint({"NewApi"}) @Ignore public Constraints(NetworkType requiredNetworkType, boolean z, boolean z2, boolean z3) { this(requiredNetworkType, z, false, z2, z3); Intrinsics.checkNotNullParameter(requiredNetworkType, "requiredNetworkType"); } public /* synthetic */ Constraints(NetworkType networkType, boolean z, boolean z2, boolean z3, boolean z4, int i, DefaultConstructorMarker defaultConstructorMarker) { this((i & 1) != 0 ? NetworkType.NOT_REQUIRED : networkType, (i & 2) != 0 ? false : z, (i & 4) != 0 ? false : z2, (i & 8) != 0 ? false : z3, (i & 16) == 0 ? z4 : false); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ @RequiresApi(23) @SuppressLint({"NewApi"}) @Ignore public Constraints(NetworkType requiredNetworkType, boolean z, boolean z2, boolean z3, boolean z4) { this(requiredNetworkType, z, z2, z3, z4, -1L, 0L, null, PsExtractor.AUDIO_STREAM, null); Intrinsics.checkNotNullParameter(requiredNetworkType, "requiredNetworkType"); } public /* synthetic */ Constraints(NetworkType networkType, boolean z, boolean z2, boolean z3, boolean z4, long j, long j2, Set set, int i, DefaultConstructorMarker defaultConstructorMarker) { this((i & 1) != 0 ? NetworkType.NOT_REQUIRED : networkType, (i & 2) != 0 ? false : z, (i & 4) != 0 ? false : z2, (i & 8) != 0 ? false : z3, (i & 16) == 0 ? z4 : false, (i & 32) != 0 ? -1L : j, (i & 64) == 0 ? j2 : -1L, (i & 128) != 0 ? SetsKt__SetsKt.emptySet() : set); } @RequiresApi(24) @Ignore public Constraints(NetworkType requiredNetworkType, boolean z, boolean z2, boolean z3, boolean z4, long j, long j2, Set contentUriTriggers) { Intrinsics.checkNotNullParameter(requiredNetworkType, "requiredNetworkType"); Intrinsics.checkNotNullParameter(contentUriTriggers, "contentUriTriggers"); this.requiredNetworkRequestCompat = new NetworkRequestCompat(null, 1, null); this.requiredNetworkType = requiredNetworkType; this.requiresCharging = z; this.requiresDeviceIdle = z2; this.requiresBatteryNotLow = z3; this.requiresStorageNotLow = z4; this.contentTriggerUpdateDelayMillis = j; this.contentTriggerMaxDelayMillis = j2; this.contentUriTriggers = contentUriTriggers; } public /* synthetic */ Constraints(NetworkRequestCompat networkRequestCompat, NetworkType networkType, boolean z, boolean z2, boolean z3, boolean z4, long j, long j2, Set set, int i, DefaultConstructorMarker defaultConstructorMarker) { this(networkRequestCompat, (i & 2) != 0 ? NetworkType.NOT_REQUIRED : networkType, (i & 4) != 0 ? false : z, (i & 8) != 0 ? false : z2, (i & 16) != 0 ? false : z3, (i & 32) == 0 ? z4 : false, (i & 64) != 0 ? -1L : j, (i & 128) == 0 ? j2 : -1L, (i & 256) != 0 ? SetsKt__SetsKt.emptySet() : set); } public Constraints(NetworkRequestCompat requiredNetworkRequestCompat, NetworkType requiredNetworkType, boolean z, boolean z2, boolean z3, boolean z4, long j, long j2, Set contentUriTriggers) { Intrinsics.checkNotNullParameter(requiredNetworkRequestCompat, "requiredNetworkRequestCompat"); Intrinsics.checkNotNullParameter(requiredNetworkType, "requiredNetworkType"); Intrinsics.checkNotNullParameter(contentUriTriggers, "contentUriTriggers"); this.requiredNetworkRequestCompat = requiredNetworkRequestCompat; this.requiredNetworkType = requiredNetworkType; this.requiresCharging = z; this.requiresDeviceIdle = z2; this.requiresBatteryNotLow = z3; this.requiresStorageNotLow = z4; this.contentTriggerUpdateDelayMillis = j; this.contentTriggerMaxDelayMillis = j2; this.contentUriTriggers = contentUriTriggers; } @SuppressLint({"NewApi"}) public Constraints(Constraints other) { Intrinsics.checkNotNullParameter(other, "other"); this.requiresCharging = other.requiresCharging; this.requiresDeviceIdle = other.requiresDeviceIdle; this.requiredNetworkRequestCompat = other.requiredNetworkRequestCompat; this.requiredNetworkType = other.requiredNetworkType; this.requiresBatteryNotLow = other.requiresBatteryNotLow; this.requiresStorageNotLow = other.requiresStorageNotLow; this.contentUriTriggers = other.contentUriTriggers; this.contentTriggerUpdateDelayMillis = other.contentTriggerUpdateDelayMillis; this.contentTriggerMaxDelayMillis = other.contentTriggerMaxDelayMillis; } @RestrictTo({RestrictTo.Scope.LIBRARY_GROUP}) public final boolean hasContentUriTriggers() { return !this.contentUriTriggers.isEmpty(); } @SuppressLint({"NewApi"}) public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !Intrinsics.areEqual(Constraints.class, obj.getClass())) { return false; } Constraints constraints = (Constraints) obj; if (this.requiresCharging == constraints.requiresCharging && this.requiresDeviceIdle == constraints.requiresDeviceIdle && this.requiresBatteryNotLow == constraints.requiresBatteryNotLow && this.requiresStorageNotLow == constraints.requiresStorageNotLow && this.contentTriggerUpdateDelayMillis == constraints.contentTriggerUpdateDelayMillis && this.contentTriggerMaxDelayMillis == constraints.contentTriggerMaxDelayMillis && Intrinsics.areEqual(getRequiredNetworkRequest(), constraints.getRequiredNetworkRequest()) && this.requiredNetworkType == constraints.requiredNetworkType) { return Intrinsics.areEqual(this.contentUriTriggers, constraints.contentUriTriggers); } return false; } @SuppressLint({"NewApi"}) public int hashCode() { int hashCode = ((((((((this.requiredNetworkType.hashCode() * 31) + (this.requiresCharging ? 1 : 0)) * 31) + (this.requiresDeviceIdle ? 1 : 0)) * 31) + (this.requiresBatteryNotLow ? 1 : 0)) * 31) + (this.requiresStorageNotLow ? 1 : 0)) * 31; long j = this.contentTriggerUpdateDelayMillis; int i = (hashCode + ((int) (j ^ (j >>> 32)))) * 31; long j2 = this.contentTriggerMaxDelayMillis; int hashCode2 = (((i + ((int) (j2 ^ (j2 >>> 32)))) * 31) + this.contentUriTriggers.hashCode()) * 31; NetworkRequest requiredNetworkRequest = getRequiredNetworkRequest(); return hashCode2 + (requiredNetworkRequest != null ? requiredNetworkRequest.hashCode() : 0); } @SuppressLint({"NewApi"}) public String toString() { return "Constraints{requiredNetworkType=" + this.requiredNetworkType + ", requiresCharging=" + this.requiresCharging + ", requiresDeviceIdle=" + this.requiresDeviceIdle + ", requiresBatteryNotLow=" + this.requiresBatteryNotLow + ", requiresStorageNotLow=" + this.requiresStorageNotLow + ", contentTriggerUpdateDelayMillis=" + this.contentTriggerUpdateDelayMillis + ", contentTriggerMaxDelayMillis=" + this.contentTriggerMaxDelayMillis + ", contentUriTriggers=" + this.contentUriTriggers + ", }"; } public static final class Builder { private Set contentUriTriggers; private NetworkRequestCompat requiredNetworkRequest; private NetworkType requiredNetworkType; private boolean requiresBatteryNotLow; private boolean requiresCharging; private boolean requiresDeviceIdle; private boolean requiresStorageNotLow; private long triggerContentMaxDelay; private long triggerContentUpdateDelay; public final Builder setRequiresBatteryNotLow(boolean z) { this.requiresBatteryNotLow = z; return this; } public final Builder setRequiresCharging(boolean z) { this.requiresCharging = z; return this; } @RequiresApi(23) public final Builder setRequiresDeviceIdle(boolean z) { this.requiresDeviceIdle = z; return this; } public final Builder setRequiresStorageNotLow(boolean z) { this.requiresStorageNotLow = z; return this; } public Builder() { this.requiredNetworkRequest = new NetworkRequestCompat(null, 1, null); this.requiredNetworkType = NetworkType.NOT_REQUIRED; this.triggerContentUpdateDelay = -1L; this.triggerContentMaxDelay = -1L; this.contentUriTriggers = new LinkedHashSet(); } @RestrictTo({RestrictTo.Scope.LIBRARY_GROUP}) public Builder(Constraints constraints) { Intrinsics.checkNotNullParameter(constraints, "constraints"); this.requiredNetworkRequest = new NetworkRequestCompat(null, 1, null); this.requiredNetworkType = NetworkType.NOT_REQUIRED; this.triggerContentUpdateDelay = -1L; this.triggerContentMaxDelay = -1L; this.contentUriTriggers = new LinkedHashSet(); this.requiresCharging = constraints.requiresCharging(); this.requiresDeviceIdle = constraints.requiresDeviceIdle(); this.requiredNetworkType = constraints.getRequiredNetworkType(); this.requiresBatteryNotLow = constraints.requiresBatteryNotLow(); this.requiresStorageNotLow = constraints.requiresStorageNotLow(); this.triggerContentUpdateDelay = constraints.getContentTriggerUpdateDelayMillis(); this.triggerContentMaxDelay = constraints.getContentTriggerMaxDelayMillis(); this.contentUriTriggers = CollectionsKt___CollectionsKt.toMutableSet(constraints.getContentUriTriggers()); } public final Builder setRequiredNetworkType(NetworkType networkType) { Intrinsics.checkNotNullParameter(networkType, "networkType"); this.requiredNetworkType = networkType; this.requiredNetworkRequest = new NetworkRequestCompat(null, 1, null); return this; } @RequiresApi(21) public final Builder setRequiredNetworkRequest(NetworkRequest networkRequest, NetworkType networkType) { Intrinsics.checkNotNullParameter(networkRequest, "networkRequest"); Intrinsics.checkNotNullParameter(networkType, "networkType"); int i = Build.VERSION.SDK_INT; if (i < 28) { this.requiredNetworkType = networkType; } else { if (i >= 31 && NetworkRequest30.INSTANCE.getNetworkSpecifier(networkRequest) != null) { throw new IllegalArgumentException("NetworkRequests with NetworkSpecifiers set aren't supported."); } this.requiredNetworkRequest = new NetworkRequestCompat(networkRequest); this.requiredNetworkType = NetworkType.NOT_REQUIRED; } return this; } @RequiresApi(24) public final Builder addContentUriTrigger(Uri uri, boolean z) { Intrinsics.checkNotNullParameter(uri, "uri"); this.contentUriTriggers.add(new ContentUriTrigger(uri, z)); return this; } @RequiresApi(24) public final Builder setTriggerContentUpdateDelay(long j, TimeUnit timeUnit) { Intrinsics.checkNotNullParameter(timeUnit, "timeUnit"); this.triggerContentUpdateDelay = timeUnit.toMillis(j); return this; } @RequiresApi(26) public final Builder setTriggerContentUpdateDelay(Duration duration) { Intrinsics.checkNotNullParameter(duration, "duration"); this.triggerContentUpdateDelay = DurationApi26Impl.toMillisCompat(duration); return this; } @RequiresApi(24) public final Builder setTriggerContentMaxDelay(long j, TimeUnit timeUnit) { Intrinsics.checkNotNullParameter(timeUnit, "timeUnit"); this.triggerContentMaxDelay = timeUnit.toMillis(j); return this; } @RequiresApi(26) public final Builder setTriggerContentMaxDelay(Duration duration) { Intrinsics.checkNotNullParameter(duration, "duration"); this.triggerContentMaxDelay = DurationApi26Impl.toMillisCompat(duration); return this; } public final Constraints build() { Set set; set = CollectionsKt___CollectionsKt.toSet(this.contentUriTriggers); return new Constraints(this.requiredNetworkRequest, this.requiredNetworkType, this.requiresCharging, this.requiresDeviceIdle, this.requiresBatteryNotLow, this.requiresStorageNotLow, this.triggerContentUpdateDelay, this.triggerContentMaxDelay, set); } } public static final class ContentUriTrigger { private final boolean isTriggeredForDescendants; private final Uri uri; public final Uri getUri() { return this.uri; } public final boolean isTriggeredForDescendants() { return this.isTriggeredForDescendants; } public ContentUriTrigger(Uri uri, boolean z) { Intrinsics.checkNotNullParameter(uri, "uri"); this.uri = uri; this.isTriggeredForDescendants = z; } public boolean equals(Object obj) { if (this == obj) { return true; } if (!Intrinsics.areEqual(ContentUriTrigger.class, obj != null ? obj.getClass() : null)) { return false; } Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type androidx.work.Constraints.ContentUriTrigger"); ContentUriTrigger contentUriTrigger = (ContentUriTrigger) obj; return Intrinsics.areEqual(this.uri, contentUriTrigger.uri) && this.isTriggeredForDescendants == contentUriTrigger.isTriggeredForDescendants; } public int hashCode() { return (this.uri.hashCode() * 31) + Boolean.hashCode(this.isTriggeredForDescendants); } } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } } }