package com.liulishuo.filedownloader; import android.content.Context; import com.liulishuo.filedownloader.BaseDownloadTask; import com.liulishuo.filedownloader.util.FileDownloadHelper; import com.liulishuo.filedownloader.util.FileDownloadLog; import java.util.Iterator; /* loaded from: classes.dex */ public class FileDownloader { private static final Object c = new Object(); private static final Object d = new Object(); private IQueuesHandler a; private ILostServiceConnectedHandler b; private static final class HolderClass { private static final FileDownloader a = new FileDownloader(); } public static void a(Context context) { FileDownloadHelper.a(context.getApplicationContext()); } public static FileDownloader e() { return HolderClass.a; } ILostServiceConnectedHandler b() { if (this.b == null) { synchronized (d) { if (this.b == null) { this.b = new LostServiceConnectedHandler(); a((FileDownloadConnectListener) this.b); } } } return this.b; } IQueuesHandler c() { if (this.a == null) { synchronized (c) { if (this.a == null) { this.a = new QueuesHandler(); } } } return this.a; } public boolean d() { return FileDownloadServiceProxy.c().b(); } public BaseDownloadTask a(String str) { return new DownloadTask(str); } public boolean a(FileDownloadListener fileDownloadListener, boolean z) { if (fileDownloadListener == null) { FileDownloadLog.e(this, "Tasks with the listener can't start, because the listener provided is null: [null, %B]", Boolean.valueOf(z)); return false; } if (z) { return c().b(fileDownloadListener); } return c().a(fileDownloadListener); } public void a(FileDownloadListener fileDownloadListener) { FileDownloadTaskLauncher.a().a(fileDownloadListener); Iterator it = FileDownloadList.b().a(fileDownloadListener).iterator(); while (it.hasNext()) { it.next().F().pause(); } } public void a() { if (d()) { return; } FileDownloadServiceProxy.c().a(FileDownloadHelper.a()); } public void a(FileDownloadConnectListener fileDownloadConnectListener) { FileDownloadEventPool.a().a("event.service.connect.changed", fileDownloadConnectListener); } }