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.Environment; import android.os.Looper; import android.os.ParcelFileDescriptor; import android.os.Process; import android.os.StatFs; import android.os.StrictMode; import androidx.work.Data; import androidx.work.WorkRequest; import com.applovin.sdk.AppLovinEventTypes; import com.facebook.appevents.AppEventsConstants; import com.facebook.appevents.integrity.IntegrityManager; import com.facebook.internal.FacebookRequestErrorClassification; import com.google.android.gms.common.internal.ImagesContract; import com.google.android.gms.measurement.AppMeasurement; import com.google.logging.type.LogSeverity; import com.intsig.camscanner.attention.PurhcaseUsingCoupon; import com.intsig.scanner.ScannerFormat; import com.microsoft.services.msa.PreferencesConstants; import com.uc.crashsdk.a.f; import com.uc.crashsdk.a.g; import com.uc.crashsdk.a.h; import com.uc.crashsdk.export.LogType; import com.vungle.warren.AdLoader; import io.netty.handler.codec.http.multipart.DiskFileUpload; 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.Set; import java.util.UUID; import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Matcher; import java.util.regex.Pattern; /* compiled from: ProGuard */ public class e implements Thread.UncaughtExceptionHandler { 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 = "?"; 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(FacebookRequestErrorClassification.EC_APP_NOT_INSTALLED); 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; /* renamed from: a reason: collision with root package name */ static final /* synthetic */ boolean f45232a = true; /* renamed from: aa reason: collision with root package name */ private static Runnable f45233aa = new com.uc.crashsdk.a.e(407); /* renamed from: ab reason: collision with root package name */ private static final Object f45234ab = new Object(); /* renamed from: ac reason: collision with root package name */ private static volatile boolean f45235ac = false; private static Object ad = new Object(); private static ParcelFileDescriptor ae = null; private static boolean af = false; private static boolean ag = false; /* renamed from: b reason: collision with root package name */ private static long f45236b; /* renamed from: c reason: collision with root package name */ private static final AtomicBoolean f45237c = new AtomicBoolean(false); /* renamed from: d reason: collision with root package name */ private static boolean f45238d = false; /* renamed from: f reason: collision with root package name */ private static long f45239f = 0; /* renamed from: g reason: collision with root package name */ private static long f45240g = -1; /* renamed from: h reason: collision with root package name */ private static boolean f45241h = true; /* renamed from: i reason: collision with root package name */ private static String f45242i; /* renamed from: j reason: collision with root package name */ private static String f45243j = ""; /* renamed from: k reason: collision with root package name */ private static String f45244k = null; /* renamed from: l reason: collision with root package name */ private static String f45245l = null; /* renamed from: m reason: collision with root package name */ private static String f45246m = null; /* renamed from: n reason: collision with root package name */ private static final Object f45247n = new Object(); /* renamed from: o reason: collision with root package name */ private static final ConditionVariable f45248o = new ConditionVariable(); /* renamed from: p reason: collision with root package name */ private static final Object f45249p = new Object(); /* renamed from: q reason: collision with root package name */ private static final Object f45250q = new Object(); /* renamed from: r reason: collision with root package name */ private static final Object f45251r = new Object(); /* renamed from: s reason: collision with root package name */ private static final ArrayList<String> f45252s = new ArrayList<>(); /* renamed from: t reason: collision with root package name */ private static int f45253t = 0; /* renamed from: u reason: collision with root package name */ private static String f45254u = null; /* renamed from: v reason: collision with root package name */ private static boolean f45255v = false; /* renamed from: w reason: collision with root package name */ private static String f45256w = null; /* renamed from: x reason: collision with root package name */ private static String f45257x = null; /* renamed from: y reason: collision with root package name */ private static final Object f45258y = new Object(); /* renamed from: z reason: collision with root package name */ private static final Object f45259z = new Object(); /* renamed from: e reason: collision with root package name */ private final List<FileInputStream> f45260e = new ArrayList(); /* access modifiers changed from: private */ /* compiled from: ProGuard */ public static class a extends OutputStream { /* renamed from: a reason: collision with root package name */ private final long f45261a; /* renamed from: b reason: collision with root package name */ private final OutputStream f45262b; /* renamed from: c reason: collision with root package name */ private int f45263c = 0; /* renamed from: d reason: collision with root package name */ private int f45264d = 0; /* renamed from: e reason: collision with root package name */ private boolean f45265e = false; a(long j2, OutputStream outputStream) { this.f45261a = j2; this.f45262b = outputStream; } /* JADX WARNING: Removed duplicated region for block: B:11:0x0027 */ /* JADX WARNING: Removed duplicated region for block: B:12:0x0030 */ /* JADX WARNING: Removed duplicated region for block: B:14:0x0037 */ private int a(byte[] bArr, int i10, int i11) { int i12; this.f45264d += i11; if (this.f45265e) { return 0; } int y6 = g.y(); if (y6 > 0) { int i13 = this.f45263c; if (i13 + i11 > y6) { i12 = y6 - i13; this.f45263c += i12; if (this.f45261a == 0) { b(new String(bArr, i10, i12)); } else { this.f45262b.write(bArr, i10, i12); } if (i12 < i11) { this.f45265e = true; } return i12; } } i12 = i11; this.f45263c += i12; if (this.f45261a == 0) { } if (i12 < i11) { } return i12; } private void b(String str) { if (b.f45200d) { JNIBridge.nativeClientWriteData(this.f45261a, str); } } /* access modifiers changed from: package-private */ public final void a() { try { if (this.f45264d - this.f45263c > 0) { a("\n"); a("--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n"); } int y6 = g.y(); a(String.format(Locale.US, "Full: %d bytes, write: %d bytes, limit: %d bytes, reject: %d bytes.\n", Integer.valueOf(this.f45264d), Integer.valueOf(this.f45263c), Integer.valueOf(y6), Integer.valueOf(this.f45264d - this.f45263c))); } catch (Throwable th) { g.a(th); } } /* access modifiers changed from: package-private */ public final void a(String str) { if (e.f45241h && e.O()) { com.uc.crashsdk.a.a.d("DEBUG", str); } if (this.f45261a != 0) { b(str); } else { this.f45262b.write(str.getBytes("UTF-8")); } } @Override // java.io.OutputStream public final void write(int i10) { if (e.f45241h && e.O()) { com.uc.crashsdk.a.a.d("DEBUG", String.format(Locale.US, "%c", Integer.valueOf(i10))); } if (this.f45261a != 0) { b(String.format(Locale.US, "%c", Integer.valueOf(i10))); } else { this.f45262b.write(i10); } this.f45263c++; this.f45264d++; } @Override // java.io.OutputStream public final void write(byte[] bArr) { if (e.f45241h && e.O() && !(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); } @Override // java.io.OutputStream public final void write(byte[] bArr, int i10, int i11) { if (e.f45241h && e.O()) { byte[] bArr2 = new byte[i11]; System.arraycopy(bArr, i10, bArr2, 0, i11); if (!(i11 == 1 && bArr2[0] == 10)) { try { com.uc.crashsdk.a.a.d("DEBUG", new String(bArr2)); } catch (Throwable unused) { } } } a(bArr, i10, i11); } } /* access modifiers changed from: private */ /* compiled from: ProGuard */ public static class b implements Comparator<File> { private b() { } /* synthetic */ b(byte b10) { this(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // java.util.Comparator public final /* synthetic */ 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; } } /* access modifiers changed from: private */ /* compiled from: ProGuard */ public static class c extends BroadcastReceiver { private c() { } /* synthetic */ c(byte b10) { this(); } 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(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1); int unused2 = e.D = intent.getIntExtra(ScannerFormat.TAG_SCALE, -1); int unused3 = e.E = intent.getIntExtra("voltage", -1); int unused4 = e.F = intent.getIntExtra(IntegrityManager.INTEGRITY_TYPE_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(); int unused9 = e.M = 0; } } else if ("android.intent.action.BATTERY_LOW".equals(action) || "android.intent.action.BATTERY_OKAY".equals(action)) { boolean unused10 = 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) { g.a(th); } } } } /* access modifiers changed from: private */ /* compiled from: ProGuard */ public static class d { /* renamed from: a reason: collision with root package name */ long f45266a; /* renamed from: b reason: collision with root package name */ long f45267b; /* renamed from: c reason: collision with root package name */ int f45268c; /* renamed from: d reason: collision with root package name */ int f45269d; /* renamed from: e reason: collision with root package name */ boolean f45270e; /* renamed from: f reason: collision with root package name */ boolean f45271f; /* renamed from: g reason: collision with root package name */ boolean f45272g; private d() { this.f45266a = 0; this.f45267b = 0; this.f45268c = 0; this.f45269d = 0; this.f45270e = false; this.f45271f = false; this.f45272g = false; } /* synthetic */ d(byte b10) { this(); } } public e() { try { M(); } catch (Throwable th) { g.a(th); } } public static void A() { if (g.q()) { f.a(0, new com.uc.crashsdk.a.e(403), WorkRequest.MIN_BACKOFF_MILLIS); } } public static void B() { if (!f45235ac && !b.L()) { f.a(1, new com.uc.crashsdk.a.e(408), 1000); } } static void C() { f.a(1, new com.uc.crashsdk.a.e(409), 7000); } /* JADX WARNING: Code restructure failed: missing block: B:21:0x003f, code lost: if ((java.lang.System.currentTimeMillis() % 3) == 0) goto L_0x0043; */ /* JADX WARNING: Code restructure failed: missing block: B:4:0x000f, code lost: if (r0 == 1) goto L_0x0011; */ /* JADX WARNING: Removed duplicated region for block: B:24:0x0045 */ /* JADX WARNING: Removed duplicated region for block: B:32:0x0071 */ /* JADX WARNING: Removed duplicated region for block: B:34:? A[RETURN, SYNTHETIC] */ public static void D() { int L2 = g.L(); boolean z10 = true; boolean z11 = false; if (L2 == 0 || L2 == 3 || L2 == 4) { int i10 = Build.VERSION.SDK_INT; if (i10 >= 21 && i10 <= 25) { boolean z12 = L2 != 0; if (L2 == 3) { z12 = System.currentTimeMillis() % 10 == 0; } if (L2 != 4) { z10 = z12; } } if (!z10) { com.uc.crashsdk.a.a.a("crashsdk", "SIG 3 is disabled by settings"); } boolean L3 = b.L(); if (Looper.getMainLooper() != Looper.myLooper() || !z10) { z11 = z10; } else { f.a(2, new com.uc.crashsdk.a.e(413)); } JNIBridge.nativeCmd(7, L3 ? 1 : 0, null, null); if (!z11) { JNIBridge.cmd(8); return; } return; } z10 = false; if (!z10) { } boolean L32 = b.L(); if (Looper.getMainLooper() != Looper.myLooper()) { } z11 = z10; JNIBridge.nativeCmd(7, L32 ? 1 : 0, null, null); if (!z11) { } } public static ParcelFileDescriptor E() { if (!b.f45200d) { 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 F() { return ag; } public static void G() { String V2 = g.V(); File file = new File(V2); if (file.exists() && file.isDirectory()) { File[] listFiles = file.listFiles(); if (listFiles == null) { com.uc.crashsdk.a.a.b("Ucebu can not list folder: " + V2); return; } for (File file2 : listFiles) { if (file2.isFile() && file2.getName().contains("ucebu")) { a(false, false); return; } } } } static /* synthetic */ int J() { int i10 = M + 1; M = i10; return i10; } static /* synthetic */ void K() { StringBuilder Y2; if (b.f45200d && (Y2 = Y()) != null) { JNIBridge.set(125, Y2.toString()); } L = true; Z(); } private void M() { int G2 = g.G(); for (int i10 = 0; i10 < G2; i10++) { try { this.f45260e.add(new FileInputStream("/dev/null")); } catch (Exception e10) { g.a(e10); return; } } } private void N() { for (FileInputStream fileInputStream : this.f45260e) { g.a(fileInputStream); } this.f45260e.clear(); } /* access modifiers changed from: private */ public static boolean O() { if (g.N()) { return true; } return a(); } private static String P() { return g.e() + "_"; } private static String Q() { return b.B() ? "fg" : "bg"; } private static byte[] R() { byte[] bArr = null; int i10 = 1024; while (bArr == null && i10 > 0) { try { bArr = new byte[i10]; } catch (Throwable unused) { i10 /= 2; if (i10 < 16) { break; } } } return bArr; } private static String S() { return (!b.F() || f45238d) ? LogType.JAVA_TYPE : "ucebujava"; } private static void T() { String str; BufferedReader bufferedReader; FileReader fileReader; Throwable th; String str2 = "-"; try { str = Build.HARDWARE; } catch (Throwable th2) { g.a(th2); str = str2; } try { fileReader = new FileReader(new File("/proc/cpuinfo")); try { bufferedReader = new BufferedReader(fileReader, 512); int i10 = 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(); } i10++; } catch (Throwable th3) { th = th3; try { g.a(th); g.a(fileReader); g.a(bufferedReader); f45244k = str; f45245l = str2; } catch (Throwable th4) { g.a(fileReader); g.a(bufferedReader); throw th4; } } } while (i10 < 2); g.a(fileReader); } catch (Throwable th5) { bufferedReader = null; th = th5; g.a(th); g.a(fileReader); g.a(bufferedReader); f45244k = str; f45245l = str2; } } catch (Throwable th6) { bufferedReader = null; th = th6; fileReader = null; g.a(th); g.a(fileReader); g.a(bufferedReader); f45244k = str; f45245l = str2; } g.a(bufferedReader); f45244k = str; f45245l = str2; } private static String U() { return g.U() + "bytes"; } private static boolean V() { return Build.VERSION.SDK_INT < 29; } private static void W() { if (!O && !b.F() && !b.L()) { JNIBridge.cmd(18); } } private static void X() { f.a(3, new com.uc.crashsdk.a.e(414), 1000); } private static StringBuilder Y() { String str; try { StringBuilder sb2 = new StringBuilder(); sb2.append("level: "); sb2.append(C); sb2.append("\n"); sb2.append("scale: "); sb2.append(D); sb2.append("\n"); String str2 = " (Unknown)"; switch (F) { case 1: str = str2; 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; } sb2.append("health: "); sb2.append(F); sb2.append(str); sb2.append("\n"); int i10 = G; String str3 = i10 != 0 ? i10 != 1 ? i10 != 2 ? i10 != 4 ? " (?)" : " (Wireless)" : " (USB port)" : " (AC charger)" : " (None)"; sb2.append("pluged: "); sb2.append(G); sb2.append(str3); sb2.append("\n"); int i11 = H; if (i11 != 1) { str2 = i11 != 2 ? i11 != 3 ? i11 != 4 ? i11 != 5 ? " (?)" : " (Full)" : " (Not charging)" : " (Discharging)" : " (Charging)"; } sb2.append("status: "); sb2.append(H); sb2.append(str2); sb2.append("\n"); sb2.append("voltage: "); sb2.append(E); sb2.append("\n"); sb2.append("temperature: "); sb2.append(I); sb2.append("\n"); sb2.append("technology: "); sb2.append(J); sb2.append("\n"); sb2.append("battery low: "); sb2.append(K); sb2.append("\n"); return sb2; } catch (Throwable th) { g.a(th); return null; } } private static void Z() { if (b.f45199c && L && a.f45116c) { L = false; if (!f.b(P)) { f.a(0, P, AdLoader.RETRY_DELAY); } } } static int a(OutputStream outputStream, String str, int i10) { Throwable th; int i11 = 0; if (str == null) { a(outputStream); return 0; } try { String a10 = com.uc.crashsdk.a.b.a(str); if (a10 == null) { a10 = "file: '" + str + "' not found or decode failed!"; } int length = a10.length(); if (length <= i10 + 32) { i10 = length; } if (i10 > 0) { try { outputStream.write(a10.getBytes("UTF-8"), 0, i10); outputStream.write("\n".getBytes("UTF-8")); } catch (Throwable th2) { th = th2; i11 = i10; a(th, outputStream); i10 = i11; a(outputStream); return i10; } } if (i10 < a10.length()) { outputStream.write(String.format(Locale.US, "(truncated %d bytes)\n", Integer.valueOf(a10.length() - i10)).getBytes("UTF-8")); } } catch (Throwable th3) { th = th3; a(th, outputStream); i10 = i11; a(outputStream); return i10; } a(outputStream); return i10; } 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 0; } return (long) ((Integer) invoke2).intValue(); } catch (Throwable th) { g.a(th); return 0; } } private static BufferedReader a(InputStreamReader inputStreamReader) { BufferedReader bufferedReader = null; int i10 = 8192; while (bufferedReader == null && i10 > 0) { try { bufferedReader = new BufferedReader(inputStreamReader, i10); } catch (Throwable unused) { i10 /= 2; if (i10 < 512) { break; } } } return bufferedReader; } static String a(int i10) { try { String a10 = g.a(new File(String.format(Locale.US, "/proc/%d/cmdline", Integer.valueOf(i10))), 128, false); return g.b(a10) ? l(a10) : "unknown"; } catch (Throwable th) { g.a(th); return "unknown"; } } private static String a(File file) { String str; try { str = file.getCanonicalPath(); } catch (Throwable unused) { str = null; } return g.a(str) ? file.getPath() : str; } static String a(String str) { int lastIndexOf; int indexOf; int i10; int indexOf2; File file; byte[] e10; if (!g.x() || (lastIndexOf = str.lastIndexOf(47)) <= 0 || (indexOf = str.indexOf(95, lastIndexOf)) <= lastIndexOf || (indexOf2 = str.indexOf(95, (i10 = indexOf + 1))) <= indexOf) { return str; } String c9 = g.c("CrashSDK" + str.substring(lastIndexOf + 1, indexOf) + str.substring(i10, indexOf2)); if (c9 == null || (e10 = g.e((file = new File(str)))) == null || e10.length <= 0) { return str; } byte[] bArr = null; try { bArr = com.uc.crashsdk.a.c.b(e10, c9.substring(0, 16).getBytes()); } catch (Throwable th) { g.a(th); } if (bArr == null) { return str; } String str2 = str + ".ec"; File file2 = new File(str2 + DiskFileUpload.postfix); if (!g.a(file2, bArr)) { return str; } if (!file2.renameTo(new File(str2))) { file2.delete(); return str; } file.delete(); return str2; } static String a(String str, String str2) { try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Runtime.getRuntime().exec(Build.VERSION.SDK_INT >= 26 ? new String[]{"ps", "-ef"} : new String[]{"ps"}).getInputStream())); boolean b10 = g.b(str); boolean b11 = g.b(str2); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { return byteArrayOutputStream.toString("UTF-8"); } boolean z10 = true; if ((!b10 || !readLine.contains(str)) && ((!b11 || !readLine.contains(str2)) && (readLine.indexOf(47) >= 0 || readLine.indexOf(46) <= 0))) { z10 = false; } if (z10) { byteArrayOutputStream.write(readLine.getBytes("UTF-8")); byteArrayOutputStream.write("\n".getBytes("UTF-8")); } } } catch (Throwable th) { g.a(th); return "exception exists."; } } /* JADX WARNING: Removed duplicated region for block: B:154:0x02d7 */ /* JADX WARNING: Removed duplicated region for block: B:170:0x0303 */ /* JADX WARNING: Removed duplicated region for block: B:182:0x032a */ /* JADX WARNING: Removed duplicated region for block: B:193:0x0341 */ /* JADX WARNING: Removed duplicated region for block: B:197:0x034e */ /* JADX WARNING: Removed duplicated region for block: B:201:0x0355 A[Catch:{ all -> 0x0365 }] */ /* JADX WARNING: Removed duplicated region for block: B:202:0x035e A[Catch:{ all -> 0x0365 }] */ private static String a(Throwable th, String str, long j2, boolean z10) { FileOutputStream fileOutputStream; Throwable th2; a aVar = null; try { if (!b.L()) { g.a(); a(true); } int i10 = (j2 > 0 ? 1 : (j2 == 0 ? 0 : -1)); fileOutputStream = i10 == 0 ? new FileOutputStream(str) : null; try { a aVar2 = new a(j2, fileOutputStream); try { if (b.f45200d) { JNIBridge.set(126, str); } } catch (Throwable th3) { th2 = th3; aVar = aVar2; try { a(th2, aVar); if (j2 != 0) { } g.a(aVar); g.a(fileOutputStream); if (!ag) { } b(!ag ? a(m(str)) : str, LogType.JAVA_TYPE); return str; } catch (Throwable th4) { if (j2 != 0) { b(aVar); } g.a(aVar); g.a(fileOutputStream); throw th4; } } b(aVar2, str, S()); if (z10) { try { aVar2.flush(); } catch (Throwable th5) { g.a(th5); } } try { aVar2.write(("Process Name: '" + h() + "'\n").getBytes("UTF-8")); aVar2.write(("Thread Name: '" + Thread.currentThread().getName() + "'\n").getBytes("UTF-8")); } catch (Throwable th6) { g.a(th6); } try { aVar2.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 th7) { g.a(th7); } String message = th.getMessage(); if (message != null && !message.equals(th.getLocalizedMessage())) { aVar2.write(("Message: " + message + "\n").getBytes("UTF-8")); } } catch (Throwable th8) { g.a(th8); } try { th.printStackTrace(new PrintStream(aVar2)); } catch (Throwable th9) { g.a(th9); } try { aVar2.write("Back traces ends.\n".getBytes("UTF-8")); } catch (Throwable th10) { g.a(th10); } a((OutputStream) aVar2); try { aVar2.flush(); } catch (Throwable th11) { g.a(th11); } try { a.a(aVar2, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n"); } catch (Throwable th12) { g.a(th12); } if (z10) { try { aVar2.flush(); } catch (Throwable th13) { g.a(th13); } } try { aVar2.write("meminfo:\n".getBytes("UTF-8")); b(aVar2, "/proc/meminfo", (int) Data.MAX_DATA_BYTES); } catch (Throwable th14) { a(th14, aVar2); } try { String format = String.format(Locale.US, "/proc/%d/status", Integer.valueOf(Process.myPid())); aVar2.write("status:\n".getBytes("UTF-8")); b(aVar2, format, (int) Data.MAX_DATA_BYTES); } catch (Throwable th15) { a(th15, aVar2); } try { aVar2.write(("memory info:\n" + g()).getBytes("UTF-8")); } catch (Throwable th16) { a(th16, aVar2); } a((OutputStream) aVar2); g(aVar2); try { a.a(aVar2, "UTF-8", (ArrayList<String>) null); } catch (Throwable th17) { a(th17, aVar2); } if (ag) { f45241h = false; try { aVar2.write(s("JAVADUMPFILES").getBytes("UTF-8")); } catch (Throwable th18) { a(th18, aVar2); } f45241h = true; } try { aVar2.flush(); } catch (Throwable th19) { g.a(th19); } b((OutputStream) aVar2); try { aVar2.flush(); } catch (Throwable th20) { g.a(th20); } try { aVar2.write("battery info:\n".getBytes("UTF-8")); } catch (Throwable th21) { a(th21, aVar2); } try { if (ag) { f45241h = false; aVar2.write(s("BATTERYINFO").getBytes("UTF-8")); f45241h = true; } else { StringBuilder Y2 = Y(); if (Y2 != null) { aVar2.write(Y2.toString().getBytes("UTF-8")); } } } catch (Throwable th22) { a(th22, aVar2); } a((OutputStream) aVar2); c(aVar2); try { aVar2.write("device status:\n".getBytes("UTF-8")); } catch (Throwable th23) { a(th23, aVar2); } if (ag) { try { f45241h = false; aVar2.write(s("DEVICESTATUS").getBytes("UTF-8")); f45241h = true; } catch (Throwable th24) { th = th24; } } else { try { Locale locale = Locale.US; aVar2.write(String.format(locale, "has root: %s\n", Boolean.valueOf(g.e())).getBytes("UTF-8")); String str2 = ""; String str3 = Build.TAGS; if (str3 != null) { str2 = str3; } StringBuilder sb2 = new StringBuilder(); sb2.append("build tags: "); sb2.append(str2); if (g.f()) { sb2.append(" (default root)"); } sb2.append("\n"); aVar2.write(sb2.toString().getBytes("UTF-8")); String h10 = g.h(); if (g.b(h10)) { aVar2.write(String.format(locale, "su binary: %s\n", h10).getBytes("UTF-8")); StringBuilder sb3 = new StringBuilder(); sb3.append("su permission: "); sb3.append(g.g() ? "valid (" : "invalid ("); sb3.append(g.i()); sb3.append(")\n"); aVar2.write(sb3.toString().getBytes("UTF-8")); } } catch (Throwable th25) { th = th25; a(th, aVar2); a((OutputStream) aVar2); d(aVar2); e(aVar2); a.b(aVar2, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", null); if (ag) { } aVar2.flush(); a.a(aVar2, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", null); if (ag) { } aVar2.a(); a(aVar2); aVar2.flush(); if (i10 != 0) { } g.a(aVar2); g.a(fileOutputStream); if (!ag) { } b(!ag ? a(m(str)) : str, LogType.JAVA_TYPE); return str; } } a((OutputStream) aVar2); d(aVar2); e(aVar2); try { a.b(aVar2, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", null); } catch (Throwable th26) { a(th26, aVar2); } if (ag) { f45241h = false; try { aVar2.write(s("JAVACACHEDINFOS").getBytes("UTF-8")); } catch (Throwable th27) { a(th27, aVar2); } f45241h = true; } try { aVar2.flush(); } catch (Throwable th28) { g.a(th28); } try { a.a(aVar2, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", null); } catch (Throwable th29) { a(th29, aVar2); } if (ag) { f45241h = false; try { aVar2.write(s("JAVACALLBACKINFOS").getBytes("UTF-8")); } catch (Throwable th30) { a(th30, aVar2); } f45241h = true; } aVar2.a(); a(aVar2); try { aVar2.flush(); } catch (Throwable th31) { g.a(th31); } if (i10 != 0) { b(aVar2); } g.a(aVar2); } catch (Throwable th32) { th2 = th32; a(th2, aVar); if (j2 != 0) { b(aVar); } g.a(aVar); g.a(fileOutputStream); if (!ag) { } b(!ag ? a(m(str)) : str, LogType.JAVA_TYPE); return str; } } catch (Throwable th33) { th2 = th33; fileOutputStream = null; a(th2, aVar); if (j2 != 0) { } g.a(aVar); g.a(fileOutputStream); if (!ag) { } b(!ag ? a(m(str)) : str, LogType.JAVA_TYPE); return str; } g.a(fileOutputStream); if (!ag) { r(str); } try { b(!ag ? a(m(str)) : str, LogType.JAVA_TYPE); } catch (Throwable th34) { g.a(th34); } return str; } private static String a(Date date) { return String.format(Locale.US, "%d%02d%02d%02d%02d%02d", Integer.valueOf(date.getYear() + 1900), Integer.valueOf(date.getMonth() + 1), Integer.valueOf(date.getDate()), Integer.valueOf(date.getHours()), Integer.valueOf(date.getMinutes()), Integer.valueOf(date.getSeconds())); } static StringBuilder a(StackTraceElement[] stackTraceElementArr, String str) { StringBuilder sb2 = new StringBuilder(); int i10 = 0; if (stackTraceElementArr != null && stackTraceElementArr.length > 0) { boolean z10 = str == null; int i11 = 0; for (StackTraceElement stackTraceElement : stackTraceElementArr) { i11++; sb2.append(" at "); sb2.append(stackTraceElement.toString()); sb2.append("\n"); if (!z10 && stackTraceElement.getMethodName().contains(str)) { sb2.delete(0, sb2.length()); z10 = true; i11 = 0; } } i10 = i11; } if (i10 == 0) { sb2.append(" (no java stack)\n"); } return sb2; } /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */ /* JADX WARNING: Code restructure failed: missing block: B:112:0x0171, code lost: if (com.uc.crashsdk.b.q() != false) goto L_0x01f2; */ /* JADX WARNING: Code restructure failed: missing block: B:114:0x0177, code lost: if (com.uc.crashsdk.a.d.e() != false) goto L_0x0183; */ /* JADX WARNING: Code restructure failed: missing block: B:115:0x0179, code lost: com.uc.crashsdk.a.a.c("DEBUG", com.uc.crashsdk.a.d.b()); */ /* JADX WARNING: Code restructure failed: missing block: B:116:0x0182, code lost: return; */ /* JADX WARNING: Code restructure failed: missing block: B:118:0x0189, code lost: if (d(com.uc.crashsdk.export.LogType.UNEXP_TYPE) != false) goto L_0x0193; */ /* JADX WARNING: Code restructure failed: missing block: B:119:0x018b, code lost: com.uc.crashsdk.a.a.d("DEBUG", "unexp sample miss"); */ /* JADX WARNING: Code restructure failed: missing block: B:120:0x0192, code lost: return; */ /* JADX WARNING: Code restructure failed: missing block: B:121:0x0193, code lost: r8 = com.uc.crashsdk.JNIBridge.nativeGenerateUnexpLog((long) com.uc.crashsdk.g.o(), com.uc.crashsdk.g.p()); */ /* JADX WARNING: Code restructure failed: missing block: B:122:0x01a0, code lost: if (r8 == 0) goto L_0x01ea; */ /* JADX WARNING: Code restructure failed: missing block: B:123:0x01a2, code lost: com.uc.crashsdk.f.a(11); */ /* JADX WARNING: Code restructure failed: missing block: B:124:0x01a9, code lost: if ((r8 & 4352) == 0) goto L_0x01b5; */ /* JADX WARNING: Code restructure failed: missing block: B:125:0x01ab, code lost: com.uc.crashsdk.e.Z = 105; r8 = 30; */ /* JADX WARNING: Code restructure failed: missing block: B:126:0x01b1, code lost: com.uc.crashsdk.f.a(r8); */ /* JADX WARNING: Code restructure failed: missing block: B:128:0x01b7, code lost: if ((r8 & com.uc.crashsdk.export.LogType.UNEXP_EXIT) == 0) goto L_0x01c0; */ /* JADX WARNING: Code restructure failed: missing block: B:129:0x01b9, code lost: com.uc.crashsdk.e.Z = 104; r8 = 31; */ /* JADX WARNING: Code restructure failed: missing block: B:131:0x01c2, code lost: if ((r8 & com.uc.crashsdk.export.LogType.UNEXP_RESTART) == 0) goto L_0x01cb; */ /* JADX WARNING: Code restructure failed: missing block: B:132:0x01c4, code lost: com.uc.crashsdk.e.Z = 106; r8 = 32; */ /* JADX WARNING: Code restructure failed: missing block: B:134:0x01cd, code lost: if ((r8 & com.uc.crashsdk.export.LogType.UNEXP_ANR) == 0) goto L_0x01d7; */ /* JADX WARNING: Code restructure failed: missing block: B:135:0x01cf, code lost: com.uc.crashsdk.e.Z = 103; com.uc.crashsdk.f.a(10); */ /* JADX WARNING: Code restructure failed: missing block: B:137:0x01d9, code lost: if ((r8 & com.uc.crashsdk.export.LogType.UNEXP_LOW_MEMORY) == 0) goto L_0x01e3; */ /* JADX WARNING: Code restructure failed: missing block: B:138:0x01db, code lost: com.uc.crashsdk.e.Z = 107; com.uc.crashsdk.f.a(29); */ /* JADX WARNING: Code restructure failed: missing block: B:139:0x01e3, code lost: com.uc.crashsdk.e.Z = 102; */ /* JADX WARNING: Code restructure failed: missing block: B:140:0x01e7, code lost: a(true); */ /* JADX WARNING: Code restructure failed: missing block: B:141:0x01ea, code lost: monitor-enter(r7); */ /* JADX WARNING: Code restructure failed: missing block: B:143:?, code lost: com.uc.crashsdk.e.X = null; */ /* JADX WARNING: Code restructure failed: missing block: B:144:0x01ed, code lost: monitor-exit(r7); */ /* JADX WARNING: Code restructure failed: missing block: B:145:0x01ee, code lost: return; */ /* JADX WARNING: Code restructure failed: missing block: B:149:0x01f2, code lost: return; */ public static void a(int i10, Object[] objArr) { switch (i10) { case 401: JNIBridge.nativeCmd(10, b.I() == 5 ? 1 : 0, null, null); a.f45116c = true; a.a(false); L = true; Z(); y(); return; case 402: Object obj = Y; synchronized (obj) { if (X != null) { W = true; break; } else { return; } } case 403: ab(); return; case 404: default: if (!f45232a) { throw new AssertionError(); } return; case 405: L = false; StringBuilder Y2 = Y(); String g2 = b.g(); if (Y2 != null) { g.a(new File(g2), Y2.toString()); return; } return; case 406: if (f45232a || objArr != null) { a((String) objArr[0], ((Boolean) objArr[1]).booleanValue(), ((Boolean) objArr[2]).booleanValue()); return; } throw new AssertionError(); case 407: try { a.d(); return; } catch (Throwable th) { g.a(th); return; } case 408: synchronized (f45234ab) { if (!f45235ac && g.O()) { if (b.z()) { b.s(); h.f(); f.c(); if (b.F()) { C(); } if (g.O()) { a(Calendar.getInstance()); } f45235ac = true; return; } } return; } case 409: d(false); return; case 410: a(false, true); return; case 411: if (b.f45200d) { JNIBridge.set(28, d(LogType.NATIVE_TYPE)); JNIBridge.set(29, d(LogType.ANR_TYPE)); return; } return; case FacebookRequestErrorClassification.EC_APP_NOT_INSTALLED: if (!R && b.B() && g.K()) { b(g.a()); return; } else if (!R) { return; } else { if (!b.B() || !g.K()) { try { g.a().unregisterReceiver(Q); R = false; return; } catch (Throwable th2) { g.a(th2); return; } } else { return; } } case 413: JNIBridge.cmd(8); return; case 414: try { if (!d(g.a())) { int i11 = N + 1; N = i11; if (i11 < 10) { X(); return; } else if (b.f45200d) { JNIBridge.set(130, "(get failed)"); return; } else { return; } } else { return; } } catch (Throwable th3) { g.a(th3); return; } case 415: if (f45232a || objArr != null) { long longValue = ((Long) objArr[0]).longValue(); Calendar instance = Calendar.getInstance(); if (instance.getTimeInMillis() >= longValue) { h.g(); f.a(100); d(true); f.a(true); h.b(); } else { h.h(); h.i(); h.c(); } a(instance); break; } else { throw new AssertionError(); } case 416: break; } W(); } public static void a(Context context) { try { if (V()) { context.registerReceiver(new c((byte) 0), new IntentFilter("android.intent.action.ANR"), null, f.a(3)); } } catch (Throwable th) { g.a(th); } } 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 a(a aVar, String str, long j2) { String str2; String str3 = null; if (b.f45200d) { try { aVar.flush(); } catch (Throwable th) { g.a(th); } str2 = JNIBridge.nativeDumpThreads(str, j2); if (ag || str2 == null || str2.length() >= 512 || !str2.startsWith("/") || str2.indexOf(10) >= 0) { str3 = str2; } else { if (!new File(str2).exists()) { str3 = "Can not found " + str2; } str3 = str2; str2 = str3; } } else { str2 = "Native not initialized, skip dump!"; } if (str2 != null) { try { aVar.write(str2.getBytes("UTF-8")); aVar.write("\n".getBytes("UTF-8")); } catch (Throwable th2) { g.a(th2); } a((OutputStream) aVar); } else if (str3 != null && !ag) { b(aVar, str3, 1048576); File file = new File(str3); if (file.exists()) { file.delete(); } } try { aVar.flush(); } catch (Throwable th3) { g.a(th3); } } private static void a(OutputStream outputStream) { try { outputStream.write("--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n".getBytes("UTF-8")); } catch (Throwable th) { a(th, outputStream); } } static void a(OutputStream outputStream, String str, String str2) { f45241h = false; try { outputStream.write(String.format(Locale.US, "$^%s`%s^$", str, str2).getBytes("UTF-8")); } catch (Throwable th) { g.a(th); } f45241h = true; } static void a(OutputStream outputStream, String str, String str2, int i10, boolean z10, boolean z11) { int i11 = 0; f45241h = false; try { Locale locale = Locale.US; Object[] objArr = new Object[5]; objArr[0] = str; objArr[1] = str2; objArr[2] = Integer.valueOf(i10); objArr[3] = Integer.valueOf(z10 ? 1 : 0); if (z11) { i11 = 1; } objArr[4] = Integer.valueOf(i11); outputStream.write(String.format(locale, "$^%s`%s`%d`%d,%d^$", objArr).getBytes("UTF-8")); } catch (Throwable th) { g.a(th); } f45241h = true; a(outputStream); } private static void a(OutputStream outputStream, String str, Set<String> set) { if (!g.a(str) && !set.contains(str) && !str.equals("/storage/emulated")) { set.add(str); try { StatFs statFs = new StatFs(str); long a10 = a(statFs, "getBlockCountLong", "getBlockCount"); long a11 = a(statFs, "getBlockSizeLong", "getBlockSize"); if ((a10 / 1024) * a11 >= 10240) { long a12 = a(statFs, "getAvailableBlocksLong", "getAvailableBlocks"); long a13 = a(statFs, "getFreeBlocksLong", "getFreeBlocks"); try { Locale locale = Locale.US; outputStream.write(String.format(locale, "%s:\n", str).getBytes("UTF-8")); double d10 = (double) a11; outputStream.write(String.format(locale, " total: %d kB\n", Long.valueOf((long) (((((double) a10) * 1.0d) * d10) / 1024.0d))).getBytes("UTF-8")); outputStream.write(String.format(locale, " available: %d kB\n", Long.valueOf((long) (((((double) a12) * 1.0d) * d10) / 1024.0d))).getBytes("UTF-8")); outputStream.write(String.format(locale, " free: %d kB\n", Long.valueOf((long) (((((double) a13) * 1.0d) * d10) / 1024.0d))).getBytes("UTF-8")); outputStream.write(String.format(locale, " block size: %d B\n\n", Long.valueOf(a11)).getBytes("UTF-8")); } catch (Throwable th) { a(th, outputStream); } } } catch (Throwable unused) { } } } /* JADX WARNING: Removed duplicated region for block: B:111:0x02e7 */ /* JADX WARNING: Removed duplicated region for block: B:112:0x02f2 */ /* JADX WARNING: Removed duplicated region for block: B:131:0x0348 */ /* JADX WARNING: Removed duplicated region for block: B:139:0x03a1 */ /* JADX WARNING: Removed duplicated region for block: B:145:0x03b9 */ /* JADX WARNING: Removed duplicated region for block: B:193:0x03ae A[SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:43:0x011e */ /* JADX WARNING: Removed duplicated region for block: B:56:0x01ba */ /* JADX WARNING: Removed duplicated region for block: B:63:0x01d8 */ /* JADX WARNING: Removed duplicated region for block: B:72:0x01f0 */ /* JADX WARNING: Removed duplicated region for block: B:73:0x01f2 A[ADDED_TO_REGION] */ /* JADX WARNING: Removed duplicated region for block: B:80:0x020d */ /* JADX WARNING: Removed duplicated region for block: B:81:0x0223 */ /* JADX WARNING: Removed duplicated region for block: B:99:0x02ad */ private static void a(String str, boolean z10, boolean z11) { ConditionVariable conditionVariable; int i10; boolean z12; boolean z13; int i11; String path; String b10; File a10; int i12; String str2; int i13; String str3; Throwable th; File file; boolean z14; com.uc.crashsdk.a.a.a("crashsdk", "crashsdk uploading logs"); synchronized (f45247n) { try { if (g.b(str)) { String V2 = g.V(); File file2 = new File(V2); if (!file2.exists()) { com.uc.crashsdk.a.a.a("crashsdk", "Folder not exist: " + V2); } else { File[] listFiles = file2.listFiles(); if (listFiles == null) { com.uc.crashsdk.a.a.b("List folder failed: " + V2); } else { int length = listFiles.length; int i14 = 0; int i15 = 0; int i16 = 0; int i17 = 0; int i18 = 0; int i19 = 0; int i20 = 0; int i21 = 0; int i22 = 0; boolean z15 = false; boolean z16 = false; boolean z17 = false; while (true) { if (i14 >= length) { i10 = i17; z12 = z15; z13 = z16; break; } File file3 = listFiles[i14]; if (!file3.isFile()) { g.a(file3); } else { String name = file3.getName(); if (!name.endsWith(DiskFileUpload.postfix)) { i11 = length; z12 = z15; z13 = z16; if (file3.length() == 0) { i15++; g.a(file3); } else { if (z10) { long currentTimeMillis = (System.currentTimeMillis() - file3.lastModified()) / 1000; if (currentTimeMillis >= 0) { if (currentTimeMillis >= 2) { if (currentTimeMillis < 5 && file3.getName().endsWith(".log")) { } } z14 = 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(z14))); if (!z14) { i17++; } } z14 = 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(z14))); if (!z14) { } } try { if (g.k()) { Matcher matcher = Pattern.compile("([^_]+)_([^_]+)_([^_]+)\\.crashsdk").matcher(file3.getName()); if (matcher.matches()) { String group = matcher.group(1); String group2 = matcher.group(2); i10 = i17; try { file = new File(g.V() + String.format(Locale.US, "%s%s_%s_%s.%s", j(group2), n(), Q(), group, matcher.group(3))); com.uc.crashsdk.a.a.a("crashsdk", "File " + file3.getPath() + " matches, rename to " + file.getPath()); file3.renameTo(file); if (file != file3) { i21++; } file3 = file; } catch (Throwable th2) { th = th2; } path = file3.getPath(); boolean[] n10 = n(path); b10 = b(path, n10[0], n10[1]); if (path != b10) { if (n10[0]) { i20++; } if (n10[1]) { i18++; } file3 = new File(b10); } a10 = d.a(file3); if (a10 == null) { a10 = null; } else if (file3 != a10 && !file3.getName().equals(a10.getName()) && file3.exists()) { file3.delete(); } if (a10 == null) { com.uc.crashsdk.a.a.b("onBeforeUploadLog return null, skip upload: " + file3.getAbsolutePath()); } else { int z18 = g.z(); if (z18 <= 0 || a10.length() < ((long) z18)) { d dVar = new d((byte) 0); dVar.f45267b = 0; dVar.f45266a = System.currentTimeMillis(); String U2 = U(); if (new File(U2).exists()) { a(U2, new com.uc.crashsdk.a.e(451, new Object[]{U2, dVar})); } long A2 = g.A(); int B2 = g.B(); int C2 = g.C(); if (A2 >= 0) { i12 = i18; if (dVar.f45267b + a10.length() > A2) { dVar.f45270e = true; str3 = "Reach max upload bytes: " + A2; } if (!g.f()) { if (b(a10)) { if (B2 >= 0 && dVar.f45268c >= B2) { dVar.f45272g = true; str3 = "Reach max upload builtin log count: " + B2; } } else if (C2 >= 0 && dVar.f45269d >= C2) { dVar.f45271f = true; str3 = "Reach max upload custom log count: " + C2; } } if (dVar.f45270e) { i18 = i12; z16 = z13; z12 = true; } else if (dVar.f45272g) { i18 = i12; z16 = true; } else if (dVar.f45271f) { i18 = i12; z16 = z13; z17 = true; } else { String name2 = a10.getName(); if (name2.startsWith(P())) { String[] split = name2.split("_", 10); if (split.length == 9) { str2 = split[1]; boolean z19 = str2 == null && str2.equals(g.R()); if (!com.uc.crashsdk.a.c.a(a10, a10.getName(), str)) { com.uc.crashsdk.a.a.a("crashsdk", "Uploaded log: " + a10.getName(), null); if (z19) { f.a(13); } dVar.f45267b += a10.length(); if (b(a10)) { dVar.f45268c++; } else { dVar.f45269d++; } String U3 = U(); a(U3, new com.uc.crashsdk.a.e(452, new Object[]{U3, dVar})); a10.delete(); i13 = 3; i22 = 0; } else { i22++; if (z19) { f.a(14); } i13 = 3; } if (i22 < i13) { com.uc.crashsdk.a.a.a("crashsdk", "Upload failed 3 times continuously, abort upload!", null); i18 = i12; break; } i18 = i12; z16 = z13; } } str2 = null; if (str2 == null) { } if (!com.uc.crashsdk.a.c.a(a10, a10.getName(), str)) { } if (i22 < i13) { } } i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } else { i12 = i18; if (!g.f()) { } if (dVar.f45270e) { } i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } com.uc.crashsdk.a.a.b(str3); if (dVar.f45270e) { } i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } else { i19++; g.a(a10); } } z16 = z13; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } } i10 = i17; file = file3; if (file != file3) { } file3 = file; } catch (Throwable th3) { th = th3; i10 = i17; g.a(th); path = file3.getPath(); boolean[] n102 = n(path); b10 = b(path, n102[0], n102[1]); if (path != b10) { } a10 = d.a(file3); if (a10 == null) { } if (a10 == null) { } z16 = z13; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } path = file3.getPath(); boolean[] n1022 = n(path); b10 = b(path, n1022[0], n1022[1]); if (path != b10) { } a10 = d.a(file3); if (a10 == null) { } if (a10 == null) { } z16 = z13; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } i10 = i17; z16 = z13; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } else if ((System.currentTimeMillis() - file3.lastModified()) / 1000 > 30) { i11 = length; com.uc.crashsdk.a.a.b("delete legacy tmp file: " + name); i16++; g.a(file3); i10 = i17; z12 = z15; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } } i11 = length; i10 = i17; z12 = z15; i14++; listFiles = listFiles; length = i11; z15 = z12; i17 = i10; } if (i16 > 0) { f.a(200, i16); } if (i15 > 0) { f.a(15, i15); } if (i19 > 0) { f.a(17, i19); } if (z12) { f.a(19); } if (z13) { f.a(20); } if (z17) { f.a(21); } if (z12 || z13 || z17) { f.a(18); } if (i20 > 0) { f.a(24, i20); } if (i18 > 0) { f.a(201, i18); } if (i21 > 0) { f.a(25, i21); } if (i10 > 0) { f.a(26, i10); } } } } else { com.uc.crashsdk.a.a.a("crashsdk", "upload url is empty!"); } if (z11) { conditionVariable = f45248o; conditionVariable.open(); } } catch (Throwable th4) { if (z11) { f45248o.open(); } throw th4; } } } private static void a(Throwable th) { try { com.uc.crashsdk.a.a.d("DEBUG", a(th.getStackTrace(), (String) null).toString()); } catch (Throwable unused) { } } 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) { g.a(th2); } } g.a(th); } private static void a(Calendar calendar) { if (g.Q()) { 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; long j10 = 3600000; if (j2 <= 3600000) { j10 = 1000 + j2; } f.a(0, new com.uc.crashsdk.a.e(415, new Object[]{Long.valueOf(timeInMillis2)}), j10); } } static void a(boolean z10) { File[] listFiles; try { if (b.y() && (listFiles = new File(g.V()).listFiles()) != null) { int l10 = g.l(); int m10 = g.m(); if (listFiles.length >= Math.min(l10, m10)) { int i10 = 0; int i11 = 0; for (File file : listFiles) { if (b(file)) { i10++; } else { i11++; } } int i12 = (!z10 || i10 < l10) ? 0 : (i10 - l10) + 1; int i13 = (z10 || i11 < m10) ? 0 : (i11 - m10) + 1; if (!(i12 == 0 && i13 == 0)) { Arrays.sort(listFiles, new b((byte) 0)); int i14 = i12; int i15 = i13; for (File file2 : listFiles) { boolean b10 = b(file2); if (b10 && i14 > 0) { com.uc.crashsdk.a.a.a("crashsdk", "Delete oldest crash log: " + file2.getPath()); file2.delete(); i14 += -1; } else if (!b10 && i15 > 0) { com.uc.crashsdk.a.a.a("crashsdk", "Delete oldest custom log: " + file2.getPath()); file2.delete(); i15 += -1; } if (i14 == 0 && i15 == 0) { break; } } f.a(16, i12 + i13); if (i12 > 0) { f.a(22, i12); } if (i13 > 0) { f.a(23, i13); } } } } } catch (Throwable th) { g.a(th); } } public static boolean a() { if (f45239f == 0) { f45239f = 2; if (h(b.b("logs")) == 1) { f45239f = 1; } } return f45239f == 1; } 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 (!b.f45200d) { 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, (long) fd, null, null); ag = nativeCmd != -1; return fd == -1 || nativeCmd != -1; } } /* JADX WARNING: Removed duplicated region for block: B:28:0x0043 */ /* JADX WARNING: Removed duplicated region for block: B:30:0x004a */ private static boolean a(String str, long j2, StringBuffer stringBuffer, String str2, long j10, ArrayList<String> arrayList, ArrayList<String> arrayList2, ArrayList<String> arrayList3, String str3) { a aVar; FileOutputStream fileOutputStream; Throwable th; int i10 = (j2 > 0 ? 1 : (j2 == 0 ? 0 : -1)); if (i10 == 0) { try { fileOutputStream = new FileOutputStream(str); } catch (Throwable th2) { th = th2; fileOutputStream = null; aVar = null; g.a(th); if (aVar != null) { } } } else { fileOutputStream = null; } try { aVar = new a(j2, fileOutputStream); } catch (Throwable th3) { th = th3; aVar = null; g.a(th); if (aVar != null) { } } try { synchronized (f45252s) { f45254u = str; if (b.f45200d) { JNIBridge.set(126, f45254u); } } } catch (Throwable th4) { th = th4; g.a(th); if (aVar != null) { } } if (aVar != null) { g.a(aVar); g.a(fileOutputStream); return false; } if ((j10 & 1) != 0) { try { b(aVar, str, str2); } catch (Throwable th5) { g.a(aVar); g.a(fileOutputStream); throw th5; } } try { aVar.write(stringBuffer.toString().getBytes()); aVar.write("\n".getBytes("UTF-8")); aVar.flush(); } catch (Throwable th6) { a(th6, aVar); } a((OutputStream) aVar); if ((j10 & 4) != 0) { b((OutputStream) aVar); try { aVar.flush(); } catch (Throwable th7) { g.a(th7); } } if (arrayList != null && arrayList.size() > 0) { a.a(aVar, "UTF-8", arrayList); } if (arrayList2 != null && arrayList2.size() > 0) { a.a(aVar, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", arrayList2); } if (arrayList3 != null && arrayList3.size() > 0) { a.b(aVar, "UTF-8", "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n", arrayList3); } if (str3 != null) { try { aVar.flush(); } catch (Throwable th8) { a(th8, aVar); } try { aVar.write("threads dump:\n".getBytes("UTF-8")); } catch (Throwable th9) { a(th9, aVar); } f45241h = false; f45256w = str3; try { a(aVar, str3, j2); } catch (Throwable th10) { a(th10, aVar); } f45256w = null; f45241h = true; } if ((j10 & 8) != 0 && i10 == 0) { try { aVar.flush(); } catch (Throwable th11) { a(th11, aVar); } try { aVar.write("all threads dump:\n".getBytes("UTF-8")); } catch (Throwable th12) { a(th12, aVar); } f45255v = true; try { a(aVar, PurhcaseUsingCoupon.CTION_UPDATE_USER_INFO_TYPE_ALL, 0L); } catch (Throwable th13) { a(th13, aVar); } f45255v = false; } if ((j10 & 16) != 0) { f(aVar); } if ((j10 & 2) != 0) { aVar.a(); a(aVar); } if (i10 != 0) { b(aVar); } g.a(aVar); g.a(fileOutputStream); try { ArrayList<String> arrayList4 = f45252s; synchronized (arrayList4) { f45253t++; String str4 = f45254u; if (str4 != null) { arrayList4.add(str4); if (arrayList4.size() > 3) { arrayList4.remove(0); } if (b.f45200d) { JNIBridge.set(127, f45254u); } f45254u = null; } if (b.f45200d) { JNIBridge.set(25, (long) f45253t); } } } catch (Throwable th14) { g.a(th14); } return true; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r5v4, types: [java.io.Closeable] */ /* JADX WARN: Type inference failed for: r5v6 */ /* JADX WARN: Type inference failed for: r1v2, types: [java.io.Closeable] */ /* JADX WARN: Type inference failed for: r1v3, types: [java.nio.channels.FileChannel] */ /* JADX WARN: Type inference failed for: r1v6 */ /* JADX WARN: Type inference failed for: r5v15 */ /* JADX WARN: Type inference failed for: r1v9 */ /* JADX WARN: Type inference failed for: r1v10 */ /* JADX WARN: Type inference failed for: r1v11 */ /* JADX WARN: Type inference failed for: r1v12 */ /* JADX WARNING: Code restructure failed: missing block: B:12:0x0024, code lost: r6 = th; */ /* JADX WARNING: Code restructure failed: missing block: B:39:0x0057, code lost: r6 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:40:0x0058, code lost: r1 = r5; r5 = r6; */ /* JADX WARNING: Code restructure failed: missing block: B:42:?, code lost: com.uc.crashsdk.a.g.a(r5); r1 = r1; */ /* JADX WARNING: Code restructure failed: missing block: B:45:0x0060, code lost: r6 = th; */ /* JADX WARNING: Code restructure failed: missing block: B:46:0x0061, code lost: r5 = r1; */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Removed duplicated region for block: B:12:0x0024 A[ExcHandler: all (th java.lang.Throwable), Splitter:B:10:0x0018] */ /* JADX WARNING: Unknown variable types count: 2 */ private static boolean a(String str, com.uc.crashsdk.a.e eVar) { boolean z10; Throwable th; ?? r52; FileChannel fileChannel; synchronized (f45249p) { File file = new File(str); if (!file.exists()) { try { file.createNewFile(); } catch (Exception e10) { g.a(e10); } } FileLock fileLock = null; fileLock = null; r52 = null; z10 = false; try { fileChannel = new RandomAccessFile(file, "rw").getChannel(); } catch (Exception e11) { g.a(e11); fileChannel = fileLock; } catch (Throwable th2) { } if (fileChannel != null) { try { fileLock = fileChannel.lock(); } catch (Exception e12) { try { g.a(e12); } catch (Exception e13) { Exception e14 = e13; FileLock fileLock2 = fileChannel; } } } try { z10 = eVar.a(); ?? r12 = fileChannel; g.a((Closeable) r12); } finally { if (fileLock != null) { try { fileLock.release(); } catch (Exception e15) { g.a(e15); } } } } return z10; g.a((Closeable) r52); throw th; } private static boolean a(String str, d dVar) { String a10 = g.a(new File(str), 64, false); if (a10 == null) { return false; } try { Matcher matcher = Pattern.compile("(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)").matcher(a10); if (matcher.find()) { long parseLong = Long.parseLong(matcher.group(1)); if (System.currentTimeMillis() - parseLong < 86400000) { dVar.f45267b = Long.parseLong(matcher.group(2)); dVar.f45268c = Integer.parseInt(matcher.group(3)); dVar.f45269d = Integer.parseInt(matcher.group(4)); dVar.f45266a = parseLong; } } } catch (Throwable th) { g.a(th); } return true; } static boolean a(String str, String str2, boolean z10) { if (!o(str2)) { return false; } h.a(str, str2, true, z10); com.uc.crashsdk.a.a.b(String.format(Locale.US, "Custom log '%s' has reach max count!", str2)); return true; } public static boolean a(StringBuffer stringBuffer, String str, long j2, ArrayList<String> arrayList, ArrayList<String> arrayList2, ArrayList<String> arrayList3, String str2) { long j10; boolean a10; long j11; if (f45237c.get()) { com.uc.crashsdk.a.a.b("Processing java crash, skip generate custom log: " + str); return false; } boolean z10 = ag || b.L(); if (!z10 && !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.V() + k(str); boolean z11 = (j2 & 32) != 0; if (z10) { if (b.f45200d) { int i10 = z11 ? 1 : 0; int i11 = z11 ? 1 : 0; int i12 = z11 ? 1 : 0; j11 = JNIBridge.nativeClientCreateConnection(str3, "custom", str, i10); } else { j11 = 0; } if (j11 == 0) { com.uc.crashsdk.a.a.d("DEBUG", "skip custom log: " + str); return false; } j10 = j11; } else if (a(h(), str, z11)) { return false; } else { g.a(); a(false); j10 = 0; } synchronized (f45250q) { a10 = a(str3, j10, stringBuffer, str, j2, arrayList, arrayList2, arrayList3, str2); } if (a10 && !z10) { b(h(), str, z11); } if (j10 != 0) { JNIBridge.nativeClientCloseConnection(j10); } if (!a10) { return false; } if (!z10) { r(str3); } if (!z10) { str3 = a(m(str3)); } b(str3, str); if (!z11 || z10) { return true; } try { a(true, false); return true; } catch (Throwable th) { g.a(th); return true; } } } public static boolean a(boolean z10, boolean z11) { if (!f45238d) { if (b.f45200d) { JNIBridge.set(1, true); } f45238d = true; } try { String k10 = k(); if (g.a(k10)) { com.uc.crashsdk.a.a.a("crashsdk", "CrashHandler url is empty!"); return false; } if (f.a(z10 ? 1 : 0, new com.uc.crashsdk.a.e(406, new Object[]{k10, Boolean.valueOf(z11), Boolean.valueOf(z10)})) && z10) { ConditionVariable conditionVariable = f45248o; conditionVariable.close(); if (!conditionVariable.block(3000)) { com.uc.crashsdk.a.a.a("crashsdk", "timeout to wait for uploading"); return false; } } return true; } catch (Throwable th) { g.a(th); return false; } } private static boolean aa() { return b.f45200d && JNIBridge.nativeIsCrashing(); } private static void ab() { String W2 = g.W(); File file = new File(W2); 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 i10 = length < 0 ? 0 : length; long currentTimeMillis = System.currentTimeMillis(); int i11 = 0; int i12 = 0; int i13 = 0; while (i11 < listFiles.length) { File file2 = listFiles[i11]; boolean z10 = i11 < i10; if (!z10 && currentTimeMillis - file2.lastModified() >= 432000000) { z10 = true; } if (!z10) { break; } try { file2.delete(); i12++; i13 = 0; } catch (Throwable th) { i13++; g.a(th); } if (i13 >= 3) { break; } i11++; } com.uc.crashsdk.a.a.a("Removed " + i12 + " logs in " + W2); } } catch (Throwable th2) { g.a(th2); } } } /* JADX INFO: finally extract failed */ static int b(OutputStream outputStream, String str, int i10) { int i11; Throwable th; DataInputStream dataInputStream; int i12; DataInputStream dataInputStream2 = null; int i13 = 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")); g.a((Closeable) null); return 0; } dataInputStream = new DataInputStream(new FileInputStream(file)); i12 = 0; i11 = 0; loop0: while (true) { boolean z10 = false; while (true) { try { int read = dataInputStream.read(R2); if (read == -1) { break loop0; } i12 += read; int i14 = i10 - i11; if (read <= i14 + 32) { i14 = read; } if (i14 > 0 && !z10) { outputStream.write(R2, 0, i14); i11 += i14; } if (!z10) { if (i14 < read || i11 >= i10) { z10 = true; } } } catch (Throwable th2) { th = th2; i13 = i11; dataInputStream2 = dataInputStream; try { a(th, outputStream); g.a(dataInputStream2); i11 = i13; a(outputStream); return i11; } catch (Throwable th3) { g.a(dataInputStream2); throw th3; } } } } } else { outputStream.write(("file: '" + str + "' not exists!\n").getBytes("UTF-8")); dataInputStream = null; i12 = 0; i11 = 0; } if (i11 > 0) { outputStream.write("\n".getBytes("UTF-8")); } if (i11 < i12) { outputStream.write(String.format(Locale.US, "(truncated %d bytes)\n", Integer.valueOf(i12 - i11)).getBytes("UTF-8")); } g.a(dataInputStream); } catch (Throwable th4) { th = th4; a(th, outputStream); g.a(dataInputStream2); i11 = i13; a(outputStream); return i11; } a(outputStream); return i11; } static long b() { if (f45240g == -1) { f45240g = h(b.b(ImagesContract.LOCAL)); } return f45240g; } private static String b(String str, boolean z10, boolean z11) { if (z10) { try { str = m(str); } catch (Throwable th) { g.a(th); } } if (!z11) { return str; } try { return a(str); } catch (Throwable th2) { g.a(th2); return str; } } public static void b(int i10) { f.a(0, new com.uc.crashsdk.a.e(410), (long) (i10 * 1000)); } public static void b(Context context) { if (g.K()) { 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, f.a(1)); R = true; } catch (Throwable th) { g.a(th); } } } private static void b(a aVar) { f45241h = false; try { aVar.write((s("LOG_END") + "\n").getBytes("UTF-8")); } catch (Throwable th) { g.a(th); } f45241h = true; } private static void b(OutputStream outputStream) { BufferedReader bufferedReader = null; try { outputStream.write("logcat:\n".getBytes("UTF-8")); if (g.n() <= 0) { try { outputStream.write("[DEBUG] custom java logcat lines count is 0!\n".getBytes("UTF-8")); } catch (Throwable th) { a(th, outputStream); } a(outputStream); g.a((Closeable) null); return; } int n10 = 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(n10)}).getInputStream())); if (bufferedReader == null) { try { outputStream.write("[DEBUG] alloc buffer failed!\n".getBytes("UTF-8")); } catch (Throwable th2) { a(th2, outputStream); } a(outputStream); g.a(bufferedReader); return; } f45241h = false; int i10 = 0; int i11 = 0; while (true) { String readLine = bufferedReader.readLine(); if (readLine != null) { i10++; if (i11 < n10 && !readLine.contains(" I auditd ") && !readLine.contains(" I liblog ")) { outputStream.write(readLine.getBytes("UTF-8")); outputStream.write("\n".getBytes("UTF-8")); i11++; } } else { try { break; } catch (Throwable th3) { a(th3, outputStream); } } } outputStream.write(String.format(Locale.US, "[DEBUG] Read %d lines, wrote %d lines.\n", Integer.valueOf(i10), Integer.valueOf(i11)).getBytes("UTF-8")); f45241h = true; g.a(bufferedReader); a(outputStream); } catch (Throwable th4) { g.a((Closeable) null); throw th4; } } private static void b(OutputStream outputStream, String str, String str2) { String str3; try { outputStream.write("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n".getBytes("UTF-8")); } catch (Throwable th) { a(th, outputStream); } try { Locale locale = Locale.US; outputStream.write(String.format(locale, "Basic Information: 'pid: %d/tid: %d/time: %s'\n", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()), n()).getBytes("UTF-8")); Object[] objArr = new Object[3]; objArr[0] = e(); if (g.a(f45245l)) { T(); } objArr[1] = f45245l; 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 { Locale locale2 = Locale.US; outputStream.write(String.format(locale2, "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")); Object[] objArr2 = new Object[4]; objArr2[0] = a(new Date(f45236b)); objArr2[1] = Long.valueOf(Runtime.getRuntime().maxMemory()); objArr2[2] = g.d(); objArr2[3] = 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 { Locale locale3 = Locale.US; outputStream.write(String.format(locale3, "Application Information: 'version: %s/subversion: %s/buildseq: %s/versioncode: %d'\n", g.R(), g.S(), g.T(), Integer.valueOf(a.c())).getBytes("UTF-8")); String str4 = AppEventsConstants.EVENT_PARAM_VALUE_NO; String str5 = ""; if (b.f45200d) { String nativeGet = JNIBridge.nativeGet(1, 0, null); str3 = JNIBridge.nativeGet(2, 0, null); str4 = nativeGet; } else { str3 = str5; } outputStream.write(String.format(locale3, "CrashSDK Information: 'version: %s/nativeseq: %s/javaseq: %s/arch: %s/target: %s'\n", "3.3.1.1", str4, "210916105822", str3, "release").getBytes("UTF-8")); if (str != null) { str5 = str; } outputStream.write(("Report Name: " + str5.substring(str5.lastIndexOf(47) + 1) + "\n").getBytes("UTF-8")); } catch (Throwable th4) { a(th4, outputStream); } try { outputStream.write(String.format("UUID: %s\n", ag ? s("UUID") : B).getBytes("UTF-8")); outputStream.write(("Log Type: " + str2 + "\n").getBytes("UTF-8")); } catch (Throwable th5) { a(th5, outputStream); } try { String E2 = b.E(); if (g.a(E2)) { E2 = "(none)"; } outputStream.write(("Activity: " + E2 + "\n").getBytes("UTF-8")); } catch (Throwable th6) { a(th6, outputStream); } a(outputStream); try { a.a(outputStream, "UTF-8"); if (ag) { f45241h = false; outputStream.write(s("HEADER").getBytes("UTF-8")); f45241h = true; } } catch (Throwable th7) { a(th7, outputStream); } a(outputStream); } public static void b(String str) { synchronized (f45258y) { f45257x = str; com.uc.crashsdk.a.b.a(b.i(), str + "\n"); } } private static void b(String str, String str2) { try { d.a(str, h(), str2); } catch (Throwable th) { g.a(th); } } static void b(String str, String str2, boolean z10) { h.a(str, str2, false, z10); } static void b(boolean z10) { try { boolean z11 = g.r() && b.F() && !f45238d; if (!z11) { z11 = g.s(); } if (z11) { if (z10) { String k10 = k(); if (!g.a(k10)) { j(); a(k10, false, false); return; } return; } a(true, false); } } catch (Throwable th) { g.a(th); } } public static boolean b(int i10, Object[] objArr) { if (i10 != 451) { if (i10 != 452) { if (f45232a) { return false; } throw new AssertionError(); } else if (f45232a || objArr != null) { d dVar = (d) objArr[1]; return g.a(new File((String) objArr[0]), String.format(Locale.US, "%d %d %d %d", Long.valueOf(dVar.f45266a), Long.valueOf(dVar.f45267b), Integer.valueOf(dVar.f45268c), Integer.valueOf(dVar.f45269d)).getBytes()); } else { throw new AssertionError(); } } else if (f45232a || objArr != null) { return a((String) objArr[0], (d) objArr[1]); } else { throw new AssertionError(); } } 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) { return false; } 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); } static void c() { f45242i = null; } /* JADX WARNING: Removed duplicated region for block: B:29:0x006e A[Catch:{ all -> 0x0080 }] */ private static void c(OutputStream outputStream) { HashSet hashSet; File[] listFiles; Throwable th; try { outputStream.write("disk info:\n".getBytes("UTF-8")); } catch (Throwable th2) { a(th2, outputStream); } if (ag) { f45241h = false; try { outputStream.write(s("FSSTAT").getBytes("UTF-8")); } catch (Throwable th3) { a(th3, outputStream); } f45241h = true; } else { try { hashSet = new HashSet(); try { a(outputStream, a(new File(g.b())), hashSet); } catch (Throwable th4) { th = th4; } } catch (Throwable th5) { hashSet = null; th = th5; a(th, outputStream); a(outputStream, a(Environment.getExternalStorageDirectory()), hashSet); File file = new File("/storage"); while (r2 < r3) { } a(outputStream); } try { a(outputStream, a(Environment.getExternalStorageDirectory()), hashSet); File file2 = new File("/storage"); if (file2.exists() && (listFiles = file2.listFiles()) != null) { for (File file3 : listFiles) { if (file3.isDirectory()) { a(outputStream, a(file3), hashSet); } } } } catch (Throwable th6) { a(th6, outputStream); } } a(outputStream); } public static void c(String str) { synchronized (f45259z) { String l10 = b.l(); com.uc.crashsdk.a.b.a(l10, str + "\n"); } } static void c(boolean z10) { boolean z11 = true; if (!R ? !z10 || !g.K() : z10 && g.K()) { z11 = false; } if (z11) { com.uc.crashsdk.a.e eVar = S; if (f.b(eVar)) { f.a(eVar); } f.a(0, eVar, 3000); } } static String d() { String str = f45242i; if (str != null) { return str; } String j2 = j(null); f45242i = j2; return j2; } private static void d(OutputStream outputStream) { if (b.f45200d) { String o10 = b.o(); f45241h = false; if (1 == JNIBridge.cmd(17, o10)) { File file = new File(o10); try { byte[] e10 = g.e(file); if (e10 != null) { outputStream.write(e10); } } catch (Throwable th) { a(th, outputStream); } try { file.delete(); } catch (Throwable th2) { a(th2, outputStream); } f45241h = true; a(outputStream); } f45241h = true; return; } File[] fileArr = null; int i10 = 900; try { i10 = g.H(); 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(i10)).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 >= i10) { outputStream.write("opened files:\n".getBytes("UTF-8")); StringBuilder sb2 = new StringBuilder(); try { for (File file2 : fileArr) { sb2.append(file2.getName()); sb2.append(" -> "); sb2.append(file2.getCanonicalPath()); sb2.append("\n"); } } catch (Throwable th4) { a(th4, outputStream); } outputStream.write(sb2.toString().getBytes("UTF-8")); } } catch (Throwable th5) { a(th5, outputStream); } } a(outputStream); } public static void d(boolean z10) { f.d(false); if (z10) { f.a(b.c(), false); h.i(); return; } f.a(); h.i(); } /* access modifiers changed from: private */ public static boolean d(Context context) { List<ActivityManager.ProcessErrorStateInfo> processesInErrorState; ActivityManager activityManager = (ActivityManager) context.getSystemService("activity"); boolean z10 = 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 (b.f45200d) { JNIBridge.set(130, next.longMsg); } z10 = true; } } if (!z10 && b.f45200d) { W(); } return true; } static boolean d(String str) { if (ag) { return true; } try { return p(str); } catch (Throwable th) { g.a(th); return true; } } public static int e(boolean z10) { return f.a(z10); } /* JADX WARNING: Removed duplicated region for block: B:32:0x0065 */ /* JADX WARNING: Removed duplicated region for block: B:35:0x006d */ /* JADX WARNING: Removed duplicated region for block: B:42:0x00ad A[Catch:{ all -> 0x00d1 }] */ /* JADX WARNING: Removed duplicated region for block: B:46:0x00cf */ public static String e() { String str; String str2; Throwable th; Method declaredMethod; String str3; String str4; boolean z10; if (!g.a(f45243j)) { return f45243j; } 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 sb2 = new StringBuilder(); int length = strArr.length; int i10 = 0; boolean z11 = true; while (i10 < length) { String str6 = strArr[i10]; if (!z11) { sb2.append(PreferencesConstants.COOKIE_DELIMITER); } sb2.append(str6); i10++; z11 = false; } f45243j = sb2.toString(); } } } catch (Throwable unused) { } if (g.a(f45243j)) { try { str4 = Build.CPU_ABI; try { str3 = Build.CPU_ABI2; } catch (Throwable unused2) { } } catch (Throwable unused3) { str4 = null; str3 = null; z10 = !g.a(str4); if (z10) { } if (!g.a(str3)) { } declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("get", String.class, String.class); if (declaredMethod == null) { } } z10 = !g.a(str4); if (z10) { f45243j = str4; } if (!g.a(str3)) { if (z10) { f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str3; } else { f45243j = str3; } } } try { declaredMethod = Class.forName("android.os.SystemProperties").getDeclaredMethod("get", String.class, String.class); if (declaredMethod == null) { declaredMethod.setAccessible(true); str2 = (String) declaredMethod.invoke(null, "ro.product.cpu.abi", null); try { str = (String) declaredMethod.invoke(null, "ro.product.cpu.abi2", null); } catch (Throwable th2) { th = th2; } str5 = str2; try { if (!g.a(str5) && !f45243j.contains(str5)) { f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str5; } if (!g.a(str) && !f45243j.contains(str)) { f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str; } } catch (Throwable th3) { g.a(th3); } return f45243j; } str = null; f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str5; f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str; return f45243j; } catch (Throwable th4) { th = th4; str2 = null; g.a(th); str = null; str5 = str2; f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str5; f45243j += PreferencesConstants.COOKIE_DELIMITER; f45243j += str; return f45243j; } } /* JADX WARNING: Removed duplicated region for block: B:15:0x0025 A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:16:0x0026 */ private static void e(OutputStream outputStream) { int i10; int i11; Throwable th; File[] fileArr = null; try { i11 = g.I(); try { fileArr = new File("/proc/self/task").listFiles(); if (fileArr == null || (i10 = fileArr.length) < i11) { return; } } catch (Throwable th2) { th = th2; g.a(th); i10 = 0; if (fileArr != null) { } } } catch (Throwable th3) { th = th3; i11 = LogSeverity.NOTICE_VALUE; g.a(th); i10 = 0; if (fileArr != null) { } } if (fileArr != null) { try { outputStream.write("threads info:\n".getBytes("UTF-8")); outputStream.write(String.format(Locale.US, "threads count: %d, dump limit: %d.\n", Integer.valueOf(i10), Integer.valueOf(i11)).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(g.a(new File(file.getPath(), "comm"), 128, false))).getBytes("UTF-8")); } } catch (Throwable th4) { a(th4, outputStream); } a(outputStream); } } public static boolean e(String str) { try { if (!g.b(str) || !str.startsWith("lib") || !str.endsWith(".so")) { return false; } System.loadLibrary(str.substring(3, str.length() - 3)); return true; } catch (Throwable th) { g.a(th); return false; } } public static int f(boolean z10) { int b10 = z10 ? f.a(b.c()) ? 1 : 0 : f.b(); int b11 = f.b(z10); return b11 > b10 ? b11 : b10; } public static String f() { if (g.a(f45244k)) { T(); } return f45244k; } static StringBuilder f(String str) { return a(Thread.currentThread().getStackTrace(), str); } /* JADX WARNING: Removed duplicated region for block: B:33:0x006f A[SYNTHETIC, Splitter:B:33:0x006f] */ /* JADX WARNING: Removed duplicated region for block: B:37:0x009b */ private static void f(OutputStream outputStream) { BufferedReader bufferedReader; Throwable th; int indexOf; boolean z10; if (b.f45200d) { try { outputStream.write("solib build id:\n".getBytes("UTF-8")); } catch (Throwable th2) { a(th2, 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/")) { if (!substring.contains(a.f45114a)) { z10 = false; if (z10 && !arrayList.contains(substring)) { arrayList.add(substring); if (!ag) { try { outputStream.write((String.format("$^%s`%s^$", "SOBUILDID", substring) + "\n").getBytes("UTF-8")); } catch (Throwable th3) { a(th3, outputStream); } } else { outputStream.write(String.format(Locale.US, "%s: %s\n", substring, JNIBridge.nativeGet(3, 0, substring)).getBytes("UTF-8")); } } } } z10 = true; arrayList.add(substring); if (!ag) { } } } catch (Throwable th4) { th = th4; fileReader = fileReader2; try { a(th, outputStream); g.a(fileReader); g.a(bufferedReader); a(outputStream); } catch (Throwable th5) { g.a(fileReader); g.a(bufferedReader); throw th5; } } } g.a(fileReader2); } catch (Throwable th6) { th = th6; bufferedReader = null; fileReader = fileReader2; a(th, outputStream); g.a(fileReader); g.a(bufferedReader); a(outputStream); } } catch (Throwable th7) { th = th7; bufferedReader = null; a(th, outputStream); g.a(fileReader); g.a(bufferedReader); a(outputStream); } g.a(bufferedReader); a(outputStream); } } static String g() { try { StringBuilder sb2 = new StringBuilder(); sb2.append("JavaMax: "); sb2.append(Runtime.getRuntime().maxMemory() / 1024); sb2.append(" kB\n"); sb2.append("JavaTotal: "); sb2.append(Runtime.getRuntime().totalMemory() / 1024); sb2.append(" kB\n"); sb2.append("JavaFree: "); sb2.append(Runtime.getRuntime().freeMemory() / 1024); sb2.append(" kB\n"); sb2.append("NativeHeap: "); sb2.append(Debug.getNativeHeapSize() / 1024); sb2.append(" kB\n"); sb2.append("NativeAllocated: "); sb2.append(Debug.getNativeHeapAllocatedSize() / 1024); sb2.append(" kB\n"); sb2.append("NativeFree: "); sb2.append(Debug.getNativeHeapFreeSize() / 1024); sb2.append(" kB\n"); try { ActivityManager activityManager = (ActivityManager) g.a().getSystemService("activity"); if (activityManager != null) { ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); activityManager.getMemoryInfo(memoryInfo); sb2.append("availMem: "); sb2.append(memoryInfo.availMem / 1024); sb2.append(" kB\n"); sb2.append("threshold: "); sb2.append(memoryInfo.threshold / 1024); sb2.append(" kB\n"); sb2.append("lowMemory: "); sb2.append(memoryInfo.lowMemory); sb2.append("\n"); } } catch (Throwable th) { g.a(th); } return sb2.toString(); } catch (Throwable th2) { g.a(th2); return ""; } } private static void g(OutputStream outputStream) { try { outputStream.write("recent status:\n".getBytes("UTF-8")); } catch (Throwable th) { a(th, outputStream); } try { outputStream.write(String.format(Locale.US, "last version: '%s'\n", ag ? s("LASTVER") : a.m()).getBytes("UTF-8")); } catch (Throwable th2) { a(th2, outputStream); } try { ArrayList<String> arrayList = f45252s; synchronized (arrayList) { if (f45254u != null) { outputStream.write(String.format(Locale.US, "generating log: %s\n", f45254u).getBytes("UTF-8")); } if (f45253t > 0 || arrayList.size() > 0) { outputStream.write(String.format(Locale.US, "generated %d logs, recent are:\n", Integer.valueOf(f45253t)).getBytes("UTF-8")); Iterator<String> it = arrayList.iterator(); while (it.hasNext()) { outputStream.write(String.format(Locale.US, "* %s\n", it.next()).getBytes("UTF-8")); } } } Locale locale = Locale.US; outputStream.write(String.format(locale, "dumping all threads: %s\n", Boolean.valueOf(f45255v)).getBytes("UTF-8")); String str = f45256w; if (str != null) { outputStream.write(String.format(locale, "dumping threads: %s\n", str).getBytes("UTF-8")); } } catch (Throwable th3) { a(th3, outputStream); } a(outputStream); } 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) { g.a(th); } return 0; } public static String h() { String str = f45246m; if (str != null) { return str; } String a10 = a(Process.myPid()); f45246m = a10; return a10; } private static String i(String str) { try { return str.replaceAll("[^0-9a-zA-Z-.]", "-"); } catch (Throwable unused) { return "unknown"; } } static boolean i() { return f45238d; } 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.R(), g.T(), i(Build.MODEL), i(Build.VERSION.RELEASE), str); } public static void j() { try { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(StrictMode.getThreadPolicy()).permitNetwork().build()); } catch (Throwable th) { g.a(th); } } public static String k() { String str = f45257x; if (g.a(str)) { synchronized (f45258y) { str = g.a(b.i(), g.P() ? "https://errlogos.umeng.com/upload" : "https://errlog.umeng.com/upload", true); f45257x = str; } } return str; } private static String k(String str) { return String.format(Locale.US, "%s%s_%s_%s.log", d(), n(), Q(), str); } private static String l(String str) { if (!g.b(str)) { return ""; } int indexOf = str.indexOf(0); if (indexOf >= 0) { str = str.substring(0, indexOf); } return str.trim(); } public static void l() { synchronized (f45258y) { f45257x = null; } } private static String m(String str) { String a10 = com.uc.crashsdk.a.b.a(str, g.w(), g.v()); if (!str.equals(a10)) { File file = new File(str); if (file.exists()) { file.delete(); } } return a10; } public static void m() { if (!ag) { f.a(1, new com.uc.crashsdk.a.e(411), 1000); } } static String n() { return a(new Date()); } /* JADX WARNING: Code restructure failed: missing block: B:22:0x0051, code lost: if (r7.endsWith(r3) != false) goto L_0x005a; */ /* JADX WARNING: Code restructure failed: missing block: B:27:0x0068, code lost: if (r7.indexOf(".log", r7.lastIndexOf(95)) != r7.lastIndexOf(".log")) goto L_0x005a; */ private static boolean[] n(String str) { boolean v10 = g.v(); boolean x10 = g.x(); if (v10 || x10) { if (!str.endsWith(DiskFileUpload.postfix) && !str.contains(".ec")) { int lastIndexOf = str.lastIndexOf(File.separatorChar); if (lastIndexOf < 0) { lastIndexOf = 0; } int i10 = 0; do { lastIndexOf = str.indexOf(95, lastIndexOf); if (lastIndexOf >= 0) { i10++; lastIndexOf++; continue; } } while (lastIndexOf >= 0); if (i10 == 8) { String w10 = g.w(); if (!str.endsWith(".log")) { if (!g.a(w10)) { } } else if (!g.a(w10)) { } v10 = false; } } v10 = false; x10 = false; } return new boolean[]{v10, x10}; } public static void o() { f45236b = System.currentTimeMillis(); } /* JADX WARNING: Removed duplicated region for block: B:28:0x00ae */ private static boolean o(String str) { boolean z10; boolean z11; Throwable th; Exception e10; FileWriter fileWriter; int i10; synchronized (f45251r) { File file = new File(g.U() + "customlog"); String a10 = g.a(file, 1024, false); long currentTimeMillis = System.currentTimeMillis(); StringBuffer stringBuffer = new StringBuffer(); if (a10 != null) { stringBuffer.append(a10); Matcher matcher = Pattern.compile("([^\\n\\r\\t\\s]+) (\\d+) (\\d+)").matcher(stringBuffer); int i11 = 0; while (true) { if (!matcher.find(i11)) { break; } else if (!str.equals(matcher.group(1))) { i11 = matcher.end(); } else { long parseLong = Long.parseLong(matcher.group(2)); if (currentTimeMillis - parseLong < 86400000) { try { i10 = Integer.parseInt(matcher.group(3)); } catch (Exception e11) { g.a(e11); } } else { parseLong = currentTimeMillis; i10 = 0; } int D2 = g.D(); z10 = D2 >= 0 && i10 >= D2; stringBuffer.replace(matcher.start(), matcher.end(), String.format(Locale.US, "%s %d %d", str, Long.valueOf(parseLong), Integer.valueOf(i10 + 1))); z11 = true; } } if (!z11) { stringBuffer.append(String.format(Locale.US, "%s %d 1\n", str, Long.valueOf(currentTimeMillis))); } FileWriter fileWriter2 = null; fileWriter = new FileWriter(file); String stringBuffer2 = stringBuffer.toString(); fileWriter.write(stringBuffer2, 0, stringBuffer2.length()); g.a(fileWriter); } z11 = false; z10 = false; if (!z11) { } FileWriter fileWriter22 = null; try { fileWriter = new FileWriter(file); try { String stringBuffer22 = stringBuffer.toString(); fileWriter.write(stringBuffer22, 0, stringBuffer22.length()); g.a(fileWriter); } catch (Exception e12) { e10 = e12; fileWriter22 = fileWriter; try { g.a(e10); g.a(fileWriter22); return z10; } catch (Throwable th2) { th = th2; g.a(fileWriter22); throw th; } } catch (Throwable th3) { th = th3; fileWriter22 = fileWriter; g.a(fileWriter22); throw th; } } catch (Exception e13) { e10 = e13; g.a(e10); g.a(fileWriter22); return z10; } } return z10; } public static void p() { String str; Throwable th; if (g.a(B)) { String str2 = null; try { File file = new File(g.U() + "unique"); if (file.exists()) { str = g.a(file, 48, false); if (str != null) { try { if (str.length() == 36) { str2 = str.replaceAll("[^0-9a-zA-Z-]", "-"); } } catch (Exception e10) { g.a(e10); } catch (Throwable th2) { th = th2; g.a(th); str2 = str; B = str2; } } str2 = str; } if (g.a(str2)) { b.G(); str2 = UUID.randomUUID().toString(); if (!g.a(str2)) { g.a(file, str2.getBytes()); } } } catch (Throwable th3) { str = null; th = th3; g.a(th); str2 = str; B = str2; } B = str2; } } /* JADX WARNING: Removed duplicated region for block: B:34:0x00a0 */ /* JADX WARNING: Removed duplicated region for block: B:35:0x00ab */ /* JADX WARNING: Removed duplicated region for block: B:37:0x00ae */ private static boolean p(String str) { boolean z10; int i10; boolean z11; Integer num; synchronized (f45259z) { z10 = false; if (A == null) { A = q(g.a(b.l(), "all:1", false)); } if (A.containsKey(PurhcaseUsingCoupon.CTION_UPDATE_USER_INFO_TYPE_ALL)) { num = A.get(PurhcaseUsingCoupon.CTION_UPDATE_USER_INFO_TYPE_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)) { if (!LogType.UNEXP_TYPE.equals(str)) { z11 = false; if (!z11 && A.containsKey(AppMeasurement.CRASH_ORIGIN)) { num = A.get(AppMeasurement.CRASH_ORIGIN); } else if (z11 && A.containsKey("nocrash")) { num = A.get("nocrash"); } else if (!A.containsKey("other")) { num = A.get("other"); } else { i10 = 1; if (i10 != 0) { long j2 = (long) i10; if (j2 < 0) { long j10 = 30; if (j2 == -2) { j10 = 7; } else if (j2 == -3) { j10 = 15; } else if (j2 == -4) { j10 = 60; } long b10 = a.b(); long currentTimeMillis = b10 == 0 ? -1 : (System.currentTimeMillis() - b10) / 86400000; j2 = currentTimeMillis <= j10 ? 1 : currentTimeMillis - j10; } if (j2 != 1) { if (j2 > 0) { if (System.currentTimeMillis() % j2 == 0) { } } } z10 = true; } } } } z11 = true; if (!z11) { } if (z11) { } if (!A.containsKey("other")) { } } i10 = num.intValue(); if (i10 != 0) { } } return z10; } public static String q() { return B; } 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 (!g.a(trim)) { int i10 = 1; try { i10 = Integer.parseInt(split[1].trim(), 10); } catch (Throwable th) { g.a(th); } hashMap.put(trim, Integer.valueOf(i10)); } } } return hashMap; } static void r() { O = false; if (!b.B()) { f.a(3, new com.uc.crashsdk.a.e(416), 11000); } if (!V()) { N = 0; X(); } } private static void r(String str) { if (g.q()) { try { ab(); } catch (Throwable th) { g.a(th); } if (str != null && !"".equals(str)) { try { File file = new File(g.W()); if (!file.exists()) { file.mkdirs(); } com.uc.crashsdk.a.a.a("crashsdk", "copy log to: " + file); g.a(new File(str), file); } catch (Throwable th2) { g.a(th2); } } } } private static String s(String str) { return String.format("$^%s^$", str); } public static void s() { T = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(new e()); } public static void t() { Thread.setDefaultUncaughtExceptionHandler(T); } static boolean u() { return f45237c.get() || aa(); } public static Throwable v() { return U; } public static int w() { if (b.I() == 5) { return Z; } return 100; } public static void x() { long o10 = (long) g.o(); if (o10 >= 0) { boolean z10 = b.I() == 5; f.a(0, new com.uc.crashsdk.a.e(401)); if (z10) { com.uc.crashsdk.a.e eVar = new com.uc.crashsdk.a.e(402); X = eVar; f.a(0, eVar, o10); } } } static void y() { if (b.f45199c && a.f45116c && !f.b(f45233aa)) { f.a(0, f45233aa, 1000); } } public static boolean z() { synchronized (Y) { Runnable runnable = X; if (runnable == null || W) { return false; } f.a(runnable); X = null; return true; } } /* JADX WARNING: Removed duplicated region for block: B:106:0x013e */ /* JADX WARNING: Removed duplicated region for block: B:134:0x01f3 A[SYNTHETIC, Splitter:B:134:0x01f3] */ /* JADX WARNING: Removed duplicated region for block: B:176:0x0257 A[Catch:{ all -> 0x0280 }] */ /* JADX WARNING: Removed duplicated region for block: B:190:0x028c */ /* JADX WARNING: Removed duplicated region for block: B:218:0x02d2 A[Catch:{ all -> 0x02fb }] */ /* JADX WARNING: Removed duplicated region for block: B:232:0x0307 */ /* JADX WARNING: Removed duplicated region for block: B:234:0x0313 */ /* JADX WARNING: Removed duplicated region for block: B:273:0x0370 A[Catch:{ all -> 0x0399 }] */ /* JADX WARNING: Removed duplicated region for block: B:287:0x03a5 */ /* JADX WARNING: Removed duplicated region for block: B:317:0x03eb A[Catch:{ all -> 0x0414 }] */ /* JADX WARNING: Removed duplicated region for block: B:331:0x0420 */ /* JADX WARNING: Removed duplicated region for block: B:339:0x0458 */ /* JADX WARNING: Removed duplicated region for block: B:352:0x04b4 A[SYNTHETIC, Splitter:B:352:0x04b4] */ /* JADX WARNING: Removed duplicated region for block: B:376:0x04e8 A[Catch:{ all -> 0x0511 }] */ /* JADX WARNING: Removed duplicated region for block: B:390:0x051e */ /* JADX WARNING: Removed duplicated region for block: B:399:0x0544 A[Catch:{ all -> 0x05d7, all -> 0x05f9, all -> 0x05f6, all -> 0x060b, all -> 0x0643 }] */ /* JADX WARNING: Removed duplicated region for block: B:406:0x0565 A[SYNTHETIC, Splitter:B:406:0x0565] */ /* JADX WARNING: Removed duplicated region for block: B:430:0x0599 A[Catch:{ all -> 0x05c2 }] */ /* JADX WARNING: Removed duplicated region for block: B:444:0x05cf */ /* JADX WARNING: Removed duplicated region for block: B:48:0x0088 A[Catch:{ all -> 0x00b1 }] */ /* JADX WARNING: Removed duplicated region for block: B:490:0x0650 */ /* JADX WARNING: Removed duplicated region for block: B:495:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:497:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:499:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:501:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:503:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:505:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:507:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:509:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:62:0x00bd */ /* JADX WARNING: Removed duplicated region for block: B:92:0x0109 A[Catch:{ all -> 0x0132 }] */ public final void a(Thread thread, Throwable th, boolean z10) { long j2; boolean z11; Throwable th2; boolean z12; Thread.UncaughtExceptionHandler uncaughtExceptionHandler; Throwable th3; boolean z13; Thread.UncaughtExceptionHandler uncaughtExceptionHandler2; Throwable th4; boolean z14; String str; boolean z15; Thread.UncaughtExceptionHandler uncaughtExceptionHandler3; Throwable th5; File file; boolean z16; Thread.UncaughtExceptionHandler uncaughtExceptionHandler4; Throwable th6; boolean z17; Thread.UncaughtExceptionHandler uncaughtExceptionHandler5; Throwable th7; boolean z18; Thread.UncaughtExceptionHandler uncaughtExceptionHandler6; Throwable th8; boolean z19; Thread.UncaughtExceptionHandler uncaughtExceptionHandler7; Throwable th9; Throwable th10; boolean z20; Thread.UncaughtExceptionHandler uncaughtExceptionHandler8; Throwable th11; boolean z21; Thread.UncaughtExceptionHandler uncaughtExceptionHandler9; Throwable th12; boolean z22 = (ag && b.f45200d) || b.L(); try { if (!f45237c.getAndSet(true) || Process.myPid() <= 0) { U = th; if (z22 || com.uc.crashsdk.a.d.e()) { com.uc.crashsdk.a.a.d("DEBUG", "encryptLog: " + g.x() + ", zipCrashLog: " + g.x()); if (g.f45282a != null) { com.uc.crashsdk.a.a.d("DEBUG", "the set zip log to false stack is:"); g.f45282a.printStackTrace(); } if (g.f45283b != null) { com.uc.crashsdk.a.a.d("DEBUG", "the set encrypt to true stack is:"); g.f45283b.printStackTrace(); } com.uc.crashsdk.a.a.d("DEBUG", "begin to generate java report"); try { N(); } catch (Throwable th13) { g.a(th13); } try { z14 = g.t(); try { String g2 = g.g(); if (g2 == null || g2.equals("")) { g2 = k(S()); } str = g.V() + g2; z11 = false; } catch (Throwable th14) { th10 = th14; com.uc.crashsdk.a.a.d("DEBUG", "get java log name failed: " + th10); a(th10); com.uc.crashsdk.a.a.d("DEBUG", "original exception is: " + th); a(th); str = null; z11 = true; if (!z22) { } boolean z23 = th instanceof OutOfMemoryError; a(th, str, j2, z23); com.uc.crashsdk.a.a.d("DEBUG", "generate java report finished"); String name = new File(str).getName(); String W2 = g.W(); file = new File(W2); if (!file.exists()) { } String format = String.format(Locale.US, "%s%s.hprof", W2, name); com.uc.crashsdk.a.a.d("DEBUG", "begin dump hprof: " + format); long currentTimeMillis = System.currentTimeMillis(); try { Debug.dumpHprofData(format); } catch (Throwable th15) { g.a(th15); } com.uc.crashsdk.a.a.d("DEBUG", "end dump hprof, use " + (System.currentTimeMillis() - currentTimeMillis) + " ms"); JNIBridge.nativeClientCloseConnection(j2); if (z10) { } z15 = false; b(false); f.c(false); boolean i10 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i10); uncaughtExceptionHandler3.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } catch (Throwable th16) { th10 = th16; z14 = false; com.uc.crashsdk.a.a.d("DEBUG", "get java log name failed: " + th10); a(th10); com.uc.crashsdk.a.a.d("DEBUG", "original exception is: " + th); a(th); str = null; z11 = true; if (!z22) { } boolean z232 = th instanceof OutOfMemoryError; a(th, str, j2, z232); com.uc.crashsdk.a.a.d("DEBUG", "generate java report finished"); String name2 = new File(str).getName(); String W22 = g.W(); file = new File(W22); if (!file.exists()) { } String format2 = String.format(Locale.US, "%s%s.hprof", W22, 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"); JNIBridge.nativeClientCloseConnection(j2); if (z10) { } z15 = false; b(false); f.c(false); boolean i102 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i102); uncaughtExceptionHandler3.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z22) { try { g.a(); try { if (b.B()) { f.a(3); } else { f.a(4); } } catch (Throwable th17) { g.a(th17); } } catch (Throwable th18) { th2 = th18; j2 = 0; try { com.uc.crashsdk.a.a.d("DEBUG", "exception occurs while java log: " + th2); a(th2); if (!z11) { } JNIBridge.nativeClientCloseConnection(j2); if (z10) { } z13 = false; b(false); try { f.c(false); } catch (Throwable th19) { g.a(th19); } try { boolean i11 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i11); uncaughtExceptionHandler2.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th20) { g.a(th20); } V = true; if (Process.myPid() <= 0) { } } catch (Throwable th21) { g.a(th21); } } try { new File(b.b()).createNewFile(); } catch (Throwable th22) { g.a(th22); } if (z14) { com.uc.crashsdk.a.a.d("DEBUG", "omit java crash"); if (z10) { try { if (g.r() && !z22) { try { a(true, false); z19 = true; } catch (Throwable th23) { th9 = th23; z19 = true; g.a(th9); b(false); f.c(false); boolean i12 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i12); uncaughtExceptionHandler7.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z19 && !z22) { b(false); } f.c(false); boolean i122 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i122 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i122); if (i122 && (uncaughtExceptionHandler7 = T) != null) { uncaughtExceptionHandler7.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th24) { th9 = th24; z19 = false; g.a(th9); b(false); f.c(false); boolean i1222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1222); uncaughtExceptionHandler7.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z19 = false; b(false); try { f.c(false); } catch (Throwable th25) { g.a(th25); } try { boolean i12222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i12222); uncaughtExceptionHandler7.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th26) { g.a(th26); } V = true; if (Process.myPid() <= 0) { } } else if (!d(LogType.JAVA_TYPE)) { com.uc.crashsdk.a.a.d("DEBUG", "java log sample miss"); if (z10) { try { if (g.r() && !z22) { try { a(true, false); z18 = true; } catch (Throwable th27) { th8 = th27; z18 = true; g.a(th8); b(false); f.c(false); boolean i13 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i13); uncaughtExceptionHandler6.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z18 && !z22) { b(false); } f.c(false); boolean i132 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i132 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i132); if (i132 && (uncaughtExceptionHandler6 = T) != null) { uncaughtExceptionHandler6.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th28) { th8 = th28; z18 = false; g.a(th8); b(false); f.c(false); boolean i1322 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1322); uncaughtExceptionHandler6.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z18 = false; b(false); try { f.c(false); } catch (Throwable th29) { g.a(th29); } try { boolean i13222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i13222); uncaughtExceptionHandler6.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th30) { g.a(th30); } V = true; if (Process.myPid() <= 0) { } } else { j2 = 0; } } else { if (z14) { str = "omit"; com.uc.crashsdk.a.a.d("DEBUG", "omit java crash"); } j2 = b.f45200d ? JNIBridge.nativeClientCreateConnection(str, LogType.JAVA_TYPE, null, 0) : 0; int i14 = (j2 > 0 ? 1 : (j2 == 0 ? 0 : -1)); if (i14 == 0) { try { com.uc.crashsdk.a.a.d("DEBUG", "skip java crash:"); a(th); if (i14 != 0 && b.f45200d) { JNIBridge.nativeClientCloseConnection(j2); } if (z10) { try { if (g.r() && !z22) { try { a(true, false); z17 = true; } catch (Throwable th31) { th7 = th31; z17 = true; g.a(th7); b(false); f.c(false); boolean i15 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i15); uncaughtExceptionHandler5.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z17 && !z22) { b(false); } f.c(false); boolean i152 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i152 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i152); if (i152 && (uncaughtExceptionHandler5 = T) != null) { uncaughtExceptionHandler5.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th32) { th7 = th32; z17 = false; g.a(th7); b(false); f.c(false); boolean i1522 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1522); uncaughtExceptionHandler5.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z17 = false; b(false); try { f.c(false); } catch (Throwable th33) { g.a(th33); } try { boolean i15222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i15222); uncaughtExceptionHandler5.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th34) { g.a(th34); } V = true; if (Process.myPid() <= 0) { } } catch (Throwable th35) { th2 = th35; com.uc.crashsdk.a.a.d("DEBUG", "exception occurs while java log: " + th2); a(th2); if (!z11) { com.uc.crashsdk.a.a.d("DEBUG", "original exception is: " + th); a(th); } if (j2 != 0 && b.f45200d) { JNIBridge.nativeClientCloseConnection(j2); } if (z10) { try { if (g.r() && !z22) { try { a(true, false); z13 = true; } catch (Throwable th36) { th4 = th36; z13 = true; g.a(th4); b(false); f.c(false); boolean i112 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i112); uncaughtExceptionHandler2.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z13 && !z22) { b(false); } f.c(false); boolean i1122 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i1122 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1122); if (i1122 && (uncaughtExceptionHandler2 = T) != null) { uncaughtExceptionHandler2.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th37) { th4 = th37; z13 = false; g.a(th4); b(false); f.c(false); boolean i11222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i11222); uncaughtExceptionHandler2.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z13 = false; b(false); f.c(false); boolean i112222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i112222); uncaughtExceptionHandler2.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } else if (z14) { if (i14 != 0 && b.f45200d) { JNIBridge.nativeClientCloseConnection(j2); } if (z10) { try { if (g.r() && !z22) { try { a(true, false); z16 = true; } catch (Throwable th38) { th6 = th38; z16 = true; g.a(th6); b(false); f.c(false); boolean i16 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i16); uncaughtExceptionHandler4.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z16 && !z22) { b(false); } f.c(false); boolean i162 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i162 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i162); if (i162 && (uncaughtExceptionHandler4 = T) != null) { uncaughtExceptionHandler4.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th39) { th6 = th39; z16 = false; g.a(th6); b(false); f.c(false); boolean i1622 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1622); uncaughtExceptionHandler4.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z16 = false; b(false); try { f.c(false); } catch (Throwable th40) { g.a(th40); } try { boolean i16222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i16222); uncaughtExceptionHandler4.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th41) { g.a(th41); } V = true; if (Process.myPid() <= 0) { } } } boolean z2322 = th instanceof OutOfMemoryError; a(th, str, j2, z2322); com.uc.crashsdk.a.a.d("DEBUG", "generate java report finished"); if (!b.L() && z2322 && g.j()) { String name22 = new File(str).getName(); String W222 = g.W(); file = new File(W222); if (!file.exists()) { file.mkdirs(); } String format22 = String.format(Locale.US, "%s%s.hprof", W222, name22); com.uc.crashsdk.a.a.d("DEBUG", "begin dump hprof: " + format22); long currentTimeMillis22 = System.currentTimeMillis(); Debug.dumpHprofData(format22); com.uc.crashsdk.a.a.d("DEBUG", "end dump hprof, use " + (System.currentTimeMillis() - currentTimeMillis22) + " ms"); } if (j2 != 0 && b.f45200d) { JNIBridge.nativeClientCloseConnection(j2); } if (z10) { try { if (g.r() && !z22) { try { a(true, false); z15 = true; } catch (Throwable th42) { th5 = th42; z15 = true; g.a(th5); b(false); f.c(false); boolean i1022 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1022); uncaughtExceptionHandler3.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z15 && !z22) { b(false); } f.c(false); boolean i10222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i10222 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i10222); if (i10222 && (uncaughtExceptionHandler3 = T) != null) { uncaughtExceptionHandler3.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th43) { th5 = th43; z15 = false; g.a(th5); b(false); f.c(false); boolean i102222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i102222); uncaughtExceptionHandler3.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z15 = false; b(false); try { f.c(false); } catch (Throwable th44) { g.a(th44); } try { boolean i1022222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1022222); uncaughtExceptionHandler3.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th45) { g.a(th45); } V = true; if (Process.myPid() <= 0) { } } else { com.uc.crashsdk.a.a.c("DEBUG", com.uc.crashsdk.a.d.b()); if (z10) { try { if (g.r() && !z22) { try { a(true, false); z20 = true; } catch (Throwable th46) { th11 = th46; z20 = true; g.a(th11); b(false); f.c(false); boolean i17 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i17); uncaughtExceptionHandler8.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z20 && !z22) { b(false); } f.c(false); boolean i172 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i172 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i172); if (i172 && (uncaughtExceptionHandler8 = T) != null) { uncaughtExceptionHandler8.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th47) { th11 = th47; z20 = false; g.a(th11); b(false); f.c(false); boolean i1722 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1722); uncaughtExceptionHandler8.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z20 = false; b(false); try { f.c(false); } catch (Throwable th48) { g.a(th48); } try { boolean i17222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i17222); uncaughtExceptionHandler8.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th49) { g.a(th49); } 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 i18 = 0; while (!V) { try { Thread.sleep(1000); } catch (Throwable th50) { g.a(th50); } i18++; if (i18 >= 4) { break; } } Process.killProcess(Process.myPid()); if (z10) { try { if (g.r() && !z22) { try { a(true, false); z21 = true; } catch (Throwable th51) { th12 = th51; z21 = true; g.a(th12); b(false); f.c(false); boolean i19 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i19); uncaughtExceptionHandler9.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } if (!z21 && !z22) { b(false); } f.c(false); boolean i192 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i192 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i192); if (i192 && (uncaughtExceptionHandler9 = T) != null) { uncaughtExceptionHandler9.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() <= 0) { Process.killProcess(Process.myPid()); return; } return; } } catch (Throwable th52) { th12 = th52; z21 = false; g.a(th12); b(false); f.c(false); boolean i1922 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1922); uncaughtExceptionHandler9.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } } z21 = false; b(false); try { f.c(false); } catch (Throwable th53) { g.a(th53); } try { boolean i19222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i19222); uncaughtExceptionHandler9.uncaughtException(thread, th); b.b(g.a()); } catch (Throwable th54) { g.a(th54); } V = true; if (Process.myPid() <= 0) { } } } catch (Throwable th55) { th2 = th55; z11 = false; j2 = 0; com.uc.crashsdk.a.a.d("DEBUG", "exception occurs while java log: " + th2); a(th2); if (!z11) { } JNIBridge.nativeClientCloseConnection(j2); if (z10) { } z13 = false; b(false); f.c(false); boolean i1122222 = g.i(); if (!com.uc.crashsdk.a.d.e()) { } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i1122222); uncaughtExceptionHandler2.uncaughtException(thread, th); b.b(g.a()); V = true; if (Process.myPid() <= 0) { } } V = true; if (Process.myPid() > 0) { Process.killProcess(Process.myPid()); } throw th; boolean i20 = g.i(); if (!com.uc.crashsdk.a.d.e()) { i20 = true; } com.uc.crashsdk.a.a.a("crashsdk", "Call java default handler: " + i20); if (i20 && (uncaughtExceptionHandler = T) != null) { uncaughtExceptionHandler.uncaughtException(thread, th); } if (b.B() && !z22) { b.b(g.a()); } V = true; if (Process.myPid() > 0) { } throw th; } public void uncaughtException(Thread thread, Throwable th) { a(thread, th, false); } }