package com.google.android.gms.internal.ads;

import android.content.Context;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;

/* JADX INFO: loaded from: classes2.dex */
public class ch1 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static volatile int f9896e = 1;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Context f9897a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Executor f9898b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final w8.h f9899c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final boolean f9900d;

    public ch1(Context context, ExecutorService executorService, w8.t tVar, boolean z10) {
        this.f9897a = context;
        this.f9898b = executorService;
        this.f9899c = tVar;
        this.f9900d = z10;
    }

    public static ch1 a(Context context, ExecutorService executorService, boolean z10) {
        w8.i iVar = new w8.i();
        if (z10) {
            executorService.execute(new nw0(context, iVar, 16));
        } else {
            executorService.execute(new na1(iVar, 7));
        }
        return new ch1(context, executorService, iVar.f34224a, z10);
    }

    public void b(int i10, long j10) {
        e(i10, j10, null, null, null);
    }

    public void c(int i10, long j10, Exception exc) {
        e(i10, j10, exc, null, null);
    }

    public void d(int i10, String str) {
        e(i10, 0L, null, null, str);
    }

    public final w8.t e(int i10, long j10, Exception exc, String str, String str2) {
        if (!this.f9900d) {
            return this.f9899c.e(this.f9898b, w80.S);
        }
        Context context = this.f9897a;
        he heVarB = le.B();
        String packageName = context.getPackageName();
        heVarB.c();
        ((le) heVarB.f8617b).C(packageName);
        heVarB.c();
        ((le) heVarB.f8617b).D(j10);
        int i11 = f9896e;
        heVarB.c();
        ((le) heVarB.f8617b).I(i11);
        if (exc != null) {
            Object obj = wq1.f18189a;
            StringWriter stringWriter = new StringWriter();
            exc.printStackTrace(new PrintWriter(stringWriter));
            String string = stringWriter.toString();
            heVarB.c();
            ((le) heVarB.f8617b).E(string);
            String name = exc.getClass().getName();
            heVarB.c();
            ((le) heVarB.f8617b).F(name);
        }
        if (str2 != null) {
            heVarB.c();
            ((le) heVarB.f8617b).G(str2);
        }
        if (str != null) {
            heVarB.c();
            ((le) heVarB.f8617b).H(str);
        }
        return this.f9899c.e(this.f9898b, new h6(i10, 6, heVarB));
    }
}
