翰林优商.apk(点击下载) / DownloadService.java


package com.ss.android.socialbase.downloader.downloader;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import com.ss.android.socialbase.downloader.c.a;
import java.lang.ref.WeakReference;
import java.util.concurrent.ExecutorService;

public class DownloadService extends Service {
    private static final String b = "DownloadService";
    protected o a;

    public void onCreate() {
        super.onCreate();
        c.a(this);
        o y = c.y();
        this.a = y;
        y.a(new WeakReference(this));
    }

    public IBinder onBind(Intent intent) {
        String str = b;
        StringBuilder sb = new StringBuilder();
        sb.append("onBind downloadServiceHandler != null:");
        sb.append(this.a != null);
        a.b(str, sb.toString());
        o oVar = this.a;
        if (oVar != null) {
            return oVar.a(intent);
        }
        return null;
    }

    public int onStartCommand(final Intent intent, final int i, final int i2) {
        if (a.a()) {
            a.b(b, "DownloadService onStartCommand");
        }
        this.a.c();
        ExecutorService l = c.l();
        if (l != null) {
            l.execute(new Runnable() {
                /* class com.ss.android.socialbase.downloader.downloader.DownloadService.AnonymousClass1 */

                public void run() {
                    if (DownloadService.this.a != null) {
                        DownloadService.this.a.a(intent, i, i2);
                    }
                }
            });
        }
        return c.j() ? 2 : 3;
    }

    public void onDestroy() {
        if (a.a()) {
            a.b(b, "Service onDestroy");
        }
        o oVar = this.a;
        if (oVar != null) {
            oVar.d();
            this.a = null;
        }
        super.onDestroy();
    }
}