package k4;

import android.util.Log;
import d3.V0;
import java.io.File;
import java.io.IOException;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;
import m4.C1167c;
import q4.C1463c;

/* JADX INFO: loaded from: classes.dex */
public final class k implements Callable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ long f13869a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Throwable f13870b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Thread f13871c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ s4.b f13872d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ m f13873e;

    public k(m mVar, long j8, Throwable th, Thread thread, s4.b bVar) {
        this.f13873e = mVar;
        this.f13869a = j8;
        this.f13870b = th;
        this.f13871c = thread;
        this.f13872d = bVar;
    }

    @Override // java.util.concurrent.Callable
    public final Object call() throws Throwable {
        long j8 = this.f13869a;
        long j9 = j8 / 1000;
        m mVar = this.f13873e;
        String strE = mVar.e();
        if (strE == null) {
            Log.e("FirebaseCrashlytics", "Tried to write a fatal exception while no session was open.", null);
            return W2.g.p(null);
        }
        mVar.f13880c.f();
        C1463c c1463c = mVar.f13889m;
        c1463c.getClass();
        String strConcat = "Persisting fatal event for session ".concat(strE);
        if (Log.isLoggable("FirebaseCrashlytics", 2)) {
            Log.v("FirebaseCrashlytics", strConcat, null);
        }
        c1463c.h(this.f13870b, this.f13871c, "crash", new C1167c(strE, j9, B6.u.f1033q), true);
        try {
            C1463c c1463c2 = mVar.f13884g;
            String str = ".ae" + j8;
            c1463c2.getClass();
            if (!new File((File) c1463c2.f16264c, str).createNewFile()) {
                throw new IOException("Create new file failed.");
            }
        } catch (IOException e8) {
            Log.w("FirebaseCrashlytics", "Could not create app exception marker file.", e8);
        }
        s4.b bVar = this.f13872d;
        mVar.b(false, bVar, false);
        mVar.c(new e().f13856a, Boolean.FALSE);
        return !mVar.f13879b.a() ? W2.g.p(null) : ((g3.h) ((AtomicReference) bVar.i).get()).f12923a.j(mVar.f13882e.f14383a, new V0(this, strE));
    }
}
