Rabbit-R1/android (non root)/java/sources/androidx/compose/runtime/SnapshotMutableStateImpl.java
2024-05-21 17:08:36 -04:00

164 lines
9.8 KiB
Java

package androidx.compose.runtime;
import androidx.compose.runtime.snapshots.Snapshot;
import androidx.compose.runtime.snapshots.SnapshotKt;
import androidx.compose.runtime.snapshots.SnapshotMutableState;
import androidx.compose.runtime.snapshots.StateObject;
import androidx.compose.runtime.snapshots.StateRecord;
import androidx.exifinterface.media.ExifInterface;
import io.sentry.protocol.SentryThread;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: SnapshotState.kt */
@Metadata(d1 = {"\u0000>\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0010\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0003:\u0001$B\u001b\u0012\u0006\u0010\u0004\u001a\u00028\u0000\u0012\f\u0010\u0005\u001a\b\u0012\u0004\u0012\u00028\u00000\u0006¢\u0006\u0002\u0010\u0007J\u000e\u0010\u0019\u001a\u00028\u0000H\u0096\u0002¢\u0006\u0002\u0010\fJ\u0015\u0010\u001a\u001a\u000e\u0012\u0004\u0012\u00028\u0000\u0012\u0004\u0012\u00020\u001c0\u001bH\u0096\u0002J\"\u0010\u001d\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u001e\u001a\u00020\u000e2\u0006\u0010\u001f\u001a\u00020\u000e2\u0006\u0010 \u001a\u00020\u000eH\u0016J\u0010\u0010!\u001a\u00020\u001c2\u0006\u0010\u0004\u001a\u00020\u000eH\u0016J\b\u0010\"\u001a\u00020#H\u0016R\u0017\u0010\b\u001a\u00028\u00008G¢\u0006\f\u0012\u0004\b\t\u0010\n\u001a\u0004\b\u000b\u0010\fR\u0014\u0010\r\u001a\u00020\u000e8VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010R\u0014\u0010\u0011\u001a\b\u0012\u0004\u0012\u00028\u00000\u0012X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010\u0005\u001a\b\u0012\u0004\u0012\u00028\u00000\u0006X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0013\u0010\u0014R*\u0010\u0004\u001a\u00028\u00002\u0006\u0010\u0004\u001a\u00028\u00008V@VX\u0096\u000e¢\u0006\u0012\u0012\u0004\b\u0015\u0010\n\u001a\u0004\b\u0016\u0010\f\"\u0004\b\u0017\u0010\u0018¨\u0006%"}, d2 = {"Landroidx/compose/runtime/SnapshotMutableStateImpl;", ExifInterface.GPS_DIRECTION_TRUE, "Landroidx/compose/runtime/snapshots/StateObject;", "Landroidx/compose/runtime/snapshots/SnapshotMutableState;", "value", "policy", "Landroidx/compose/runtime/SnapshotMutationPolicy;", "(Ljava/lang/Object;Landroidx/compose/runtime/SnapshotMutationPolicy;)V", "debuggerDisplayValue", "getDebuggerDisplayValue$annotations", "()V", "getDebuggerDisplayValue", "()Ljava/lang/Object;", "firstStateRecord", "Landroidx/compose/runtime/snapshots/StateRecord;", "getFirstStateRecord", "()Landroidx/compose/runtime/snapshots/StateRecord;", "next", "Landroidx/compose/runtime/SnapshotMutableStateImpl$StateStateRecord;", "getPolicy", "()Landroidx/compose/runtime/SnapshotMutationPolicy;", "getValue$annotations", "getValue", "setValue", "(Ljava/lang/Object;)V", "component1", "component2", "Lkotlin/Function1;", "", "mergeRecords", "previous", SentryThread.JsonKeys.CURRENT, "applied", "prependStateRecord", "toString", "", "StateStateRecord", "runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public class SnapshotMutableStateImpl<T> implements StateObject, SnapshotMutableState<T> {
private StateStateRecord<T> next;
private final SnapshotMutationPolicy<T> policy;
public static /* synthetic */ void getDebuggerDisplayValue$annotations() {
}
public static /* synthetic */ void getValue$annotations() {
}
@Override // androidx.compose.runtime.snapshots.SnapshotMutableState
public SnapshotMutationPolicy<T> getPolicy() {
return this.policy;
}
public SnapshotMutableStateImpl(T t, SnapshotMutationPolicy<T> policy) {
Intrinsics.checkNotNullParameter(policy, "policy");
this.policy = policy;
this.next = new StateStateRecord<>(t);
}
@Override // androidx.compose.runtime.MutableState, androidx.compose.runtime.State
public T getValue() {
return (T) ((StateStateRecord) SnapshotKt.readable(this.next, this)).getValue();
}
/* JADX WARN: Multi-variable type inference failed */
@Override // androidx.compose.runtime.MutableState
public void setValue(T t) {
Snapshot current;
StateStateRecord stateStateRecord = (StateStateRecord) SnapshotKt.current(this.next);
if (getPolicy().equivalent(stateStateRecord.getValue(), t)) {
return;
}
StateStateRecord<T> stateStateRecord2 = this.next;
SnapshotKt.getSnapshotInitializer();
synchronized (SnapshotKt.getLock()) {
current = Snapshot.INSTANCE.getCurrent();
((StateStateRecord) SnapshotKt.overwritableRecord(stateStateRecord2, this, current, stateStateRecord)).setValue(t);
Unit unit = Unit.INSTANCE;
}
SnapshotKt.notifyWrite(current, this);
}
@Override // androidx.compose.runtime.snapshots.StateObject
public StateRecord getFirstStateRecord() {
return this.next;
}
@Override // androidx.compose.runtime.snapshots.StateObject
public void prependStateRecord(StateRecord value) {
Intrinsics.checkNotNullParameter(value, "value");
this.next = (StateStateRecord) value;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // androidx.compose.runtime.snapshots.StateObject
public StateRecord mergeRecords(StateRecord previous, StateRecord current, StateRecord applied) {
Intrinsics.checkNotNullParameter(previous, "previous");
Intrinsics.checkNotNullParameter(current, "current");
Intrinsics.checkNotNullParameter(applied, "applied");
StateStateRecord stateStateRecord = (StateStateRecord) previous;
StateStateRecord stateStateRecord2 = (StateStateRecord) current;
StateStateRecord stateStateRecord3 = (StateStateRecord) applied;
if (getPolicy().equivalent(stateStateRecord2.getValue(), stateStateRecord3.getValue())) {
return current;
}
Object merge = getPolicy().merge(stateStateRecord.getValue(), stateStateRecord2.getValue(), stateStateRecord3.getValue());
if (merge == null) {
return null;
}
StateRecord create = stateStateRecord3.create();
Intrinsics.checkNotNull(create, "null cannot be cast to non-null type androidx.compose.runtime.SnapshotMutableStateImpl.StateStateRecord<T of androidx.compose.runtime.SnapshotMutableStateImpl.mergeRecords$lambda$2>");
((StateStateRecord) create).setValue(merge);
return create;
}
public String toString() {
return "MutableState(value=" + ((StateStateRecord) SnapshotKt.current(this.next)).getValue() + ")@" + hashCode();
}
/* JADX INFO: Access modifiers changed from: private */
/* compiled from: SnapshotState.kt */
@Metadata(d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0002\u0018\u0000*\u0004\b\u0001\u0010\u00012\u00020\u0002B\r\u0012\u0006\u0010\u0003\u001a\u00028\u0001¢\u0006\u0002\u0010\u0004J\u0010\u0010\n\u001a\u00020\u000b2\u0006\u0010\u0005\u001a\u00020\u0002H\u0016J\b\u0010\f\u001a\u00020\u0002H\u0016R\u001c\u0010\u0005\u001a\u00028\u0001X\u0086\u000e¢\u0006\u0010\n\u0002\u0010\t\u001a\u0004\b\u0006\u0010\u0007\"\u0004\b\b\u0010\u0004¨\u0006\r"}, d2 = {"Landroidx/compose/runtime/SnapshotMutableStateImpl$StateStateRecord;", ExifInterface.GPS_DIRECTION_TRUE, "Landroidx/compose/runtime/snapshots/StateRecord;", "myValue", "(Ljava/lang/Object;)V", "value", "getValue", "()Ljava/lang/Object;", "setValue", "Ljava/lang/Object;", "assign", "", "create", "runtime_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public static final class StateStateRecord<T> extends StateRecord {
private T value;
public final T getValue() {
return this.value;
}
public final void setValue(T t) {
this.value = t;
}
public StateStateRecord(T t) {
this.value = t;
}
@Override // androidx.compose.runtime.snapshots.StateRecord
public void assign(StateRecord value) {
Intrinsics.checkNotNullParameter(value, "value");
this.value = ((StateStateRecord) value).value;
}
@Override // androidx.compose.runtime.snapshots.StateRecord
public StateRecord create() {
return new StateStateRecord(this.value);
}
}
@Override // androidx.compose.runtime.MutableState
public T component1() {
return getValue();
}
@Override // androidx.compose.runtime.MutableState
public Function1<T, Unit> component2() {
return new Function1<T, Unit>(this) { // from class: androidx.compose.runtime.SnapshotMutableStateImpl$component2$1
final /* synthetic */ SnapshotMutableStateImpl<T> this$0;
/* JADX INFO: Access modifiers changed from: package-private */
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
{
super(1);
this.this$0 = this;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // kotlin.jvm.functions.Function1
public /* bridge */ /* synthetic */ Unit invoke(Object obj) {
invoke2((SnapshotMutableStateImpl$component2$1<T>) obj);
return Unit.INSTANCE;
}
/* renamed from: invoke, reason: avoid collision after fix types in other method */
public final void invoke2(T t) {
this.this$0.setValue(t);
}
};
}
public final T getDebuggerDisplayValue() {
return (T) ((StateStateRecord) SnapshotKt.current(this.next)).getValue();
}
}