笔 趣 阁 破 解 版2023 v4.18.00版本的 MD5 值为:35c48a89f5572ff5a659afd7c5a81cad

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


package com.kwai.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.kwai.filedownloader.event.DownloadServiceConnectChangedEvent;
import com.kwai.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 {
    public final Class<?> aCE;
    public volatile INTERFACE aDj;
    public final HashMap<String, Object> aDk = new HashMap<>();
    public final List<Context> aDl = new ArrayList();
    public final ArrayList<Runnable> aAs = new ArrayList<>();
    public final CALLBACK aDi = FJ();

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

    private void a(Context context, Runnable runnable) {
        if (com.kwai.filedownloader.e.f.dB(context)) {
            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");
        }
        if (com.kwai.filedownloader.e.d.aDJ) {
            com.kwai.filedownloader.e.d.e(this, "bindStartByContext %s", context.getClass().getSimpleName());
        }
        Intent intent = new Intent(context, this.aCE);
        if (!this.aDl.contains(context)) {
            this.aDl.add(context);
        }
        context.bindService(intent, this, 1);
        context.startService(intent);
    }

    private void bK(boolean z) {
        if (com.kwai.filedownloader.e.d.aDJ) {
            com.kwai.filedownloader.e.d.e(this, "release connect resources %s", this.aDj);
        }
        this.aDj = null;
        com.kwai.filedownloader.f.Fr().c(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.lost, this.aCE));
    }

    public abstract CALLBACK FJ();

    public final INTERFACE Hc() {
        return this.aDj;
    }

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

    public abstract INTERFACE b(IBinder iBinder);

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

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

    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        this.aDj = b(iBinder);
        if (com.kwai.filedownloader.e.d.aDJ) {
            com.kwai.filedownloader.e.d.e(this, "onServiceConnected %s %s", componentName, this.aDj);
        }
        try {
            a((a<CALLBACK, INTERFACE>) this.aDj, (INTERFACE) this.aDi);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        this.aAs.clear();
        for (Runnable runnable : (List) this.aAs.clone()) {
            runnable.run();
        }
        com.kwai.filedownloader.f.Fr().c(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.connected, this.aCE));
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        if (com.kwai.filedownloader.e.d.aDJ) {
            com.kwai.filedownloader.e.d.e(this, "onServiceDisconnected %s %s", componentName, this.aDj);
        }
        bK(true);
    }
}