千 千 结 漫 画 v5.08.01版本的 MD5 值为:5a7c0402f1ddab1f936443d048993d8e
以下内容为反编译后的 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.Iterator;
import java.util.List;
public abstract class a<CALLBACK extends Binder, INTERFACE extends IInterface> implements ServiceConnection, u {
public volatile INTERFACE b;
public final Class<?> c;
public final HashMap<String, Object> d = new HashMap<>();
public final List<Context> e = new ArrayList();
public final ArrayList<Runnable> f = new ArrayList<>();
public final CALLBACK a = b();
public a(Class<?> cls) {
this.c = cls;
}
private void a(boolean z) {
if (!z && this.b != null) {
try {
a((a<CALLBACK, INTERFACE>) this.b, (INTERFACE) this.a);
} catch (RemoteException e) {
e.printStackTrace();
}
}
if (com.kwai.filedownloader.e.d.a) {
com.kwai.filedownloader.e.d.c(this, "release connect resources %s", this.b);
}
this.b = null;
com.kwai.filedownloader.f.a().b(new DownloadServiceConnectChangedEvent(z ? DownloadServiceConnectChangedEvent.ConnectStatus.lost : DownloadServiceConnectChangedEvent.ConnectStatus.disconnected, this.c));
}
@Override
public void a(Context context) {
a(context, (Runnable) null);
}
public void a(Context context, Runnable runnable) {
if (com.kwai.filedownloader.e.f.a(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.a) {
com.kwai.filedownloader.e.d.c(this, "bindStartByContext %s", context.getClass().getSimpleName());
}
Intent intent = new Intent(context, this.c);
if (runnable != null && !this.f.contains(runnable)) {
this.f.add(runnable);
}
if (!this.e.contains(context)) {
this.e.add(context);
}
context.bindService(intent, this, 1);
context.startService(intent);
}
public abstract void a(INTERFACE r1, CALLBACK callback);
public abstract CALLBACK b();
public abstract INTERFACE b(IBinder iBinder);
public abstract void b(INTERFACE r1, CALLBACK callback);
@Override
public boolean c() {
return d() != null;
}
public INTERFACE d() {
return this.b;
}
@Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
this.b = b(iBinder);
if (com.kwai.filedownloader.e.d.a) {
com.kwai.filedownloader.e.d.c(this, "onServiceConnected %s %s", componentName, this.b);
}
try {
b(this.b, this.a);
} catch (RemoteException e) {
e.printStackTrace();
}
List list = (List) this.f.clone();
this.f.clear();
Iterator it = list.iterator();
while (it.hasNext()) {
((Runnable) it.next()).run();
}
com.kwai.filedownloader.f.a().b(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.connected, this.c));
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
if (com.kwai.filedownloader.e.d.a) {
com.kwai.filedownloader.e.d.c(this, "onServiceDisconnected %s %s", componentName, this.b);
}
a(true);
}
}