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

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


package b.g.a.q0;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Binder;
import android.os.Build;
import android.os.IBinder;
import android.os.IInterface;
import android.os.RemoteException;
import b.g.a.y;
import com.liulishuo.filedownloader.event.DownloadServiceConnectChangedEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public abstract class a<CALLBACK extends Binder, INTERFACE extends IInterface> implements y, ServiceConnection {
    public volatile INTERFACE f2752b;
    public final Class<?> f2753c;
    public boolean f2754d = false;
    public final HashMap<String, Object> e = new HashMap<>();
    public final List<Context> f = new ArrayList();
    public final ArrayList<Runnable> g = new ArrayList<>();
    public final CALLBACK f2751a = o();

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

    private void u(boolean z) {
        if (!z && this.f2752b != null) {
            try {
                v(this.f2752b, this.f2751a);
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
        if (b.g.a.s0.e.f2790a) {
            b.g.a.s0.e.a(this, "release connect resources %s", this.f2752b);
        }
        this.f2752b = null;
        b.g.a.g.f().b(new DownloadServiceConnectChangedEvent(z ? DownloadServiceConnectChangedEvent.ConnectStatus.lost : DownloadServiceConnectChangedEvent.ConnectStatus.disconnected, this.f2753c));
    }

    @Override
    public void i(Context context) {
        if (this.f.contains(context)) {
            if (b.g.a.s0.e.f2790a) {
                b.g.a.s0.e.a(this, "unbindByContext %s", context);
            }
            this.f.remove(context);
            if (this.f.isEmpty()) {
                u(false);
            }
            Intent intent = new Intent(context, this.f2753c);
            context.unbindService(this);
            context.stopService(intent);
        }
    }

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

    @Override
    public void j(Context context) {
        n(context, null);
    }

    public abstract INTERFACE k(IBinder iBinder);

    @Override
    public boolean m() {
        return this.f2754d;
    }

    @Override
    public void n(Context context, Runnable runnable) {
        if (!b.g.a.s0.h.N(context)) {
            if (b.g.a.s0.e.f2790a) {
                b.g.a.s0.e.a(this, "bindStartByContext %s", context.getClass().getSimpleName());
            }
            Intent intent = new Intent(context, this.f2753c);
            if (runnable != null && !this.g.contains(runnable)) {
                this.g.add(runnable);
            }
            if (!this.f.contains(context)) {
                this.f.add(context);
            }
            boolean U = b.g.a.s0.h.U(context);
            this.f2754d = U;
            intent.putExtra(b.g.a.s0.b.f2787a, U);
            context.bindService(intent, this, 1);
            if (this.f2754d) {
                if (b.g.a.s0.e.f2790a) {
                    b.g.a.s0.e.a(this, "start foreground service", new Object[0]);
                }
                if (Build.VERSION.SDK_INT >= 26) {
                    context.startForegroundService(intent);
                    return;
                }
                return;
            }
            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");
    }

    public abstract CALLBACK o();

    @Override
    public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
        this.f2752b = k(iBinder);
        if (b.g.a.s0.e.f2790a) {
            b.g.a.s0.e.a(this, "onServiceConnected %s %s", componentName, this.f2752b);
        }
        try {
            t(this.f2752b, this.f2751a);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        this.g.clear();
        for (Runnable runnable : (List) this.g.clone()) {
            runnable.run();
        }
        b.g.a.g.f().b(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.connected, this.f2753c));
    }

    @Override
    public void onServiceDisconnected(ComponentName componentName) {
        if (b.g.a.s0.e.f2790a) {
            b.g.a.s0.e.a(this, "onServiceDisconnected %s %s", componentName, this.f2752b);
        }
        u(true);
    }

    public CALLBACK p() {
        return this.f2751a;
    }

    public INTERFACE q() {
        return this.f2752b;
    }

    public Object r(String str) {
        return this.e.remove(str);
    }

    public String s(Object obj) {
        if (obj == null) {
            return null;
        }
        String obj2 = obj.toString();
        this.e.put(obj2, obj);
        return obj2;
    }

    public abstract void t(INTERFACE r1, CALLBACK callback) throws RemoteException;

    public abstract void v(INTERFACE r1, CALLBACK callback) throws RemoteException;
}