整点视频 v3.3.0版本的 MD5 值为:cba0457dc37421eed445b30f92de25d3

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


package com.kwad.framework.filedownloader.services;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.RemoteException;
import com.kwad.framework.filedownloader.event.DownloadServiceConnectChangedEvent;
import com.kwad.framework.filedownloader.u;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public abstract class a<CALLBACK extends Binder, INTERFACE extends IInterface> implements ServiceConnection, u {
    private volatile INTERFACE ahL;
    private final Class<?> ahf;
    private final HashMap<String, Object> ahM = new HashMap<>();
    private final List<Context> ahN = new ArrayList();
    private final ArrayList<Runnable> aeS = new ArrayList<>();
    private final CALLBACK ahK = uR();

    public a(Class<?> cls) {
        this.ahf = cls;
    }

    private void a(Context context, Runnable runnable) {
        if (!com.kwad.framework.filedownloader.f.f.an(context)) {
            if (com.kwad.framework.filedownloader.f.d.aik) {
                com.kwad.framework.filedownloader.f.d.c(this, "bindStartByContext %s", context.getClass().getSimpleName());
            }
            Intent intent = new Intent(context, this.ahf);
            if (!this.ahN.contains(context)) {
                this.ahN.add(context);
            }
            context.bindService(intent, this, 1);
            context.startService(intent);
            return;
        }
        throw new IllegalStateException("Fatal-Exception: You can't bind the FileDownloadService in :filedownloader process.\n It's the invalid operation and is likely to cause unexpected problems.\n Maybe you want to use non-separate process mode for FileDownloader, More detail about non-separate mode, please move to wiki manually: https://github.com/lingochamp/FileDownloader/wiki/filedownloader.properties");
    }

    private void bg(boolean z) {
        if (com.kwad.framework.filedownloader.f.d.aik) {
            com.kwad.framework.filedownloader.f.d.c(this, "release connect resources %s", this.ahL);
        }
        this.ahL = null;
        com.kwad.framework.filedownloader.f.uz().c(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.lost, this.ahf));
    }

    protected abstract void a(INTERFACE r1, CALLBACK callback);

    @Override
    public final void ak(Context context) {
        a(context, (Runnable) null);
    }

    protected abstract INTERFACE b(IBinder iBinder);

    @Override
    public final boolean isConnected() {
        return wq() != null;
    }

    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        this.ahL = b(iBinder);
        if (com.kwad.framework.filedownloader.f.d.aik) {
            com.kwad.framework.filedownloader.f.d.c(this, "onServiceConnected %s %s", componentName, this.ahL);
        }
        try {
            a((a<CALLBACK, INTERFACE>) this.ahL, (INTERFACE) this.ahK);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        this.aeS.clear();
        for (Runnable runnable : (List) this.aeS.clone()) {
            runnable.run();
        }
        com.kwad.framework.filedownloader.f.uz().c(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.connected, this.ahf));
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        if (com.kwad.framework.filedownloader.f.d.aik) {
            com.kwad.framework.filedownloader.f.d.c(this, "onServiceDisconnected %s %s", componentName, this.ahL);
        }
        bg(true);
    }

    protected abstract CALLBACK uR();

    public final INTERFACE wq() {
        return this.ahL;
    }
}