西瓜看球 v2.9.13版本的 MD5 值为:755288f3c36852638c41cf20ae0d004e
以下内容为反编译后的 e.java 源代码,内容仅作参考
package com.uc.crashsdk;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.ConditionVariable;
import android.os.Debug;
import android.os.Looper;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.StatFs;
import android.os.StrictMode;
import androidtranscoder.format.MediaFormatExtraConstants;
import com.facebook.cache.disk.DefaultDiskStorage;
import com.heytap.mcssdk.constant.Constants;
import com.huawei.hms.utils.FileUtil;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.taobao.weex.el.parse.Operators;
import com.uc.crashsdk.a.h;
import com.uc.crashsdk.export.LogType;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.lang.Thread;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.cybergarage.http.HTTP;
import org.cybergarage.http.HTTPStatus;
import org.cybergarage.upnp.UPnPStatus;
import org.cybergarage.upnp.ssdp.SSDP;
import org.mozilla.universalchardet.prober.contextanalysis.SJISContextAnalysis;
import tv.danmaku.ijk.media.player.IMediaPlayer;
import tv.danmaku.ijk.media.player.IjkMediaMeta;
public class e implements Thread.UncaughtExceptionHandler {
static final boolean a = true;
private static long b;
private static String i;
private final List<FileInputStream> e = new ArrayList();
private static final AtomicBoolean c = new AtomicBoolean(false);
private static boolean d = false;
private static long f = 0;
private static long g = -1;
private static boolean h = true;
private static String j = "";
private static String k = null;
private static String l = null;
private static String m = null;
private static final Object n = new Object();
private static final ConditionVariable o = new ConditionVariable();
private static final Object p = new Object();
private static final Object q = new Object();
private static final Object r = new Object();
private static final ArrayList<String> s = new ArrayList<>();
private static int t = 0;
private static String u = null;
private static boolean v = false;
private static String w = null;
private static String x = null;
private static final Object y = new Object();
private static final Object z = new Object();
private static Map<String, Integer> A = null;
private static String B = null;
private static int C = -1;
private static int D = -1;
private static int E = -1;
private static int F = -1;
private static int G = -1;
private static int H = -1;
private static int I = -1;
private static String J = Operators.CONDITION_IF_STRING;
private static boolean K = false;
private static boolean L = false;
private static int M = 0;
private static int N = 0;
private static boolean O = false;
private static com.uc.crashsdk.a.e P = new com.uc.crashsdk.a.e(405);
private static c Q = new c((byte) 0);
private static boolean R = false;
private static final com.uc.crashsdk.a.e S = new com.uc.crashsdk.a.e(412);
private static Thread.UncaughtExceptionHandler T = null;
private static Throwable U = null;
private static boolean V = false;
private static boolean W = false;
private static Runnable X = null;
private static final Object Y = new Object();
private static int Z = 101;
private static Runnable aa = new com.uc.crashsdk.a.e(407);
private static final Object ab = new Object();
private static volatile boolean ac = false;
private static Object ad = new Object();
private static ParcelFileDescriptor ae = null;
private static boolean af = false;
private static boolean ag = false;
static boolean I() {
return O();
}
static int J() {
int i2 = M + 1;
M = i2;
return i2;
}
static void K() {
StringBuilder Y2;
if (com.uc.crashsdk.b.d && (Y2 = Y()) != null) {
JNIBridge.set(125, Y2.toString());
}
L = true;
Z();
}
static int L() {
M = 0;
return 0;
}
public e() {
try {
M();
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
private void M() {
int I2 = g.I();
for (int i2 = 0; i2 < I2; i2++) {
try {
this.e.add(new FileInputStream("/dev/null"));
} catch (Exception e) {
com.uc.crashsdk.a.g.a(e);
return;
}
}
}
private void N() {
for (FileInputStream fileInputStream : this.e) {
com.uc.crashsdk.a.g.a(fileInputStream);
}
this.e.clear();
}
private static boolean O() {
if (g.P()) {
return true;
}
return a();
}
public static boolean a() {
if (f == 0) {
f = 2L;
if (h(com.uc.crashsdk.b.b("logs")) == 1) {
f = 1L;
}
}
return f == 1;
}
private static long h(String str) {
try {
Method declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("getLong", String.class, Long.TYPE);
if (declaredMethod != null) {
declaredMethod.setAccessible(true);
return ((Long) declaredMethod.invoke(null, str, 0L)).longValue();
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
return 0L;
}
public static long b() {
if (g == -1) {
g = h(com.uc.crashsdk.b.b("local"));
}
return g;
}
public static class a extends OutputStream {
private final long a;
private final OutputStream b;
private int c = 0;
private int d = 0;
private boolean e = false;
a(long j, OutputStream outputStream) {
this.a = j;
this.b = outputStream;
}
private int a(byte[] bArr, int i, int i2) {
int i3;
this.d += i2;
if (this.e) {
return 0;
}
int A = g.A();
if (A > 0) {
int i4 = this.c;
if (i4 + i2 > A) {
i3 = A - i4;
this.c += i3;
if (this.a == 0) {
b(new String(bArr, i, i3));
} else {
this.b.write(bArr, i, i3);
}
if (i3 < i2) {
this.e = true;
}
return i3;
}
}
i3 = i2;
this.c += i3;
if (this.a == 0) {
}
if (i3 < i2) {
}
return i3;
}
final void a() {
try {
if (this.d - this.c > 0) {
a("\n");
a("--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
}
a(String.format(Locale.US, "Full: %d bytes, write: %d bytes, limit: %d bytes, reject: %d bytes.\n", Integer.valueOf(this.d), Integer.valueOf(this.c), Integer.valueOf(g.A()), Integer.valueOf(this.d - this.c)));
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
final void a(String str) {
if (e.h && e.I()) {
com.uc.crashsdk.a.a.d("DEBUG", str);
}
if (this.a != 0) {
b(str);
} else {
this.b.write(str.getBytes("UTF-8"));
}
}
@Override
public final void write(int i) {
if (e.h && e.I()) {
com.uc.crashsdk.a.a.d("DEBUG", String.format(Locale.US, "%c", Integer.valueOf(i)));
}
if (this.a != 0) {
b(String.format(Locale.US, "%c", Integer.valueOf(i)));
} else {
this.b.write(i);
}
this.c++;
this.d++;
}
@Override
public final void write(byte[] bArr, int i, int i2) {
if (e.h && e.I()) {
byte[] bArr2 = new byte[i2];
System.arraycopy(bArr, i, bArr2, 0, i2);
if (i2 != 1 || bArr2[0] != 10) {
try {
com.uc.crashsdk.a.a.d("DEBUG", new String(bArr2));
} catch (Throwable unused) {
}
}
}
a(bArr, i, i2);
}
@Override
public final void write(byte[] bArr) {
if (e.h && e.I() && (bArr.length != 1 || bArr[0] != 10)) {
try {
com.uc.crashsdk.a.a.d("DEBUG", new String(bArr));
} catch (Throwable unused) {
}
}
a(bArr, 0, bArr.length);
}
private void b(String str) {
if (com.uc.crashsdk.b.d) {
JNIBridge.nativeClientWriteData(this.a, str);
}
}
}
private static String i(String str) {
try {
return str.replaceAll("[^0-9a-zA-Z-.]", "-");
} catch (Throwable unused) {
return "unknown";
}
}
private static String P() {
return g.e() + "_";
}
public static void c() {
i = null;
}
public static String d() {
String str = i;
if (str != null) {
return str;
}
String j2 = j(null);
i = j2;
return j2;
}
private static String j(String str) {
if (str == null) {
str = String.valueOf(System.currentTimeMillis()) + new Random().nextInt(65536);
}
return String.format(Locale.US, "%s%s_%s_%s_%s_%s_", P(), g.T(), g.V(), i(Build.MODEL), i(Build.VERSION.RELEASE), str);
}
private static String Q() {
return com.uc.crashsdk.b.B() ? "fg" : "bg";
}
private static byte[] R() {
byte[] bArr = null;
int i2 = 1024;
while (bArr == null && i2 > 0) {
try {
bArr = new byte[i2];
} catch (Throwable unused) {
i2 /= 2;
if (i2 < 16) {
break;
}
}
}
return bArr;
}
private static String k(String str) {
return String.format(Locale.US, "%s%s_%s_%s.log", d(), n(), Q(), str);
}
public static void a(int i2, Object[] objArr) {
int i3;
switch (i2) {
case 401:
JNIBridge.nativeCmd(10, com.uc.crashsdk.b.I() == 5 ? 1L : 0L, null, null);
com.uc.crashsdk.a.c = true;
com.uc.crashsdk.a.a(false);
L = true;
Z();
y();
return;
case UPnPStatus.INVALID_ARGS:
Object obj = Y;
synchronized (obj) {
if (X == null) {
return;
}
W = true;
if (com.uc.crashsdk.b.q()) {
return;
}
if (!com.uc.crashsdk.a.d.e()) {
com.uc.crashsdk.a.a.c("DEBUG", com.uc.crashsdk.a.d.b());
return;
} else if (!d(LogType.UNEXP_TYPE)) {
com.uc.crashsdk.a.a.d("DEBUG", "unexp sample miss");
return;
} else {
int nativeGenerateUnexpLog = JNIBridge.nativeGenerateUnexpLog(g.o(), g.p());
if (nativeGenerateUnexpLog != 0) {
f.a(11);
if ((nativeGenerateUnexpLog & 4352) != 0) {
Z = 105;
i3 = 30;
} else if ((nativeGenerateUnexpLog & LogType.UNEXP_EXIT) != 0) {
Z = 104;
i3 = 31;
} else if ((nativeGenerateUnexpLog & LogType.UNEXP_RESTART) != 0) {
Z = 106;
i3 = 32;
} else {
if ((nativeGenerateUnexpLog & LogType.UNEXP_ANR) != 0) {
Z = 103;
f.a(10);
} else if ((nativeGenerateUnexpLog & LogType.UNEXP_LOW_MEMORY) != 0) {
Z = 107;
f.a(29);
} else {
Z = 102;
}
a(true);
}
f.a(i3);
a(true);
}
synchronized (obj) {
X = null;
}
return;
}
}
case 403:
ab();
return;
case 404:
default:
if (!a) {
throw new AssertionError();
}
return;
case 405:
L = false;
StringBuilder Y2 = Y();
String g2 = com.uc.crashsdk.b.g();
if (Y2 != null) {
com.uc.crashsdk.a.g.a(new File(g2), Y2.toString());
return;
}
return;
case 406:
if (!a && objArr == null) {
throw new AssertionError();
}
a((String) objArr[0], ((Boolean) objArr[1]).booleanValue(), ((Boolean) objArr[2]).booleanValue());
return;
case 407:
try {
com.uc.crashsdk.a.d();
return;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return;
}
case 408:
synchronized (ab) {
if (!ac && g.Q() && com.uc.crashsdk.b.z()) {
com.uc.crashsdk.b.s();
h.f();
f.c();
if (com.uc.crashsdk.b.F()) {
C();
}
if (g.Q()) {
a(Calendar.getInstance());
}
ac = true;
return;
}
return;
}
case 409:
d(false);
return;
case 410:
a(false, true);
return;
case 411:
if (com.uc.crashsdk.b.d) {
JNIBridge.set(28, d(LogType.NATIVE_TYPE));
JNIBridge.set(29, d(LogType.ANR_TYPE));
return;
}
return;
case 412:
if (!R && com.uc.crashsdk.b.B() && g.M()) {
b(com.uc.crashsdk.a.g.a());
return;
} else if (R) {
if (com.uc.crashsdk.b.B() && g.M()) {
return;
}
try {
com.uc.crashsdk.a.g.a().unregisterReceiver(Q);
R = false;
return;
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
return;
}
} else {
return;
}
case 413:
JNIBridge.cmd(8);
return;
case 414:
try {
if (d(com.uc.crashsdk.a.g.a())) {
return;
}
int i4 = N + 1;
N = i4;
if (i4 < 10) {
X();
return;
} else if (com.uc.crashsdk.b.d) {
JNIBridge.set((int) SJISContextAnalysis.HIRAGANA_HIGHBYTE, "(get failed)");
return;
} else {
return;
}
} catch (Throwable th3) {
com.uc.crashsdk.a.g.a(th3);
return;
}
case 415:
if (!a && objArr == null) {
throw new AssertionError();
}
long longValue = ((Long) objArr[0]).longValue();
Calendar calendar = Calendar.getInstance();
if (calendar.getTimeInMillis() >= longValue) {
h.g();
f.a(100);
d(true);
f.a(true);
h.b();
} else {
h.h();
h.i();
h.c();
}
a(calendar);
break;
case HTTPStatus.INVALID_RANGE:
break;
}
W();
}
public static boolean b(int i2, Object[] objArr) {
if (i2 == 451) {
if (a || objArr != null) {
return a((String) objArr[0], (d) objArr[1]);
}
throw new AssertionError();
} else if (i2 == 452) {
if (a || objArr != null) {
d dVar = (d) objArr[1];
return com.uc.crashsdk.a.g.a(new File((String) objArr[0]), String.format(Locale.US, "%d %d %d %d", Long.valueOf(dVar.a), Long.valueOf(dVar.b), Integer.valueOf(dVar.c), Integer.valueOf(dVar.d)).getBytes());
}
throw new AssertionError();
} else if (a) {
return false;
} else {
throw new AssertionError();
}
}
private static String S() {
return (!com.uc.crashsdk.b.F() || d) ? LogType.JAVA_TYPE : "ucebujava";
}
public static void a(boolean z2) {
File[] listFiles;
try {
if (com.uc.crashsdk.b.y() && (listFiles = new File(g.X()).listFiles()) != null) {
int l2 = g.l();
int m2 = g.m();
if (listFiles.length < Math.min(l2, m2)) {
return;
}
int i2 = 0;
int i3 = 0;
for (File file : listFiles) {
if (b(file)) {
i2++;
} else {
i3++;
}
}
int i4 = (!z2 || i2 < l2) ? 0 : (i2 - l2) + 1;
int i5 = (z2 || i3 < m2) ? 0 : (i3 - m2) + 1;
if (i4 == 0 && i5 == 0) {
return;
}
Arrays.sort(listFiles, new b((byte) 0));
int i6 = i4;
int i7 = i5;
for (File file2 : listFiles) {
boolean b2 = b(file2);
if (b2 && i6 > 0) {
com.uc.crashsdk.a.a.a("crashsdk", "Delete oldest crash log: " + file2.getPath());
file2.delete();
i6 += -1;
} else if (!b2 && i7 > 0) {
com.uc.crashsdk.a.a.a("crashsdk", "Delete oldest custom log: " + file2.getPath());
file2.delete();
i7 += -1;
}
if (i6 == 0 && i7 == 0) {
break;
}
}
f.a(16, i4 + i5);
if (i4 > 0) {
f.a(22, i4);
}
if (i5 > 0) {
f.a(23, i5);
}
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
public static class b implements Comparator<File> {
private b() {
}
b(byte b) {
this();
}
@Override
public final int compare(File file, File file2) {
File file3 = file;
File file4 = file2;
if (file3.lastModified() > file4.lastModified()) {
return 1;
}
return file3.lastModified() < file4.lastModified() ? -1 : 0;
}
}
private static void b(OutputStream outputStream, String str, String str2) {
String str3;
String str4;
try {
outputStream.write("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n".getBytes("UTF-8"));
} catch (Throwable th) {
a(th, outputStream);
}
try {
outputStream.write(String.format(Locale.US, "Basic Information: 'pid: %d/tid: %d/time: %s'\n", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()), n()).getBytes("UTF-8"));
Locale locale = Locale.US;
Object[] objArr = new Object[3];
objArr[0] = e();
if (com.uc.crashsdk.a.g.a(l)) {
T();
}
objArr[1] = l;
objArr[2] = f();
outputStream.write(String.format(locale, "Cpu Information: 'abi: %s/processor: %s/hardware: %s'\n", objArr).getBytes("UTF-8"));
} catch (Throwable th2) {
a(th2, outputStream);
}
try {
outputStream.write(String.format(Locale.US, "Mobile Information: 'model: %s/version: %s/sdk: %d'\n", Build.MODEL, Build.VERSION.RELEASE, Integer.valueOf(Build.VERSION.SDK_INT)).getBytes("UTF-8"));
outputStream.write(("Build fingerprint: '" + Build.FINGERPRINT + "'\n").getBytes("UTF-8"));
Locale locale2 = Locale.US;
Object[] objArr2 = new Object[4];
objArr2[0] = a(new Date(b));
objArr2[1] = Long.valueOf(Runtime.getRuntime().maxMemory());
objArr2[2] = com.uc.crashsdk.a.g.d();
objArr2[3] = com.uc.crashsdk.b.B() ? "fg" : "bg";
outputStream.write(String.format(locale2, "Runtime Information: 'start: %s/maxheap: %s/primaryabi: %s/ground: %s'\n", objArr2).getBytes("UTF-8"));
} catch (Throwable th3) {
a(th3, outputStream);
}
try {
outputStream.write(String.format(Locale.US, "Application Information: 'version: %s/subversion: %s/buildseq: %s/versioncode: %d'\n", g.T(), g.U(), g.V(), Integer.valueOf(com.uc.crashsdk.a.c())).getBytes("UTF-8"));
String str5 = "0";
String str6 = "";
if (com.uc.crashsdk.b.d) {
String nativeGet = JNIBridge.nativeGet(1, 0L, null);
str4 = JNIBridge.nativeGet(2, 0L, null);
str5 = nativeGet;
} else {
str4 = "";
}
outputStream.write(String.format(Locale.US, "CrashSDK Information: 'version: %s/nativeseq: %s/javaseq: %s/arch: %s/target: %s'\n", "3.3.2.2", str5, "211215141717", str4, "release").getBytes("UTF-8"));
if (str != null) {
str6 = str;
}
outputStream.write(("Report Name: " + str6.substring(str6.lastIndexOf(47) + 1) + "\n").getBytes("UTF-8"));
} catch (Throwable th4) {
a(th4, outputStream);
}
try {
if (ag) {
str3 = s("UUID");
} else {
str3 = B;
}
outputStream.write(String.format("UUID: %s\n", str3).getBytes("UTF-8"));
outputStream.write(("Log Type: " + str2 + "\n").getBytes("UTF-8"));
} catch (Throwable th5) {
a(th5, outputStream);
}
try {
String E2 = com.uc.crashsdk.b.E();
if (com.uc.crashsdk.a.g.a(E2)) {
E2 = "(none)";
}
outputStream.write(("Activity: " + E2 + "\n").getBytes("UTF-8"));
} catch (Throwable th6) {
a(th6, outputStream);
}
a(outputStream);
try {
com.uc.crashsdk.a.a(outputStream, "UTF-8");
if (ag) {
h = false;
outputStream.write(s("HEADER").getBytes("UTF-8"));
h = true;
}
} catch (Throwable th7) {
a(th7, outputStream);
}
a(outputStream);
}
public static String e() {
String str;
String str2;
boolean z2;
String str3;
String str4;
Method declaredMethod;
if (!com.uc.crashsdk.a.g.a(j)) {
return j;
}
String str5 = null;
try {
if (Build.VERSION.SDK_INT >= 21) {
Field declaredField = Build.class.getDeclaredField("SUPPORTED_ABIS");
declaredField.setAccessible(true);
Object obj = declaredField.get(null);
if (obj != null && (obj instanceof String[])) {
String[] strArr = (String[]) obj;
StringBuilder sb = new StringBuilder();
int length = strArr.length;
int i2 = 0;
boolean z3 = true;
while (i2 < length) {
String str6 = strArr[i2];
if (!z3) {
sb.append(",");
}
sb.append(str6);
i2++;
z3 = false;
}
j = sb.toString();
}
}
} catch (Throwable unused) {
}
if (com.uc.crashsdk.a.g.a(j)) {
try {
str = Build.CPU_ABI;
} catch (Throwable unused2) {
str = null;
}
try {
str2 = Build.CPU_ABI2;
} catch (Throwable unused3) {
str2 = null;
z2 = !com.uc.crashsdk.a.g.a(str);
if (z2) {
}
if (!com.uc.crashsdk.a.g.a(str2)) {
}
declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("get", String.class, String.class);
if (declaredMethod == null) {
}
}
z2 = !com.uc.crashsdk.a.g.a(str);
if (z2) {
j = str;
}
if (!com.uc.crashsdk.a.g.a(str2)) {
if (z2) {
j += ",";
j += str2;
} else {
j = str2;
}
}
}
try {
declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("get", String.class, String.class);
} catch (Throwable th) {
th = th;
str3 = null;
}
if (declaredMethod == null) {
declaredMethod.setAccessible(true);
str3 = (String) declaredMethod.invoke(null, "ro.product.cpu.abi", null);
try {
str4 = (String) declaredMethod.invoke(null, "ro.product.cpu.abi2", null);
} catch (Throwable th2) {
th = th2;
com.uc.crashsdk.a.g.a(th);
str4 = null;
str5 = str3;
if (!com.uc.crashsdk.a.g.a(str5)) {
}
if (!com.uc.crashsdk.a.g.a(str4)) {
}
return j;
}
str5 = str3;
if (!com.uc.crashsdk.a.g.a(str5) && !j.contains(str5)) {
j += ",";
j += str5;
}
if (!com.uc.crashsdk.a.g.a(str4) && !j.contains(str4)) {
j += ",";
j += str4;
}
return j;
}
str4 = null;
if (!com.uc.crashsdk.a.g.a(str5)) {
j += ",";
j += str5;
}
if (!com.uc.crashsdk.a.g.a(str4)) {
j += ",";
j += str4;
}
return j;
}
public static String f() {
if (com.uc.crashsdk.a.g.a(k)) {
T();
}
return k;
}
private static void T() {
String str;
BufferedReader bufferedReader;
Throwable th;
FileReader fileReader;
String str2 = "-";
try {
str = Build.HARDWARE;
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
str = "-";
}
try {
fileReader = new FileReader(new File("/proc/cpuinfo"));
try {
bufferedReader = new BufferedReader(fileReader, 512);
int i2 = 0;
do {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (readLine.startsWith("Hardware")) {
str = readLine.substring(readLine.indexOf(":") + 1).trim();
} else if (readLine.startsWith("Processor")) {
str2 = readLine.substring(readLine.indexOf(":") + 1).trim();
}
i2++;
} catch (Throwable th3) {
th = th3;
try {
com.uc.crashsdk.a.g.a(th);
com.uc.crashsdk.a.g.a(fileReader);
com.uc.crashsdk.a.g.a(bufferedReader);
k = str;
l = str2;
} catch (Throwable th4) {
com.uc.crashsdk.a.g.a(fileReader);
com.uc.crashsdk.a.g.a(bufferedReader);
throw th4;
}
}
} while (i2 < 2);
com.uc.crashsdk.a.g.a(fileReader);
} catch (Throwable th5) {
bufferedReader = null;
th = th5;
}
} catch (Throwable th6) {
bufferedReader = null;
th = th6;
fileReader = null;
}
com.uc.crashsdk.a.g.a(bufferedReader);
k = str;
l = str2;
}
public static String g() {
try {
StringBuilder sb = new StringBuilder();
sb.append("JavaMax: ");
sb.append(Runtime.getRuntime().maxMemory() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("JavaTotal: ");
sb.append(Runtime.getRuntime().totalMemory() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("JavaFree: ");
sb.append(Runtime.getRuntime().freeMemory() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("NativeHeap: ");
sb.append(Debug.getNativeHeapSize() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("NativeAllocated: ");
sb.append(Debug.getNativeHeapAllocatedSize() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("NativeFree: ");
sb.append(Debug.getNativeHeapFreeSize() / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
ActivityManager activityManager = (ActivityManager) com.uc.crashsdk.a.g.a().getSystemService(PushConstants.INTENT_ACTIVITY_NAME);
if (activityManager != null) {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
sb.append("availMem: ");
sb.append(memoryInfo.availMem / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("threshold: ");
sb.append(memoryInfo.threshold / IjkMediaMeta.AV_CH_SIDE_RIGHT);
sb.append(" kB\n");
sb.append("lowMemory: ");
sb.append(memoryInfo.lowMemory);
sb.append("\n");
}
return sb.toString();
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return "";
}
}
public static String a(String str, String str2) {
String[] strArr;
try {
if (Build.VERSION.SDK_INT >= 26) {
strArr = new String[]{"ps", "-ef"};
} else {
strArr = new String[]{"ps"};
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(strArr).getInputStream()));
boolean b2 = com.uc.crashsdk.a.g.b(str);
boolean b3 = com.uc.crashsdk.a.g.b(str2);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
boolean z2 = true;
if ((!b2 || !readLine.contains(str)) && ((!b3 || !readLine.contains(str2)) && (readLine.indexOf(47) >= 0 || readLine.indexOf(46) <= 0))) {
z2 = false;
}
} else {
return byteArrayOutputStream.toString("UTF-8");
}
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return "exception exists.";
}
}
private static BufferedReader a(InputStreamReader inputStreamReader) {
BufferedReader bufferedReader = null;
int i2 = 8192;
while (bufferedReader == null && i2 > 0) {
try {
bufferedReader = new BufferedReader(inputStreamReader, i2);
} catch (Throwable unused) {
i2 /= 2;
if (i2 < 512) {
break;
}
}
}
return bufferedReader;
}
private static void a(OutputStream outputStream) {
try {
outputStream.write("--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n".getBytes("UTF-8"));
} catch (Throwable th) {
a(th, outputStream);
}
}
private static void b(OutputStream outputStream) {
BufferedReader bufferedReader = null;
try {
outputStream.write("logcat:\n".getBytes("UTF-8"));
} finally {
try {
com.uc.crashsdk.a.g.a(bufferedReader);
a(outputStream);
} finally {
}
}
if (g.n() <= 0) {
outputStream.write("[DEBUG] custom java logcat lines count is 0!\n".getBytes("UTF-8"));
a(outputStream);
return;
}
int n2 = g.n();
bufferedReader = a(new InputStreamReader(Runtime.getRuntime().exec(new String[]{"logcat", "-d", "-b", com.umeng.analytics.pro.d.ar, "-b", "main", "-v", "threadtime", "-t", String.valueOf(n2)}).getInputStream()));
if (bufferedReader == null) {
outputStream.write("[DEBUG] alloc buffer failed!\n".getBytes("UTF-8"));
a(outputStream);
return;
}
h = false;
int i2 = 0;
int i3 = 0;
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
i2++;
if (i3 < n2 && !readLine.contains(" I auditd ") && !readLine.contains(" I liblog ")) {
outputStream.write(readLine.getBytes("UTF-8"));
outputStream.write("\n".getBytes("UTF-8"));
i3++;
}
}
outputStream.write(String.format(Locale.US, "[DEBUG] Read %d lines, wrote %d lines.\n", Integer.valueOf(i2), Integer.valueOf(i3)).getBytes("UTF-8"));
h = true;
com.uc.crashsdk.a.g.a(bufferedReader);
a(outputStream);
}
private static String a(File file) {
String str;
try {
str = file.getCanonicalPath();
} catch (Throwable unused) {
str = null;
}
return com.uc.crashsdk.a.g.a(str) ? file.getPath() : str;
}
private static long a(StatFs statFs, String str, String str2) {
try {
if (Build.VERSION.SDK_INT >= 18) {
Method declaredMethod = StatFs.class.getDeclaredMethod(str, new Class[0]);
declaredMethod.setAccessible(true);
Object invoke = declaredMethod.invoke(statFs, new Object[0]);
if (invoke != null && (invoke instanceof Long)) {
return ((Long) invoke).longValue();
}
}
} catch (Throwable unused) {
}
try {
Method declaredMethod2 = StatFs.class.getDeclaredMethod(str2, new Class[0]);
declaredMethod2.setAccessible(true);
Object invoke2 = declaredMethod2.invoke(statFs, new Object[0]);
if (invoke2 == null || !(invoke2 instanceof Integer)) {
return 0L;
}
return ((Integer) invoke2).intValue();
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return 0L;
}
}
private static void c(OutputStream outputStream) {
if (com.uc.crashsdk.b.d) {
String o2 = com.uc.crashsdk.b.o();
h = false;
if (1 == JNIBridge.cmd(17, o2)) {
File file = new File(o2);
try {
byte[] e = com.uc.crashsdk.a.g.e(file);
if (e != null) {
outputStream.write(e);
}
} catch (Throwable th) {
a(th, outputStream);
}
try {
file.delete();
} catch (Throwable th2) {
a(th2, outputStream);
}
h = true;
a(outputStream);
}
h = true;
return;
}
File[] fileArr = null;
int i2 = IMediaPlayer.MEDIA_INFO_TIMED_TEXT_ERROR;
try {
i2 = g.J();
fileArr = new File("/proc/self/fd").listFiles();
if (fileArr != null) {
outputStream.write(String.format(Locale.US, "opened file count: %d, write limit: %d.\n", Integer.valueOf(fileArr.length), Integer.valueOf(i2)).getBytes("UTF-8"));
} else {
outputStream.write("[DEBUG] listFiles failed!\n".getBytes("UTF-8"));
}
} catch (Throwable th3) {
a(th3, outputStream);
}
if (fileArr != null) {
try {
if (fileArr.length >= i2) {
outputStream.write("opened files:\n".getBytes("UTF-8"));
StringBuilder sb = new StringBuilder();
for (File file2 : fileArr) {
sb.append(file2.getName());
sb.append(" -> ");
sb.append(file2.getCanonicalPath());
sb.append("\n");
}
outputStream.write(sb.toString().getBytes("UTF-8"));
}
} catch (Throwable th4) {
a(th4, outputStream);
}
}
a(outputStream);
}
private static void d(OutputStream outputStream) {
int i2;
int i3;
File[] fileArr = null;
try {
i2 = g.K();
try {
fileArr = new File("/proc/self/task").listFiles();
} catch (Throwable th) {
th = th;
com.uc.crashsdk.a.g.a(th);
i3 = 0;
if (fileArr != null) {
}
}
} catch (Throwable th2) {
th = th2;
i2 = 300;
}
if (fileArr == null) {
return;
}
i3 = fileArr.length;
if (i3 < i2) {
return;
}
if (fileArr != null) {
return;
}
try {
outputStream.write("threads info:\n".getBytes("UTF-8"));
outputStream.write(String.format(Locale.US, "threads count: %d, dump limit: %d.\n", Integer.valueOf(i3), Integer.valueOf(i2)).getBytes("UTF-8"));
outputStream.write(" tid name\n".getBytes("UTF-8"));
for (File file : fileArr) {
outputStream.write(String.format(Locale.US, "%5s %s\n", file.getName(), l(com.uc.crashsdk.a.g.a(new File(file.getPath(), "comm"), 128, false))).getBytes("UTF-8"));
}
} catch (Throwable th3) {
a(th3, outputStream);
}
a(outputStream);
}
private static void e(OutputStream outputStream) {
BufferedReader bufferedReader;
int indexOf;
boolean z2;
if (com.uc.crashsdk.b.d) {
try {
outputStream.write("solib build id:\n".getBytes("UTF-8"));
} catch (Throwable th) {
a(th, outputStream);
}
FileReader fileReader = null;
try {
ArrayList arrayList = new ArrayList();
FileReader fileReader2 = new FileReader(new File("/proc/self/maps"));
try {
bufferedReader = new BufferedReader(fileReader2, 512);
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
} else if (readLine.endsWith(".so") && (indexOf = readLine.indexOf(47)) != -1) {
String substring = readLine.substring(indexOf);
if (!substring.contains("/data/") && !substring.contains(com.uc.crashsdk.a.a)) {
z2 = false;
if (z2 && !arrayList.contains(substring)) {
arrayList.add(substring);
if (!ag) {
outputStream.write((String.format("$^%s`%s^$", "SOBUILDID", substring) + "\n").getBytes("UTF-8"));
} else {
outputStream.write(String.format(Locale.US, "%s: %s\n", substring, JNIBridge.nativeGet(3, 0L, substring)).getBytes("UTF-8"));
}
}
}
z2 = true;
if (z2) {
arrayList.add(substring);
if (!ag) {
}
}
}
} catch (Throwable th2) {
th = th2;
fileReader = fileReader2;
try {
a(th, outputStream);
com.uc.crashsdk.a.g.a(fileReader);
com.uc.crashsdk.a.g.a(bufferedReader);
a(outputStream);
} catch (Throwable th3) {
com.uc.crashsdk.a.g.a(fileReader);
com.uc.crashsdk.a.g.a(bufferedReader);
throw th3;
}
}
}
com.uc.crashsdk.a.g.a(fileReader2);
} catch (Throwable th4) {
th = th4;
bufferedReader = null;
}
} catch (Throwable th5) {
th = th5;
bufferedReader = null;
}
com.uc.crashsdk.a.g.a(bufferedReader);
a(outputStream);
}
}
private static void a(a aVar) {
try {
aVar.a(String.format(Locale.US, "log end: %s\n", n()));
} catch (Throwable th) {
a(th, aVar);
}
}
private static void b(a aVar) {
h = false;
try {
aVar.write((s("LOG_END") + "\n").getBytes("UTF-8"));
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
h = true;
}
public static int a(OutputStream outputStream, String str, int i2) {
int i3 = 0;
if (str == null) {
a(outputStream);
return 0;
}
try {
String a2 = com.uc.crashsdk.a.b.a(str);
if (a2 == null) {
a2 = "file: '" + str + "' not found or decode failed!";
}
int length = a2.length();
if (length <= i2 + 32) {
i2 = length;
}
if (i2 > 0) {
try {
outputStream.write(a2.getBytes("UTF-8"), 0, i2);
outputStream.write("\n".getBytes("UTF-8"));
} catch (Throwable th) {
th = th;
i3 = i2;
a(th, outputStream);
i2 = i3;
a(outputStream);
return i2;
}
}
if (i2 < a2.length()) {
outputStream.write(String.format(Locale.US, "(truncated %d bytes)\n", Integer.valueOf(a2.length() - i2)).getBytes("UTF-8"));
}
} catch (Throwable th2) {
th = th2;
}
a(outputStream);
return i2;
}
public static int b(OutputStream outputStream, String str, int i2) {
int i3;
DataInputStream dataInputStream;
int i4;
DataInputStream dataInputStream2 = null;
int i5 = 0;
try {
File file = new File(str);
if (file.exists()) {
byte[] R2 = R();
if (R2 == null) {
outputStream.write("(alloc buffer failed!)\n".getBytes("UTF-8"));
return 0;
}
dataInputStream = new DataInputStream(new FileInputStream(file));
i4 = 0;
i3 = 0;
loop0: while (true) {
boolean z2 = false;
while (true) {
try {
int read = dataInputStream.read(R2);
if (read == -1) {
break loop0;
}
i4 += read;
int i6 = i2 - i3;
if (read <= i6 + 32) {
i6 = read;
}
if (i6 > 0 && !z2) {
outputStream.write(R2, 0, i6);
i3 += i6;
}
if (!z2) {
if (i6 < read || i3 >= i2) {
z2 = true;
}
}
} catch (Throwable th) {
th = th;
i5 = i3;
dataInputStream2 = dataInputStream;
try {
a(th, outputStream);
com.uc.crashsdk.a.g.a(dataInputStream2);
i3 = i5;
a(outputStream);
return i3;
} finally {
com.uc.crashsdk.a.g.a(dataInputStream2);
}
}
}
}
} else {
outputStream.write(("file: '" + str + "' not exists!\n").getBytes("UTF-8"));
dataInputStream = null;
i4 = 0;
i3 = 0;
}
if (i3 > 0) {
outputStream.write("\n".getBytes("UTF-8"));
}
if (i3 < i4) {
outputStream.write(String.format(Locale.US, "(truncated %d bytes)\n", Integer.valueOf(i4 - i3)).getBytes("UTF-8"));
}
} catch (Throwable th2) {
th = th2;
}
a(outputStream);
return i3;
}
public static String a(int i2) {
try {
String a2 = com.uc.crashsdk.a.g.a(new File(String.format(Locale.US, "/proc/%d/cmdline", Integer.valueOf(i2))), 128, false);
return com.uc.crashsdk.a.g.b(a2) ? l(a2) : "unknown";
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return "unknown";
}
}
private static String l(String str) {
if (com.uc.crashsdk.a.g.b(str)) {
int indexOf = str.indexOf(0);
if (indexOf >= 0) {
str = str.substring(0, indexOf);
}
return str.trim();
}
return "";
}
public static String h() {
String str = m;
if (str != null) {
return str;
}
String a2 = a(Process.myPid());
m = a2;
return a2;
}
private static String a(Throwable th, String str, long j2, boolean z2) {
FileOutputStream fileOutputStream;
FileOutputStream fileOutputStream2;
a aVar;
String str2;
String str3;
HashSet hashSet;
String a2;
StatFs statFs;
long a3;
long a4;
a aVar2 = null;
try {
if (!com.uc.crashsdk.b.L()) {
try {
g.a();
a(true);
} catch (Throwable th2) {
th = th2;
fileOutputStream = null;
try {
a(th, aVar2);
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar2);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
} catch (Throwable th3) {
if (j2 != 0) {
b(aVar2);
}
com.uc.crashsdk.a.g.a(aVar2);
com.uc.crashsdk.a.g.a(fileOutputStream);
throw th3;
}
}
}
fileOutputStream2 = j2 == 0 ? new FileOutputStream(str) : null;
try {
aVar = new a(j2, fileOutputStream2);
try {
if (com.uc.crashsdk.b.d) {
JNIBridge.set(126, str);
}
b(aVar, str, S());
if (z2) {
aVar.flush();
}
aVar.write(("Process Name: '" + h() + "'\n").getBytes("UTF-8"));
aVar.write(("Thread Name: '" + Thread.currentThread().getName() + "'\n").getBytes("UTF-8"));
aVar.write("Back traces starts.\n".getBytes("UTF-8"));
try {
Field declaredField = Throwable.class.getDeclaredField("detailMessage");
declaredField.setAccessible(true);
Object obj = declaredField.get(th);
if (obj != null) {
declaredField.set(th, ((String) obj).replaceAll("\n\t", "\n-> "));
}
} catch (Throwable th4) {
com.uc.crashsdk.a.g.a(th4);
}
String message = th.getMessage();
if (message != null && !message.equals(th.getLocalizedMessage())) {
aVar.write(("Message: " + message + "\n").getBytes("UTF-8"));
}
th.printStackTrace(new PrintStream(aVar));
aVar.write("Back traces ends.\n".getBytes("UTF-8"));
a((OutputStream) aVar);
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n");
if (z2) {
aVar.flush();
}
aVar.write("meminfo:\n".getBytes("UTF-8"));
b(aVar, "/proc/meminfo", 10240);
String format = String.format(Locale.US, "/proc/%d/status", Integer.valueOf(Process.myPid()));
aVar.write("status:\n".getBytes("UTF-8"));
b(aVar, format, 10240);
aVar.write(("memory info:\n" + g()).getBytes("UTF-8"));
a((OutputStream) aVar);
f(aVar);
com.uc.crashsdk.a.a(aVar, "UTF-8", (ArrayList<String>) null);
if (ag) {
h = false;
aVar.write(s("JAVADUMPFILES").getBytes("UTF-8"));
h = true;
}
aVar.flush();
b((OutputStream) aVar);
aVar.flush();
aVar.write("battery info:\n".getBytes("UTF-8"));
if (ag) {
h = false;
aVar.write(s("BATTERYINFO").getBytes("UTF-8"));
h = true;
} else {
StringBuilder Y2 = Y();
if (Y2 != null) {
aVar.write(Y2.toString().getBytes("UTF-8"));
}
}
a((OutputStream) aVar);
aVar.write("disk info:\n".getBytes("UTF-8"));
}
} catch (Throwable th5) {
th = th5;
fileOutputStream = fileOutputStream2;
}
} catch (Throwable th6) {
th = th6;
}
if (ag) {
h = false;
aVar.write(s("FSSTAT").getBytes("UTF-8"));
h = true;
} else {
try {
hashSet = new HashSet();
a2 = a(new File(com.uc.crashsdk.a.g.b()));
} catch (Throwable th7) {
th = th7;
str2 = "\n";
str3 = "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n";
}
if (!com.uc.crashsdk.a.g.a(a2) && !hashSet.contains(a2) && !a2.equals("/storage/emulated")) {
hashSet.add(a2);
try {
statFs = new StatFs(a2);
a3 = a(statFs, "getBlockCountLong", "getBlockCount");
str3 = "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n";
} catch (Throwable unused) {
}
try {
a4 = a(statFs, "getBlockSizeLong", "getBlockSize");
} catch (Throwable th8) {
th = th8;
str2 = "\n";
fileOutputStream = fileOutputStream2;
try {
a(th, aVar);
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str4 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str4, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str4, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
} catch (Throwable th9) {
th = th9;
aVar2 = aVar;
a(th, aVar2);
if (j2 != 0) {
b(aVar2);
}
com.uc.crashsdk.a.g.a(aVar2);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
if ((a3 / IjkMediaMeta.AV_CH_SIDE_RIGHT) * a4 >= FileUtil.LOCAL_REPORT_FILE_MAX_SIZE) {
fileOutputStream = fileOutputStream2;
try {
long a5 = a(statFs, "getAvailableBlocksLong", "getAvailableBlocks");
long a6 = a(statFs, "getFreeBlocksLong", "getFreeBlocks");
try {
aVar.write(String.format(Locale.US, "%s:\n", a2).getBytes("UTF-8"));
Locale locale = Locale.US;
Object[] objArr = new Object[1];
double d2 = a3;
Double.isNaN(d2);
str2 = "\n";
double d3 = a4;
Double.isNaN(d3);
try {
objArr[0] = Long.valueOf((long) (((d2 * 1.0d) * d3) / 1024.0d));
aVar.write(String.format(locale, " total: %d kB\n", objArr).getBytes("UTF-8"));
Locale locale2 = Locale.US;
Object[] objArr2 = new Object[1];
double d4 = a5;
Double.isNaN(d4);
Double.isNaN(d3);
objArr2[0] = Long.valueOf((long) (((d4 * 1.0d) * d3) / 1024.0d));
aVar.write(String.format(locale2, " available: %d kB\n", objArr2).getBytes("UTF-8"));
Locale locale3 = Locale.US;
Object[] objArr3 = new Object[1];
double d5 = a6;
Double.isNaN(d5);
Double.isNaN(d3);
objArr3[0] = Long.valueOf((long) (((d5 * 1.0d) * d3) / 1024.0d));
aVar.write(String.format(locale3, " free: %d kB\n", objArr3).getBytes("UTF-8"));
aVar.write(String.format(Locale.US, " block size: %d B\n\n", Long.valueOf(a4)).getBytes("UTF-8"));
} catch (Throwable th10) {
th = th10;
try {
a(th, aVar);
} catch (Throwable th11) {
th = th11;
a(th, aVar);
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str42 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str42, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str42, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str422 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str422, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str422, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
} catch (Throwable th12) {
th = th12;
str2 = "\n";
}
} catch (Throwable th13) {
th = th13;
str2 = "\n";
}
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
try {
h = false;
aVar.write(s("DEVICESTATUS").getBytes("UTF-8"));
h = true;
} catch (Throwable th14) {
th = th14;
a(th, aVar);
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str4222 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str4222, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str4222, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
} else {
try {
aVar.write(String.format(Locale.US, "has root: %s\n", Boolean.valueOf(com.uc.crashsdk.a.g.e())).getBytes("UTF-8"));
String str5 = Build.TAGS != null ? Build.TAGS : "";
StringBuilder sb = new StringBuilder();
sb.append("build tags: ");
sb.append(str5);
if (com.uc.crashsdk.a.g.f()) {
sb.append(" (default root)");
}
sb.append(str2);
aVar.write(sb.toString().getBytes("UTF-8"));
String h2 = com.uc.crashsdk.a.g.h();
if (com.uc.crashsdk.a.g.b(h2)) {
aVar.write(String.format(Locale.US, "su binary: %s\n", h2).getBytes("UTF-8"));
StringBuilder sb2 = new StringBuilder();
sb2.append("su permission: ");
sb2.append(com.uc.crashsdk.a.g.g() ? "valid (" : "invalid (");
sb2.append(com.uc.crashsdk.a.g.i());
sb2.append(")\n");
aVar.write(sb2.toString().getBytes("UTF-8"));
}
} catch (Throwable th15) {
th = th15;
a(th, aVar);
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str42222 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str42222, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str42222, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str422222 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str422222, null);
if (ag) {
h = false;
aVar.write(s("JAVACACHEDINFOS").getBytes("UTF-8"));
h = true;
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str422222, null);
if (ag) {
h = false;
aVar.write(s("JAVACALLBACKINFOS").getBytes("UTF-8"));
h = true;
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
b(aVar);
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
r(str);
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
str2 = "\n";
fileOutputStream = fileOutputStream2;
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str4222222 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str4222222, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str4222222, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
}
str2 = "\n";
str3 = "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n";
fileOutputStream = fileOutputStream2;
a((OutputStream) aVar);
aVar.write("device status:\n".getBytes("UTF-8"));
if (!ag) {
}
a((OutputStream) aVar);
c(aVar);
d(aVar);
String str42222222 = str3;
com.uc.crashsdk.a.b(aVar, "UTF-8", str42222222, null);
if (ag) {
}
aVar.flush();
com.uc.crashsdk.a.a(aVar, "UTF-8", str42222222, null);
if (ag) {
}
aVar.a();
a(aVar);
aVar.flush();
if (j2 != 0) {
}
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
if (!ag) {
}
b(ag ? a(m(str)) : str, LogType.JAVA_TYPE);
return str;
}
private static void f(OutputStream outputStream) {
String m2;
try {
outputStream.write("recent status:\n".getBytes("UTF-8"));
} catch (Throwable th) {
a(th, outputStream);
}
try {
if (ag) {
m2 = s("LASTVER");
} else {
m2 = com.uc.crashsdk.a.m();
}
outputStream.write(String.format(Locale.US, "last version: '%s'\n", m2).getBytes("UTF-8"));
} catch (Throwable th2) {
a(th2, outputStream);
}
try {
ArrayList<String> arrayList = s;
synchronized (arrayList) {
if (u != null) {
outputStream.write(String.format(Locale.US, "generating log: %s\n", u).getBytes("UTF-8"));
}
if (t > 0 || arrayList.size() > 0) {
outputStream.write(String.format(Locale.US, "generated %d logs, recent are:\n", Integer.valueOf(t)).getBytes("UTF-8"));
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
outputStream.write(String.format(Locale.US, "* %s\n", it.next()).getBytes("UTF-8"));
}
}
}
outputStream.write(String.format(Locale.US, "dumping all threads: %s\n", Boolean.valueOf(v)).getBytes("UTF-8"));
if (w != null) {
outputStream.write(String.format(Locale.US, "dumping threads: %s\n", w).getBytes("UTF-8"));
}
} catch (Throwable th3) {
a(th3, outputStream);
}
a(outputStream);
}
private static String m(String str) {
String a2 = com.uc.crashsdk.a.b.a(str, g.w(), g.v());
if (!str.equals(a2)) {
File file = new File(str);
if (file.exists()) {
file.delete();
}
}
return a2;
}
public static String a(String str) {
int lastIndexOf;
int indexOf;
int i2;
int indexOf2;
File file;
byte[] e;
if (g.x() && (lastIndexOf = str.lastIndexOf(47)) > 0 && (indexOf = str.indexOf(95, lastIndexOf)) > lastIndexOf && (indexOf2 = str.indexOf(95, (i2 = indexOf + 1))) > indexOf) {
String d2 = com.uc.crashsdk.a.g.d("CrashSDK" + str.substring(lastIndexOf + 1, indexOf) + str.substring(i2, indexOf2));
if (d2 == null || (e = com.uc.crashsdk.a.g.e((file = new File(str)))) == null || e.length <= 0) {
return str;
}
byte[] bArr = null;
try {
bArr = com.uc.crashsdk.a.c.b(e, d2.substring(0, 16).getBytes());
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
if (bArr == null) {
return str;
}
String str2 = str + ".ec";
File file2 = new File(str2 + DefaultDiskStorage.FileType.TEMP);
if (com.uc.crashsdk.a.g.a(file2, bArr)) {
if (!file2.renameTo(new File(str2))) {
file2.delete();
return str;
}
file.delete();
return str2;
}
return str;
}
return str;
}
public static void a(Throwable th, OutputStream outputStream) {
if (outputStream != null) {
try {
outputStream.write("[DEBUG] CrashHandler occurred new exception:\n".getBytes("UTF-8"));
th.printStackTrace(new PrintStream(outputStream));
outputStream.write("\n\n".getBytes("UTF-8"));
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
}
}
com.uc.crashsdk.a.g.a(th);
}
private static void a(String str, boolean z2, boolean z3) {
int i2;
boolean z4;
boolean z5;
int i3;
String path;
String b2;
File a2;
int i4;
String str2;
String str3;
int i5;
File file;
boolean z6;
com.uc.crashsdk.a.a.a("crashsdk", "crashsdk uploading logs");
synchronized (n) {
try {
if (com.uc.crashsdk.a.g.b(str)) {
String X2 = g.X();
File file2 = new File(X2);
if (file2.exists()) {
File[] listFiles = file2.listFiles();
if (listFiles == null) {
com.uc.crashsdk.a.a.b("List folder failed: " + X2);
} else {
int length = listFiles.length;
int i6 = 0;
int i7 = 0;
int i8 = 0;
int i9 = 0;
int i10 = 0;
int i11 = 0;
int i12 = 0;
int i13 = 0;
int i14 = 0;
boolean z7 = false;
boolean z8 = false;
boolean z9 = false;
while (true) {
if (i6 >= length) {
i2 = i9;
z4 = z7;
z5 = z8;
break;
}
File file3 = listFiles[i6];
File[] fileArr = listFiles;
if (file3.isFile()) {
String name = file3.getName();
if (!name.endsWith(DefaultDiskStorage.FileType.TEMP)) {
i3 = length;
z4 = z7;
z5 = z8;
if (file3.length() == 0) {
i7++;
com.uc.crashsdk.a.g.a(file3);
} else {
if (z2) {
long currentTimeMillis = (System.currentTimeMillis() - file3.lastModified()) / 1000;
if (currentTimeMillis < 0 || (currentTimeMillis >= 2 && (currentTimeMillis >= 5 || !file3.getName().endsWith(".log")))) {
z6 = true;
com.uc.crashsdk.a.a.a(String.format(Locale.US, "file: %s, modify interval: %d s, safe upload: %s", file3.getName(), Long.valueOf(currentTimeMillis), Boolean.valueOf(z6)));
if (!z6) {
i9++;
}
}
z6 = false;
com.uc.crashsdk.a.a.a(String.format(Locale.US, "file: %s, modify interval: %d s, safe upload: %s", file3.getName(), Long.valueOf(currentTimeMillis), Boolean.valueOf(z6)));
if (!z6) {
}
}
try {
} catch (Throwable th) {
th = th;
i2 = i9;
}
if (g.k()) {
Matcher matcher = Pattern.compile("([^_]+)_([^_]+)_([^_]+)\\.crashsdk").matcher(file3.getName());
if (matcher.matches()) {
i2 = i9;
try {
file = new File(g.X() + String.format(Locale.US, "%s%s_%s_%s.%s", j(matcher.group(2)), n(), Q(), matcher.group(1), matcher.group(3)));
com.uc.crashsdk.a.a.a("crashsdk", "File " + file3.getPath() + " matches, rename to " + file.getPath());
file3.renameTo(file);
if (file != file3) {
i13++;
}
file3 = file;
} catch (Throwable th2) {
th = th2;
com.uc.crashsdk.a.g.a(th);
path = file3.getPath();
boolean[] n2 = n(path);
b2 = b(path, n2[0], n2[1]);
if (path != b2) {
}
a2 = com.uc.crashsdk.d.a(file3);
if (a2 == null) {
}
if (a2 == null) {
}
z8 = z5;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
path = file3.getPath();
boolean[] n22 = n(path);
b2 = b(path, n22[0], n22[1]);
if (path != b2) {
if (n22[0]) {
i12++;
}
if (n22[1]) {
i10++;
}
file3 = new File(b2);
}
a2 = com.uc.crashsdk.d.a(file3);
if (a2 == null) {
a2 = null;
} else if (file3 != a2 && !file3.getName().equals(a2.getName()) && file3.exists()) {
file3.delete();
}
if (a2 == null) {
com.uc.crashsdk.a.a.b("onBeforeUploadLog return null, skip upload: " + file3.getAbsolutePath());
} else {
int B2 = g.B();
if (B2 <= 0 || a2.length() < B2) {
d dVar = new d((byte) 0);
dVar.b = 0L;
dVar.a = System.currentTimeMillis();
String U2 = U();
if (new File(U2).exists()) {
a(U2, new com.uc.crashsdk.a.e(451, new Object[]{U2, dVar}));
}
long C2 = g.C();
int D2 = g.D();
int E2 = g.E();
if (C2 >= 0) {
i4 = i10;
if (dVar.b + a2.length() > C2) {
dVar.e = true;
str2 = "Reach max upload bytes: " + C2;
com.uc.crashsdk.a.a.b(str2);
if (!dVar.e) {
i10 = i4;
z8 = z5;
z4 = true;
} else if (dVar.g) {
i10 = i4;
z8 = true;
} else if (dVar.f) {
i10 = i4;
z8 = z5;
z9 = true;
} else {
String name2 = a2.getName();
if (name2.startsWith(P())) {
String[] split = name2.split("_", 10);
if (split.length == 9) {
str3 = split[1];
boolean z10 = str3 == null && str3.equals(g.T());
if (com.uc.crashsdk.a.c.a(a2, a2.getName(), str)) {
i14++;
if (z10) {
f.a(14);
}
i5 = 3;
} else {
com.uc.crashsdk.a.a.a("crashsdk", "Uploaded log: " + a2.getName(), null);
if (z10) {
f.a(13);
}
dVar.b += a2.length();
if (b(a2)) {
dVar.c++;
} else {
dVar.d++;
}
String U3 = U();
a(U3, new com.uc.crashsdk.a.e(452, new Object[]{U3, dVar}));
a2.delete();
i5 = 3;
i14 = 0;
}
if (i14 < i5) {
com.uc.crashsdk.a.a.a("crashsdk", "Upload failed 3 times continuously, abort upload!", null);
i10 = i4;
break;
}
i10 = i4;
z8 = z5;
}
}
str3 = null;
if (str3 == null) {
}
if (com.uc.crashsdk.a.c.a(a2, a2.getName(), str)) {
}
if (i14 < i5) {
}
}
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
} else {
i4 = i10;
}
if (!g.f()) {
if (b(a2)) {
if (D2 >= 0 && dVar.c >= D2) {
dVar.g = true;
str2 = "Reach max upload builtin log count: " + D2;
com.uc.crashsdk.a.a.b(str2);
}
} else if (E2 >= 0 && dVar.d >= E2) {
dVar.f = true;
str2 = "Reach max upload custom log count: " + E2;
com.uc.crashsdk.a.a.b(str2);
}
}
if (!dVar.e) {
}
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
} else {
i11++;
com.uc.crashsdk.a.g.a(a2);
}
}
z8 = z5;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
}
i2 = i9;
file = file3;
if (file != file3) {
}
file3 = file;
path = file3.getPath();
boolean[] n222 = n(path);
b2 = b(path, n222[0], n222[1]);
if (path != b2) {
}
a2 = com.uc.crashsdk.d.a(file3);
if (a2 == null) {
}
if (a2 == null) {
}
z8 = z5;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
i2 = i9;
z8 = z5;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
} else if ((System.currentTimeMillis() - file3.lastModified()) / 1000 > 30) {
i3 = length;
com.uc.crashsdk.a.a.b("delete legacy tmp file: " + name);
i8++;
com.uc.crashsdk.a.g.a(file3);
i2 = i9;
z4 = z7;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
} else {
com.uc.crashsdk.a.g.a(file3);
}
i3 = length;
i2 = i9;
z4 = z7;
i6++;
listFiles = fileArr;
length = i3;
z7 = z4;
i9 = i2;
}
if (i8 > 0) {
f.a(200, i8);
}
if (i7 > 0) {
f.a(15, i7);
}
if (i11 > 0) {
f.a(17, i11);
}
if (z4) {
f.a(19);
}
if (z5) {
f.a(20);
}
if (z9) {
f.a(21);
}
if (z4 || z5 || z9) {
f.a(18);
}
if (i12 > 0) {
f.a(24, i12);
}
if (i10 > 0) {
f.a(201, i10);
}
if (i13 > 0) {
f.a(25, i13);
}
if (i2 > 0) {
f.a(26, i2);
}
}
} else {
com.uc.crashsdk.a.a.a("crashsdk", "Folder not exist: " + X2);
}
} else {
com.uc.crashsdk.a.a.a("crashsdk", "upload url is empty!");
}
if (z3) {
o.open();
}
} catch (Throwable th3) {
throw th3;
}
}
}
public static boolean i() {
return d;
}
public static boolean a(boolean z2, boolean z3) {
if (!d) {
if (com.uc.crashsdk.b.d) {
JNIBridge.set(1, true);
}
d = true;
}
try {
String k2 = k();
if (com.uc.crashsdk.a.g.a(k2)) {
com.uc.crashsdk.a.a.a("crashsdk", "CrashHandler url is empty!");
return false;
}
if (com.uc.crashsdk.a.f.a(z2 ? 1 : 0, new com.uc.crashsdk.a.e(406, new Object[]{k2, Boolean.valueOf(z3), Boolean.valueOf(z2)})) && z2) {
ConditionVariable conditionVariable = o;
conditionVariable.close();
if (!conditionVariable.block(3000L)) {
com.uc.crashsdk.a.a.a("crashsdk", "timeout to wait for uploading");
return false;
}
}
return true;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return false;
}
}
public static void b(boolean z2) {
try {
boolean z3 = g.r() && com.uc.crashsdk.b.F() && !d;
if (!z3) {
z3 = g.s();
}
if (z3) {
if (z2) {
String k2 = k();
if (com.uc.crashsdk.a.g.a(k2)) {
return;
}
j();
a(k2, false, false);
return;
}
a(true, false);
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
public static void j() {
try {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(StrictMode.getThreadPolicy()).permitNetwork().build());
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
private static String U() {
return g.W() + HTTP.CONTENT_RANGE_BYTES;
}
private static boolean a(String str, com.uc.crashsdk.a.e eVar) {
boolean z2;
FileChannel fileChannel;
Exception e;
synchronized (p) {
File file = new File(str);
if (!file.exists()) {
try {
file.createNewFile();
} catch (Exception e2) {
com.uc.crashsdk.a.g.a(e2);
}
}
?? r5 = 0;
r5 = null;
FileLock lock = null;
z2 = false;
try {
try {
try {
fileChannel = new RandomAccessFile(file, "rw").getChannel();
} catch (Throwable th) {
th = th;
r5 = file;
com.uc.crashsdk.a.g.a((Closeable) r5);
throw th;
}
} catch (Exception e3) {
try {
com.uc.crashsdk.a.g.a(e3);
fileChannel = null;
} catch (Exception e4) {
fileChannel = null;
e = e4;
com.uc.crashsdk.a.g.a(e);
com.uc.crashsdk.a.g.a(fileChannel);
return z2;
}
}
if (fileChannel != null) {
try {
lock = fileChannel.lock();
} catch (Exception e5) {
try {
com.uc.crashsdk.a.g.a(e5);
} catch (Exception e6) {
e = e6;
com.uc.crashsdk.a.g.a(e);
com.uc.crashsdk.a.g.a(fileChannel);
return z2;
}
}
}
try {
z2 = eVar.a();
com.uc.crashsdk.a.g.a(fileChannel);
} finally {
if (lock != null) {
try {
lock.release();
} catch (Exception e7) {
com.uc.crashsdk.a.g.a(e7);
}
}
}
} catch (Throwable th2) {
th = th2;
}
}
return z2;
}
public static class d {
long a;
long b;
int c;
int d;
boolean e;
boolean f;
boolean g;
private d() {
this.a = 0L;
this.b = 0L;
this.c = 0;
this.d = 0;
this.e = false;
this.f = false;
this.g = false;
}
d(byte b) {
this();
}
}
private static boolean a(String str, d dVar) {
String a2 = com.uc.crashsdk.a.g.a(new File(str), 64, false);
if (a2 == null) {
return false;
}
try {
Matcher matcher = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)").matcher(a2);
if (matcher.find()) {
long parseLong = Long.parseLong(matcher.group(1));
if (System.currentTimeMillis() - parseLong < 86400000) {
dVar.b = Long.parseLong(matcher.group(2));
dVar.c = Integer.parseInt(matcher.group(3));
dVar.d = Integer.parseInt(matcher.group(4));
dVar.a = parseLong;
}
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
return true;
}
private static boolean b(File file) {
int indexOf;
String name = file.getName();
int lastIndexOf = name.lastIndexOf(95);
if (lastIndexOf > 0 && (indexOf = name.indexOf(46, lastIndexOf)) > 0) {
String substring = name.substring(lastIndexOf + 1, indexOf);
return LogType.JAVA_TYPE.equals(substring) || "ucebujava".equals(substring) || LogType.NATIVE_TYPE.equals(substring) || "ucebujni".equals(substring) || LogType.UNEXP_TYPE.equals(substring) || LogType.ANR_TYPE.equals(substring);
}
return false;
}
private static boolean[] n(String str) {
boolean v2 = g.v();
boolean x2 = g.x();
if (v2 || x2) {
if (!str.endsWith(DefaultDiskStorage.FileType.TEMP) && !str.contains(".ec")) {
int lastIndexOf = str.lastIndexOf(File.separatorChar);
if (lastIndexOf < 0) {
lastIndexOf = 0;
}
int i2 = 0;
do {
lastIndexOf = str.indexOf(95, lastIndexOf);
if (lastIndexOf >= 0) {
i2++;
lastIndexOf++;
continue;
}
} while (lastIndexOf >= 0);
if (i2 == 8) {
String w2 = g.w();
if (!str.endsWith(".log")) {
if (!com.uc.crashsdk.a.g.a(w2)) {
}
} else if (!com.uc.crashsdk.a.g.a(w2)) {
}
v2 = false;
}
}
v2 = false;
x2 = false;
}
return new boolean[]{v2, x2};
}
private static String b(String str, boolean z2, boolean z3) {
if (z2) {
try {
str = m(str);
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
if (z3) {
try {
return a(str);
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
return str;
}
}
return str;
}
public static boolean a(StringBuffer stringBuffer, String str, long j2, ArrayList<String> arrayList, ArrayList<String> arrayList2, ArrayList<String> arrayList3, String str2) {
long j3;
boolean z2;
boolean a2;
if (c.get()) {
com.uc.crashsdk.a.a.b("Processing java crash, skip generate custom log: " + str);
return false;
}
boolean z3 = ag || com.uc.crashsdk.b.L();
if (!z3 && !com.uc.crashsdk.a.d.e()) {
com.uc.crashsdk.a.a.c("DEBUG", com.uc.crashsdk.a.d.b());
return false;
} else if (!d(str)) {
com.uc.crashsdk.a.a.d("DEBUG", "custom log sample miss: " + str);
return false;
} else if (aa()) {
com.uc.crashsdk.a.a.b("Processing native crash, skip generate custom log: " + str);
return false;
} else if (stringBuffer == null || str == null) {
return false;
} else {
String str3 = g.X() + k(str);
?? r11 = (j2 & 32) != 0 ? 1 : 0;
if (z3) {
long nativeClientCreateConnection = com.uc.crashsdk.b.d ? JNIBridge.nativeClientCreateConnection(str3, "custom", str, r11) : 0L;
if (nativeClientCreateConnection == 0) {
com.uc.crashsdk.a.a.d("DEBUG", "skip custom log: " + str);
return false;
}
j3 = nativeClientCreateConnection;
} else if (a(h(), str, (boolean) r11)) {
return false;
} else {
g.a();
a(false);
j3 = 0;
}
synchronized (q) {
z2 = r11;
a2 = a(str3, j3, stringBuffer, str, j2, arrayList, arrayList2, arrayList3, str2);
}
if (a2 && !z3) {
b(h(), str, z2);
}
if (j3 != 0) {
JNIBridge.nativeClientCloseConnection(j3);
}
if (a2) {
if (!z3) {
r(str3);
}
if (!z3) {
str3 = a(m(str3));
}
b(str3, str);
if (!z2 || z3) {
return true;
}
try {
a(true, false);
return true;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return true;
}
}
return false;
}
}
public static boolean a(String str, String str2, boolean z2) {
if (o(str2)) {
h.a(str, str2, true, z2);
com.uc.crashsdk.a.a.b(String.format(Locale.US, "Custom log '%s' has reach max count!", str2));
return true;
}
return false;
}
public static void b(String str, String str2, boolean z2) {
h.a(str, str2, false, z2);
}
private static boolean o(String str) {
boolean z2;
boolean z3;
int parseInt;
synchronized (r) {
File file = new File(g.W() + "customlog");
String a2 = com.uc.crashsdk.a.g.a(file, 1024, false);
long currentTimeMillis = System.currentTimeMillis();
StringBuffer stringBuffer = new StringBuffer();
try {
if (a2 != null) {
stringBuffer.append(a2);
Matcher matcher = Pattern.compile("([^\\n\\r\\t\\s]+) (\\d+) (\\d+)").matcher(stringBuffer);
for (int i2 = 0; matcher.find(i2); i2 = matcher.end()) {
if (str.equals(matcher.group(1))) {
long parseLong = Long.parseLong(matcher.group(2));
if (currentTimeMillis - parseLong < 86400000) {
try {
parseInt = Integer.parseInt(matcher.group(3));
} catch (Exception e) {
com.uc.crashsdk.a.g.a(e);
}
int F2 = g.F();
z3 = F2 < 0 && parseInt >= F2;
stringBuffer.replace(matcher.start(), matcher.end(), String.format(Locale.US, "%s %d %d", str, Long.valueOf(parseLong), Integer.valueOf(parseInt + 1)));
z2 = true;
if (!z2) {
stringBuffer.append(String.format(Locale.US, "%s %d 1\n", str, Long.valueOf(currentTimeMillis)));
}
FileWriter fileWriter = null;
FileWriter fileWriter2 = new FileWriter(file);
String stringBuffer2 = stringBuffer.toString();
fileWriter2.write(stringBuffer2, 0, stringBuffer2.length());
com.uc.crashsdk.a.g.a(fileWriter2);
} else {
parseLong = currentTimeMillis;
}
parseInt = 0;
int F22 = g.F();
if (F22 < 0) {
}
stringBuffer.replace(matcher.start(), matcher.end(), String.format(Locale.US, "%s %d %d", str, Long.valueOf(parseLong), Integer.valueOf(parseInt + 1)));
z2 = true;
if (!z2) {
}
FileWriter fileWriter3 = null;
FileWriter fileWriter22 = new FileWriter(file);
String stringBuffer22 = stringBuffer.toString();
fileWriter22.write(stringBuffer22, 0, stringBuffer22.length());
com.uc.crashsdk.a.g.a(fileWriter22);
}
}
}
FileWriter fileWriter222 = new FileWriter(file);
String stringBuffer222 = stringBuffer.toString();
fileWriter222.write(stringBuffer222, 0, stringBuffer222.length());
com.uc.crashsdk.a.g.a(fileWriter222);
} catch (Throwable th) {
th = th;
}
z2 = false;
z3 = false;
if (!z2) {
}
FileWriter fileWriter32 = null;
}
return z3;
}
private static void a(a aVar, String str, long j2) {
String nativeDumpThreads;
String str2 = null;
if (com.uc.crashsdk.b.d) {
try {
aVar.flush();
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
nativeDumpThreads = JNIBridge.nativeDumpThreads(str, j2);
if (ag || nativeDumpThreads == null || nativeDumpThreads.length() >= 512 || !nativeDumpThreads.startsWith("/") || nativeDumpThreads.indexOf(10) >= 0) {
str2 = nativeDumpThreads;
} else {
if (!new File(nativeDumpThreads).exists()) {
str2 = "Can not found " + nativeDumpThreads;
}
String str3 = str2;
str2 = nativeDumpThreads;
nativeDumpThreads = str3;
}
} else {
nativeDumpThreads = "Native not initialized, skip dump!";
}
if (nativeDumpThreads != null) {
try {
aVar.write(nativeDumpThreads.getBytes("UTF-8"));
aVar.write("\n".getBytes("UTF-8"));
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
}
a((OutputStream) aVar);
} else if (str2 != null && !ag) {
b(aVar, str2, 1048576);
File file = new File(str2);
if (file.exists()) {
file.delete();
}
}
try {
aVar.flush();
} catch (Throwable th3) {
com.uc.crashsdk.a.g.a(th3);
}
}
private static boolean a(String str, long j2, StringBuffer stringBuffer, String str2, long j3, ArrayList<String> arrayList, ArrayList<String> arrayList2, ArrayList<String> arrayList3, String str3) {
FileOutputStream fileOutputStream;
a aVar;
if (j2 == 0) {
try {
fileOutputStream = new FileOutputStream(str);
} catch (Throwable th) {
th = th;
fileOutputStream = null;
aVar = null;
com.uc.crashsdk.a.g.a(th);
if (aVar == null) {
}
}
} else {
fileOutputStream = null;
}
try {
aVar = new a(j2, fileOutputStream);
try {
synchronized (s) {
u = str;
if (com.uc.crashsdk.b.d) {
JNIBridge.set(126, u);
}
}
} catch (Throwable th2) {
th = th2;
com.uc.crashsdk.a.g.a(th);
if (aVar == null) {
}
}
} catch (Throwable th3) {
th = th3;
aVar = null;
}
if (aVar == null) {
return false;
}
if ((j3 & 1) != 0) {
try {
b(aVar, str, str2);
} catch (Throwable th4) {
try {
a(th4, aVar);
} finally {
com.uc.crashsdk.a.g.a(aVar);
com.uc.crashsdk.a.g.a(fileOutputStream);
}
}
}
aVar.write(stringBuffer.toString().getBytes());
aVar.write("\n".getBytes("UTF-8"));
aVar.flush();
a((OutputStream) aVar);
if ((j3 & 4) != 0) {
b((OutputStream) aVar);
aVar.flush();
}
if (arrayList != null && arrayList.size() > 0) {
com.uc.crashsdk.a.a(aVar, "UTF-8", arrayList);
}
if (arrayList2 != null && arrayList2.size() > 0) {
com.uc.crashsdk.a.a(aVar, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", arrayList2);
}
if (arrayList3 != null && arrayList3.size() > 0) {
com.uc.crashsdk.a.b(aVar, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", arrayList3);
}
if (str3 != null) {
aVar.flush();
aVar.write("threads dump:\n".getBytes("UTF-8"));
h = false;
w = str3;
a(aVar, str3, j2);
w = null;
h = true;
}
if ((j3 & 8) != 0 && j2 == 0) {
aVar.flush();
aVar.write("all threads dump:\n".getBytes("UTF-8"));
v = true;
a(aVar, "all", 0L);
v = false;
}
if ((j3 & 16) != 0) {
e(aVar);
}
if ((j3 & 2) != 0) {
aVar.a();
a(aVar);
}
if (j2 != 0) {
b(aVar);
}
try {
ArrayList<String> arrayList4 = s;
synchronized (arrayList4) {
t++;
String str4 = u;
if (str4 != null) {
arrayList4.add(str4);
if (arrayList4.size() > 3) {
arrayList4.remove(0);
}
if (com.uc.crashsdk.b.d) {
JNIBridge.set(127, u);
}
u = null;
}
if (com.uc.crashsdk.b.d) {
JNIBridge.set(25, t);
}
}
} catch (Throwable th5) {
com.uc.crashsdk.a.g.a(th5);
}
return true;
}
public static String k() {
String str = x;
if (com.uc.crashsdk.a.g.a(str)) {
synchronized (y) {
str = com.uc.crashsdk.a.g.a(com.uc.crashsdk.b.i(), g.y(), true);
x = str;
}
}
return str;
}
public static void b(String str) {
synchronized (y) {
x = str;
com.uc.crashsdk.a.b.a(com.uc.crashsdk.b.i(), str + "\n");
}
}
public static void l() {
synchronized (y) {
x = null;
}
}
public static void c(String str) {
synchronized (z) {
String l2 = com.uc.crashsdk.b.l();
com.uc.crashsdk.a.b.a(l2, str + "\n");
}
}
public static boolean d(String str) {
if (ag) {
return true;
}
try {
return p(str);
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return true;
}
}
private static boolean p(String str) {
boolean z2;
boolean z3;
int i2;
Integer num;
synchronized (z) {
z2 = false;
if (A == null) {
A = q(com.uc.crashsdk.a.g.a(com.uc.crashsdk.b.l(), "all:1", false));
}
if (A.containsKey("all")) {
num = A.get("all");
} else if (A.containsKey(str)) {
num = A.get(str);
} else {
if (!LogType.JAVA_TYPE.equals(str) && !LogType.NATIVE_TYPE.equals(str) && !LogType.ANR_TYPE.equals(str) && !LogType.UNEXP_TYPE.equals(str)) {
z3 = false;
if (!z3 && A.containsKey("crash")) {
num = A.get("crash");
} else if (z3 && A.containsKey("nocrash")) {
num = A.get("nocrash");
} else if (A.containsKey("other")) {
i2 = 1;
if (i2 != 0) {
long j2 = i2;
if (j2 < 0) {
long j3 = 30;
if (j2 == -2) {
j3 = 7;
} else if (j2 == -3) {
j3 = 15;
} else if (j2 == -4) {
j3 = 60;
}
long b2 = com.uc.crashsdk.a.b();
long currentTimeMillis = b2 == 0 ? -1L : (System.currentTimeMillis() - b2) / 86400000;
j2 = currentTimeMillis <= j3 ? 1L : currentTimeMillis - j3;
}
if (j2 != 1) {
if (j2 > 0) {
if (System.currentTimeMillis() % j2 == 0) {
}
}
}
z2 = true;
}
} else {
num = A.get("other");
}
}
z3 = true;
if (!z3) {
}
if (z3) {
}
if (A.containsKey("other")) {
}
}
i2 = num.intValue();
if (i2 != 0) {
}
}
return z2;
}
private static Map<String, Integer> q(String str) {
HashMap hashMap = new HashMap();
for (String str2 : str.split("\\|", 30)) {
String[] split = str2.split(":", 3);
if (split.length == 2) {
String trim = split[0].trim();
if (!com.uc.crashsdk.a.g.a(trim)) {
int i2 = 1;
try {
i2 = Integer.parseInt(split[1].trim(), 10);
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
hashMap.put(trim, Integer.valueOf(i2));
}
}
}
return hashMap;
}
public static void m() {
if (ag) {
return;
}
com.uc.crashsdk.a.f.a(1, new com.uc.crashsdk.a.e(411), 1000L);
}
public static String n() {
return a(new Date());
}
private static String a(Date date) {
return String.format(Locale.US, "%d%02d%02d%02d%02d%02d", Integer.valueOf(date.getYear() + SSDP.PORT), Integer.valueOf(date.getMonth() + 1), Integer.valueOf(date.getDate()), Integer.valueOf(date.getHours()), Integer.valueOf(date.getMinutes()), Integer.valueOf(date.getSeconds()));
}
public static void o() {
b = System.currentTimeMillis();
}
private static void r(String str) {
if (g.q()) {
try {
ab();
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
if (str == null || "".equals(str)) {
return;
}
try {
File file = new File(g.Y());
if (!file.exists()) {
file.mkdirs();
}
com.uc.crashsdk.a.a.a("crashsdk", "copy log to: " + file);
com.uc.crashsdk.a.g.a(new File(str), file);
} catch (Throwable th2) {
com.uc.crashsdk.a.g.a(th2);
}
}
}
private static void b(String str, String str2) {
try {
com.uc.crashsdk.d.a(str, h(), str2);
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
public static void p() {
String str;
Throwable th;
if (com.uc.crashsdk.a.g.a(B)) {
String str2 = null;
try {
File file = new File(g.W() + "unique");
if (file.exists()) {
str = com.uc.crashsdk.a.g.a(file, 48, false);
try {
if (str != null) {
try {
if (str.length() == 36) {
str2 = str.replaceAll("[^0-9a-zA-Z-]", "-");
}
} catch (Exception e) {
com.uc.crashsdk.a.g.a(e);
}
}
str2 = str;
} catch (Throwable th2) {
th = th2;
com.uc.crashsdk.a.g.a(th);
str2 = str;
B = str2;
}
}
if (com.uc.crashsdk.a.g.a(str2)) {
com.uc.crashsdk.b.G();
str2 = UUID.randomUUID().toString();
if (!com.uc.crashsdk.a.g.a(str2)) {
com.uc.crashsdk.a.g.a(file, str2.getBytes());
}
}
} catch (Throwable th3) {
str = str2;
th = th3;
}
B = str2;
}
}
public static String q() {
return B;
}
private static String s(String str) {
return String.format("$^%s^$", str);
}
public static void a(OutputStream outputStream, String str, String str2, int i2, boolean z2, boolean z3) {
h = false;
try {
Locale locale = Locale.US;
Object[] objArr = new Object[5];
objArr[0] = str;
objArr[1] = str2;
objArr[2] = Integer.valueOf(i2);
objArr[3] = Integer.valueOf(z2 ? 1 : 0);
objArr[4] = Integer.valueOf(z3 ? 1 : 0);
outputStream.write(String.format(locale, "$^%s`%s`%d`%d,%d^$", objArr).getBytes("UTF-8"));
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
h = true;
a(outputStream);
}
public static void a(OutputStream outputStream, String str, String str2) {
h = false;
try {
outputStream.write(String.format(Locale.US, "$^%s`%s^$", str, str2).getBytes("UTF-8"));
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
h = true;
}
public static class c extends BroadcastReceiver {
private c() {
}
c(byte b) {
this();
}
@Override
public final void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if ("android.intent.action.BATTERY_CHANGED".equals(action)) {
int unused = e.C = intent.getIntExtra(MediaFormatExtraConstants.KEY_LEVEL, -1);
int unused2 = e.D = intent.getIntExtra("scale", -1);
int unused3 = e.E = intent.getIntExtra("voltage", -1);
int unused4 = e.F = intent.getIntExtra("health", -1);
int unused5 = e.G = intent.getIntExtra("plugged", -1);
int unused6 = e.H = intent.getIntExtra("status", -1);
int unused7 = e.I = intent.getIntExtra("temperature", -1);
String unused8 = e.J = intent.getStringExtra("technology");
if (e.J() >= 2) {
e.K();
e.L();
}
} else if ("android.intent.action.BATTERY_LOW".equals(action) || "android.intent.action.BATTERY_OKAY".equals(action)) {
boolean unused9 = e.K = "android.intent.action.BATTERY_LOW".equals(action);
e.K();
} else if ("android.intent.action.ANR".equals(action)) {
try {
e.d(context);
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
}
}
private static boolean V() {
return Build.VERSION.SDK_INT < 29;
}
public static void a(Context context) {
try {
if (V()) {
context.registerReceiver(new c((byte) 0), new IntentFilter("android.intent.action.ANR"), null, com.uc.crashsdk.a.f.a(3));
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
public static boolean d(Context context) {
List<ActivityManager.ProcessErrorStateInfo> processesInErrorState;
ActivityManager activityManager = (ActivityManager) context.getSystemService(PushConstants.INTENT_ACTIVITY_NAME);
boolean z2 = false;
if (activityManager == null || (processesInErrorState = activityManager.getProcessesInErrorState()) == null) {
return false;
}
int myPid = Process.myPid();
Iterator<ActivityManager.ProcessErrorStateInfo> it = processesInErrorState.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
ActivityManager.ProcessErrorStateInfo next = it.next();
if (next.pid == myPid) {
O = true;
if (O()) {
com.uc.crashsdk.a.a.d("crashsdk", "ANR occurred in process: " + next.processName);
}
if (com.uc.crashsdk.b.d) {
JNIBridge.set((int) SJISContextAnalysis.HIRAGANA_HIGHBYTE, next.longMsg);
}
z2 = true;
}
}
if (!z2 && com.uc.crashsdk.b.d) {
W();
}
return true;
}
private static void W() {
if (O || com.uc.crashsdk.b.F() || com.uc.crashsdk.b.L()) {
return;
}
JNIBridge.cmd(18);
}
public static void r() {
O = false;
if (!com.uc.crashsdk.b.B()) {
com.uc.crashsdk.a.f.a(3, new com.uc.crashsdk.a.e(HTTPStatus.INVALID_RANGE), 11000L);
}
if (V()) {
return;
}
N = 0;
X();
}
private static void X() {
com.uc.crashsdk.a.f.a(3, new com.uc.crashsdk.a.e(414), 1000L);
}
private static StringBuilder Y() {
String str;
try {
StringBuilder sb = new StringBuilder();
sb.append("level: ");
sb.append(C);
sb.append("\n");
sb.append("scale: ");
sb.append(D);
sb.append("\n");
switch (F) {
case 1:
str = " (Unknown)";
break;
case 2:
str = " (Good)";
break;
case 3:
str = " (Overheat)";
break;
case 4:
str = " (Dead)";
break;
case 5:
str = " (Over voltage)";
break;
case 6:
str = " (Unspecified failure)";
break;
case 7:
str = " (Cold)";
break;
default:
str = " (?)";
break;
}
sb.append("health: ");
sb.append(F);
sb.append(str);
sb.append("\n");
int i2 = G;
String str2 = i2 != 0 ? i2 != 1 ? i2 != 2 ? i2 != 4 ? " (?)" : " (Wireless)" : " (USB port)" : " (AC charger)" : " (None)";
sb.append("pluged: ");
sb.append(G);
sb.append(str2);
sb.append("\n");
int i3 = H;
String str3 = i3 != 1 ? i3 != 2 ? i3 != 3 ? i3 != 4 ? i3 != 5 ? " (?)" : " (Full)" : " (Not charging)" : " (Discharging)" : " (Charging)" : " (Unknown)";
sb.append("status: ");
sb.append(H);
sb.append(str3);
sb.append("\n");
sb.append("voltage: ");
sb.append(E);
sb.append("\n");
sb.append("temperature: ");
sb.append(I);
sb.append("\n");
sb.append("technology: ");
sb.append(J);
sb.append("\n");
sb.append("battery low: ");
sb.append(K);
sb.append("\n");
return sb;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return null;
}
}
private static void Z() {
if (com.uc.crashsdk.b.c && L && com.uc.crashsdk.a.c) {
L = false;
if (com.uc.crashsdk.a.f.b(P)) {
return;
}
com.uc.crashsdk.a.f.a(0, P, 2000L);
}
}
public static void b(Context context) {
if (g.M()) {
try {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.BATTERY_CHANGED");
intentFilter.addAction("android.intent.action.BATTERY_LOW");
intentFilter.addAction("android.intent.action.BATTERY_OKAY");
context.registerReceiver(Q, intentFilter, null, com.uc.crashsdk.a.f.a(1));
R = true;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
}
public static void c(boolean z2) {
boolean z3 = true;
if (!R ? !z2 || !g.M() : z2 && g.M()) {
z3 = false;
}
if (z3) {
com.uc.crashsdk.a.e eVar = S;
if (com.uc.crashsdk.a.f.b(eVar)) {
com.uc.crashsdk.a.f.a(eVar);
}
com.uc.crashsdk.a.f.a(0, eVar, 3000L);
}
}
public static void s() {
T = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new e());
}
public static void t() {
Thread.setDefaultUncaughtExceptionHandler(T);
}
@Override
public void uncaughtException(Thread thread, Throwable th) {
a(thread, th, false);
}
private static boolean aa() {
return com.uc.crashsdk.b.d && JNIBridge.nativeIsCrashing();
}
public static boolean u() {
return c.get() || aa();
}
public final void a(Thread thread, Throwable th, boolean z2) {
boolean z3;
long j2;
boolean z4;
boolean i2;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
Throwable th2;
boolean z5;
boolean i3;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler2;
boolean z6;
String str;
long nativeClientCreateConnection;
boolean z7;
boolean i4;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler3;
boolean z8;
boolean i5;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler4;
Throwable th3;
boolean z9;
boolean i6;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler5;
File file;
boolean z10;
boolean i7;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler6;
boolean z11;
boolean i8;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler7;
boolean z12;
boolean i9;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler8;
boolean z13;
boolean i10;
Thread.UncaughtExceptionHandler uncaughtExceptionHandler9;
boolean z14 = (ag && com.uc.crashsdk.b.d) || com.uc.crashsdk.b.L();
try {
j2 = 4;
if (!c.getAndSet(true) || Process.myPid() <= 0) {
U = th;
if (z14 || com.uc.crashsdk.a.d.e()) {
com.uc.crashsdk.a.a.d("DEBUG", "encryptLog: " + g.x() + ", zipCrashLog: " + g.x());
if (g.a != null) {
com.uc.crashsdk.a.a.d("DEBUG", "the set zip log to false stack is:");
g.a.printStackTrace();
}
if (g.b != null) {
com.uc.crashsdk.a.a.d("DEBUG", "the set encrypt to true stack is:");
g.b.printStackTrace();
}
com.uc.crashsdk.a.a.d("DEBUG", "begin to generate java report");
N();
try {
z6 = g.t();
try {
String g2 = g.g();
if (g2 == null || g2.equals("")) {
g2 = k(S());
}
str = g.X() + g2;
z3 = false;
} catch (Throwable th4) {
th = th4;
com.uc.crashsdk.a.a.d("DEBUG", "get java log name failed: " + th);
a(th);
com.uc.crashsdk.a.a.d("DEBUG", "original exception is: " + th);
a(th);
str = null;
z3 = true;
try {
if (z14) {
}
boolean z15 = th instanceof OutOfMemoryError;
a(th, str, nativeClientCreateConnection, z15);
com.uc.crashsdk.a.a.d("DEBUG", "generate java report finished");
if (!com.uc.crashsdk.b.L()) {
String name = new File(str).getName();
String Y2 = g.Y();
file = new File(Y2);
if (!file.exists()) {
}
String format = String.format(Locale.US, "%s%s.hprof", Y2, name);
com.uc.crashsdk.a.a.d("DEBUG", "begin dump hprof: " + format);
long currentTimeMillis = System.currentTimeMillis();
Debug.dumpHprofData(format);
com.uc.crashsdk.a.a.d("DEBUG", "end dump hprof, use " + (System.currentTimeMillis() - currentTimeMillis) + " ms");
}
if (nativeClientCreateConnection != 0) {
JNIBridge.nativeClientCloseConnection(nativeClientCreateConnection);
}
if (z2) {
}
z9 = false;
if (!z9) {
}
f.c(false);
i6 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i6);
if (i6) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() <= 0) {
}
} catch (Throwable th5) {
th = th5;
try {
com.uc.crashsdk.a.a.d("DEBUG", "exception occurs while java log: " + th);
a(th);
if (!z3) {
com.uc.crashsdk.a.a.d("DEBUG", "original exception is: " + th);
a(th);
}
if (j2 != 0 && com.uc.crashsdk.b.d) {
JNIBridge.nativeClientCloseConnection(j2);
}
if (z2) {
try {
} catch (Throwable th6) {
th2 = th6;
z5 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z5 = true;
} catch (Throwable th7) {
th2 = th7;
z5 = true;
com.uc.crashsdk.a.g.a(th2);
if (!z5) {
}
f.c(false);
i3 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i3);
if (i3) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z5 && !z14) {
b(false);
}
f.c(false);
i3 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i3 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i3);
if (i3 && (uncaughtExceptionHandler2 = T) != null) {
uncaughtExceptionHandler2.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z5 = false;
if (!z5) {
b(false);
}
f.c(false);
i3 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i3);
if (i3) {
uncaughtExceptionHandler2.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
} catch (Throwable th8) {
if (j2 != 0 && com.uc.crashsdk.b.d) {
JNIBridge.nativeClientCloseConnection(j2);
}
if (z2) {
try {
} catch (Throwable th9) {
th = th9;
z4 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z4 = true;
} catch (Throwable th10) {
th = th10;
z4 = true;
com.uc.crashsdk.a.g.a(th);
if (!z4 && !z14) {
b(false);
}
f.c(false);
i2 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i2 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i2);
if (i2 && (uncaughtExceptionHandler = T) != null) {
uncaughtExceptionHandler.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
}
throw th8;
}
if (!z4) {
b(false);
}
f.c(false);
i2 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i2);
if (i2) {
uncaughtExceptionHandler.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
throw th8;
}
}
z4 = false;
if (!z4) {
}
f.c(false);
i2 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i2);
if (i2) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
throw th8;
}
}
}
} catch (Throwable th11) {
th = th11;
z6 = false;
}
try {
if (z14) {
g.a();
try {
if (com.uc.crashsdk.b.B()) {
f.a(3);
} else {
f.a(4);
}
} catch (Throwable th12) {
com.uc.crashsdk.a.g.a(th12);
}
new File(com.uc.crashsdk.b.b()).createNewFile();
if (z6) {
com.uc.crashsdk.a.a.d("DEBUG", "omit java crash");
if (z2) {
try {
} catch (Throwable th13) {
th = th13;
z11 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z11 = true;
} catch (Throwable th14) {
th = th14;
z11 = true;
com.uc.crashsdk.a.g.a(th);
if (!z11) {
}
f.c(false);
i8 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i8);
if (i8) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z11 && !z14) {
b(false);
}
f.c(false);
i8 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i8 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i8);
if (i8 && (uncaughtExceptionHandler7 = T) != null) {
uncaughtExceptionHandler7.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z11 = false;
if (!z11) {
b(false);
}
f.c(false);
i8 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i8);
if (i8) {
uncaughtExceptionHandler7.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
} else if (d(LogType.JAVA_TYPE)) {
nativeClientCreateConnection = 0;
} else {
com.uc.crashsdk.a.a.d("DEBUG", "java log sample miss");
if (z2) {
try {
} catch (Throwable th15) {
th = th15;
z10 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z10 = true;
} catch (Throwable th16) {
th = th16;
z10 = true;
com.uc.crashsdk.a.g.a(th);
if (!z10) {
}
f.c(false);
i7 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i7);
if (i7) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z10 && !z14) {
b(false);
}
f.c(false);
i7 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i7 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i7);
if (i7 && (uncaughtExceptionHandler6 = T) != null) {
uncaughtExceptionHandler6.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z10 = false;
if (!z10) {
b(false);
}
f.c(false);
i7 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i7);
if (i7) {
uncaughtExceptionHandler6.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
}
} else {
if (z6) {
str = "omit";
com.uc.crashsdk.a.a.d("DEBUG", "omit java crash");
}
nativeClientCreateConnection = com.uc.crashsdk.b.d ? JNIBridge.nativeClientCreateConnection(str, LogType.JAVA_TYPE, null, 0) : 0L;
if (nativeClientCreateConnection == 0) {
com.uc.crashsdk.a.a.d("DEBUG", "skip java crash:");
a(th);
if (nativeClientCreateConnection != 0 && com.uc.crashsdk.b.d) {
JNIBridge.nativeClientCloseConnection(nativeClientCreateConnection);
}
if (z2) {
try {
} catch (Throwable th17) {
th = th17;
z8 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z8 = true;
} catch (Throwable th18) {
th = th18;
z8 = true;
com.uc.crashsdk.a.g.a(th);
if (!z8) {
}
f.c(false);
i5 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i5);
if (i5) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z8 && !z14) {
b(false);
}
f.c(false);
i5 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i5 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i5);
if (i5 && (uncaughtExceptionHandler4 = T) != null) {
uncaughtExceptionHandler4.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z8 = false;
if (!z8) {
b(false);
}
f.c(false);
i5 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i5);
if (i5) {
uncaughtExceptionHandler4.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
} else if (z6) {
if (nativeClientCreateConnection != 0 && com.uc.crashsdk.b.d) {
JNIBridge.nativeClientCloseConnection(nativeClientCreateConnection);
}
if (z2) {
try {
} catch (Throwable th19) {
th = th19;
z7 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z7 = true;
} catch (Throwable th20) {
th = th20;
z7 = true;
com.uc.crashsdk.a.g.a(th);
if (!z7) {
}
f.c(false);
i4 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i4);
if (i4) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z7 && !z14) {
b(false);
}
f.c(false);
i4 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i4 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i4);
if (i4 && (uncaughtExceptionHandler3 = T) != null) {
uncaughtExceptionHandler3.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z7 = false;
if (!z7) {
b(false);
}
f.c(false);
i4 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i4);
if (i4) {
uncaughtExceptionHandler3.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
}
}
boolean z152 = th instanceof OutOfMemoryError;
a(th, str, nativeClientCreateConnection, z152);
com.uc.crashsdk.a.a.d("DEBUG", "generate java report finished");
if (!com.uc.crashsdk.b.L() && z152 && g.j()) {
String name2 = new File(str).getName();
String Y22 = g.Y();
file = new File(Y22);
if (!file.exists()) {
file.mkdirs();
}
String format2 = String.format(Locale.US, "%s%s.hprof", Y22, name2);
com.uc.crashsdk.a.a.d("DEBUG", "begin dump hprof: " + format2);
long currentTimeMillis2 = System.currentTimeMillis();
Debug.dumpHprofData(format2);
com.uc.crashsdk.a.a.d("DEBUG", "end dump hprof, use " + (System.currentTimeMillis() - currentTimeMillis2) + " ms");
}
if (nativeClientCreateConnection != 0 && com.uc.crashsdk.b.d) {
JNIBridge.nativeClientCloseConnection(nativeClientCreateConnection);
}
if (z2) {
try {
} catch (Throwable th21) {
th3 = th21;
z9 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z9 = true;
} catch (Throwable th22) {
th3 = th22;
z9 = true;
com.uc.crashsdk.a.g.a(th3);
if (!z9) {
}
f.c(false);
i6 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i6);
if (i6) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() <= 0) {
}
}
if (!z9 && !z14) {
b(false);
}
f.c(false);
i6 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i6 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i6);
if (i6 && (uncaughtExceptionHandler5 = T) != null) {
uncaughtExceptionHandler5.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() <= 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z9 = false;
if (!z9) {
b(false);
}
f.c(false);
i6 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i6);
if (i6) {
uncaughtExceptionHandler5.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() <= 0) {
}
}
} else {
com.uc.crashsdk.a.a.c("DEBUG", com.uc.crashsdk.a.d.b());
if (z2) {
try {
} catch (Throwable th23) {
th = th23;
z12 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z12 = true;
} catch (Throwable th24) {
th = th24;
z12 = true;
com.uc.crashsdk.a.g.a(th);
if (!z12) {
}
f.c(false);
i9 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i9);
if (i9) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z12 && !z14) {
b(false);
}
f.c(false);
i9 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i9 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i9);
if (i9 && (uncaughtExceptionHandler8 = T) != null) {
uncaughtExceptionHandler8.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z12 = false;
if (!z12) {
b(false);
}
f.c(false);
i9 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i9);
if (i9) {
uncaughtExceptionHandler8.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
}
} else {
com.uc.crashsdk.a.a.d("DEBUG", "another thread is generating java report!");
com.uc.crashsdk.a.a.d("DEBUG", "current thread exception is:");
a(th);
int i11 = 0;
while (!V) {
Thread.sleep(1000L);
i11++;
if (i11 >= 4) {
break;
}
}
Process.killProcess(Process.myPid());
if (z2) {
try {
} catch (Throwable th25) {
th = th25;
z13 = false;
}
if (g.r() && !z14) {
try {
a(true, false);
z13 = true;
} catch (Throwable th26) {
th = th26;
z13 = true;
com.uc.crashsdk.a.g.a(th);
if (!z13) {
}
f.c(false);
i10 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i10);
if (i10) {
}
if (com.uc.crashsdk.b.B()) {
}
V = true;
if (Process.myPid() > 0) {
}
}
if (!z13 && !z14) {
b(false);
}
f.c(false);
i10 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
i10 = true;
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i10);
if (i10 && (uncaughtExceptionHandler9 = T) != null) {
uncaughtExceptionHandler9.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B() && !z14) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
Process.killProcess(Process.myPid());
return;
}
return;
}
}
z13 = false;
if (!z13) {
b(false);
}
f.c(false);
i10 = g.i();
if (!com.uc.crashsdk.a.d.e()) {
}
com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i10);
if (i10) {
uncaughtExceptionHandler9.uncaughtException(thread, th);
}
if (com.uc.crashsdk.b.B()) {
com.uc.crashsdk.b.b(com.uc.crashsdk.a.g.a());
}
V = true;
if (Process.myPid() > 0) {
}
}
} catch (Throwable th27) {
th = th27;
z3 = false;
j2 = 0;
}
}
private static void a(Throwable th) {
try {
com.uc.crashsdk.a.a.d("DEBUG", a(th.getStackTrace(), (String) null).toString());
} catch (Throwable unused) {
}
}
public static Throwable v() {
return U;
}
public static int w() {
if (com.uc.crashsdk.b.I() == 5) {
return Z;
}
return 100;
}
public static void x() {
long o2 = g.o();
if (o2 < 0) {
return;
}
boolean z2 = com.uc.crashsdk.b.I() == 5;
com.uc.crashsdk.a.f.a(0, new com.uc.crashsdk.a.e(401));
if (z2) {
com.uc.crashsdk.a.e eVar = new com.uc.crashsdk.a.e(UPnPStatus.INVALID_ARGS);
X = eVar;
com.uc.crashsdk.a.f.a(0, eVar, o2);
}
}
public static void y() {
if (com.uc.crashsdk.b.c && com.uc.crashsdk.a.c && !com.uc.crashsdk.a.f.b(aa)) {
com.uc.crashsdk.a.f.a(0, aa, 1000L);
}
}
public static boolean z() {
synchronized (Y) {
Runnable runnable = X;
if (runnable == null || W) {
return false;
}
com.uc.crashsdk.a.f.a(runnable);
X = null;
return true;
}
}
public static boolean e(String str) {
try {
if (com.uc.crashsdk.a.g.b(str) && str.startsWith("lib") && str.endsWith(".so")) {
System.loadLibrary(str.substring(3, str.length() - 3));
return true;
}
return false;
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
return false;
}
}
public static void b(int i2) {
com.uc.crashsdk.a.f.a(0, new com.uc.crashsdk.a.e(410), i2 * 1000);
}
private static void ab() {
String Y2 = g.Y();
File file = new File(Y2);
if (file.isDirectory()) {
try {
File[] listFiles = file.listFiles();
if (listFiles != null && listFiles.length > 150) {
Arrays.sort(listFiles, new b((byte) 0));
int length = listFiles.length - 150;
int i2 = length < 0 ? 0 : length;
long currentTimeMillis = System.currentTimeMillis();
int i3 = 0;
int i4 = 0;
while (i3 < listFiles.length) {
File file2 = listFiles[i3];
boolean z2 = i3 < i2;
if (!z2 && currentTimeMillis - file2.lastModified() >= 432000000) {
z2 = true;
}
if (!z2) {
break;
}
file2.delete();
i4++;
if (0 >= 3) {
break;
}
i3++;
}
com.uc.crashsdk.a.a.a("Removed " + i4 + " logs in " + Y2);
}
} catch (Throwable th) {
com.uc.crashsdk.a.g.a(th);
}
}
}
public static void A() {
if (g.q()) {
com.uc.crashsdk.a.f.a(0, new com.uc.crashsdk.a.e(403), Constants.MILLS_OF_EXCEPTION_TIME);
}
}
public static void B() {
if (ac || com.uc.crashsdk.b.L()) {
return;
}
com.uc.crashsdk.a.f.a(1, new com.uc.crashsdk.a.e(408), 1000L);
}
private static void a(Calendar calendar) {
if (g.S()) {
long timeInMillis = calendar.getTimeInMillis();
calendar.add(5, 1);
calendar.set(11, 0);
calendar.set(12, 0);
calendar.set(13, 0);
long timeInMillis2 = calendar.getTimeInMillis();
long j2 = timeInMillis2 - timeInMillis;
com.uc.crashsdk.a.f.a(0, new com.uc.crashsdk.a.e(415, new Object[]{Long.valueOf(timeInMillis2)}), j2 <= 3600000 ? 1000 + j2 : 3600000L);
}
}
public static void C() {
com.uc.crashsdk.a.f.a(1, new com.uc.crashsdk.a.e(409), 7000L);
}
public static void d(boolean z2) {
f.d(false);
if (z2) {
f.a(com.uc.crashsdk.b.c(), false);
h.i();
return;
}
f.a();
h.i();
}
public static int e(boolean z2) {
return f.a(z2);
}
public static int f(boolean z2) {
int b2;
if (z2) {
b2 = f.a(com.uc.crashsdk.b.c()) ? 1 : 0;
} else {
b2 = f.b();
}
int b3 = f.b(z2);
return b3 > b2 ? b3 : b2;
}
public static StringBuilder a(StackTraceElement[] stackTraceElementArr, String str) {
StringBuilder sb = new StringBuilder();
int i2 = 0;
if (stackTraceElementArr != null && stackTraceElementArr.length > 0) {
boolean z2 = str == null;
int i3 = 0;
for (StackTraceElement stackTraceElement : stackTraceElementArr) {
i3++;
sb.append(" at ");
sb.append(stackTraceElement.toString());
sb.append("\n");
if (!z2 && stackTraceElement.getMethodName().contains(str)) {
sb.delete(0, sb.length());
z2 = true;
i3 = 0;
}
}
i2 = i3;
}
if (i2 == 0) {
sb.append(" (no java stack)\n");
}
return sb;
}
public static StringBuilder f(String str) {
return a(Thread.currentThread().getStackTrace(), str);
}
public static void D() {
int N2 = g.N();
boolean z2 = true;
boolean z3 = false;
if (N2 == 0 || N2 == 3 || N2 == 4) {
if (Build.VERSION.SDK_INT >= 21 && Build.VERSION.SDK_INT <= 25) {
boolean z4 = N2 != 0;
if (N2 == 3) {
z4 = System.currentTimeMillis() % 10 == 0;
}
if (N2 != 4) {
z2 = z4;
}
}
}
if (!z2) {
com.uc.crashsdk.a.a.a("crashsdk", "SIG 3 is disabled by settings");
}
boolean L2 = com.uc.crashsdk.b.L();
if (Looper.getMainLooper() == Looper.myLooper() || !z2) {
z3 = z2;
} else {
com.uc.crashsdk.a.f.a(2, new com.uc.crashsdk.a.e(413));
}
JNIBridge.nativeCmd(7, L2 ? 1L : 0L, null, null);
if (z3) {
JNIBridge.cmd(8);
}
}
public static ParcelFileDescriptor E() {
if (!com.uc.crashsdk.b.d) {
com.uc.crashsdk.a.a.d("crashsdk", "Crash so is not loaded!");
return null;
}
synchronized (ad) {
ParcelFileDescriptor parcelFileDescriptor = ae;
if (parcelFileDescriptor != null) {
return parcelFileDescriptor;
}
int cmd = (int) JNIBridge.cmd(14);
if (cmd == -1) {
return null;
}
ParcelFileDescriptor adoptFd = ParcelFileDescriptor.adoptFd(cmd);
ae = adoptFd;
af = true;
return adoptFd;
}
}
public static boolean a(ParcelFileDescriptor parcelFileDescriptor) {
if (af) {
com.uc.crashsdk.a.a.d("crashsdk", "Can not call setHostFd and getHostFd in the same process!");
return false;
} else if (!com.uc.crashsdk.b.d) {
com.uc.crashsdk.a.a.d("crashsdk", "Crash so is not loaded!");
return false;
} else {
if (ae != null) {
com.uc.crashsdk.a.a.c("crashsdk", "Has already set host fd!");
}
ae = parcelFileDescriptor;
int fd = parcelFileDescriptor.getFd();
int nativeCmd = (int) JNIBridge.nativeCmd(13, fd, null, null);
ag = nativeCmd != -1;
return fd == -1 || nativeCmd != -1;
}
}
public static boolean F() {
return ag;
}
public static void G() {
String X2 = g.X();
File file = new File(X2);
if (file.exists() && file.isDirectory()) {
File[] listFiles = file.listFiles();
if (listFiles == null) {
com.uc.crashsdk.a.a.b("Ucebu can not list folder: " + X2);
return;
}
for (File file2 : listFiles) {
if (file2.isFile() && file2.getName().contains("ucebu")) {
a(false, false);
return;
}
}
}
}
}