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

import java.io.File;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p177.p242.p270.AbstractC5062;
import p138.p176.p291.p296.p297.C5608;
import p138.p176.p291.p296.p297.p299.C5642;
import p138.p176.p291.p296.p297.p306.C5836;
import p138.p176.p291.p296.p297.p306.p307.C5843;
import p138.p176.p291.p296.p297.p306.p307.C5846;
import p138.p176.p291.p296.p297.p306.p307.InterfaceC5844;

/* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.އ.ޘ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class CallableC5666 implements Callable<AbstractC5062<Void>> {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final /* synthetic */ Boolean f16218;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final /* synthetic */ C5642.C5648 f16219;

    public CallableC5666(C5642.C5648 c5648, Boolean bool) {
        this.f16219 = c5648;
        this.f16218 = bool;
    }

    @Override // java.util.concurrent.Callable
    public AbstractC5062<Void> call() {
        C5836 c5836 = C5642.this.f16168;
        if (c5836 == null) {
            throw null;
        }
        C5608.f16066.m8972("Checking for crash reports...");
        File[] fileArrM9039 = C5642.this.m9039();
        File[] fileArrListFiles = C5642.this.m9036().listFiles();
        if (fileArrListFiles == null) {
            fileArrListFiles = new File[0];
        }
        LinkedList linkedList = new LinkedList();
        if (fileArrM9039 != null) {
            for (File file : fileArrM9039) {
                C5608 c5608 = C5608.f16066;
                StringBuilder sbM4889 = C2803.m4889("Found crash report ");
                sbM4889.append(file.getPath());
                c5608.m8972(sbM4889.toString());
                linkedList.add(new C5846(file, Collections.emptyMap()));
            }
        }
        for (File file2 : fileArrListFiles) {
            linkedList.add(new C5843(file2));
        }
        if (linkedList.isEmpty()) {
            C5608.f16066.m8972("No reports found.");
        }
        if (!this.f16218.booleanValue()) {
            C5608.f16066.m8972("Reports are being deleted.");
            if (C5642.this.f16168 == null) {
                throw null;
            }
            Iterator it = linkedList.iterator();
            while (it.hasNext()) {
                ((InterfaceC5844) it.next()).remove();
            }
            C5642.this.f16175.f16288.m9142();
            C5642.this.f16179.m8557((Void) null);
            return C4303.m7054((Object) null);
        }
        C5608.f16066.m8972("Reports are being sent.");
        boolean zBooleanValue = this.f16218.booleanValue();
        C5679 c5679 = C5642.this.f16157;
        if (c5679 == null) {
            throw null;
        }
        if (!zBooleanValue) {
            throw new IllegalStateException("An invalid data collection token was used.");
        }
        c5679.f16258.m8557((Void) null);
        C5642.C5648 c5648 = this.f16219;
        ExecutorService executorService = C5642.this.f16160.f16124;
        return c5648.f16186.mo8550(executorService, new C5665(this, linkedList, zBooleanValue, executorService));
    }
}
