package xyz.stream.download;

import java.io.File;
import xyz.stream.download.db.DbHolder;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class d implements Runnable {

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

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

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

    public /* synthetic */ d(DownloadManager downloadManager, Integer num, int i10) {
        this.f36070a = i10;
        this.f36071b = downloadManager;
        this.f36072c = num;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = this.f36070a;
        Integer num = this.f36072c;
        DownloadManager downloadManager = this.f36071b;
        switch (i10) {
            case 0:
                downloadManager.getClass();
                downloadManager.f36048e.submit(new d(downloadManager, num, 1));
                break;
            default:
                Object obj = t4.f.x(downloadManager.downloadTaskList).e(new c(2, num)).g().f32947a;
                if (obj == null) {
                    obj = null;
                }
                DownloadFile downloadFile = (DownloadFile) obj;
                if (downloadFile != null) {
                    DbHolder.getInstance(downloadManager.f36044a).deleteFileInfo(downloadFile.getDownloadId());
                    downloadManager.f36050g.runInTransaction(new e(downloadManager, downloadFile, 4));
                    downloadManager.downloadTaskList.remove(downloadFile);
                    File file = new File(downloadFile.getFilePath());
                    downloadManager.f36052i.put(num, Boolean.FALSE);
                    if (file.exists()) {
                        file.delete();
                        File parentFile = file.getParentFile();
                        if (parentFile != null && parentFile.exists()) {
                            File[] fileArrListFiles = parentFile.listFiles();
                            if (fileArrListFiles != null) {
                                for (File file2 : fileArrListFiles) {
                                    file2.delete();
                                }
                            }
                            parentFile.delete();
                            break;
                        }
                    }
                }
                break;
        }
    }
}
