package androidx.work;

import com.google.android.gms.common.api.Api;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
import z5.g;
import z5.i;
import z5.r;
import z5.x;

/* loaded from: classes.dex */
public final class a {

    /* renamed from: a, reason: collision with root package name */
    final Executor f5870a;

    /* renamed from: b, reason: collision with root package name */
    final Executor f5871b;

    /* renamed from: c, reason: collision with root package name */
    final x f5872c;

    /* renamed from: d, reason: collision with root package name */
    final i f5873d;

    /* renamed from: e, reason: collision with root package name */
    final r f5874e;

    /* renamed from: f, reason: collision with root package name */
    final String f5875f;

    /* renamed from: g, reason: collision with root package name */
    final int f5876g;

    /* renamed from: h, reason: collision with root package name */
    final int f5877h;

    /* renamed from: i, reason: collision with root package name */
    final int f5878i;

    /* renamed from: j, reason: collision with root package name */
    final int f5879j;

    /* renamed from: k, reason: collision with root package name */
    private final boolean f5880k;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* renamed from: androidx.work.a$a, reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public class ThreadFactoryC0148a implements ThreadFactory {

        /* renamed from: a, reason: collision with root package name */
        private final AtomicInteger f5881a = new AtomicInteger(0);

        /* renamed from: b, reason: collision with root package name */
        final /* synthetic */ boolean f5882b;

        ThreadFactoryC0148a(boolean z10) {
            this.f5882b = z10;
        }

        @Override // java.util.concurrent.ThreadFactory
        public Thread newThread(Runnable runnable) {
            return new Thread(runnable, (this.f5882b ? "WM.task-" : "androidx.work-") + this.f5881a.incrementAndGet());
        }
    }

    /* loaded from: classes.dex */
    public static final class b {

        /* renamed from: a, reason: collision with root package name */
        Executor f5884a;

        /* renamed from: b, reason: collision with root package name */
        x f5885b;

        /* renamed from: c, reason: collision with root package name */
        i f5886c;

        /* renamed from: d, reason: collision with root package name */
        Executor f5887d;

        /* renamed from: e, reason: collision with root package name */
        r f5888e;

        /* renamed from: f, reason: collision with root package name */
        String f5889f;

        /* renamed from: g, reason: collision with root package name */
        int f5890g = 4;

        /* renamed from: h, reason: collision with root package name */
        int f5891h = 0;

        /* renamed from: i, reason: collision with root package name */
        int f5892i = Api.BaseClientBuilder.API_PRIORITY_OTHER;

        /* renamed from: j, reason: collision with root package name */
        int f5893j = 20;

        public a a() {
            return new a(this);
        }
    }

    a(b bVar) {
        Executor executor = bVar.f5884a;
        if (executor == null) {
            this.f5870a = a(false);
        } else {
            this.f5870a = executor;
        }
        Executor executor2 = bVar.f5887d;
        if (executor2 == null) {
            this.f5880k = true;
            this.f5871b = a(true);
        } else {
            this.f5880k = false;
            this.f5871b = executor2;
        }
        x xVar = bVar.f5885b;
        if (xVar == null) {
            this.f5872c = x.c();
        } else {
            this.f5872c = xVar;
        }
        i iVar = bVar.f5886c;
        if (iVar == null) {
            this.f5873d = i.c();
        } else {
            this.f5873d = iVar;
        }
        r rVar = bVar.f5888e;
        if (rVar == null) {
            this.f5874e = new a6.a();
        } else {
            this.f5874e = rVar;
        }
        this.f5876g = bVar.f5890g;
        this.f5877h = bVar.f5891h;
        this.f5878i = bVar.f5892i;
        this.f5879j = bVar.f5893j;
        this.f5875f = bVar.f5889f;
    }

    private Executor a(boolean z10) {
        return Executors.newFixedThreadPool(Math.max(2, Math.min(Runtime.getRuntime().availableProcessors() - 1, 4)), b(z10));
    }

    private ThreadFactory b(boolean z10) {
        return new ThreadFactoryC0148a(z10);
    }

    public String c() {
        return this.f5875f;
    }

    public g d() {
        return null;
    }

    public Executor e() {
        return this.f5870a;
    }

    public i f() {
        return this.f5873d;
    }

    public int g() {
        return this.f5878i;
    }

    public int h() {
        return this.f5879j;
    }

    public int i() {
        return this.f5877h;
    }

    public int j() {
        return this.f5876g;
    }

    public r k() {
        return this.f5874e;
    }

    public Executor l() {
        return this.f5871b;
    }

    public x m() {
        return this.f5872c;
    }
}
