143 lines
4.3 KiB
Java
143 lines
4.3 KiB
Java
package s.a.v1;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import d0.d0.f;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import kotlin.Unit;
|
|
import kotlin.coroutines.CoroutineContext;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlinx.coroutines.CancellableContinuation;
|
|
import s.a.g0;
|
|
import s.a.i1;
|
|
import s.a.j;
|
|
import s.a.k0;
|
|
/* compiled from: HandlerDispatcher.kt */
|
|
public final class a extends b implements g0 {
|
|
public volatile a _immediate;
|
|
public final a i;
|
|
public final Handler j;
|
|
public final String k;
|
|
public final boolean l;
|
|
|
|
/* compiled from: HandlerDispatcher.kt */
|
|
/* renamed from: s.a.v1.a$a reason: collision with other inner class name */
|
|
public static final class C0339a implements k0 {
|
|
public final /* synthetic */ a i;
|
|
public final /* synthetic */ Runnable j;
|
|
|
|
public C0339a(a aVar, Runnable runnable) {
|
|
this.i = aVar;
|
|
this.j = runnable;
|
|
}
|
|
|
|
@Override // s.a.k0
|
|
public void dispose() {
|
|
this.i.j.removeCallbacks(this.j);
|
|
}
|
|
}
|
|
|
|
/* compiled from: Runnable.kt */
|
|
public static final class b implements Runnable {
|
|
public final /* synthetic */ a i;
|
|
public final /* synthetic */ CancellableContinuation j;
|
|
|
|
public b(a aVar, CancellableContinuation cancellableContinuation) {
|
|
this.i = aVar;
|
|
this.j = cancellableContinuation;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
this.j.i(this.i, Unit.a);
|
|
}
|
|
}
|
|
|
|
/* compiled from: HandlerDispatcher.kt */
|
|
public static final class c extends o implements Function1<Throwable, Unit> {
|
|
public final /* synthetic */ Runnable $block;
|
|
public final /* synthetic */ a this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public c(a aVar, Runnable runnable) {
|
|
super(1);
|
|
this.this$0 = aVar;
|
|
this.$block = runnable;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public Unit invoke(Throwable th) {
|
|
this.this$0.j.removeCallbacks(this.$block);
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public a(Handler handler, String str, boolean z2) {
|
|
super(null);
|
|
a aVar = null;
|
|
this.j = handler;
|
|
this.k = str;
|
|
this.l = z2;
|
|
this._immediate = z2 ? this : aVar;
|
|
a aVar2 = this._immediate;
|
|
if (aVar2 == null) {
|
|
aVar2 = new a(handler, str, true);
|
|
this._immediate = aVar2;
|
|
}
|
|
this.i = aVar2;
|
|
}
|
|
|
|
@Override // s.a.i1
|
|
public i1 H() {
|
|
return this.i;
|
|
}
|
|
|
|
@Override // s.a.g0
|
|
public void b(long j, CancellableContinuation<? super Unit> cancellableContinuation) {
|
|
b bVar = new b(this, cancellableContinuation);
|
|
this.j.postDelayed(bVar, f.coerceAtMost(j, 4611686018427387903L));
|
|
((j) cancellableContinuation).e(new c(this, bVar));
|
|
}
|
|
|
|
@Override // s.a.z
|
|
public void dispatch(CoroutineContext coroutineContext, Runnable runnable) {
|
|
this.j.post(runnable);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
return (obj instanceof a) && ((a) obj).j == this.j;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return System.identityHashCode(this.j);
|
|
}
|
|
|
|
@Override // s.a.z
|
|
public boolean isDispatchNeeded(CoroutineContext coroutineContext) {
|
|
return !this.l || (m.areEqual(Looper.myLooper(), this.j.getLooper()) ^ true);
|
|
}
|
|
|
|
@Override // s.a.i1, s.a.z
|
|
public String toString() {
|
|
String I = I();
|
|
if (I != null) {
|
|
return I;
|
|
}
|
|
String str = this.k;
|
|
if (str == null) {
|
|
str = this.j.toString();
|
|
}
|
|
return this.l ? c.d.b.a.a.u(str, ".immediate") : str;
|
|
}
|
|
|
|
@Override // s.a.v1.b, s.a.g0
|
|
public k0 w(long j, Runnable runnable, CoroutineContext coroutineContext) {
|
|
this.j.postDelayed(runnable, f.coerceAtMost(j, 4611686018427387903L));
|
|
return new C0339a(this, runnable);
|
|
}
|
|
}
|