米多多 v3.0.1版本的 MD5 值为:f69e79dbe1787218a397ad907fb8f3ab
以下内容为反编译后的 i.java 源代码,内容仅作参考
package c.f.a.p;
import android.content.Context;
import android.content.res.AssetFileDescriptor;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import com.dtf.face.log.RecordLevel;
import com.dtf.face.network.APICallback;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
public class i {
public static Map<String, CopyOnWriteArrayList<APICallback<String>>> f4364a = null;
public static List<String> f4365b = null;
public static List<String> f4366c = null;
public static AtomicInteger f4367d = null;
public static String f4368e = "";
public static class a implements Runnable {
public final Context f4369a;
public final List f4370b;
public final boolean f4371c;
public final APICallback f4372d;
public a(Context context, List list, boolean z, APICallback aPICallback) {
this.f4369a = context;
this.f4370b = list;
this.f4371c = z;
this.f4372d = aPICallback;
}
@Override
public void run() {
i.k(this.f4369a, this.f4370b, this.f4371c, this.f4372d);
}
}
public static class b implements APICallback<File> {
public final long f4373a;
public b(long j2) {
this.f4373a = j2;
}
public void a(boolean z) {
c.f.a.h.b j2 = c.f.a.h.b.j();
RecordLevel recordLevel = RecordLevel.LOG_ERROR;
String[] strArr = new String[8];
strArr[0] = "status";
strArr[1] = "total";
strArr[2] = "result";
strArr[3] = z ? "1" : "0";
strArr[4] = "cost";
strArr[5] = String.valueOf(System.currentTimeMillis() - this.f4373a);
strArr[6] = "count";
strArr[7] = String.valueOf(i.f4367d.get());
j2.s(recordLevel, "modelDownload", strArr);
i.f4367d.set(0);
i.f4365b.clear();
}
@Override
public void onSuccess(File file) {
List<APICallback> list;
a(true);
synchronized (i.class) {
list = (List) i.f4364a.remove("fd4ddd72c85fd5fe2913be520df32ed0");
}
if (list != null) {
for (APICallback aPICallback : list) {
aPICallback.onSuccess("SUCCESS");
}
}
}
@Override
public void onError(String str, String str2, String str3) {
List<APICallback> list;
a(false);
synchronized (i.class) {
list = (List) i.f4364a.remove("fd4ddd72c85fd5fe2913be520df32ed0");
}
if (list != null) {
for (APICallback aPICallback : list) {
aPICallback.onError(str, str2, str3);
}
}
}
}
public static class c implements APICallback<Pair<File, String>> {
public final APICallback f4374a;
public final String f4375b;
public final String f4376c;
public final String f4377d;
public final long f4378e;
public c(APICallback aPICallback, String str, String str2, String str3, long j2) {
this.f4374a = aPICallback;
this.f4375b = str;
this.f4376c = str2;
this.f4377d = str3;
this.f4378e = j2;
}
public void a(boolean z, String str) {
c.f.a.h.b j2 = c.f.a.h.b.j();
RecordLevel recordLevel = RecordLevel.LOG_ERROR;
String[] strArr = new String[10];
strArr[0] = "status";
strArr[1] = "end";
strArr[2] = "url";
strArr[3] = i.f4368e;
strArr[4] = "result";
strArr[5] = z ? "1" : "0";
strArr[6] = "msg";
if (str == null) {
str = "";
}
strArr[7] = str;
strArr[8] = "totalCost";
strArr[9] = String.valueOf(System.currentTimeMillis() - this.f4378e);
j2.s(recordLevel, "modelDownload", strArr);
}
@Override
public void onSuccess(Pair<File, String> pair) {
if (pair != null) {
Object obj = pair.second;
String lowerCase = obj != null ? ((String) obj).toLowerCase() : "";
if (!lowerCase.startsWith("http") && !lowerCase.startsWith("www")) {
APICallback aPICallback = this.f4374a;
if (aPICallback != null) {
aPICallback.onSuccess(pair.first);
}
} else {
f.c("modelUrl", (String) pair.second);
APICallback aPICallback2 = this.f4374a;
if (aPICallback2 != null) {
aPICallback2.onSuccess(pair.first);
} else {
onError("MD5-ERROR", "Rename MD5 error", null);
return;
}
}
a(true, null);
return;
}
onError("NULL-PARAMS", "Null file", null);
}
@Override
public void onError(String str, String str2, String str3) {
a(false, str + "-" + str2 + "-" + str3);
if (!i.f4366c.contains(i.f4368e)) {
i.f4366c.add(i.f4368e);
}
String unused = i.f4368e = "";
i.l(this.f4375b, this.f4376c, this.f4377d, this.f4374a);
}
}
public static File i(Context context) {
File[] listFiles;
String n = n(context);
if (!TextUtils.isEmpty(n) && (listFiles = new File(n).listFiles()) != null && listFiles.length > 0) {
for (File file : listFiles) {
if ("fd4ddd72c85fd5fe2913be520df32ed0".equals(g.h(file.getAbsolutePath()))) {
return file;
}
}
}
return null;
}
public static void j(Context context) {
c.f.a.h.b.j().s(RecordLevel.LOG_ERROR, "modelDownload", "status", "clean");
f.c("modelUrl", null);
String n = n(context);
if (TextUtils.isEmpty(n)) {
return;
}
e.d(n);
}
public static void k(Context context, List<String> list, boolean z, APICallback<String> aPICallback) {
boolean o = o(context);
if (!o) {
o = p(context);
}
if (o) {
if (aPICallback != null) {
aPICallback.onSuccess("SUCCESS");
return;
}
return;
}
synchronized (i.class) {
q();
if (p(context)) {
if (aPICallback != null) {
aPICallback.onSuccess("SUCCESS");
}
return;
}
c.f.a.h.b j2 = c.f.a.h.b.j();
RecordLevel recordLevel = RecordLevel.LOG_ERROR;
String[] strArr = new String[2];
strArr[0] = "status";
strArr[1] = z ? "preload" : "backup";
j2.s(recordLevel, "modelDownload", strArr);
if (list != null) {
for (int i2 = 0; i2 < list.size(); i2++) {
String str = list.get(i2);
String lowerCase = str.toLowerCase();
if (!TextUtils.isEmpty(str) && ((lowerCase.startsWith("http") || lowerCase.startsWith("www")) && !f4365b.contains(str) && !f4366c.contains(str) && !f4368e.equals(str))) {
f4365b.add(0, str);
}
}
}
if (f4364a.get("fd4ddd72c85fd5fe2913be520df32ed0") != null) {
if (aPICallback != null) {
f4364a.get("fd4ddd72c85fd5fe2913be520df32ed0").add(aPICallback);
}
return;
}
CopyOnWriteArrayList<APICallback<String>> copyOnWriteArrayList = new CopyOnWriteArrayList<>();
if (aPICallback != null) {
copyOnWriteArrayList.add(aPICallback);
}
f4364a.put("fd4ddd72c85fd5fe2913be520df32ed0", copyOnWriteArrayList);
if (!f4365b.contains("https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_dtfconfig/1.0.1/lib/toyger.face.android.wasm") && !f4366c.contains("https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_dtfconfig/1.0.1/lib/toyger.face.android.wasm") && !f4368e.equals("https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_dtfconfig/1.0.1/lib/toyger.face.android.wasm")) {
f4365b.add("https://gw.alipayobjects.com/render/p/yuyan_npm/@alipay_dtfconfig/1.0.1/lib/toyger.face.android.wasm");
}
if (!f4365b.contains("https://cn-shanghai-aliyun-cloudauth.oss-cn-shanghai.aliyuncs.com/model/toyger.face.dat") && !f4366c.contains("https://cn-shanghai-aliyun-cloudauth.oss-cn-shanghai.aliyuncs.com/model/toyger.face.dat") && !f4368e.equals("https://cn-shanghai-aliyun-cloudauth.oss-cn-shanghai.aliyuncs.com/model/toyger.face.dat")) {
f4365b.add("https://cn-shanghai-aliyun-cloudauth.oss-cn-shanghai.aliyuncs.com/model/toyger.face.dat");
}
l("fd4ddd72c85fd5fe2913be520df32ed0", n(context), null, new b(System.currentTimeMillis()));
}
}
public static void l(String str, String str2, String str3, APICallback<File> aPICallback) {
if (f4365b.size() == 0) {
if (aPICallback != null) {
aPICallback.onError("RETRY-OVER", null, null);
return;
}
return;
}
f4367d.incrementAndGet();
long currentTimeMillis = System.currentTimeMillis();
f4368e = f4365b.remove(0);
c.f.a.h.b.j().s(RecordLevel.LOG_ERROR, "modelDownload", "status", "start", "url", f4368e, "left", String.valueOf(f4365b.size()));
d.c(f4368e, str2, str3, str, 0, new c(aPICallback, str, str2, str3, currentTimeMillis));
}
public static void m(Context context, List<String> list, boolean z, APICallback<String> aPICallback) {
c.f.a.n.a.f4321a.execute(new a(context, list, z, aPICallback));
}
public static String n(Context context) {
String h2;
if (context == null || (h2 = e.h(context)) == null) {
return null;
}
String str = h2 + File.separator + "dtf" + File.separator + "model";
e.i(new File(str));
return str;
}
public static boolean o(Context context) {
boolean z = false;
try {
AssetFileDescriptor openFd = context.getAssets().openFd(faceverify.g.ASSET_FACE);
if (openFd != null) {
z = true;
openFd.close();
return true;
}
return false;
} catch (Throwable th) {
Log.getStackTraceString(th);
return z;
}
}
public static boolean p(Context context) {
return i(context) != null;
}
public static synchronized void q() {
synchronized (i.class) {
if (f4365b == null) {
f4365b = new CopyOnWriteArrayList();
}
if (f4367d == null) {
f4367d = new AtomicInteger(0);
}
if (f4364a == null) {
f4364a = new ConcurrentHashMap();
}
if (f4366c == null) {
f4366c = new CopyOnWriteArrayList();
}
}
}
}