package c.a.q; import android.os.Handler; import android.os.Looper; import android.os.Process; import com.airbnb.lottie.parser.AnimatableValueParser; import d0.z.d.m; 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.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; /* compiled from: MediaEngineExecutorService.kt */ public final class c implements ExecutorService { public static final AtomicInteger i = new AtomicInteger(); public volatile int j = -1; public final ExecutorService k; public final boolean l; /* compiled from: MediaEngineExecutorService.kt */ public static final class a implements Runnable { public final /* synthetic */ c i; public a(c cVar) { this.i = cVar; } @Override // java.lang.Runnable public final void run() { this.i.j = Process.myTid(); Thread currentThread = Thread.currentThread(); m.checkNotNullExpressionValue(currentThread, "Thread.currentThread()"); currentThread.setName("MediaEngineExecutor-" + c.i.getAndIncrement()); } } public c(ExecutorService executorService, boolean z2) { m.checkNotNullParameter(executorService, "es"); this.k = executorService; this.l = z2; executorService.submit(new a(this)); } public final void a() { if (Process.myTid() != this.j) { IllegalStateException illegalStateException = new IllegalStateException("oops! not called on the MediaEngineExecutor"); AnimatableValueParser.F1("MediaEngineExecutor", "oops! not called on the MediaEngineExecutor", illegalStateException); if (this.l) { new Handler(Looper.getMainLooper()).post(new d(illegalStateException)); } } } @Override // java.util.concurrent.ExecutorService public boolean awaitTermination(long j, TimeUnit timeUnit) { return this.k.awaitTermination(j, timeUnit); } @Override // java.util.concurrent.Executor public void execute(Runnable runnable) { this.k.execute(runnable); } @Override // java.util.concurrent.ExecutorService public List> invokeAll(Collection> collection) { return this.k.invokeAll(collection); } @Override // java.util.concurrent.ExecutorService public List> invokeAll(Collection> collection, long j, TimeUnit timeUnit) { return this.k.invokeAll(collection, j, timeUnit); } @Override // java.util.concurrent.ExecutorService public T invokeAny(Collection> collection) { return (T) this.k.invokeAny(collection); } @Override // java.util.concurrent.ExecutorService public T invokeAny(Collection> collection, long j, TimeUnit timeUnit) { return (T) this.k.invokeAny(collection, j, timeUnit); } @Override // java.util.concurrent.ExecutorService public boolean isShutdown() { return this.k.isShutdown(); } @Override // java.util.concurrent.ExecutorService public boolean isTerminated() { return this.k.isTerminated(); } @Override // java.util.concurrent.ExecutorService public void shutdown() { this.k.shutdown(); } @Override // java.util.concurrent.ExecutorService public List shutdownNow() { return this.k.shutdownNow(); } @Override // java.util.concurrent.ExecutorService public Future submit(Runnable runnable) { return this.k.submit(runnable); } @Override // java.util.concurrent.ExecutorService public Future submit(Runnable runnable, T t) { return this.k.submit(runnable, t); } @Override // java.util.concurrent.ExecutorService public Future submit(Callable callable) { return this.k.submit(callable); } }