You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.6 KiB

package p031k;
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: k.c */
/* loaded from: classes.dex */
public class C1273c extends AbstractC1275d {
/* renamed from: a */
public final Object f2961a = new Object();
/* renamed from: b */
public final ExecutorService f2962b = Executors.newFixedThreadPool(4, new ThreadFactoryC1274a());
/* renamed from: c */
public volatile Handler f2963c;
/* renamed from: k.c$a */
/* loaded from: classes.dex */
public class ThreadFactoryC1274a implements ThreadFactory {
/* renamed from: a */
public final AtomicInteger f2964a = new AtomicInteger(0);
public ThreadFactoryC1274a() {
}
@Override // java.util.concurrent.ThreadFactory
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setName(String.format("arch_disk_io_%d", Integer.valueOf(this.f2964a.getAndIncrement())));
return thread;
}
}
/* renamed from: d */
public static Handler m1746d(Looper looper) {
Handler createAsync;
if (Build.VERSION.SDK_INT >= 28) {
createAsync = Handler.createAsync(looper);
return createAsync;
}
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);
}
}
@Override // p031k.AbstractC1275d
/* renamed from: a */
public void mo1745a(Runnable runnable) {
this.f2962b.execute(runnable);
}
@Override // p031k.AbstractC1275d
/* renamed from: b */
public boolean mo1744b() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
@Override // p031k.AbstractC1275d
/* renamed from: c */
public void mo1743c(Runnable runnable) {
if (this.f2963c == null) {
synchronized (this.f2961a) {
if (this.f2963c == null) {
this.f2963c = m1746d(Looper.getMainLooper());
}
}
}
this.f2963c.post(runnable);
}
}