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


package com.xlx.speech.voicereadsdk.component.media.video;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import com.google.android.exoplayer2.database.DatabaseProvider;
import com.google.android.exoplayer2.database.ExoDatabaseProvider;
import com.google.android.exoplayer2.offline.Download;
import com.google.android.exoplayer2.offline.DownloadManager;
import com.google.android.exoplayer2.offline.DownloadService;
import com.google.android.exoplayer2.scheduler.PlatformScheduler;
import com.google.android.exoplayer2.scheduler.Scheduler;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
import com.google.android.exoplayer2.upstream.cache.Cache;
import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor;
import com.google.android.exoplayer2.upstream.cache.SimpleCache;
import com.google.android.exoplayer2.util.Util;
import com.sigmob.sdk.base.services.j;
import com.xlx.speech.voicereadsdk.R;
import java.io.File;
import java.util.List;
import java.util.concurrent.Executors;

public class ExoDownloadService extends DownloadService {
    public static final a a = new a();

    public static class a {
        public volatile Cache a;
        public volatile DatabaseProvider b;
        public volatile DataSource.Factory c;
        public volatile DownloadManager d;

        public DataSource.Factory a() {
            if (this.c == null) {
                synchronized (ExoDownloadService.class) {
                    if (this.c == null) {
                        this.c = new DefaultHttpDataSource.Factory();
                    }
                }
            }
            return this.c;
        }

        public Cache a(Context context) {
            if (this.a == null) {
                synchronized (ExoDownloadService.class) {
                    if (this.a == null) {
                        this.a = new SimpleCache(new File(context.getCacheDir().getAbsolutePath(), "downloads"), new LeastRecentlyUsedCacheEvictor(104857600), b(context));
                    }
                }
            }
            return this.a;
        }

        public DatabaseProvider b(Context context) {
            if (this.b == null) {
                synchronized (ExoDownloadService.class) {
                    if (this.b == null) {
                        this.b = new ExoDatabaseProvider(context);
                    }
                }
            }
            return this.b;
        }

        public DownloadManager c(Context context) {
            if (this.d == null) {
                synchronized (ExoDownloadService.class) {
                    if (this.d == null) {
                        this.d = new DownloadManager(context, b(context), a(context), a(), Executors.newFixedThreadPool(6));
                    }
                }
            }
            return this.d;
        }
    }

    public ExoDownloadService() {
        super(0);
    }

    /* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: com.xlx.speech.voicereadsdk.component.media.video.ExoDownloadService */
    /* JADX WARN: Multi-variable type inference failed */
    public DownloadManager getDownloadManager() {
        return a.c(this);
    }

    /* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: com.xlx.speech.voicereadsdk.component.media.video.ExoDownloadService */
    /* JADX WARN: Multi-variable type inference failed */
    public Notification getForegroundNotification(List<Download> list) {
        int i = Build.VERSION.SDK_INT;
        if (i >= 26) {
            ((NotificationManager) getSystemService("notification")).createNotificationChannel(new NotificationChannel("exo_download_channel", "Download", 4));
        }
        NotificationCompat.Builder builder = new NotificationCompat.Builder((Context) this, "exo_download_channel");
        if (i >= 18) {
            builder.setSmallIcon(R.drawable.xlx_voice_notification_icon).setContentTitle(j.d).setContentText(j.d);
        }
        return builder.build();
    }

    /* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: com.xlx.speech.voicereadsdk.component.media.video.ExoDownloadService */
    /* JADX WARN: Multi-variable type inference failed */
    public Scheduler getScheduler() {
        if (Util.SDK_INT >= 21) {
            return new PlatformScheduler(this, 4877);
        }
        return null;
    }
}