il.java 源代码
package com.ss.android.downloadlib.addownload;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import com.ss.android.download.api.config.b;
import com.ss.android.download.api.config.h;
import com.ss.android.download.api.config.ro;
import com.ss.android.download.api.config.ur;
import com.ss.android.download.api.config.uw;
import com.ss.android.download.api.config.zw;
import com.ss.android.download.api.model.g;
import com.ss.android.socialbase.downloader.exception.BaseException;
import com.ss.android.socialbase.downloader.model.DownloadInfo;
import java.io.File;
import org.json.JSONObject;
public class il {
private static h b;
private static com.ss.android.download.api.config.gj e;
private static com.ss.android.download.api.config.t fy;
public static final JSONObject g = new JSONObject();
private static com.ss.android.download.api.model.g gj;
private static com.ss.android.download.api.config.il h;
private static com.ss.android.download.api.config.e i;
private static com.ss.android.socialbase.appdownloader.i.t il;
private static com.ss.android.download.api.config.r kc;
private static com.ss.android.download.api.config.kc lf;
private static ur nk;
private static com.ss.android.download.api.config.ql nr;
private static com.ss.android.download.api.zc.g o;
private static com.ss.android.download.api.config.i ql;
private static com.ss.android.download.api.config.nr r;
private static b ro;
private static com.ss.android.download.api.config.zy t;
private static uw ur;
private static zw uw;
private static Context zc;
private static ro zw;
private static com.ss.android.download.api.config.zc zy;
public static String b() {
return "1.7.0";
}
public static void g(Context context) {
if (context == null || context.getApplicationContext() == null) {
throw new IllegalArgumentException("Context is null");
}
zc = context.getApplicationContext();
}
public static void zc(Context context) {
if (zc != null || context == null || context.getApplicationContext() == null) {
return;
}
zc = context.getApplicationContext();
}
public static Context getContext() {
Context context = zc;
if (context != null) {
return context;
}
throw new IllegalArgumentException("Context is null");
}
public static void g(com.ss.android.download.api.config.e eVar) {
i = eVar;
}
public static void g(com.ss.android.download.api.config.nr nrVar) {
r = nrVar;
}
public static void g(com.ss.android.download.api.config.t tVar) {
fy = tVar;
}
public static void g(com.ss.android.download.api.config.gj gjVar) {
e = gjVar;
}
public static void g(com.ss.android.download.api.config.zy zyVar) {
t = zyVar;
}
public static void g(com.ss.android.download.api.model.g gVar) {
gj = gVar;
}
public static void g(com.ss.android.download.api.config.zc zcVar) {
zy = zcVar;
}
public static com.ss.android.download.api.config.e g() {
return i;
}
public static com.ss.android.download.api.config.i zc() {
if (ql == null) {
ql = new com.ss.android.download.api.config.i() {
};
}
return ql;
}
public static com.ss.android.download.api.config.nr i() {
if (r == null) {
r = new com.ss.android.download.api.g.g();
}
return r;
}
public static com.ss.android.download.api.config.t ql() {
return fy;
}
public static com.ss.android.download.api.config.gj r() {
if (e == null) {
e = new com.ss.android.download.api.g.zc();
}
return e;
}
public static com.ss.android.socialbase.appdownloader.i.t fy() {
if (il == null) {
il = new com.ss.android.socialbase.appdownloader.i.t() {
@Override
public void g(DownloadInfo downloadInfo, BaseException baseException, int i2) {
}
};
}
return il;
}
public static h e() {
return b;
}
public static uw t() {
if (ur == null) {
ur = new uw() {
};
}
return ur;
}
public static JSONObject gj() {
com.ss.android.download.api.config.zy zyVar = t;
if (zyVar == null || zyVar.g() == null) {
return g;
}
return t.g();
}
public static com.ss.android.download.api.model.g zy() {
if (gj == null) {
gj = new g.C0272g().g();
}
return gj;
}
public static com.ss.android.download.api.config.kc il() {
return lf;
}
public static com.ss.android.download.api.config.zc nr() {
return zy;
}
public static b kc() {
return ro;
}
public static void g(String str) {
com.ss.android.socialbase.appdownloader.ql.zy().g(str);
}
public static com.ss.android.download.api.config.ql h() {
return nr;
}
public static com.ss.android.download.api.config.r uw() {
return kc;
}
public static com.ss.android.download.api.config.il ro() {
return h;
}
public static void g(ro roVar) {
zw = roVar;
}
public static ro lf() {
return zw;
}
public static zw ur() {
return uw;
}
public static void g(com.ss.android.download.api.zc.g gVar) {
o = gVar;
}
public static com.ss.android.download.api.zc.g o() {
if (o == null) {
o = new com.ss.android.download.api.zc.g() {
@Override
public void g(Throwable th, String str) {
}
};
}
return o;
}
public static ur zw() {
if (nk == null) {
nk = new ur() {
};
}
return nk;
}
public static String nk() {
try {
int i2 = getContext().getApplicationInfo().targetSdkVersion;
if (Build.VERSION.SDK_INT >= 29 && ((i2 == 29 && !Environment.isExternalStorageLegacy()) || i2 > 29)) {
return getContext().getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
}
return Environment.getExternalStorageDirectory().getPath() + File.separator + gj().optString("default_save_dir_name", "ByteDownload");
} catch (Throwable unused) {
return null;
}
}
public static boolean y() {
return (i == null || fy == null || t == null || zy == null || zw == null) ? false : true;
}
}