package ඓ.ῲ.K.ᕣ.ᨨ.㮔;

import android.os.Build;
import android.os.Process;
import android.os.StrictMode;
import android.text.TextUtils;
import android.util.Log;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import ඓ.K.K.K.C1293;

/* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㮔.K  reason: contains not printable characters */
/* compiled from: GlideExecutor */
public final class ExecutorServiceC1008 implements ExecutorService {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static volatile int f4410;

    /* renamed from: ῲ  reason: contains not printable characters */
    public static final long f4411 = TimeUnit.SECONDS.toMillis(10);

    /* renamed from: K  reason: contains not printable characters */
    public final ExecutorService f4412;

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㮔.K$ῲ  reason: contains not printable characters */
    /* compiled from: GlideExecutor */
    public interface AbstractC1009 {

        /* renamed from: ῲ  reason: contains not printable characters */
        public static final AbstractC1009 f4413 = f4414;

        /* renamed from: K  reason: contains not printable characters */
        public static final AbstractC1009 f4414 = new C1010();

        /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㮔.K$ῲ$K  reason: contains not printable characters */
        /* compiled from: GlideExecutor */
        public class C1010 implements AbstractC1009 {
            @Override // ඓ.ῲ.K.ᕣ.ᨨ.㮔.ExecutorServiceC1008.AbstractC1009
            /* renamed from: K  reason: contains not printable characters */
            public void m2818(Throwable th) {
                if (th != null && Log.isLoggable("GlideExecutor", 6)) {
                    Log.e("GlideExecutor", "Request threw uncaught throwable", th);
                }
            }
        }

        /* renamed from: K  reason: contains not printable characters */
        void m2817(Throwable th);
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㮔.K$K  reason: contains not printable characters */
    /* compiled from: GlideExecutor */
    public static final class ThreadFactoryC1011 implements ThreadFactory {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final AbstractC1009 f4415;

        /* renamed from: ඓ  reason: contains not printable characters */
        public int f4416;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final String f4417;

        /* renamed from: 㸾  reason: contains not printable characters */
        public final boolean f4418;

        /* renamed from: ඓ.ῲ.K.ᕣ.ᨨ.㮔.K$K$K  reason: contains not printable characters */
        /* compiled from: GlideExecutor */
        public class C1012 extends Thread {
            public C1012(Runnable runnable, String str) {
                super(runnable, str);
            }

            public void run() {
                Process.setThreadPriority(9);
                if (ThreadFactoryC1011.this.f4418) {
                    StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectNetwork().penaltyDeath().build());
                }
                try {
                    super.run();
                } catch (Throwable th) {
                    ThreadFactoryC1011.this.f4415.m2817(th);
                }
            }
        }

        public ThreadFactoryC1011(String str, AbstractC1009 r2, boolean z) {
            this.f4417 = str;
            this.f4415 = r2;
            this.f4418 = z;
        }

        public synchronized Thread newThread(Runnable runnable) {
            C1012 k;
            k = new C1012(runnable, "glide-" + this.f4417 + "-thread-" + this.f4416);
            this.f4416 = this.f4416 + 1;
            return k;
        }
    }

    public ExecutorServiceC1008(ExecutorService executorService) {
        this.f4412 = executorService;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public static ExecutorServiceC1008 m2814() {
        AbstractC1009 r1 = AbstractC1009.f4413;
        int r2 = m2816();
        if (!TextUtils.isEmpty("source")) {
            ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(r2, r2, 0, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), new ThreadFactoryC1011("source", r1, false));
            if (0 != 0) {
                threadPoolExecutor.allowCoreThreadTimeOut(true);
            }
            return new ExecutorServiceC1008(threadPoolExecutor);
        }
        throw new IllegalArgumentException(C1293.m3412("Name must be non-null and non-empty, but given: ", "source"));
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static ExecutorServiceC1008 m2815() {
        AbstractC1009 r0 = AbstractC1009.f4413;
        if (!TextUtils.isEmpty("disk-cache")) {
            ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, new PriorityBlockingQueue(), new ThreadFactoryC1011("disk-cache", r0, true));
            if (0 != 0) {
                threadPoolExecutor.allowCoreThreadTimeOut(true);
            }
            return new ExecutorServiceC1008(threadPoolExecutor);
        }
        throw new IllegalArgumentException(C1293.m3412("Name must be non-null and non-empty, but given: ", "disk-cache"));
    }

    /* renamed from: K  reason: contains not printable characters */
    public static int m2816() {
        if (f4410 == 0) {
            int availableProcessors = Runtime.getRuntime().availableProcessors();
            int i = Build.VERSION.SDK_INT;
            f4410 = Math.min(4, availableProcessors);
        }
        return f4410;
    }

    @Override // java.util.concurrent.ExecutorService
    public boolean awaitTermination(long j, TimeUnit timeUnit) throws InterruptedException {
        return this.f4412.awaitTermination(j, timeUnit);
    }

    public void execute(Runnable runnable) {
        this.f4412.execute(runnable);
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection) throws InterruptedException {
        return this.f4412.invokeAll(collection);
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> T invokeAny(Collection<? extends Callable<T>> collection) throws InterruptedException, ExecutionException {
        return (T) this.f4412.invokeAny(collection);
    }

    public boolean isShutdown() {
        return this.f4412.isShutdown();
    }

    public boolean isTerminated() {
        return this.f4412.isTerminated();
    }

    public void shutdown() {
        this.f4412.shutdown();
    }

    @Override // java.util.concurrent.ExecutorService
    public List<Runnable> shutdownNow() {
        return this.f4412.shutdownNow();
    }

    @Override // java.util.concurrent.ExecutorService
    public Future<?> submit(Runnable runnable) {
        return this.f4412.submit(runnable);
    }

    public String toString() {
        return this.f4412.toString();
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws InterruptedException {
        return this.f4412.invokeAll(collection, j, timeUnit);
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> T invokeAny(Collection<? extends Callable<T>> collection, long j, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
        return (T) this.f4412.invokeAny(collection, j, timeUnit);
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> Future<T> submit(Runnable runnable, T t) {
        return this.f4412.submit(runnable, t);
    }

    @Override // java.util.concurrent.ExecutorService
    public <T> Future<T> submit(Callable<T> callable) {
        return this.f4412.submit(callable);
    }
}
