MD5 校验值:4dbca1eecd2fe1b6e4b14bca2547898a
a.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package b.h.a.m0; 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.h.a.v; import com.liulishuo.filedownloader.event.DownloadServiceConnectChangedEvent; 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 v, ServiceConnection { public final CALLBACK n; public volatile INTERFACE t; public final Class<?> u; public boolean v = false; public final List<Context> w; public final ArrayList<Runnable> x; public a(Class<?> cls) { new HashMap(); this.w = new ArrayList(); this.x = new ArrayList<>(); this.u = cls; this.n = i(); } public abstract INTERFACE d(IBinder iBinder); @Override public void f(Context context) { h(context, null); } @Override public boolean g() { return this.v; } public void h(Context context, Runnable runnable) { if (!b.h.a.o0.f.J(context)) { if (b.h.a.o0.d.f2237a) { b.h.a.o0.d.a(this, "bindStartByContext %s", context.getClass().getSimpleName()); } Intent intent = new Intent(context, this.u); if (runnable != null && !this.x.contains(runnable)) { this.x.add(runnable); } if (!this.w.contains(context)) { this.w.add(context); } boolean P = b.h.a.o0.f.P(context); this.v = P; intent.putExtra("is_foreground", P); context.bindService(intent, this, 1); if (this.v) { if (b.h.a.o0.d.f2237a) { b.h.a.o0.d.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 i(); @Override public boolean isConnected() { return j() != null; } public INTERFACE j() { return this.t; } public abstract void k(INTERFACE r1, CALLBACK callback) throws RemoteException; public final void l(boolean z) { if (!z && this.t != null) { try { m(this.t, this.n); } catch (RemoteException e) { e.printStackTrace(); } } if (b.h.a.o0.d.f2237a) { b.h.a.o0.d.a(this, "release connect resources %s", this.t); } this.t = null; b.h.a.f.e().b(new DownloadServiceConnectChangedEvent(z ? DownloadServiceConnectChangedEvent.ConnectStatus.lost : DownloadServiceConnectChangedEvent.ConnectStatus.disconnected, this.u)); } public abstract void m(INTERFACE r1, CALLBACK callback) throws RemoteException; @Override public void onServiceConnected(ComponentName componentName, IBinder iBinder) { this.t = d(iBinder); if (b.h.a.o0.d.f2237a) { b.h.a.o0.d.a(this, "onServiceConnected %s %s", componentName, this.t); } try { k(this.t, this.n); } catch (RemoteException e) { e.printStackTrace(); } List list = (List) this.x.clone(); this.x.clear(); Iterator it = list.iterator(); while (it.hasNext()) { ((Runnable) it.next()).run(); } b.h.a.f.e().b(new DownloadServiceConnectChangedEvent(DownloadServiceConnectChangedEvent.ConnectStatus.connected, this.u)); } @Override public void onServiceDisconnected(ComponentName componentName) { if (b.h.a.o0.d.f2237a) { b.h.a.o0.d.a(this, "onServiceDisconnected %s %s", componentName, this.t); } l(true); } }