package p138.p176.p291.p296.p297.p306;

import android.util.Log;
import java.util.ArrayList;
import java.util.List;
import p138.p139.p143.p144.C2803;
import p138.p176.p291.p296.p297.C5608;
import p138.p176.p291.p296.p297.p299.AbstractRunnableC5624;
import p138.p176.p291.p296.p297.p299.C5642;
import p138.p176.p291.p296.p297.p299.EnumC5680;
import p138.p176.p291.p296.p297.p306.p307.C5842;
import p138.p176.p291.p296.p297.p306.p307.InterfaceC5844;
import p138.p176.p291.p296.p297.p306.p308.InterfaceC5848;

/* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C5837 {

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static final short[] f16543 = {10, 20, 30, 60, 120, 300};

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final InterfaceC5848 f16544;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final String f16545;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final String f16546;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final EnumC5680 f16547;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final C5836 f16548;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final InterfaceC5838 f16549;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public Thread f16550;

    /* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ؠ$֏, reason: contains not printable characters */
    public interface InterfaceC5838 {
    }

    /* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ؠ$ؠ, reason: contains not printable characters */
    public interface InterfaceC5839 {
    }

    /* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ؠ$ހ, reason: contains not printable characters */
    public interface InterfaceC5840 {
    }

    /* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ލ.ؠ$ށ, reason: contains not printable characters */
    public class C5841 extends AbstractRunnableC5624 {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final List<InterfaceC5844> f16551;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final boolean f16552;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public final float f16553;

        public C5841(List<InterfaceC5844> list, boolean z, float f) {
            this.f16551 = list;
            this.f16552 = z;
            this.f16553 = f;
        }

        @Override // p138.p176.p291.p296.p297.p299.AbstractRunnableC5624
        /* JADX INFO: renamed from: ֏ */
        public void mo8985() {
            try {
                m9188(this.f16551, this.f16552);
            } catch (Exception e) {
                C5608 c5608 = C5608.f16066;
                if (c5608.m8974(6)) {
                    Log.e(c5608.f16067, "An unexpected error occurred while attempting to upload crash reports.", e);
                }
            }
            C5837.this.f16550 = null;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final void m9188(List<InterfaceC5844> list, boolean z) {
            C5608 c5608 = C5608.f16066;
            StringBuilder sbM4889 = C2803.m4889("Starting report processing in ");
            sbM4889.append(this.f16553);
            sbM4889.append(" second(s)...");
            c5608.m8972(sbM4889.toString());
            float f = this.f16553;
            if (f > 0.0f) {
                try {
                    Thread.sleep((long) (f * 1000.0f));
                } catch (InterruptedException unused) {
                    Thread.currentThread().interrupt();
                    return;
                }
            }
            if (C5642.this.m9038()) {
                return;
            }
            int i = 0;
            while (list.size() > 0 && !C5642.this.m9038()) {
                C5608 c56082 = C5608.f16066;
                StringBuilder sbM48892 = C2803.m4889("Attempting to send ");
                sbM48892.append(list.size());
                sbM48892.append(" report(s)");
                c56082.m8972(sbM48892.toString());
                ArrayList arrayList = new ArrayList();
                for (InterfaceC5844 interfaceC5844 : list) {
                    if (!C5837.this.m9187(interfaceC5844, z)) {
                        arrayList.add(interfaceC5844);
                    }
                }
                if (arrayList.size() > 0) {
                    int i2 = i + 1;
                    long j = C5837.f16543[Math.min(i, r8.length - 1)];
                    C5608.f16066.m8972("Report submission: scheduling delayed retry in " + j + " seconds");
                    try {
                        Thread.sleep(j * 1000);
                        i = i2;
                    } catch (InterruptedException unused2) {
                        Thread.currentThread().interrupt();
                        return;
                    }
                }
                list = arrayList;
            }
        }
    }

    public C5837(String str, String str2, EnumC5680 enumC5680, C5836 c5836, InterfaceC5848 interfaceC5848, InterfaceC5838 interfaceC5838) {
        if (interfaceC5848 == null) {
            throw new IllegalArgumentException("createReportCall must not be null.");
        }
        this.f16544 = interfaceC5848;
        this.f16545 = str;
        this.f16546 = str2;
        this.f16547 = enumC5680;
        this.f16548 = c5836;
        this.f16549 = interfaceC5838;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public synchronized void m9186(List<InterfaceC5844> list, boolean z, float f) {
        if (this.f16550 != null) {
            C5608.f16066.m8972("Report upload has already been started.");
            return;
        }
        Thread thread = new Thread(new C5841(list, z, f), "Crashlytics Report Uploader");
        this.f16550 = thread;
        thread.start();
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0065 A[Catch: Exception -> 0x006e, TryCatch #0 {Exception -> 0x006e, blocks: (B:3:0x0001, B:5:0x0011, B:20:0x0065, B:22:0x0069, B:23:0x006d, B:6:0x0019, B:8:0x001f, B:10:0x0027, B:12:0x0030, B:16:0x0049, B:18:0x005e), top: B:28:0x0001 }] */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean m9187(InterfaceC5844 interfaceC5844, boolean z) {
        C5842 c5842;
        boolean zMo9195;
        try {
            c5842 = new C5842(this.f16545, this.f16546, interfaceC5844);
        } catch (Exception e) {
            C5608.f16066.m8976("Error occurred sending report " + interfaceC5844, e);
        }
        if (this.f16547 == EnumC5680.ALL) {
            C5608.f16066.m8972("Send to Reports Endpoint disabled. Removing Reports Endpoint report.");
        } else {
            if (this.f16547 != EnumC5680.JAVA_ONLY || interfaceC5844.mo9193() != InterfaceC5844.EnumC5845.JAVA) {
                zMo9195 = this.f16544.mo9195(c5842, z);
                C5608 c5608 = C5608.f16066;
                StringBuilder sb = new StringBuilder();
                sb.append("Crashlytics Reports Endpoint upload ");
                sb.append(zMo9195 ? "complete: " : "FAILED: ");
                sb.append(interfaceC5844.mo9192());
                String string = sb.toString();
                if (c5608.m8974(4)) {
                    Log.i(c5608.f16067, string, null);
                }
                if (zMo9195) {
                    if (this.f16548 == null) {
                        throw null;
                    }
                    interfaceC5844.remove();
                    return true;
                }
                return false;
            }
            C5608.f16066.m8972("Send to Reports Endpoint for non-native reports disabled. Removing Reports Uploader report.");
        }
        zMo9195 = true;
        if (zMo9195) {
        }
        return false;
    }
}
