- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
271 lines
9.3 KiB
Java
271 lines
9.3 KiB
Java
package com.ironsource.environment.thread;
|
|
|
|
import android.os.Handler;
|
|
import android.os.HandlerThread;
|
|
import android.os.Looper;
|
|
import com.ironsource.i9;
|
|
import com.ironsource.ti;
|
|
import com.ironsource.zp;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.Lazy;
|
|
import kotlin.LazyKt__LazyJVMKt;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.Lambda;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
|
|
@SourceDebugExtension({"SMAP\nIronSourceThreadManager.kt\nKotlin\n*S Kotlin\n*F\n+ 1 IronSourceThreadManager.kt\ncom/ironsource/environment/thread/IronSourceThreadManager\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,147:1\n1855#2,2:148\n1855#2,2:150\n1855#2,2:152\n*S KotlinDebug\n*F\n+ 1 IronSourceThreadManager.kt\ncom/ironsource/environment/thread/IronSourceThreadManager\n*L\n70#1:148,2\n77#1:150,2\n84#1:152,2\n*E\n"})
|
|
/* loaded from: classes4.dex */
|
|
public final class IronSourceThreadManager {
|
|
private static boolean a;
|
|
private static final Handler c;
|
|
private static final ti d;
|
|
private static final ti e;
|
|
private static final ti f;
|
|
private static final Lazy g;
|
|
private static final Lazy h;
|
|
public static final IronSourceThreadManager INSTANCE = new IronSourceThreadManager();
|
|
private static final Handler b = new Handler(Looper.getMainLooper());
|
|
|
|
public static final class a extends Lambda implements Function0 {
|
|
public static final a a = new a();
|
|
|
|
public a() {
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public final zp invoke() {
|
|
return new zp(0, null, null, 7, null);
|
|
}
|
|
}
|
|
|
|
public static final class b extends Lambda implements Function0 {
|
|
public static final b a = new b();
|
|
|
|
public b() {
|
|
super(0);
|
|
}
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
|
public final ti invoke() {
|
|
ti tiVar = new ti("managersThread");
|
|
tiVar.start();
|
|
tiVar.a();
|
|
return tiVar;
|
|
}
|
|
}
|
|
|
|
static {
|
|
Lazy lazy;
|
|
Lazy lazy2;
|
|
HandlerThread handlerThread = new HandlerThread("IronSourceInitiatorHandler");
|
|
handlerThread.start();
|
|
c = new Handler(handlerThread.getLooper());
|
|
ti tiVar = new ti("mediationBackground");
|
|
tiVar.start();
|
|
tiVar.a();
|
|
d = tiVar;
|
|
ti tiVar2 = new ti("adapterBackground");
|
|
tiVar2.start();
|
|
tiVar2.a();
|
|
e = tiVar2;
|
|
ti tiVar3 = new ti("publisher-callbacks");
|
|
tiVar3.start();
|
|
tiVar3.a();
|
|
f = tiVar3;
|
|
lazy = LazyKt__LazyJVMKt.lazy(a.a);
|
|
g = lazy;
|
|
lazy2 = LazyKt__LazyJVMKt.lazy(b.a);
|
|
h = lazy2;
|
|
}
|
|
|
|
private IronSourceThreadManager() {
|
|
}
|
|
|
|
private final zp a() {
|
|
return (zp) g.getValue();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void a(Runnable it, final CountDownLatch latch) {
|
|
Intrinsics.checkNotNullParameter(it, "$it");
|
|
Intrinsics.checkNotNullParameter(latch, "$latch");
|
|
it.run();
|
|
new Runnable() { // from class: com.ironsource.environment.thread.IronSourceThreadManager$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
IronSourceThreadManager.a(latch);
|
|
}
|
|
}.run();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public static final void a(CountDownLatch latch) {
|
|
Intrinsics.checkNotNullParameter(latch, "$latch");
|
|
latch.countDown();
|
|
}
|
|
|
|
private final boolean a(Runnable runnable) {
|
|
return a && a().getQueue().contains(runnable);
|
|
}
|
|
|
|
public static /* synthetic */ void postAdapterBackgroundTask$default(IronSourceThreadManager ironSourceThreadManager, Runnable runnable, long j, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
ironSourceThreadManager.postAdapterBackgroundTask(runnable, j);
|
|
}
|
|
|
|
public static /* synthetic */ void postMediationBackgroundTask$default(IronSourceThreadManager ironSourceThreadManager, Runnable runnable, long j, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
ironSourceThreadManager.postMediationBackgroundTask(runnable, j);
|
|
}
|
|
|
|
public static /* synthetic */ void postOnUiThreadTask$default(IronSourceThreadManager ironSourceThreadManager, Runnable runnable, long j, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
ironSourceThreadManager.postOnUiThreadTask(runnable, j);
|
|
}
|
|
|
|
public static /* synthetic */ void postPublisherCallback$default(IronSourceThreadManager ironSourceThreadManager, Runnable runnable, long j, int i, Object obj) {
|
|
if ((i & 2) != 0) {
|
|
j = 0;
|
|
}
|
|
ironSourceThreadManager.postPublisherCallback(runnable, j);
|
|
}
|
|
|
|
public final void executeTasks(boolean z, boolean z2, List<? extends Runnable> tasks) {
|
|
Intrinsics.checkNotNullParameter(tasks, "tasks");
|
|
if (!z) {
|
|
Iterator<T> it = tasks.iterator();
|
|
while (it.hasNext()) {
|
|
((Runnable) it.next()).run();
|
|
}
|
|
return;
|
|
}
|
|
if (!z2) {
|
|
Iterator<T> it2 = tasks.iterator();
|
|
while (it2.hasNext()) {
|
|
postMediationBackgroundTask$default(INSTANCE, (Runnable) it2.next(), 0L, 2, null);
|
|
}
|
|
return;
|
|
}
|
|
final CountDownLatch countDownLatch = new CountDownLatch(tasks.size());
|
|
for (final Runnable runnable : tasks) {
|
|
postMediationBackgroundTask$default(INSTANCE, new Runnable() { // from class: com.ironsource.environment.thread.IronSourceThreadManager$$ExternalSyntheticLambda1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
IronSourceThreadManager.a(runnable, countDownLatch);
|
|
}
|
|
}, 0L, 2, null);
|
|
}
|
|
try {
|
|
countDownLatch.await();
|
|
} catch (InterruptedException e2) {
|
|
i9.d().a(e2);
|
|
}
|
|
}
|
|
|
|
public final Handler getInitHandler() {
|
|
return c;
|
|
}
|
|
|
|
public final ti getSharedManagersThread() {
|
|
return (ti) h.getValue();
|
|
}
|
|
|
|
public final ThreadPoolExecutor getThreadPoolExecutor() {
|
|
return new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), Runtime.getRuntime().availableProcessors(), Long.MAX_VALUE, TimeUnit.NANOSECONDS, new LinkedBlockingQueue());
|
|
}
|
|
|
|
public final boolean getUseSharedExecutorService() {
|
|
return a;
|
|
}
|
|
|
|
public final void postAdapterBackgroundTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
postAdapterBackgroundTask$default(this, action, 0L, 2, null);
|
|
}
|
|
|
|
public final void postAdapterBackgroundTask(Runnable action, long j) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (a) {
|
|
a().schedule(action, j, TimeUnit.MILLISECONDS);
|
|
} else {
|
|
e.a(action, j);
|
|
}
|
|
}
|
|
|
|
public final void postMediationBackgroundTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
postMediationBackgroundTask$default(this, action, 0L, 2, null);
|
|
}
|
|
|
|
public final void postMediationBackgroundTask(Runnable action, long j) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (a) {
|
|
a().schedule(action, j, TimeUnit.MILLISECONDS);
|
|
} else {
|
|
d.a(action, j);
|
|
}
|
|
}
|
|
|
|
public final void postOnUiThreadTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
postOnUiThreadTask$default(this, action, 0L, 2, null);
|
|
}
|
|
|
|
public final void postOnUiThreadTask(Runnable action, long j) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
b.postDelayed(action, j);
|
|
}
|
|
|
|
public final void postPublisherCallback(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
postPublisherCallback$default(this, action, 0L, 2, null);
|
|
}
|
|
|
|
public final void postPublisherCallback(Runnable action, long j) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
f.a(action, j);
|
|
}
|
|
|
|
public final void removeAdapterBackgroundTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (a(action)) {
|
|
a().remove(action);
|
|
} else {
|
|
e.b(action);
|
|
}
|
|
}
|
|
|
|
public final void removeMediationBackgroundTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
if (a(action)) {
|
|
a().remove(action);
|
|
} else {
|
|
d.b(action);
|
|
}
|
|
}
|
|
|
|
public final void removeUiThreadTask(Runnable action) {
|
|
Intrinsics.checkNotNullParameter(action, "action");
|
|
b.removeCallbacks(action);
|
|
}
|
|
|
|
public final void setUseSharedExecutorService(boolean z) {
|
|
a = z;
|
|
}
|
|
}
|