package defpackage;

import android.content.Context;
import android.util.Log;
import j$.util.DesugarCollections;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import java.util.Stack;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicReference;

/* renamed from: ᵙᵦ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class CallableC2608 implements Callable {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final /* synthetic */ C5432 f10090;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final /* synthetic */ Thread f10091;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final /* synthetic */ long f10092;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final /* synthetic */ Throwable f10093;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final /* synthetic */ C0975 f10094;

    public CallableC2608(C5432 c5432, long j, Throwable th, Thread thread, C0975 c0975) {
        this.f10090 = c5432;
        this.f10092 = j;
        this.f10093 = th;
        this.f10091 = thread;
        this.f10094 = c0975;
    }

    @Override // java.util.concurrent.Callable
    public final Object call() throws Throwable {
        ʿˁ r7;
        String str;
        Iterator<Map.Entry<Thread, StackTraceElement[]>> it;
        long j = this.f10092;
        long j2 = j / 1000;
        C5432 c5432 = this.f10090;
        NavigableSet navigableSetM1727 = ((C0322) c5432.f20395.f12991).m1727();
        String str2 = !navigableSetM1727.isEmpty() ? (String) navigableSetM1727.first() : null;
        if (str2 == null) {
            return ʼٴ.ˑᵥˁ((Object) null);
        }
        C2720 c2720 = c5432.f20390;
        c2720.getClass();
        try {
            ʿˁ r9 = (ʿˁ) c2720.f10550;
            String str3 = (String) c2720.f10548;
            r9.getClass();
            new File((File) r9.ᵴᵳ, str3).createNewFile();
        } catch (IOException unused) {
        }
        C3460 c3460 = c5432.f20395;
        c3460.getClass();
        Log.isLoggable("FirebaseCrashlytics", 2);
        C4918 c4918 = (C4918) c3460.f12987;
        Context context = c4918.f18306;
        int i = context.getResources().getConfiguration().orientation;
        ᵶˉᵹʣ r12 = c4918.f18308;
        Stack stack = new Stack();
        for (Throwable cause = this.f10093; cause != null; cause = cause.getCause()) {
            stack.push(cause);
        }
        C0030 c0030 = null;
        while (!stack.isEmpty()) {
            Throwable th = (Throwable) stack.pop();
            c0030 = new C0030(th.getLocalizedMessage(), th.getClass().getName(), r12.ᵹᵝᵶ(th.getStackTrace()), c0030, 1);
        }
        C0030 c00302 = c0030;
        C3061 c3061 = new C3061();
        c3061.f11717 = "crash";
        c3061.f11716 = j2;
        c3061.f11713 = (byte) (c3061.f11713 | 1);
        AbstractC5376 abstractC5376M1770 = C0347.f2065.m1770(context);
        int i2 = ((C1080) abstractC5376M1770).f4675;
        Boolean boolValueOf = i2 > 0 ? Boolean.valueOf(i2 != 100) : null;
        ArrayList arrayListM1769 = C0347.m1769(context);
        ArrayList arrayList = new ArrayList();
        StackTraceElement[] stackTraceElementArr = (StackTraceElement[]) c00302.f1154;
        Thread thread = this.f10091;
        String name = thread.getName();
        if (name == null) {
            C1260.m3813("Null name");
            return null;
        }
        List listM10357 = C4918.m10357(stackTraceElementArr, 4);
        if (listM10357 == null) {
            C1260.m3813("Null frames");
            return null;
        }
        arrayList.add(new C4096(name, 4, listM10357));
        Iterator<Map.Entry<Thread, StackTraceElement[]>> it2 = Thread.getAllStackTraces().entrySet().iterator();
        while (it2.hasNext()) {
            Map.Entry<Thread, StackTraceElement[]> next = it2.next();
            Thread key = next.getKey();
            if (key.equals(thread)) {
                it = it2;
            } else {
                StackTraceElement[] stackTraceElementArr2 = r12.ᵹᵝᵶ(next.getValue());
                String name2 = key.getName();
                if (name2 == null) {
                    C1260.m3813("Null name");
                    return null;
                }
                List listM103572 = C4918.m10357(stackTraceElementArr2, 0);
                if (listM103572 == null) {
                    C1260.m3813("Null frames");
                    return null;
                }
                it = it2;
                arrayList.add(new C4096(name2, 0, listM103572));
            }
            it2 = it;
        }
        List listUnmodifiableList = DesugarCollections.unmodifiableList(arrayList);
        C2285 c2285M10356 = C4918.m10356(c00302, 0);
        C4738 c4738M10355 = C4918.m10355();
        List listM10358 = c4918.m10358();
        if (listM10358 == null) {
            C1260.m3813("Null binaries");
            return null;
        }
        c3061.f11715 = new C2498(new C1932(listUnmodifiableList, c2285M10356, null, c4738M10355, listM10358), null, null, boolValueOf, abstractC5376M1770, arrayListM1769, i);
        c3061.f11718 = c4918.m10359(i);
        C1169 c1169M7387 = c3061.m7387();
        C2720 c27202 = (C2720) c3460.f12988;
        C2549 c2549 = (C2549) c3460.f12986;
        ((C0322) c3460.f12991).m1729(C3460.m7871(C3460.m7869(c1169M7387, c27202, c2549, C1859.f7545), c2549), str2, true);
        try {
            r7 = c5432.f20388;
            str = ".ae" + j;
            r7.getClass();
        } catch (IOException unused2) {
        }
        if (!new File((File) r7.ᵴᵳ, str).createNewFile()) {
            throw new IOException("Create new file failed.");
        }
        C0975 c0975 = this.f10094;
        c5432.m11078(false, c0975, false);
        c5432.m11077(new C3829().f14229, Boolean.FALSE);
        return !c5432.f20397.ᵸʓᵠ() ? ʼٴ.ˑᵥˁ((Object) null) : ((C1353) ((AtomicReference) c0975.f4342).get()).f5582.m8715((ExecutorC2146) c5432.f20385.ᵢˇᵭ, new ˊᵘʛ(this, str2));
    }
}
