2021-11-08 18:25:28 +00:00
|
|
|
package j0.l.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-12-17 22:03:14 +00:00
|
|
|
import j0.l.e.i;
|
|
|
|
import j0.l.e.n.e;
|
2021-11-08 18:25:28 +00:00
|
|
|
import j0.o.l;
|
2021-06-27 20:44:35 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.concurrent.atomic.AtomicLong;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.Producer;
|
|
|
|
import rx.Subscriber;
|
|
|
|
import rx.Subscription;
|
|
|
|
import rx.exceptions.CompositeException;
|
|
|
|
import rx.subscriptions.SerialSubscription;
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OperatorSwitch.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public final class y1<T> implements Observable.b<T, Observable<? extends T>> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final boolean j;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OperatorSwitch.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class a {
|
|
|
|
public static final y1<Object> a = new y1<>(false);
|
|
|
|
}
|
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OperatorSwitch.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class b<T> extends Subscriber<T> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final long j;
|
|
|
|
public final c<T> k;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
public b(long j, c<T> cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = j;
|
|
|
|
this.k = cVar;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T> cVar = this.k;
|
|
|
|
long j = this.j;
|
2021-06-27 20:44:35 +00:00
|
|
|
synchronized (cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (cVar.n.get() == j) {
|
|
|
|
cVar.v = false;
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3765s = null;
|
2021-06-27 20:44:35 +00:00
|
|
|
cVar.b();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
|
|
|
boolean z2;
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T> cVar = this.k;
|
|
|
|
long j = this.j;
|
2021-06-27 20:44:35 +00:00
|
|
|
synchronized (cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (cVar.n.get() == j) {
|
2021-06-27 20:44:35 +00:00
|
|
|
z2 = cVar.c(th);
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.v = false;
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3765s = null;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (z2) {
|
|
|
|
cVar.b();
|
|
|
|
} else {
|
|
|
|
l.b(th);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(T t) {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T> cVar = this.k;
|
2021-06-27 20:44:35 +00:00
|
|
|
synchronized (cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (cVar.n.get() == this.j) {
|
|
|
|
e<Object> eVar = cVar.o;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (t == null) {
|
2022-03-30 16:43:10 +00:00
|
|
|
t = (T) e.f3753b;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
eVar.e(this, t);
|
|
|
|
cVar.b();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // rx.Subscriber
|
|
|
|
public void setProducer(Producer producer) {
|
2021-12-17 22:03:14 +00:00
|
|
|
c<T> cVar = this.k;
|
|
|
|
long j = this.j;
|
2021-06-27 20:44:35 +00:00
|
|
|
synchronized (cVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (cVar.n.get() == j) {
|
|
|
|
long j2 = cVar.r;
|
2022-03-30 16:43:10 +00:00
|
|
|
cVar.f3765s = producer;
|
2021-06-27 20:44:35 +00:00
|
|
|
producer.j(j2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* compiled from: OperatorSwitch.java */
|
|
|
|
/* loaded from: classes3.dex */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class c<T> extends Subscriber<Observable<? extends T>> {
|
2021-12-17 22:03:14 +00:00
|
|
|
public static final Throwable j = new Throwable("Terminal error");
|
|
|
|
public final Subscriber<? super T> k;
|
|
|
|
public final boolean m;
|
2021-06-27 20:44:35 +00:00
|
|
|
public boolean p;
|
2021-12-17 22:03:14 +00:00
|
|
|
public boolean q;
|
|
|
|
public long r;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
/* renamed from: s reason: collision with root package name */
|
2022-03-30 16:43:10 +00:00
|
|
|
public Producer f3765s;
|
2021-12-17 22:03:14 +00:00
|
|
|
public volatile boolean t;
|
|
|
|
public Throwable u;
|
|
|
|
public boolean v;
|
2022-03-02 20:59:20 +00:00
|
|
|
public final SerialSubscription l = new SerialSubscription();
|
|
|
|
public final AtomicLong n = new AtomicLong();
|
|
|
|
public final e<Object> o = new e<>(i.j);
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
public c(Subscriber<? super T> subscriber, boolean z2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k = subscriber;
|
|
|
|
this.m = z2;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public boolean a(boolean z2, boolean z3, Throwable th, e<Object> eVar, Subscriber<? super T> subscriber, boolean z4) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.m) {
|
2021-06-27 20:44:35 +00:00
|
|
|
if (!z2 || z3 || !z4) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (th != null) {
|
|
|
|
subscriber.onError(th);
|
|
|
|
} else {
|
|
|
|
subscriber.onCompleted();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else if (th != null) {
|
|
|
|
eVar.clear();
|
|
|
|
subscriber.onError(th);
|
|
|
|
return true;
|
|
|
|
} else if (!z2 || z3 || !z4) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
subscriber.onCompleted();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-02 20:59:20 +00:00
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x0072, code lost:
|
|
|
|
if (r18 != 0) goto L_0x008e;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:33:0x0078, code lost:
|
|
|
|
if (r11.isUnsubscribed() == false) goto L_0x007b;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:34:0x007a, code lost:
|
|
|
|
return;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:36:0x008b, code lost:
|
|
|
|
if (a(r20.t, r0, r14, r9, r11, r9.isEmpty()) == false) goto L_0x008e;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:37:0x008d, code lost:
|
|
|
|
return;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:38:0x008e, code lost:
|
|
|
|
monitor-enter(r20);
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:39:0x008f, code lost:
|
|
|
|
r0 = r20.r;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:40:0x0098, code lost:
|
|
|
|
if (r0 == androidx.recyclerview.widget.RecyclerView.FOREVER_NS) goto L_0x009e;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:41:0x009a, code lost:
|
|
|
|
r0 = r0 - r16;
|
|
|
|
r20.r = r0;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:43:0x00a2, code lost:
|
|
|
|
if (r20.q != false) goto L_0x00a8;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:44:0x00a4, code lost:
|
|
|
|
r20.p = false;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:45:0x00a6, code lost:
|
|
|
|
monitor-exit(r20);
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:46:0x00a7, code lost:
|
|
|
|
return;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:47:0x00a8, code lost:
|
|
|
|
r20.q = false;
|
|
|
|
r15 = r20.t;
|
|
|
|
r0 = r20.v;
|
|
|
|
r14 = r20.u;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:48:0x00b0, code lost:
|
|
|
|
if (r14 == null) goto L_0x00bc;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:49:0x00b2, code lost:
|
|
|
|
r1 = j0.l.a.y1.c.j;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:50:0x00b4, code lost:
|
|
|
|
if (r14 == r1) goto L_0x00bc;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:52:0x00b8, code lost:
|
|
|
|
if (r20.m != false) goto L_0x00bc;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:53:0x00ba, code lost:
|
|
|
|
r20.u = r1;
|
|
|
|
*/
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:54:0x00bc, code lost:
|
|
|
|
monitor-exit(r20);
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
2021-06-27 20:44:35 +00:00
|
|
|
public void b() {
|
|
|
|
Throwable th;
|
|
|
|
synchronized (this) {
|
2021-12-17 22:03:14 +00:00
|
|
|
if (this.p) {
|
|
|
|
this.q = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.p = true;
|
2022-03-02 20:59:20 +00:00
|
|
|
boolean z2 = this.v;
|
|
|
|
long j2 = this.r;
|
|
|
|
Throwable th2 = this.u;
|
|
|
|
if (!(th2 == null || th2 == (th = j) || this.m)) {
|
|
|
|
this.u = th;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2022-03-02 20:59:20 +00:00
|
|
|
e<Object> eVar = this.o;
|
|
|
|
AtomicLong atomicLong = this.n;
|
|
|
|
Subscriber<? super T> subscriber = this.k;
|
|
|
|
boolean z3 = this.t;
|
|
|
|
Throwable th3 = th2;
|
2021-06-27 20:44:35 +00:00
|
|
|
while (true) {
|
2022-03-02 20:59:20 +00:00
|
|
|
long j3 = 0;
|
|
|
|
while (true) {
|
|
|
|
int i = (j3 > j2 ? 1 : (j3 == j2 ? 0 : -1));
|
|
|
|
if (i == 0) {
|
|
|
|
break;
|
|
|
|
} else if (!subscriber.isUnsubscribed()) {
|
|
|
|
boolean isEmpty = eVar.isEmpty();
|
|
|
|
if (!a(z3, z2, th3, eVar, subscriber, isEmpty)) {
|
|
|
|
if (isEmpty) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
Object obj = (Object) e.b(eVar.poll());
|
|
|
|
if (atomicLong.get() == ((b) eVar.poll()).j) {
|
|
|
|
subscriber.onNext(obj);
|
|
|
|
j3++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean c(Throwable th) {
|
2021-12-17 22:03:14 +00:00
|
|
|
Throwable th2 = this.u;
|
|
|
|
if (th2 == j) {
|
2021-06-27 20:44:35 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (th2 == null) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.u = th;
|
2021-06-27 20:44:35 +00:00
|
|
|
} else if (th2 instanceof CompositeException) {
|
|
|
|
ArrayList arrayList = new ArrayList(((CompositeException) th2).b());
|
|
|
|
arrayList.add(th);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.u = new CompositeException(arrayList);
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.u = new CompositeException(th2, th);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onCompleted() {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.t = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
b();
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onError(Throwable th) {
|
2021-12-21 23:37:30 +00:00
|
|
|
boolean c;
|
2021-06-27 20:44:35 +00:00
|
|
|
synchronized (this) {
|
2021-12-21 23:37:30 +00:00
|
|
|
c = c(th);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-21 23:37:30 +00:00
|
|
|
if (c) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.t = true;
|
2021-06-27 20:44:35 +00:00
|
|
|
b();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
l.b(th);
|
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.g
|
2021-06-27 20:44:35 +00:00
|
|
|
public void onNext(Object obj) {
|
|
|
|
b bVar;
|
|
|
|
Observable observable = (Observable) obj;
|
2021-12-17 22:03:14 +00:00
|
|
|
long incrementAndGet = this.n.incrementAndGet();
|
|
|
|
Subscription subscription = this.l.j.get();
|
2021-11-08 18:25:28 +00:00
|
|
|
if (subscription == j0.l.d.b.INSTANCE) {
|
|
|
|
subscription = j0.r.c.a;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
if (subscription != null) {
|
|
|
|
subscription.unsubscribe();
|
|
|
|
}
|
|
|
|
synchronized (this) {
|
|
|
|
bVar = new b(incrementAndGet, this);
|
2021-12-17 22:03:14 +00:00
|
|
|
this.v = true;
|
2022-03-30 16:43:10 +00:00
|
|
|
this.f3765s = null;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
this.l.a(bVar);
|
2021-10-26 23:51:06 +00:00
|
|
|
observable.i0(bVar);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public y1(boolean z2) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = z2;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-11-08 18:25:28 +00:00
|
|
|
@Override // j0.k.b
|
2021-06-27 20:44:35 +00:00
|
|
|
public Object call(Object obj) {
|
|
|
|
Subscriber subscriber = (Subscriber) obj;
|
2021-12-17 22:03:14 +00:00
|
|
|
c cVar = new c(subscriber, this.j);
|
2021-06-27 20:44:35 +00:00
|
|
|
subscriber.add(cVar);
|
2021-12-17 22:03:14 +00:00
|
|
|
cVar.k.add(cVar.l);
|
|
|
|
cVar.k.add(new j0.r.a(new z1(cVar)));
|
|
|
|
cVar.k.setProducer(new a2(cVar));
|
2021-06-27 20:44:35 +00:00
|
|
|
return cVar;
|
|
|
|
}
|
|
|
|
}
|