package v1; import android.os.Process; import android.os.StrictMode; import android.text.TextUtils; import android.util.Log; import com.google.android.gms.common.api.Api; import java.util.Collection; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /* loaded from: classes.dex */ public final class a implements ExecutorService { /* renamed from: b, reason: collision with root package name */ private static final long f14861b = TimeUnit.SECONDS.toMillis(10); /* renamed from: c, reason: collision with root package name */ private static volatile int f14862c; /* renamed from: a, reason: collision with root package name */ private final ExecutorService f14863a; /* renamed from: v1.a$a, reason: collision with other inner class name */ public static final class C0242a { /* renamed from: a, reason: collision with root package name */ private final boolean f14864a; /* renamed from: b, reason: collision with root package name */ private int f14865b; /* renamed from: c, reason: collision with root package name */ private int f14866c; /* renamed from: d, reason: collision with root package name */ private c f14867d = c.f14878d; /* renamed from: e, reason: collision with root package name */ private String f14868e; /* renamed from: f, reason: collision with root package name */ private long f14869f; C0242a(boolean z10) { this.f14864a = z10; } public a a() { if (TextUtils.isEmpty(this.f14868e)) { throw new IllegalArgumentException("Name must be non-null and non-empty, but given: " + this.f14868e); } ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(this.f14865b, this.f14866c, this.f14869f, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), new b(this.f14868e, this.f14867d, this.f14864a)); if (this.f14869f != 0) { threadPoolExecutor.allowCoreThreadTimeOut(true); } return new a(threadPoolExecutor); } public C0242a b(String str) { this.f14868e = str; return this; } public C0242a c(int i10) { this.f14865b = i10; this.f14866c = i10; return this; } } private static final class b implements ThreadFactory { /* renamed from: a, reason: collision with root package name */ private final String f14870a; /* renamed from: b, reason: collision with root package name */ final c f14871b; /* renamed from: c, reason: collision with root package name */ final boolean f14872c; /* renamed from: d, reason: collision with root package name */ private int f14873d; /* renamed from: v1.a$b$a, reason: collision with other inner class name */ class C0243a extends Thread { C0243a(Runnable runnable, String str) { super(runnable, str); } @Override // java.lang.Thread, java.lang.Runnable public void run() { Process.setThreadPriority(9); if (b.this.f14872c) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().penaltyDeath().build()); } try { super.run(); } catch (Throwable th) { b.this.f14871b.a(th); } } } b(String str, c cVar, boolean z10) { this.f14870a = str; this.f14871b = cVar; this.f14872c = z10; } @Override // java.util.concurrent.ThreadFactory public synchronized Thread newThread(Runnable runnable) { C0243a c0243a; c0243a = new C0243a(runnable, "glide-" + this.f14870a + "-thread-" + this.f14873d); this.f14873d = this.f14873d + 1; return c0243a; } } public interface c { /* renamed from: a, reason: collision with root package name */ public static final c f14875a = new C0244a(); /* renamed from: b, reason: collision with root package name */ public static final c f14876b; /* renamed from: c, reason: collision with root package name */ public static final c f14877c; /* renamed from: d, reason: collision with root package name */ public static final c f14878d; /* renamed from: v1.a$c$a, reason: collision with other inner class name */ class C0244a implements c { C0244a() { } @Override // v1.a.c public void a(Throwable th) { } } class b implements c { b() { } @Override // v1.a.c public void a(Throwable th) { if (th == null || !Log.isLoggable("GlideExecutor", 6)) { return; } Log.e("GlideExecutor", "Request threw uncaught throwable", th); } } /* renamed from: v1.a$c$c, reason: collision with other inner class name */ class C0245c implements c { C0245c() { } @Override // v1.a.c public void a(Throwable th) { if (th != null) { throw new RuntimeException("Request threw uncaught throwable", th); } } } static { b bVar = new b(); f14876b = bVar; f14877c = new C0245c(); f14878d = bVar; } void a(Throwable th); } a(ExecutorService executorService) { this.f14863a = executorService; } public static int a() { if (f14862c == 0) { f14862c = Math.min(4, v1.b.a()); } return f14862c; } public static C0242a b() { return new C0242a(true).c(a() >= 4 ? 2 : 1).b("animation"); } public static a c() { return b().a(); } public static C0242a d() { return new C0242a(true).c(1).b("disk-cache"); } public static a e() { return d().a(); } public static C0242a f() { return new C0242a(false).c(a()).b("source"); } public static a g() { return f().a(); } public static a h() { return new a(new ThreadPoolExecutor(0, Api.BaseClientBuilder.API_PRIORITY_OTHER, f14861b, TimeUnit.MILLISECONDS, new SynchronousQueue(), new b("source-unlimited", c.f14878d, false))); } @Override // java.util.concurrent.ExecutorService public boolean awaitTermination(long j10, TimeUnit timeUnit) { return this.f14863a.awaitTermination(j10, timeUnit); } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { this.f14863a.execute(runnable); } @Override // java.util.concurrent.ExecutorService public List invokeAll(Collection collection) { return this.f14863a.invokeAll(collection); } @Override // java.util.concurrent.ExecutorService public Object invokeAny(Collection collection) { return this.f14863a.invokeAny(collection); } @Override // java.util.concurrent.ExecutorService public boolean isShutdown() { return this.f14863a.isShutdown(); } @Override // java.util.concurrent.ExecutorService public boolean isTerminated() { return this.f14863a.isTerminated(); } @Override // java.util.concurrent.ExecutorService public void shutdown() { this.f14863a.shutdown(); } @Override // java.util.concurrent.ExecutorService public List shutdownNow() { return this.f14863a.shutdownNow(); } @Override // java.util.concurrent.ExecutorService public Future submit(Runnable runnable) { return this.f14863a.submit(runnable); } public String toString() { return this.f14863a.toString(); } @Override // java.util.concurrent.ExecutorService public List invokeAll(Collection collection, long j10, TimeUnit timeUnit) { return this.f14863a.invokeAll(collection, j10, timeUnit); } @Override // java.util.concurrent.ExecutorService public Object invokeAny(Collection collection, long j10, TimeUnit timeUnit) { return this.f14863a.invokeAny(collection, j10, timeUnit); } @Override // java.util.concurrent.ExecutorService public Future submit(Runnable runnable, Object obj) { return this.f14863a.submit(runnable, obj); } @Override // java.util.concurrent.ExecutorService public Future submit(Callable callable) { return this.f14863a.submit(callable); } }