You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

244 lines
6.6 KiB

package androidx.lifecycle;
import androidx.lifecycle.AbstractC0424i;
import p031k.C1269a;
import p034l.C1408b;
/* loaded from: classes.dex */
public abstract class LiveData<T> {
/* renamed from: k */
public static final Object f1579k = new Object();
/* renamed from: a */
public final Object f1580a = new Object();
/* renamed from: b */
public C1408b<InterfaceC0441s<? super T>, LiveData<T>.AbstractC0396b> f1581b = new C1408b<>();
/* renamed from: c */
public int f1582c = 0;
/* renamed from: d */
public boolean f1583d;
/* renamed from: e */
public volatile Object f1584e;
/* renamed from: f */
public volatile Object f1585f;
/* renamed from: g */
public int f1586g;
/* renamed from: h */
public boolean f1587h;
/* renamed from: i */
public boolean f1588i;
/* renamed from: j */
public final Runnable f1589j;
/* loaded from: classes.dex */
public class LifecycleBoundObserver extends LiveData<T>.AbstractC0396b implements InterfaceC0432k {
/* renamed from: d */
public final InterfaceC0434m f1590d;
/* renamed from: e */
public final /* synthetic */ LiveData f1591e;
@Override // androidx.lifecycle.InterfaceC0432k
/* renamed from: d */
public void mo472d(InterfaceC0434m interfaceC0434m, AbstractC0424i.EnumC0426b enumC0426b) {
AbstractC0424i.EnumC0427c mo3692b = this.f1590d.mo421a().mo3692b();
AbstractC0424i.EnumC0427c enumC0427c = null;
if (mo3692b == AbstractC0424i.EnumC0427c.DESTROYED) {
this.f1591e.mo702g(null);
return;
}
while (enumC0427c != mo3692b) {
m3746h(mo3744j());
enumC0427c = mo3692b;
mo3692b = this.f1590d.mo421a().mo3692b();
}
}
@Override // androidx.lifecycle.LiveData.AbstractC0396b
/* renamed from: i */
public void mo3745i() {
this.f1590d.mo421a().mo3691c(this);
}
@Override // androidx.lifecycle.LiveData.AbstractC0396b
/* renamed from: j */
public boolean mo3744j() {
return this.f1590d.mo421a().mo3692b().m3697a(AbstractC0424i.EnumC0427c.STARTED);
}
}
/* renamed from: androidx.lifecycle.LiveData$a */
/* loaded from: classes.dex */
public class RunnableC0395a implements Runnable {
public RunnableC0395a() {
}
/* JADX WARN: Multi-variable type inference failed */
@Override // java.lang.Runnable
public void run() {
Object obj;
synchronized (LiveData.this.f1580a) {
obj = LiveData.this.f1585f;
LiveData.this.f1585f = LiveData.f1579k;
}
LiveData.this.mo701h(obj);
}
}
/* renamed from: androidx.lifecycle.LiveData$b */
/* loaded from: classes.dex */
public abstract class AbstractC0396b {
/* renamed from: a */
public boolean f1593a;
/* renamed from: b */
public int f1594b;
/* renamed from: c */
public final /* synthetic */ LiveData f1595c;
/* renamed from: h */
public void m3746h(boolean z) {
if (z == this.f1593a) {
return;
}
this.f1593a = z;
this.f1595c.m3749b(z ? 1 : -1);
if (this.f1593a) {
this.f1595c.m3747d(this);
}
}
/* renamed from: i */
public void mo3745i() {
}
/* renamed from: j */
public abstract boolean mo3744j();
}
public LiveData() {
Object obj = f1579k;
this.f1585f = obj;
this.f1589j = new RunnableC0395a();
this.f1584e = obj;
this.f1586g = -1;
}
/* renamed from: a */
public static void m3750a(String str) {
if (C1269a.m1748d().mo1744b()) {
return;
}
throw new IllegalStateException("Cannot invoke " + str + " on a background thread");
}
/* renamed from: b */
public void m3749b(int i) {
int i2 = this.f1582c;
this.f1582c = i + i2;
if (this.f1583d) {
return;
}
this.f1583d = true;
while (true) {
try {
int i3 = this.f1582c;
if (i2 == i3) {
return;
}
boolean z = i2 == 0 && i3 > 0;
boolean z2 = i2 > 0 && i3 == 0;
if (z) {
mo704e();
} else if (z2) {
mo703f();
}
i2 = i3;
} finally {
this.f1583d = false;
}
}
}
/* renamed from: c */
public final void m3748c(LiveData<T>.AbstractC0396b abstractC0396b) {
if (abstractC0396b.f1593a) {
if (!abstractC0396b.mo3744j()) {
abstractC0396b.m3746h(false);
return;
}
int i = abstractC0396b.f1594b;
int i2 = this.f1586g;
if (i >= i2) {
return;
}
abstractC0396b.f1594b = i2;
throw null;
}
}
/* renamed from: d */
public void m3747d(LiveData<T>.AbstractC0396b abstractC0396b) {
if (this.f1587h) {
this.f1588i = true;
return;
}
this.f1587h = true;
do {
this.f1588i = false;
if (abstractC0396b == null) {
C1408b<InterfaceC0441s<? super T>, LiveData<T>.AbstractC0396b>.C1412d m1405c = this.f1581b.m1405c();
while (m1405c.hasNext()) {
m3748c((AbstractC0396b) m1405c.next().getValue());
if (this.f1588i) {
break;
}
}
} else {
m3748c(abstractC0396b);
abstractC0396b = null;
}
} while (this.f1588i);
this.f1587h = false;
}
/* renamed from: e */
public void mo704e() {
}
/* renamed from: f */
public void mo703f() {
}
/* renamed from: g */
public void mo702g(InterfaceC0441s<? super T> interfaceC0441s) {
m3750a("removeObserver");
LiveData<T>.AbstractC0396b mo1401g = this.f1581b.mo1401g(interfaceC0441s);
if (mo1401g == null) {
return;
}
mo1401g.mo3745i();
mo1401g.m3746h(false);
}
/* renamed from: h */
public void mo701h(T t) {
m3750a("setValue");
this.f1586g++;
this.f1584e = t;
m3747d(null);
}
}