QQ浏览器 v12.2.3.7053版本的 MD5 值为:8285ab3059e5c8b521a264dfbc5c3685

以下内容为反编译后的 AudioDetectResourceService.java 源代码,内容仅作参考


package com.tencent.mtt.external.audio.detect;

import com.tencent.common.utils.FileUtils;
import com.tencent.common.utils.Md5Utils;
import com.tencent.mtt.browser.download.core.facade.IBusinessDownloadService;
import com.tencent.mtt.browser.download.core.impl.DownloadServiceManager;
import com.tencent.mtt.browser.download.engine.BaseDownloadTaskListener;
import com.tencent.mtt.browser.download.engine.DownloadInfo;
import com.tencent.mtt.browser.download.engine.DownloadTask;
import com.tencent.mtt.browser.download.engine.RemovePolicy;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;

public class AudioDetectResourceService {
    private static AudioDetectResourceService e;

    private File f50367a;

    private ArrayList<Callback> f50368b;

    private final Object f50369c = new Object();

    private boolean f50370d;

    interface Callback {
        void a();

        void a(int i);

        void b();
    }

    private AudioDetectResourceService() {
        File file = new File(FileUtils.e(), "AudioFM");
        if (file.exists()) {
            this.f50367a = new File(file.getAbsolutePath(), "a00249657a49503e01a96584cf1ea016.js");
        }
    }

    public static synchronized AudioDetectResourceService a() {
        AudioDetectResourceService audioDetectResourceService;
        synchronized (AudioDetectResourceService.class) {
            if (e == null) {
                e = new AudioDetectResourceService();
            }
            audioDetectResourceService = e;
        }
        return audioDetectResourceService;
    }

    public File b() {
        File file;
        synchronized (this.f50369c) {
            file = this.f50367a;
        }
        return file;
    }

    public boolean c() {
        synchronized (this.f50369c) {
            return this.f50367a != null && this.f50367a.exists() && "2f3115dc6d4cd072d50913cbd2dd0ef5".equals(Md5Utils.a(this.f50367a));
        }
    }

    public boolean d() {
        synchronized (this.f50369c) {
            if (this.f50370d) {
                return false;
            }
            this.f50370d = true;
            final DownloadInfo downloadInfo = new DownloadInfo();
            downloadInfo.f37604a = "https://res.imtt.qq.com/res_mtt/music/musicSiteDetect_android.js";
            downloadInfo.f37606c = "a00249657a49503e01a96584cf1ea016.js";
            downloadInfo.f = FileUtils.r().getAbsolutePath();
            if (FileUtils.t() != null) {
                downloadInfo.f = FileUtils.t().getAbsolutePath();
            }
            downloadInfo.H |= 32;
            downloadInfo.j = false;
            IBusinessDownloadService a2 = DownloadServiceManager.a();
            a2.removeDownloadTask("https://res.imtt.qq.com/res_mtt/music/musicSiteDetect_android.js", RemovePolicy.DELETE_TASK_AND_FILE);
            a2.startDownloadTask(downloadInfo, null, null);
            a2.addTaskListener("https://res.imtt.qq.com/res_mtt/music/musicSiteDetect_android.js", new BaseDownloadTaskListener() {
                @Override
                public void a(DownloadTask downloadTask) {
                    synchronized (AudioDetectResourceService.this.f50369c) {
                        AudioDetectResourceService.this.f50370d = false;
                        if (AudioDetectResourceService.this.f50368b != null) {
                            Iterator it = AudioDetectResourceService.this.f50368b.iterator();
                            while (it.hasNext()) {
                                ((Callback) it.next()).b();
                            }
                        }
                    }
                }

                @Override
                public void onTaskCompleted(DownloadTask downloadTask) {
                    File file = new File(FileUtils.e(), "AudioFM");
                    if (!file.exists()) {
                        file.mkdir();
                    }
                    synchronized (AudioDetectResourceService.this.f50369c) {
                        AudioDetectResourceService.this.f50370d = false;
                        AudioDetectResourceService.this.f50367a = new File(file.getAbsolutePath(), "a00249657a49503e01a96584cf1ea016.js");
                        FileUtils.b(new File(downloadInfo.f, downloadInfo.f37606c).getAbsolutePath(), AudioDetectResourceService.this.f50367a.getAbsolutePath());
                        if (AudioDetectResourceService.this.f50368b != null) {
                            Iterator it = AudioDetectResourceService.this.f50368b.iterator();
                            while (it.hasNext()) {
                                ((Callback) it.next()).a();
                            }
                        }
                    }
                }

                @Override
                public void onTaskCreated(DownloadTask downloadTask) {
                }

                @Override
                public void onTaskProgress(DownloadTask downloadTask) {
                    int Z = (int) ((((float) downloadTask.Z()) / ((float) downloadTask.o())) * 100.0f);
                    synchronized (AudioDetectResourceService.this.f50369c) {
                        if (AudioDetectResourceService.this.f50368b != null) {
                            Iterator it = AudioDetectResourceService.this.f50368b.iterator();
                            while (it.hasNext()) {
                                ((Callback) it.next()).a(Z);
                            }
                        }
                    }
                }

                @Override
                public void onTaskStarted(DownloadTask downloadTask) {
                }
            });
            return true;
        }
    }
}