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

68 lines
2.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import java.lang.reflect.InvocationTargetException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/* renamed from: o.trl, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C17099trl extends AbstractC17812zvc {
private volatile Handler a;
private final Object c = new Object();
private final ExecutorService e = Executors.newFixedThreadPool(4, new ThreadFactory(this) { // from class: o.trl.2
final C17099trl d;
private final AtomicInteger e = new AtomicInteger(0);
{
this.d = this;
}
@Override // java.util.concurrent.ThreadFactory
public final Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setName(String.format("arch_disk_io_%d", Integer.valueOf(this.e.getAndIncrement())));
return thread;
}
});
@Override // o.AbstractC17812zvc
public final void b(Runnable runnable) {
this.e.execute(runnable);
}
@Override // o.AbstractC17812zvc
public final void a(Runnable runnable) {
if (this.a == null) {
synchronized (this.c) {
if (this.a == null) {
this.a = kc_(Looper.getMainLooper());
}
}
}
this.a.post(runnable);
}
@Override // o.AbstractC17812zvc
public final boolean c() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
private static Handler kc_(Looper looper) {
if (Build.VERSION.SDK_INT >= 28) {
return Handler.createAsync(looper);
}
try {
return (Handler) Handler.class.getDeclaredConstructor(Looper.class, Handler.Callback.class, Boolean.TYPE).newInstance(looper, null, Boolean.TRUE);
} catch (IllegalAccessException | InstantiationException | NoSuchMethodException unused) {
return new Handler(looper);
} catch (InvocationTargetException unused2) {
return new Handler(looper);
}
}
}