what-the-bank/sources/o/LPk.java

325 lines
10 KiB
Java

package o;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import o.hFr;
import o.wdQ;
/* loaded from: classes.dex */
public class LPk extends wdQ {
private int a;
private boolean b;
private final boolean c;
private final WeakReference<InterfaceC16541pFg> d;
private boolean e;
private ArrayList<wdQ.IeS> f;
private C17820zzj<InterfaceC16186lzC, IeS> h;
private wdQ.IeS i;
public LPk(InterfaceC16541pFg interfaceC16541pFg) {
this(interfaceC16541pFg, (byte) 0);
}
private LPk(InterfaceC16541pFg interfaceC16541pFg, byte b) {
this.h = new C17820zzj<>();
this.a = 0;
this.e = false;
this.b = false;
this.f = new ArrayList<>();
this.d = new WeakReference<>(interfaceC16541pFg);
this.i = wdQ.IeS.INITIALIZED;
this.c = true;
}
@Deprecated
public final void a(wdQ.IeS ieS) {
d("markState");
d("setCurrentState");
d(ieS);
}
public final void b(wdQ.IeS ieS) {
d("setCurrentState");
d(ieS);
}
public final void d(wdQ.HBt hBt) {
d("handleLifecycleEvent");
d(hBt.a());
}
public final void d(wdQ.IeS ieS) {
wdQ.IeS ieS2 = this.i;
if (ieS2 == ieS) {
return;
}
if (ieS2 == wdQ.IeS.INITIALIZED && ieS == wdQ.IeS.DESTROYED) {
StringBuilder sb = new StringBuilder("no event down from ");
sb.append(this.i);
throw new IllegalStateException(sb.toString());
}
this.i = ieS;
if (this.e || this.a != 0) {
this.b = true;
return;
}
this.e = true;
c();
this.e = false;
if (this.i == wdQ.IeS.DESTROYED) {
this.h = new C17820zzj<>();
}
}
@Override // o.wdQ
public final void e(InterfaceC16186lzC interfaceC16186lzC) {
InterfaceC16541pFg interfaceC16541pFg;
d("addObserver");
IeS ieS = new IeS(interfaceC16186lzC, this.i == wdQ.IeS.DESTROYED ? wdQ.IeS.DESTROYED : wdQ.IeS.INITIALIZED);
if (this.h.a(interfaceC16186lzC, ieS) == null && (interfaceC16541pFg = this.d.get()) != null) {
boolean z = this.a != 0 || this.e;
wdQ.IeS d = d(interfaceC16186lzC);
this.a++;
while (ieS.d.compareTo(d) < 0 && this.h.b.containsKey(interfaceC16186lzC)) {
this.f.add(ieS.d);
wdQ.HBt e = wdQ.HBt.e(ieS.d);
if (e == null) {
StringBuilder sb = new StringBuilder("no event up from ");
sb.append(ieS.d);
throw new IllegalStateException(sb.toString());
}
ieS.b(interfaceC16541pFg, e);
ArrayList<wdQ.IeS> arrayList = this.f;
arrayList.remove(arrayList.size() - 1);
d = d(interfaceC16186lzC);
}
if (!z) {
c();
}
this.a--;
}
}
@Override // o.wdQ
public final void a(InterfaceC16186lzC interfaceC16186lzC) {
d("removeObserver");
this.h.b(interfaceC16186lzC);
}
private void c() {
InterfaceC16541pFg interfaceC16541pFg = this.d.get();
if (interfaceC16541pFg == null) {
throw new IllegalStateException("LifecycleOwner of this LifecycleRegistry is alreadygarbage collected. It is too late to change lifecycle state.");
}
while (!d()) {
this.b = false;
if (this.i.compareTo(this.h.a.getValue().d) < 0) {
d(interfaceC16541pFg);
}
hFr.Sts<InterfaceC16186lzC, IeS> sts = this.h.e;
if (!this.b && sts != null && this.i.compareTo(sts.getValue().d) > 0) {
a(interfaceC16541pFg);
}
}
this.b = false;
}
public final void d(String str) {
if (!this.c || C7268clA.d().c.c()) {
return;
}
StringBuilder sb = new StringBuilder("Method ");
sb.append(str);
sb.append(" must be called on the main thread");
throw new IllegalStateException(sb.toString());
}
static wdQ.IeS a(wdQ.IeS ieS, wdQ.IeS ieS2) {
return (ieS2 == null || ieS2.compareTo(ieS) >= 0) ? ieS : ieS2;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class IeS {
private InterfaceC3451axm b;
wdQ.IeS d;
IeS(InterfaceC16186lzC interfaceC16186lzC, wdQ.IeS ieS) {
this.b = QmX.d(interfaceC16186lzC);
this.d = ieS;
}
final void b(InterfaceC16541pFg interfaceC16541pFg, wdQ.HBt hBt) {
wdQ.IeS a = hBt.a();
this.d = LPk.a(this.d, a);
this.b.c(interfaceC16541pFg, hBt);
this.d = a;
}
}
/* JADX WARN: Code restructure failed: missing block: B:20:0x0012, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void d(o.InterfaceC16541pFg r7) {
/*
r6 = this;
o.zzj<o.lzC, o.LPk$IeS> r0 = r6.h
o.hFr$LWm r1 = new o.hFr$LWm
o.hFr$Sts<K, V> r2 = r0.e
o.hFr$Sts<K, V> r3 = r0.a
r1.<init>(r2, r3)
java.util.WeakHashMap<o.hFr$saX<K, V>, java.lang.Boolean> r0 = r0.c
java.lang.Boolean r2 = java.lang.Boolean.FALSE
r0.put(r1, r2)
L12:
boolean r0 = r1.hasNext()
if (r0 == 0) goto L7c
boolean r0 = r6.b
if (r0 != 0) goto L7c
java.lang.Object r0 = r1.next()
java.util.Map$Entry r0 = (java.util.Map.Entry) r0
java.lang.Object r2 = r0.getValue()
o.LPk$IeS r2 = (o.LPk.IeS) r2
L28:
o.wdQ$IeS r3 = r2.d
o.wdQ$IeS r4 = r6.i
int r3 = r3.compareTo(r4)
if (r3 <= 0) goto L12
boolean r3 = r6.b
if (r3 != 0) goto L12
o.zzj<o.lzC, o.LPk$IeS> r3 = r6.h
java.lang.Object r4 = r0.getKey()
o.lzC r4 = (o.InterfaceC16186lzC) r4
java.util.HashMap<K, o.hFr$Sts<K, V>> r3 = r3.b
boolean r3 = r3.containsKey(r4)
if (r3 == 0) goto L12
o.wdQ$IeS r3 = r2.d
o.wdQ$HBt r3 = o.wdQ.HBt.d(r3)
if (r3 == 0) goto L66
o.wdQ$IeS r4 = r3.a()
java.util.ArrayList<o.wdQ$IeS> r5 = r6.f
r5.add(r4)
r2.b(r7, r3)
java.util.ArrayList<o.wdQ$IeS> r3 = r6.f
int r4 = r3.size()
int r4 = r4 + (-1)
r3.remove(r4)
goto L28
L66:
java.lang.IllegalStateException r7 = new java.lang.IllegalStateException
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "no event down from "
r0.<init>(r1)
o.wdQ$IeS r1 = r2.d
r0.append(r1)
java.lang.String r0 = r0.toString()
r7.<init>(r0)
throw r7
L7c:
return
*/
throw new UnsupportedOperationException("Method not decompiled: o.LPk.d(o.pFg):void");
}
private wdQ.IeS d(InterfaceC16186lzC interfaceC16186lzC) {
C17820zzj<InterfaceC16186lzC, IeS> c17820zzj = this.h;
wdQ.IeS ieS = null;
hFr.Sts<InterfaceC16186lzC, IeS> sts = c17820zzj.b.containsKey(interfaceC16186lzC) ? c17820zzj.b.get(interfaceC16186lzC).c : null;
wdQ.IeS ieS2 = sts != null ? sts.getValue().d : null;
if (!this.f.isEmpty()) {
ieS = this.f.get(r0.size() - 1);
}
wdQ.IeS ieS3 = this.i;
if (ieS2 == null || ieS2.compareTo(ieS3) >= 0) {
ieS2 = ieS3;
}
return (ieS == null || ieS.compareTo(ieS2) >= 0) ? ieS2 : ieS;
}
/* JADX WARN: Code restructure failed: missing block: B:20:0x000e, code lost:
continue;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void a(o.InterfaceC16541pFg r6) {
/*
r5 = this;
o.zzj<o.lzC, o.LPk$IeS> r0 = r5.h
o.hFr$IeS r1 = new o.hFr$IeS
r1.<init>(r0)
java.util.WeakHashMap<o.hFr$saX<K, V>, java.lang.Boolean> r0 = r0.c
java.lang.Boolean r2 = java.lang.Boolean.FALSE
r0.put(r1, r2)
Le:
boolean r0 = r1.hasNext()
if (r0 == 0) goto L76
boolean r0 = r5.b
if (r0 != 0) goto L76
java.lang.Object r0 = r1.next()
java.util.Map$Entry r0 = (java.util.Map.Entry) r0
java.lang.Object r2 = r0.getValue()
o.LPk$IeS r2 = (o.LPk.IeS) r2
L24:
o.wdQ$IeS r3 = r2.d
o.wdQ$IeS r4 = r5.i
int r3 = r3.compareTo(r4)
if (r3 >= 0) goto Le
boolean r3 = r5.b
if (r3 != 0) goto Le
o.zzj<o.lzC, o.LPk$IeS> r3 = r5.h
java.lang.Object r4 = r0.getKey()
o.lzC r4 = (o.InterfaceC16186lzC) r4
java.util.HashMap<K, o.hFr$Sts<K, V>> r3 = r3.b
boolean r3 = r3.containsKey(r4)
if (r3 == 0) goto Le
o.wdQ$IeS r3 = r2.d
java.util.ArrayList<o.wdQ$IeS> r4 = r5.f
r4.add(r3)
o.wdQ$IeS r3 = r2.d
o.wdQ$HBt r3 = o.wdQ.HBt.e(r3)
if (r3 == 0) goto L60
r2.b(r6, r3)
java.util.ArrayList<o.wdQ$IeS> r3 = r5.f
int r4 = r3.size()
int r4 = r4 + (-1)
r3.remove(r4)
goto L24
L60:
java.lang.IllegalStateException r6 = new java.lang.IllegalStateException
java.lang.StringBuilder r0 = new java.lang.StringBuilder
java.lang.String r1 = "no event up from "
r0.<init>(r1)
o.wdQ$IeS r1 = r2.d
r0.append(r1)
java.lang.String r0 = r0.toString()
r6.<init>(r0)
throw r6
L76:
return
*/
throw new UnsupportedOperationException("Method not decompiled: o.LPk.a(o.pFg):void");
}
private boolean d() {
if (this.h.d == 0) {
return true;
}
wdQ.IeS ieS = this.h.a.getValue().d;
wdQ.IeS ieS2 = this.h.e.getValue().d;
return ieS == ieS2 && this.i == ieS2;
}
@Override // o.wdQ
public final wdQ.IeS a() {
return this.i;
}
}