Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package com.tencent.a.a.a.a;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
final class a {
static File a(String str) {
File file = new File(str);
if (file.exists()) {
return file;
}
if (!file.getParentFile().exists()) {
a(file.getParentFile().getAbsolutePath());
}
file.mkdir();
return file;
}
static List<String> a(File file) {
FileReader fileReader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(fileReader);
ArrayList arrayList = new ArrayList();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
fileReader.close();
bufferedReader.close();
return arrayList;
}
arrayList.add(readLine.trim());
}
}
}

View File

@@ -0,0 +1,61 @@
package com.tencent.a.a.a.a;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
/* loaded from: classes.dex */
final class b extends f {
b(Context context) {
super(context);
}
@Override // com.tencent.a.a.a.a.f
protected final void a(String str) {
synchronized (this) {
Log.i("MID", "write mid to InternalStorage");
a.a(Environment.getExternalStorageDirectory() + "/" + h.c("6X8Y4XdM2Vhvn0I="));
try {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(new File(Environment.getExternalStorageDirectory(), h.c("6X8Y4XdM2Vhvn0KfzcEatGnWaNU="))));
bufferedWriter.write(h.c("4kU71lN96TJUomD1vOU9lgj9Tw==") + "," + str);
bufferedWriter.write("\n");
bufferedWriter.close();
} catch (Exception e) {
Log.w("MID", e);
}
}
}
@Override // com.tencent.a.a.a.a.f
protected final boolean a() {
return h.a(this.a, "android.permission.WRITE_EXTERNAL_STORAGE") && Environment.getExternalStorageState().equals("mounted");
}
@Override // com.tencent.a.a.a.a.f
protected final String b() {
String str;
synchronized (this) {
Log.i("MID", "read mid from InternalStorage");
try {
Iterator<String> it = a.a(new File(Environment.getExternalStorageDirectory(), h.c("6X8Y4XdM2Vhvn0KfzcEatGnWaNU="))).iterator();
while (it.hasNext()) {
String[] split = it.next().split(",");
if (split.length == 2 && split[0].equals(h.c("4kU71lN96TJUomD1vOU9lgj9Tw=="))) {
Log.i("MID", "read mid from InternalStorage:" + split[1]);
str = split[1];
break;
}
}
} catch (IOException e) {
Log.w("MID", e);
}
str = null;
}
return str;
}
}

View File

@@ -0,0 +1,58 @@
package com.tencent.a.a.a.a;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class c {
String a = null;
String b = null;
String c = "0";
long d = 0;
static c a(String str) {
c cVar = new c();
if (h.a(str)) {
try {
JSONObject jSONObject = new JSONObject(str);
if (!jSONObject.isNull("ui")) {
cVar.a = jSONObject.getString("ui");
}
if (!jSONObject.isNull("mc")) {
cVar.b = jSONObject.getString("mc");
}
if (!jSONObject.isNull("mid")) {
cVar.c = jSONObject.getString("mid");
}
if (!jSONObject.isNull("ts")) {
cVar.d = jSONObject.getLong("ts");
}
} catch (JSONException e) {
Log.w("MID", e);
}
}
return cVar;
}
private JSONObject b() {
JSONObject jSONObject = new JSONObject();
try {
h.a(jSONObject, "ui", this.a);
h.a(jSONObject, "mc", this.b);
h.a(jSONObject, "mid", this.c);
jSONObject.put("ts", this.d);
} catch (JSONException e) {
Log.w("MID", e);
}
return jSONObject;
}
public final String a() {
return this.c;
}
public final String toString() {
return b().toString();
}
}

View File

@@ -0,0 +1,38 @@
package com.tencent.a.a.a.a;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
/* loaded from: classes.dex */
final class d extends f {
public d(Context context) {
super(context);
}
@Override // com.tencent.a.a.a.a.f
protected final void a(String str) {
synchronized (this) {
Log.i("MID", "write mid to sharedPreferences");
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(this.a).edit();
edit.putString(h.c("4kU71lN96TJUomD1vOU9lgj9Tw=="), str);
edit.commit();
}
}
@Override // com.tencent.a.a.a.a.f
protected final boolean a() {
return true;
}
@Override // com.tencent.a.a.a.a.f
protected final String b() {
String string;
synchronized (this) {
Log.i("MID", "read mid from sharedPreferences");
string = PreferenceManager.getDefaultSharedPreferences(this.a).getString(h.c("4kU71lN96TJUomD1vOU9lgj9Tw=="), null);
}
return string;
}
}

View File

@@ -0,0 +1,34 @@
package com.tencent.a.a.a.a;
import android.content.Context;
import android.util.Log;
/* loaded from: classes.dex */
public final class e extends f {
public e(Context context) {
super(context);
}
@Override // com.tencent.a.a.a.a.f
protected final void a(String str) {
synchronized (this) {
Log.i("MID", "write mid to Settings.System");
com.tencent.wxop.stat.common.g.a(this.a).a(h.c("4kU71lN96TJUomD1vOU9lgj9Tw=="), str);
}
}
@Override // com.tencent.a.a.a.a.f
protected final boolean a() {
return h.a(this.a, "android.permission.WRITE_SETTINGS");
}
@Override // com.tencent.a.a.a.a.f
protected final String b() {
String a;
synchronized (this) {
Log.i("MID", "read mid from Settings.System");
a = com.tencent.wxop.stat.common.g.a(this.a).a(h.c("4kU71lN96TJUomD1vOU9lgj9Tw=="));
}
return a;
}
}

View File

@@ -0,0 +1,37 @@
package com.tencent.a.a.a.a;
import android.content.Context;
/* loaded from: classes.dex */
public abstract class f {
protected Context a;
protected f(Context context) {
this.a = null;
this.a = context;
}
public final void a(c cVar) {
if (cVar == null) {
return;
}
String cVar2 = cVar.toString();
if (a()) {
a(h.d(cVar2));
}
}
protected abstract void a(String str);
protected abstract boolean a();
protected abstract String b();
public final c c() {
String c = a() ? h.c(b()) : null;
if (c != null) {
return c.a(c);
}
return null;
}
}

View File

@@ -0,0 +1,71 @@
package com.tencent.a.a.a.a;
import android.content.Context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public final class g {
private static g c;
private Map<Integer, f> a;
private Context b;
private g(Context context) {
this.a = null;
this.b = null;
this.b = context.getApplicationContext();
this.a = new HashMap(3);
this.a.put(1, new e(context));
this.a.put(2, new b(context));
this.a.put(4, new d(context));
}
private c a(List<Integer> list) {
c c2;
if (list.size() >= 0) {
Iterator<Integer> it = list.iterator();
while (it.hasNext()) {
f fVar = this.a.get(it.next());
if (fVar != null && (c2 = fVar.c()) != null && h.b(c2.c)) {
return c2;
}
}
}
return new c();
}
public static synchronized g a(Context context) {
g gVar;
synchronized (g.class) {
if (c == null) {
c = new g(context);
}
gVar = c;
}
return gVar;
}
public final c a() {
return a(new ArrayList(Arrays.asList(1, 2, 4)));
}
public final void a(String str) {
c a = a();
a.c = str;
if (!h.a(a.a)) {
a.a = h.a(this.b);
}
if (!h.a(a.b)) {
a.b = h.b(this.b);
}
a.d = System.currentTimeMillis();
Iterator<Map.Entry<Integer, f>> it = this.a.entrySet().iterator();
while (it.hasNext()) {
it.next().getValue().a(a);
}
}
}

View File

@@ -0,0 +1,102 @@
package com.tencent.a.a.a.a;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.util.Base64;
import android.util.Log;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class h {
static String a(Context context) {
try {
if (a(context, "android.permission.READ_PHONE_STATE")) {
String deviceId = ((TelephonyManager) context.getSystemService("phone")).getDeviceId();
if (deviceId != null) {
return deviceId;
}
} else {
Log.i("MID", "Could not get permission of android.permission.READ_PHONE_STATE");
}
return "";
} catch (Throwable th) {
Log.w("MID", th);
return "";
}
}
private static void a(String str, Throwable th) {
Log.e("MID", str, th);
}
static void a(JSONObject jSONObject, String str, String str2) {
if (a(str2)) {
jSONObject.put(str, str2);
}
}
static boolean a(Context context, String str) {
try {
return context.getPackageManager().checkPermission(str, context.getPackageName()) == 0;
} catch (Throwable th) {
a("checkPermission error", th);
return false;
}
}
static boolean a(String str) {
return (str == null || str.trim().length() == 0) ? false : true;
}
static String b(Context context) {
String str;
if (a(context, "android.permission.ACCESS_WIFI_STATE")) {
try {
WifiManager wifiManager = (WifiManager) context.getSystemService("wifi");
return wifiManager == null ? "" : wifiManager.getConnectionInfo().getMacAddress();
} catch (Exception e) {
str = "get wifi address error" + e;
}
} else {
str = "Could not get permission of android.permission.ACCESS_WIFI_STATE";
}
Log.i("MID", str);
return "";
}
public static boolean b(String str) {
return str != null && str.trim().length() >= 40;
}
static String c(String str) {
if (str == null) {
return null;
}
if (Build.VERSION.SDK_INT < 8) {
return str;
}
try {
return new String(com.tencent.wxop.stat.common.f.b(Base64.decode(str.getBytes("UTF-8"), 0)), "UTF-8").trim().replace("\t", "").replace("\n", "").replace("\r", "");
} catch (Throwable th) {
a("decode error", th);
return str;
}
}
static String d(String str) {
if (str == null) {
return null;
}
if (Build.VERSION.SDK_INT < 8) {
return str;
}
try {
return new String(Base64.encode(com.tencent.wxop.stat.common.f.a(str.getBytes("UTF-8")), 0), "UTF-8").trim().replace("\t", "").replace("\n", "").replace("\r", "");
} catch (Throwable th) {
a("decode error", th);
return str;
}
}
}

View File

@@ -0,0 +1,85 @@
package com.tencent.bugly;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.bugly.proguard.o;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class Bugly {
public static final String SDK_IS_DEV = "false";
private static boolean a = false;
public static Context applicationContext = null;
private static String[] b = {"BuglyCrashModule", "BuglyRqdModule", "BuglyBetaModule"};
private static String[] c = {"BuglyRqdModule", "BuglyCrashModule", "BuglyBetaModule"};
public static boolean enable = true;
public static Boolean isDev;
public static synchronized String getAppChannel() {
byte[] bArr;
synchronized (Bugly.class) {
com.tencent.bugly.crashreport.common.info.a b2 = com.tencent.bugly.crashreport.common.info.a.b();
if (b2 == null) {
return null;
}
if (TextUtils.isEmpty(b2.l)) {
p a2 = p.a();
if (a2 == null) {
return b2.l;
}
Map<String, byte[]> a3 = a2.a(556, (o) null, true);
if (a3 != null && (bArr = a3.get("app_channel")) != null) {
return new String(bArr);
}
}
return b2.l;
}
}
public static void init(Context context, String str, boolean z) {
init(context, str, z, null);
}
public static boolean isDev() {
if (isDev == null) {
isDev = Boolean.valueOf(Boolean.parseBoolean(SDK_IS_DEV.replace("@", "")));
}
return isDev.booleanValue();
}
public static synchronized void init(Context context, String str, boolean z, BuglyStrategy buglyStrategy) {
synchronized (Bugly.class) {
if (a) {
return;
}
a = true;
Context a2 = z.a(context);
applicationContext = a2;
if (a2 == null) {
Log.e(x.a, "init arg 'context' should not be null!");
return;
}
if (isDev()) {
b = c;
}
for (String str2 : b) {
try {
if (str2.equals("BuglyCrashModule")) {
b.a(CrashModule.getInstance());
} else if (!str2.equals("BuglyBetaModule") && !str2.equals("BuglyRqdModule")) {
str2.equals("BuglyFeedbackModule");
}
} catch (Throwable th) {
x.b(th);
}
}
b.a = enable;
b.a(applicationContext, str, z, buglyStrategy);
}
}
}

View File

@@ -0,0 +1,188 @@
package com.tencent.bugly;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class BuglyStrategy {
private String a;
private String b;
private String c;
private long d;
private String e;
private String f;
private boolean g = true;
private boolean h = true;
private boolean i = true;
private Class<?> j = null;
private boolean k = true;
private boolean l = true;
private boolean m = true;
private boolean n = false;
private a o;
/* compiled from: BUGLY */
public static class a {
public static final int CRASHTYPE_ANR = 4;
public static final int CRASHTYPE_BLOCK = 7;
public static final int CRASHTYPE_COCOS2DX_JS = 5;
public static final int CRASHTYPE_COCOS2DX_LUA = 6;
public static final int CRASHTYPE_JAVA_CATCH = 1;
public static final int CRASHTYPE_JAVA_CRASH = 0;
public static final int CRASHTYPE_NATIVE = 2;
public static final int CRASHTYPE_U3D = 3;
public static final int MAX_USERDATA_KEY_LENGTH = 100;
public static final int MAX_USERDATA_VALUE_LENGTH = 30000;
public synchronized Map<String, String> onCrashHandleStart(int i, String str, String str2, String str3) {
return null;
}
public synchronized byte[] onCrashHandleStart2GetExtraDatas(int i, String str, String str2, String str3) {
return null;
}
}
public synchronized String getAppChannel() {
if (this.b == null) {
return com.tencent.bugly.crashreport.common.info.a.b().l;
}
return this.b;
}
public synchronized String getAppPackageName() {
if (this.c == null) {
return com.tencent.bugly.crashreport.common.info.a.b().c;
}
return this.c;
}
public synchronized long getAppReportDelay() {
return this.d;
}
public synchronized String getAppVersion() {
if (this.a == null) {
return com.tencent.bugly.crashreport.common.info.a.b().j;
}
return this.a;
}
public synchronized a getCrashHandleCallback() {
return this.o;
}
public synchronized String getDeviceID() {
return this.f;
}
public synchronized String getLibBuglySOFilePath() {
return this.e;
}
public synchronized Class<?> getUserInfoActivity() {
return this.j;
}
public synchronized boolean isBuglyLogUpload() {
return this.k;
}
public synchronized boolean isEnableANRCrashMonitor() {
return this.h;
}
public synchronized boolean isEnableNativeCrashMonitor() {
return this.g;
}
public synchronized boolean isEnableUserInfo() {
return this.i;
}
public boolean isReplaceOldChannel() {
return this.l;
}
public synchronized boolean isUploadProcess() {
return this.m;
}
public synchronized boolean recordUserInfoOnceADay() {
return this.n;
}
public synchronized BuglyStrategy setAppChannel(String str) {
this.b = str;
return this;
}
public synchronized BuglyStrategy setAppPackageName(String str) {
this.c = str;
return this;
}
public synchronized BuglyStrategy setAppReportDelay(long j) {
this.d = j;
return this;
}
public synchronized BuglyStrategy setAppVersion(String str) {
this.a = str;
return this;
}
public synchronized BuglyStrategy setBuglyLogUpload(boolean z) {
this.k = z;
return this;
}
public synchronized BuglyStrategy setCrashHandleCallback(a aVar) {
this.o = aVar;
return this;
}
public synchronized BuglyStrategy setDeviceID(String str) {
this.f = str;
return this;
}
public synchronized BuglyStrategy setEnableANRCrashMonitor(boolean z) {
this.h = z;
return this;
}
public synchronized BuglyStrategy setEnableNativeCrashMonitor(boolean z) {
this.g = z;
return this;
}
public synchronized BuglyStrategy setEnableUserInfo(boolean z) {
this.i = z;
return this;
}
public synchronized BuglyStrategy setLibBuglySOFilePath(String str) {
this.e = str;
return this;
}
public synchronized BuglyStrategy setRecordUserInfoOnceADay(boolean z) {
this.n = z;
return this;
}
public void setReplaceOldChannel(boolean z) {
this.l = z;
}
public synchronized BuglyStrategy setUploadProcess(boolean z) {
this.m = z;
return this;
}
public synchronized BuglyStrategy setUserInfoActivity(Class<?> cls) {
this.j = cls;
return this;
}
}

View File

@@ -0,0 +1,158 @@
package com.tencent.bugly;
import android.content.Context;
import android.text.TextUtils;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.proguard.x;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class CrashModule extends a {
public static final int MODULE_ID = 1004;
private static int c;
private static CrashModule e = new CrashModule();
private long a;
private BuglyStrategy.a b;
private boolean d = false;
private synchronized void a(Context context, BuglyStrategy buglyStrategy) {
if (buglyStrategy == null) {
return;
}
String libBuglySOFilePath = buglyStrategy.getLibBuglySOFilePath();
if (!TextUtils.isEmpty(libBuglySOFilePath)) {
com.tencent.bugly.crashreport.common.info.a.a(context).m = libBuglySOFilePath;
x.a("setted libBugly.so file path :%s", libBuglySOFilePath);
}
if (buglyStrategy.getCrashHandleCallback() != null) {
this.b = buglyStrategy.getCrashHandleCallback();
x.a("setted CrashHanldeCallback", new Object[0]);
}
if (buglyStrategy.getAppReportDelay() > 0) {
this.a = buglyStrategy.getAppReportDelay();
x.a("setted delay: %d", Long.valueOf(this.a));
}
}
public static CrashModule getInstance() {
CrashModule crashModule = e;
crashModule.id = 1004;
return crashModule;
}
@Override // com.tencent.bugly.a
public String[] getTables() {
return new String[]{"t_cr"};
}
public synchronized boolean hasInitialized() {
return this.d;
}
/* JADX WARN: Removed duplicated region for block: B:22:0x006a A[Catch: all -> 0x0094, TryCatch #0 {, blocks: (B:7:0x0003, B:10:0x0009, B:12:0x003c, B:15:0x0043, B:17:0x0053, B:20:0x005a, B:22:0x006a, B:23:0x0071, B:28:0x0065, B:29:0x004e), top: B:6:0x0003 }] */
/* JADX WARN: Removed duplicated region for block: B:27:0x006f */
@Override // com.tencent.bugly.a
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized void init(android.content.Context r12, boolean r13, com.tencent.bugly.BuglyStrategy r14) {
/*
r11 = this;
monitor-enter(r11)
if (r12 == 0) goto L97
boolean r0 = r11.d // Catch: java.lang.Throwable -> L94
if (r0 == 0) goto L9
goto L97
L9:
java.lang.String r0 = "Initializing crash module."
r1 = 0
java.lang.Object[] r2 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L94
com.tencent.bugly.proguard.x.a(r0, r2) // Catch: java.lang.Throwable -> L94
com.tencent.bugly.proguard.n r0 = com.tencent.bugly.proguard.n.a() // Catch: java.lang.Throwable -> L94
int r2 = com.tencent.bugly.CrashModule.c // Catch: java.lang.Throwable -> L94
r3 = 1
int r2 = r2 + r3
com.tencent.bugly.CrashModule.c = r2 // Catch: java.lang.Throwable -> L94
r4 = 1004(0x3ec, float:1.407E-42)
r0.a(r4, r2) // Catch: java.lang.Throwable -> L94
r11.d = r3 // Catch: java.lang.Throwable -> L94
com.tencent.bugly.crashreport.CrashReport.setContext(r12) // Catch: java.lang.Throwable -> L94
r11.a(r12, r14) // Catch: java.lang.Throwable -> L94
r5 = 1004(0x3ec, float:1.407E-42)
com.tencent.bugly.BuglyStrategy$a r8 = r11.b // Catch: java.lang.Throwable -> L94
r9 = 0
r10 = 0
r6 = r12
r7 = r13
com.tencent.bugly.crashreport.crash.c r13 = com.tencent.bugly.crashreport.crash.c.a(r5, r6, r7, r8, r9, r10) // Catch: java.lang.Throwable -> L94
r13.e() // Catch: java.lang.Throwable -> L94
r13.m() // Catch: java.lang.Throwable -> L94
if (r14 == 0) goto L4e
boolean r0 = r14.isEnableNativeCrashMonitor() // Catch: java.lang.Throwable -> L94
if (r0 == 0) goto L43
goto L4e
L43:
java.lang.String r0 = "[crash] Closed native crash monitor!"
java.lang.Object[] r2 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L94
com.tencent.bugly.proguard.x.a(r0, r2) // Catch: java.lang.Throwable -> L94
r13.f() // Catch: java.lang.Throwable -> L94
goto L51
L4e:
r13.g() // Catch: java.lang.Throwable -> L94
L51:
if (r14 == 0) goto L65
boolean r0 = r14.isEnableANRCrashMonitor() // Catch: java.lang.Throwable -> L94
if (r0 == 0) goto L5a
goto L65
L5a:
java.lang.String r0 = "[crash] Closed ANR monitor!"
java.lang.Object[] r1 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L94
com.tencent.bugly.proguard.x.a(r0, r1) // Catch: java.lang.Throwable -> L94
r13.i() // Catch: java.lang.Throwable -> L94
goto L68
L65:
r13.h() // Catch: java.lang.Throwable -> L94
L68:
if (r14 == 0) goto L6f
long r0 = r14.getAppReportDelay() // Catch: java.lang.Throwable -> L94
goto L71
L6f:
r0 = 0
L71:
r13.a(r0) // Catch: java.lang.Throwable -> L94
r13.l() // Catch: java.lang.Throwable -> L94
com.tencent.bugly.crashreport.crash.d.a(r12) // Catch: java.lang.Throwable -> L94
com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver r13 = com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver.getInstance() // Catch: java.lang.Throwable -> L94
java.lang.String r14 = "android.net.conn.CONNECTIVITY_CHANGE"
r13.addFilter(r14) // Catch: java.lang.Throwable -> L94
r13.register(r12) // Catch: java.lang.Throwable -> L94
com.tencent.bugly.proguard.n r12 = com.tencent.bugly.proguard.n.a() // Catch: java.lang.Throwable -> L94
int r13 = com.tencent.bugly.CrashModule.c // Catch: java.lang.Throwable -> L94
int r13 = r13 - r3
com.tencent.bugly.CrashModule.c = r13 // Catch: java.lang.Throwable -> L94
r12.a(r4, r13) // Catch: java.lang.Throwable -> L94
monitor-exit(r11)
return
L94:
r12 = move-exception
monitor-exit(r11)
throw r12
L97:
monitor-exit(r11)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.CrashModule.init(android.content.Context, boolean, com.tencent.bugly.BuglyStrategy):void");
}
@Override // com.tencent.bugly.a
public void onServerStrategyChanged(StrategyBean strategyBean) {
c a;
if (strategyBean == null || (a = c.a()) == null) {
return;
}
a.a(strategyBean);
}
}

View File

@@ -0,0 +1,59 @@
package com.tencent.bugly;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.proguard.x;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public abstract class a {
public int id;
public String moduleName;
public String version;
public String versionKey;
public abstract String[] getTables();
public abstract void init(Context context, boolean z, BuglyStrategy buglyStrategy);
public void onDbCreate(SQLiteDatabase sQLiteDatabase) {
}
public void onDbDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
try {
if (getTables() == null) {
return;
}
for (String str : getTables()) {
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS " + str);
}
onDbCreate(sQLiteDatabase);
} catch (Throwable th) {
if (x.b(th)) {
return;
}
th.printStackTrace();
}
}
public void onDbUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
try {
if (getTables() == null) {
return;
}
for (String str : getTables()) {
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS " + str);
}
onDbCreate(sQLiteDatabase);
} catch (Throwable th) {
if (x.b(th)) {
return;
}
th.printStackTrace();
}
}
public void onServerStrategyChanged(StrategyBean strategyBean) {
}
}

View File

@@ -0,0 +1,605 @@
package com.tencent.bugly.agent;
import android.app.Activity;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
/* loaded from: classes.dex */
public class GameAgent {
private static final String CLASS_COCOS_ACTIVITY = "org.cocos2dx.lib.Cocos2dxActivity";
private static final String CLASS_UNITY_PLAYER = "com.unity3d.player.UnityPlayer";
private static final String CRASH_REPORT_CLASS_SUFFIX = "crashreport.CrashReport";
public static final int GAME_TYPE_COCOS = 1;
public static final int GAME_TYPE_UNITY = 2;
public static final int GAME_TYPE_UNKNOWN = 0;
private static final int LOG_LEVEL_DEBUG = 1;
private static final int LOG_LEVEL_ERROR = 4;
private static final int LOG_LEVEL_INFO = 2;
private static final int LOG_LEVEL_VERBOSE = 0;
private static final int LOG_LEVEL_WARN = 3;
private static final String LOG_TAG = "CrashReport-GameAgent";
private static final String OLD_STRATEGY_CLASS_SUFFIX = "crashreport.CrashReport$UserStrategy";
private static final String STRATEGY_CLASS_SUFFIX = "BuglyStrategy";
private static final int TYPE_COCOS2DX_JS_CRASH = 5;
private static final int TYPE_COCOS2DX_LUA_CRASH = 6;
private static final int TYPE_U3D_CRASH = 4;
private static final String VERSION = "3.2";
private static boolean hasGuessed = false;
private static WeakReference<Activity> sActivity = null;
private static String sAppChannel = null;
private static String sAppVersion = null;
private static WeakReference<Context> sContext = null;
private static int sGameType = 0;
private static Handler sHandler = null;
private static boolean sIsDebug = false;
private static String sUserId = null;
private static String sdkPackageName = "com.tencent.bugly";
private static class Reflection {
/* JADX INFO: Access modifiers changed from: private */
public static Object b(String str, String str2, Object obj) {
try {
Field declaredField = Class.forName(str).getDeclaredField(str2);
declaredField.setAccessible(true);
return declaredField.get(obj);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
} catch (IllegalAccessException e2) {
e2.printStackTrace();
return null;
} catch (NoSuchFieldException e3) {
e3.printStackTrace();
return null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static Object b(String str, String str2, Object[] objArr, Class<?>... clsArr) {
try {
Method declaredMethod = Class.forName(str).getDeclaredMethod(str2, clsArr);
declaredMethod.setAccessible(true);
return declaredMethod.invoke(null, objArr);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
} catch (IllegalAccessException e2) {
e2.printStackTrace();
return null;
} catch (NoSuchMethodException e3) {
e3.printStackTrace();
return null;
} catch (InvocationTargetException e4) {
e4.printStackTrace();
return null;
} catch (Exception e5) {
e5.printStackTrace();
return null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static Object b(String str, Object[] objArr, Class<?>... clsArr) {
try {
Class<?> cls = Class.forName(str);
if (objArr == null) {
return cls.newInstance();
}
return cls.getConstructor(clsArr).newInstance(objArr);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
} catch (IllegalAccessException e2) {
e2.printStackTrace();
return null;
} catch (InstantiationException e3) {
e3.printStackTrace();
return null;
} catch (NoSuchMethodException e4) {
e4.printStackTrace();
return null;
} catch (InvocationTargetException e5) {
e5.printStackTrace();
return null;
} catch (Exception e6) {
e6.printStackTrace();
return null;
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public static String convertToCanonicalName(String str) {
StringBuilder sb = new StringBuilder();
if (sdkPackageName == null) {
sdkPackageName = "com.tencent.bugly";
}
sb.append(sdkPackageName);
sb.append(".");
sb.append(str);
return sb.toString();
}
/* JADX INFO: Access modifiers changed from: private */
public static void delayExit(long j) {
long max = Math.max(0L, j);
Handler handler = sHandler;
if (handler != null) {
handler.postDelayed(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.1
@Override // java.lang.Runnable
public void run() {
GameAgent.exitApplication();
}
}, max);
return;
}
try {
Thread.sleep(max);
exitApplication();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void exitApplication() {
int myPid = Process.myPid();
printLog(3, String.format(Locale.US, "Exit application by kill process[%d]", Integer.valueOf(myPid)));
Process.killProcess(myPid);
}
private static Activity getActivity() {
Activity cocosActivity;
WeakReference<Activity> weakReference = sActivity;
if (weakReference == null || weakReference.get() == null) {
int i = sGameType;
if (i == 1) {
cocosActivity = getCocosActivity();
} else if (i != 2) {
Log.w(LOG_TAG, "Game type has not been set.");
cocosActivity = guessActivity();
} else {
cocosActivity = getUnityActivity();
}
if (cocosActivity != null) {
sActivity = new WeakReference<>(cocosActivity);
}
}
WeakReference<Activity> weakReference2 = sActivity;
if (weakReference2 != null) {
return weakReference2.get();
}
return null;
}
/* JADX INFO: Access modifiers changed from: private */
public static Context getApplicationContext() {
Activity activity;
WeakReference<Context> weakReference = sContext;
if ((weakReference == null || weakReference.get() == null) && (activity = getActivity()) != null) {
sContext = new WeakReference<>(activity.getApplicationContext());
}
WeakReference<Context> weakReference2 = sContext;
if (weakReference2 != null) {
return weakReference2.get();
}
return null;
}
public static Activity getCocosActivity() {
try {
Object b = Reflection.b(CLASS_COCOS_ACTIVITY, "getContext", null, new Class[0]);
if (b != null && (b instanceof Activity)) {
return (Activity) b;
}
} catch (Exception unused) {
Log.w(LOG_TAG, "Failed to get activity of Cocos.");
}
return null;
}
public static Activity getUnityActivity() {
try {
Object b = Reflection.b(CLASS_UNITY_PLAYER, "currentActivity", (Object) null);
if (b != null && (b instanceof Activity)) {
return (Activity) b;
}
} catch (Exception unused) {
Log.w(LOG_TAG, "Failed to get activity of Unity.");
}
return null;
}
public static String getVersion() {
return VERSION;
}
private static Activity guessActivity() {
if (hasGuessed) {
return null;
}
hasGuessed = true;
Activity activity = sGameType != 0 ? getActivity() : null;
if (activity == null) {
sGameType = 1;
activity = getActivity();
}
if (activity == null) {
sGameType = 2;
activity = getActivity();
}
if (activity == null) {
sGameType = 0;
}
return activity;
}
public static void initCrashReport(String str, boolean z) {
setLogEnable(z);
initCrashReport(str, sAppChannel, sAppVersion, sUserId, 0L);
}
private static Object newStrategy(Context context, String str, String str2, long j) {
Object b;
if (context != null && ((!TextUtils.isEmpty(str) || !TextUtils.isEmpty(str2)) && (b = Reflection.b(convertToCanonicalName(OLD_STRATEGY_CLASS_SUFFIX), new Object[]{context}, (Class<?>[]) new Class[]{Context.class})) != null)) {
try {
Class<?> cls = Class.forName(convertToCanonicalName(STRATEGY_CLASS_SUFFIX));
cls.getDeclaredMethod("setAppChannel", String.class).invoke(b, str);
cls.getDeclaredMethod("setAppVersion", String.class).invoke(b, str2);
cls.getDeclaredMethod("setAppReportDelay", Long.TYPE).invoke(b, Long.valueOf(j));
return b;
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (IllegalArgumentException e2) {
e2.printStackTrace();
} catch (NoSuchMethodException e3) {
e3.printStackTrace();
} catch (InvocationTargetException e4) {
e4.printStackTrace();
} catch (Exception e5) {
e5.printStackTrace();
}
}
return null;
}
private static void postCocosJsException(final int i, final String str, final String str2, final String str3, final boolean z) {
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.12
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName("crashreport.inner.InnerApi"), "postCocos2dxCrashAsync", new Object[]{Integer.valueOf(i), str, str2, str3}, Integer.TYPE, String.class, String.class, String.class);
if (z) {
GameAgent.delayExit(3000L);
}
}
});
}
private static void postCocosLuaException(final int i, String str, final String str2, String str3, final boolean z) {
final String str4;
try {
if (str3.startsWith("stack traceback")) {
str3 = str3.substring(str3.indexOf("\n") + 1, str3.length()).trim();
}
int indexOf = str3.indexOf("\n");
if (indexOf > 0) {
str3 = str3.substring(indexOf + 1, str3.length());
}
int indexOf2 = str3.indexOf("\n");
String substring = indexOf2 > 0 ? str3.substring(0, indexOf2) : str3;
int indexOf3 = substring.indexOf("]:");
if (str == null || str.length() == 0) {
str = indexOf3 != -1 ? substring.substring(0, indexOf3 + 1) : str2;
}
} catch (Throwable unused) {
if (str == null || str.length() == 0) {
str4 = str2;
}
}
str4 = str;
final String str5 = str3;
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.11
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName("crashreport.inner.InnerApi"), "postCocos2dxCrashAsync", new Object[]{Integer.valueOf(i), str4, str2, str5}, Integer.TYPE, String.class, String.class, String.class);
if (z) {
GameAgent.delayExit(3000L);
}
}
});
}
public static void postException(int i, String str, String str2, String str3, boolean z) {
if (i == 4) {
postUnityException(str, str2, str3, z);
return;
}
if (i == 5) {
postCocosJsException(i, str, str2, str3, z);
return;
}
if (i == 6) {
postCocosLuaException(i, str, str2, str3, z);
return;
}
printLog(4, "The category of exception posted is unknown: " + String.valueOf(i));
}
private static void postUnityException(final String str, final String str2, final String str3, final boolean z) {
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.13
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName("crashreport.inner.InnerApi"), "postU3dCrashAsync", new Object[]{str, str2, str3}, String.class, String.class, String.class);
if (z) {
GameAgent.delayExit(3000L);
}
}
});
}
public static void printLog(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
if (str.startsWith("<Log>")) {
printLog(2, str);
return;
}
if (str.startsWith("<LogDebug>")) {
printLog(1, str);
return;
}
if (str.startsWith("<LogInfo>")) {
printLog(2, str);
return;
}
if (str.startsWith("<LogWarning>")) {
printLog(3, str);
return;
}
if (str.startsWith("<LogAssert>")) {
printLog(3, str);
return;
}
if (str.startsWith("<LogError>")) {
printLog(4, str);
} else if (str.startsWith("<LogException>")) {
printLog(4, str);
} else {
printLog(0, str);
}
}
public static void putUserData(final String str, final String str2) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return;
}
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.7
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "putUserData", new Object[]{GameAgent.getApplicationContext(), str, str2}, Context.class, String.class, String.class);
}
});
}
public static void removeUserData(final String str) {
if (TextUtils.isEmpty(str)) {
return;
}
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.8
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "removeUserData", new Object[]{GameAgent.getApplicationContext(), str}, Context.class, String.class);
}
});
}
private static void runTaskInUiThread(Runnable runnable) {
Activity activity = getActivity();
if (activity != null) {
activity.runOnUiThread(runnable);
} else {
new Thread(runnable).start();
}
}
public static void setAppChannel(final String str) {
if (TextUtils.isEmpty(str)) {
return;
}
sAppChannel = str;
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.4
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "setAppChannel", new Object[]{GameAgent.getApplicationContext(), str}, Context.class, String.class);
}
});
}
public static void setAppVersion(final String str) {
if (TextUtils.isEmpty(str)) {
return;
}
sAppVersion = str;
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.3
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "setAppVersion", new Object[]{GameAgent.getApplicationContext(), str}, Context.class, String.class);
}
});
}
public static void setGameType(int i) {
sGameType = i;
}
public static void setLog(int i, final String str, final String str2) {
if (TextUtils.isEmpty(str)) {
return;
}
final String str3 = i != 0 ? i != 1 ? i != 2 ? i != 3 ? i != 4 ? null : "e" : "w" : "i" : "d" : "v";
if (str3 != null) {
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.10
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName("crashreport.BuglyLog"), str3, new Object[]{str, str2}, String.class, String.class);
}
});
}
}
public static void setLogEnable(boolean z) {
sIsDebug = z;
}
public static void setSdkConfig(final String str, final String str2) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return;
}
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.9
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "putSdkData", new Object[]{GameAgent.getApplicationContext(), "SDK_" + str, str2}, Context.class, String.class, String.class);
}
});
}
public static void setSdkPackageName(String str) {
if (TextUtils.isEmpty(str)) {
return;
}
sdkPackageName = str;
}
public static void setUserId(final String str) {
if (TextUtils.isEmpty(str)) {
return;
}
sUserId = str;
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.5
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "setUserId", new Object[]{GameAgent.getApplicationContext(), str}, Context.class, String.class);
}
});
}
public static void setUserSceneTag(final int i) {
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.6
@Override // java.lang.Runnable
public void run() {
Reflection.b(GameAgent.convertToCanonicalName(GameAgent.CRASH_REPORT_CLASS_SUFFIX), "setUserSceneTag", new Object[]{GameAgent.getApplicationContext(), Integer.valueOf(i)}, Context.class, Integer.TYPE);
}
});
}
private static void initCrashReport(final String str, String str2, String str3, final String str4, long j) {
final Context applicationContext = getApplicationContext();
if (applicationContext == null) {
printLog(4, "Context is null. bugly initialize terminated.");
} else {
if (TextUtils.isEmpty(str)) {
printLog(4, "Please input appid when initCrashReport.");
return;
}
sHandler = new Handler(Looper.getMainLooper());
final Object newStrategy = newStrategy(applicationContext, str2, str3, j);
runTaskInUiThread(new Runnable() { // from class: com.tencent.bugly.agent.GameAgent.2
/* JADX WARN: Removed duplicated region for block: B:9:0x0058 */
@Override // java.lang.Runnable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void run() {
/*
r12 = this;
boolean r0 = com.tencent.bugly.agent.GameAgent.access$400()
java.lang.Object r1 = r1
java.lang.String r2 = "initCrashReport"
java.lang.String r3 = "crashreport.CrashReport"
r4 = 2
r5 = 3
r6 = 1
r7 = 0
if (r1 == 0) goto L55
r1 = 0
java.lang.String r8 = "crashreport.CrashReport$UserStrategy"
java.lang.String r8 = com.tencent.bugly.agent.GameAgent.access$500(r8) // Catch: java.lang.Exception -> L1c java.lang.ClassNotFoundException -> L21
java.lang.Class r1 = java.lang.Class.forName(r8) // Catch: java.lang.Exception -> L1c java.lang.ClassNotFoundException -> L21
goto L25
L1c:
r8 = move-exception
r8.printStackTrace()
goto L25
L21:
r8 = move-exception
r8.printStackTrace()
L25:
if (r1 == 0) goto L55
java.lang.String r8 = com.tencent.bugly.agent.GameAgent.access$500(r3)
r9 = 4
java.lang.Object[] r10 = new java.lang.Object[r9]
android.content.Context r11 = r2
r10[r7] = r11
java.lang.String r11 = r3
r10[r6] = r11
java.lang.Boolean r11 = java.lang.Boolean.valueOf(r0)
r10[r4] = r11
java.lang.Object r11 = r1
r10[r5] = r11
java.lang.Class[] r9 = new java.lang.Class[r9]
java.lang.Class<android.content.Context> r11 = android.content.Context.class
r9[r7] = r11
java.lang.Class<java.lang.String> r11 = java.lang.String.class
r9[r6] = r11
java.lang.Class r11 = java.lang.Boolean.TYPE
r9[r4] = r11
r9[r5] = r1
com.tencent.bugly.agent.GameAgent.Reflection.a(r8, r2, r10, r9)
r1 = 1
goto L56
L55:
r1 = 0
L56:
if (r1 != 0) goto L7d
java.lang.String r1 = com.tencent.bugly.agent.GameAgent.access$500(r3)
java.lang.Object[] r3 = new java.lang.Object[r5]
android.content.Context r8 = r2
r3[r7] = r8
java.lang.String r8 = r3
r3[r6] = r8
java.lang.Boolean r0 = java.lang.Boolean.valueOf(r0)
r3[r4] = r0
java.lang.Class[] r0 = new java.lang.Class[r5]
java.lang.Class<android.content.Context> r5 = android.content.Context.class
r0[r7] = r5
java.lang.Class<java.lang.String> r5 = java.lang.String.class
r0[r6] = r5
java.lang.Class r5 = java.lang.Boolean.TYPE
r0[r4] = r5
com.tencent.bugly.agent.GameAgent.Reflection.a(r1, r2, r3, r0)
L7d:
java.lang.String r0 = r4
com.tencent.bugly.agent.GameAgent.setUserId(r0)
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.agent.GameAgent.AnonymousClass2.run():void");
}
});
}
}
private static void printLog(int i, String str) {
setLog(i, LOG_TAG, str);
}
}

View File

@@ -0,0 +1,190 @@
package com.tencent.bugly;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.bugly.proguard.n;
import com.tencent.bugly.proguard.o;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.u;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.y;
import com.tencent.bugly.proguard.z;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class b {
public static boolean a = true;
public static List<a> b = new ArrayList();
public static boolean c;
private static p d;
private static boolean e;
private static boolean a(com.tencent.bugly.crashreport.common.info.a aVar) {
List<String> list = aVar.o;
aVar.getClass();
return list != null && list.contains("bugly");
}
public static synchronized void a(Context context) {
synchronized (b.class) {
a(context, null);
}
}
public static synchronized void a(Context context, BuglyStrategy buglyStrategy) {
synchronized (b.class) {
if (e) {
x.d("[init] initial Multi-times, ignore this.", new Object[0]);
return;
}
if (context == null) {
Log.w(x.a, "[init] context of init() is null, check it.");
return;
}
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
if (a(a2)) {
a = false;
return;
}
String f = a2.f();
if (f == null) {
Log.e(x.a, "[init] meta data of BUGLY_APPID in AndroidManifest.xml should be set.");
} else {
a(context, f, a2.u, buglyStrategy);
}
}
}
public static synchronized void a(Context context, String str, boolean z, BuglyStrategy buglyStrategy) {
byte[] bArr;
synchronized (b.class) {
if (e) {
x.d("[init] initial Multi-times, ignore this.", new Object[0]);
return;
}
if (context == null) {
Log.w(x.a, "[init] context is null, check it.");
return;
}
if (str == null) {
Log.e(x.a, "init arg 'crashReportAppID' should not be null!");
return;
}
e = true;
if (z) {
c = true;
x.b = true;
x.d("Bugly debug模式开启请在发布时把isDebug关闭。 -- Running in debug model for 'isDebug' is enabled. Please disable it when you release.", new Object[0]);
x.e("--------------------------------------------------------------------------------------------", new Object[0]);
x.d("Bugly debug模式将有以下行为特性 -- The following list shows the behaviour of debug model: ", new Object[0]);
x.d("[1] 输出详细的Bugly SDK的Log -- More detailed log of Bugly SDK will be output to logcat;", new Object[0]);
x.d("[2] 每一条Crash都会被立即上报 -- Every crash caught by Bugly will be uploaded immediately.", new Object[0]);
x.d("[3] 自定义日志将会在Logcat中输出 -- Custom log will be output to logcat.", new Object[0]);
x.e("--------------------------------------------------------------------------------------------", new Object[0]);
x.b("[init] Open debug mode of Bugly.", new Object[0]);
}
x.a("[init] Bugly version: v%s", "3.1.0");
x.a(" crash report start initializing...", new Object[0]);
x.b("[init] Bugly start initializing...", new Object[0]);
x.a("[init] Bugly complete version: v%s", "3.1.0");
Context a2 = z.a(context);
com.tencent.bugly.crashreport.common.info.a a3 = com.tencent.bugly.crashreport.common.info.a.a(a2);
a3.t();
y.a(a2);
d = p.a(a2, b);
u.a(a2);
com.tencent.bugly.crashreport.common.strategy.a a4 = com.tencent.bugly.crashreport.common.strategy.a.a(a2, b);
n a5 = n.a(a2);
if (a(a3)) {
a = false;
return;
}
a3.a(str);
x.a("[param] Set APP ID:%s", str);
if (buglyStrategy != null) {
String appVersion = buglyStrategy.getAppVersion();
if (!TextUtils.isEmpty(appVersion)) {
if (appVersion.length() > 100) {
String substring = appVersion.substring(0, 100);
x.d("appVersion %s length is over limit %d substring to %s", appVersion, 100, substring);
appVersion = substring;
}
a3.j = appVersion;
x.a("[param] Set App version: %s", buglyStrategy.getAppVersion());
}
try {
if (buglyStrategy.isReplaceOldChannel()) {
String appChannel = buglyStrategy.getAppChannel();
if (!TextUtils.isEmpty(appChannel)) {
if (appChannel.length() > 100) {
String substring2 = appChannel.substring(0, 100);
x.d("appChannel %s length is over limit %d substring to %s", appChannel, 100, substring2);
appChannel = substring2;
}
d.a(556, "app_channel", appChannel.getBytes(), (o) null, false);
a3.l = appChannel;
}
} else {
Map<String, byte[]> a6 = d.a(556, (o) null, true);
if (a6 != null && (bArr = a6.get("app_channel")) != null) {
a3.l = new String(bArr);
}
}
x.a("[param] Set App channel: %s", a3.l);
} catch (Exception e2) {
if (c) {
e2.printStackTrace();
}
}
String appPackageName = buglyStrategy.getAppPackageName();
if (!TextUtils.isEmpty(appPackageName)) {
if (appPackageName.length() > 100) {
String substring3 = appPackageName.substring(0, 100);
x.d("appPackageName %s length is over limit %d substring to %s", appPackageName, 100, substring3);
appPackageName = substring3;
}
a3.c = appPackageName;
x.a("[param] Set App package: %s", buglyStrategy.getAppPackageName());
}
String deviceID = buglyStrategy.getDeviceID();
if (deviceID != null) {
if (deviceID.length() > 100) {
String substring4 = deviceID.substring(0, 100);
x.d("deviceId %s length is over limit %d substring to %s", deviceID, 100, substring4);
deviceID = substring4;
}
a3.c(deviceID);
x.a("[param] Set device ID: %s", deviceID);
}
a3.e = buglyStrategy.isUploadProcess();
y.a = buglyStrategy.isBuglyLogUpload();
}
com.tencent.bugly.crashreport.biz.b.a(a2, buglyStrategy);
for (int i = 0; i < b.size(); i++) {
try {
if (a5.a(b.get(i).id)) {
b.get(i).init(a2, z, buglyStrategy);
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
a4.a(buglyStrategy != null ? buglyStrategy.getAppReportDelay() : 0L);
x.b("[init] Bugly initialization finished.", new Object[0]);
}
}
public static synchronized void a(a aVar) {
synchronized (b.class) {
if (!b.contains(aVar)) {
b.add(aVar);
}
}
}
}

View File

@@ -0,0 +1,9 @@
package com.tencent.bugly.crashreport;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class BuglyHintException extends RuntimeException {
public BuglyHintException(String str) {
super(str);
}
}

View File

@@ -0,0 +1,91 @@
package com.tencent.bugly.crashreport;
import android.util.Log;
import com.tencent.bugly.b;
import com.tencent.bugly.proguard.y;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class BuglyLog {
public static void d(String str, String str2) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.d(str, str2);
}
y.a("D", str, str2);
}
public static void e(String str, String str2) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.e(str, str2);
}
y.a("E", str, str2);
}
public static void i(String str, String str2) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.i(str, str2);
}
y.a("I", str, str2);
}
public static void setCache(int i) {
y.a(i);
}
public static void v(String str, String str2) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.v(str, str2);
}
y.a("V", str, str2);
}
public static void w(String str, String str2) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.w(str, str2);
}
y.a("W", str, str2);
}
public static void e(String str, String str2, Throwable th) {
if (str == null) {
str = "";
}
if (str2 == null) {
str2 = "null";
}
if (b.c) {
Log.e(str, str2, th);
}
y.a("E", str, th);
}
}

View File

@@ -0,0 +1,812 @@
package com.tencent.bugly.crashreport;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Build;
import android.util.Log;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.bugly.CrashModule;
import com.tencent.bugly.b;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.crashreport.crash.d;
import com.tencent.bugly.crashreport.crash.h5.H5JavaScriptInterface;
import com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler;
import com.tencent.bugly.proguard.q;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.diy.model.CategoryModel;
import java.net.InetAddress;
import java.net.Proxy;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class CrashReport {
private static Context a;
/* compiled from: BUGLY */
public static class CrashHandleCallback extends BuglyStrategy.a {
}
/* compiled from: BUGLY */
public static class UserStrategy extends BuglyStrategy {
private CrashHandleCallback a;
public UserStrategy(Context context) {
}
public synchronized void setCrashHandleCallback(CrashHandleCallback crashHandleCallback) {
this.a = crashHandleCallback;
}
@Override // com.tencent.bugly.BuglyStrategy
public synchronized CrashHandleCallback getCrashHandleCallback() {
return this.a;
}
}
/* compiled from: BUGLY */
public interface WebViewInterface {
void addJavascriptInterface(H5JavaScriptInterface h5JavaScriptInterface, String str);
CharSequence getContentDescription();
String getUrl();
void loadUrl(String str);
void setJavaScriptEnabled(boolean z);
}
public static void closeBugly() {
if (!b.a) {
Log.w(x.a, "Can not close bugly because bugly is disable.");
return;
}
if (!CrashModule.getInstance().hasInitialized()) {
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return;
}
if (a == null) {
return;
}
BuglyBroadcastReceiver buglyBroadcastReceiver = BuglyBroadcastReceiver.getInstance();
if (buglyBroadcastReceiver != null) {
buglyBroadcastReceiver.unregister(a);
}
closeCrashReport();
com.tencent.bugly.crashreport.biz.b.a(a);
w a2 = w.a();
if (a2 != null) {
a2.b();
}
}
public static void closeCrashReport() {
if (!b.a) {
Log.w(x.a, "Can not close crash report because bugly is disable.");
} else if (CrashModule.getInstance().hasInitialized()) {
c.a().d();
} else {
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
}
}
public static void closeNativeReport() {
if (!b.a) {
Log.w(x.a, "Can not close native report because bugly is disable.");
} else if (CrashModule.getInstance().hasInitialized()) {
c.a().f();
} else {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
}
}
public static void enableBugly(boolean z) {
b.a = z;
}
public static void enableObtainId(Context context, boolean z) {
if (!b.a) {
Log.w(x.a, "Can not set DB name because bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "enableObtainId args context should not be null");
return;
}
Log.i(x.a, "Enable identification obtaining? " + z);
com.tencent.bugly.crashreport.common.info.a.a(context).b(z);
}
public static Set<String> getAllUserDataKeys(Context context) {
if (!b.a) {
Log.w(x.a, "Can not get all keys of user data because bugly is disable.");
return new HashSet();
}
if (context != null) {
return com.tencent.bugly.crashreport.common.info.a.a(context).E();
}
Log.e(x.a, "getAllUserDataKeys args context should not be null");
return new HashSet();
}
public static String getAppChannel() {
if (!b.a) {
Log.w(x.a, "Can not get App channel because bugly is disable.");
return CategoryModel.unknown;
}
if (CrashModule.getInstance().hasInitialized()) {
return com.tencent.bugly.crashreport.common.info.a.a(a).l;
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return CategoryModel.unknown;
}
public static String getAppID() {
if (!b.a) {
Log.w(x.a, "Can not get App ID because bugly is disable.");
return CategoryModel.unknown;
}
if (CrashModule.getInstance().hasInitialized()) {
return com.tencent.bugly.crashreport.common.info.a.a(a).f();
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return CategoryModel.unknown;
}
public static String getAppVer() {
if (!b.a) {
Log.w(x.a, "Can not get app version because bugly is disable.");
return CategoryModel.unknown;
}
if (CrashModule.getInstance().hasInitialized()) {
return com.tencent.bugly.crashreport.common.info.a.a(a).j;
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return CategoryModel.unknown;
}
public static String getBuglyVersion(Context context) {
if (context == null) {
x.d("Please call with context.", new Object[0]);
return CategoryModel.unknown;
}
com.tencent.bugly.crashreport.common.info.a.a(context);
return com.tencent.bugly.crashreport.common.info.a.c();
}
public static Proxy getHttpProxy() {
return com.tencent.bugly.proguard.a.b();
}
public static Map<String, String> getSdkExtraData() {
if (!b.a) {
Log.w(x.a, "Can not get SDK extra data because bugly is disable.");
return new HashMap();
}
if (CrashModule.getInstance().hasInitialized()) {
return com.tencent.bugly.crashreport.common.info.a.a(a).A;
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return null;
}
public static String getUserData(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not get user data because bugly is disable.");
return CategoryModel.unknown;
}
if (context == null) {
Log.e(x.a, "getUserDataValue args context should not be null");
return CategoryModel.unknown;
}
if (z.a(str)) {
return null;
}
return com.tencent.bugly.crashreport.common.info.a.a(context).g(str);
}
public static int getUserDatasSize(Context context) {
if (!b.a) {
Log.w(x.a, "Can not get size of user data because bugly is disable.");
return -1;
}
if (context != null) {
return com.tencent.bugly.crashreport.common.info.a.a(context).D();
}
Log.e(x.a, "getUserDatasSize args context should not be null");
return -1;
}
public static String getUserId() {
if (!b.a) {
Log.w(x.a, "Can not get user ID because bugly is disable.");
return CategoryModel.unknown;
}
if (CrashModule.getInstance().hasInitialized()) {
return com.tencent.bugly.crashreport.common.info.a.a(a).g();
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return CategoryModel.unknown;
}
public static int getUserSceneTagId(Context context) {
if (!b.a) {
Log.w(x.a, "Can not get user scene tag because bugly is disable.");
return -1;
}
if (context != null) {
return com.tencent.bugly.crashreport.common.info.a.a(context).H();
}
Log.e(x.a, "getUserSceneTagId args context should not be null");
return -1;
}
public static void initCrashReport(Context context) {
a = context;
b.a(CrashModule.getInstance());
b.a(context);
}
public static boolean isLastSessionCrash() {
if (!b.a) {
Log.w(x.a, "The info 'isLastSessionCrash' is not accurate because bugly is disable.");
return false;
}
if (CrashModule.getInstance().hasInitialized()) {
return c.a().b();
}
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return false;
}
public static void postCatchedException(Throwable th) {
postCatchedException(th, Thread.currentThread(), false);
}
public static void postException(Thread thread, int i, String str, String str2, String str3, Map<String, String> map) {
if (!b.a) {
Log.w(x.a, "Can not post crash caught because bugly is disable.");
} else if (CrashModule.getInstance().hasInitialized()) {
d.a(thread, i, str, str2, str3, map);
} else {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
}
}
private static void putSdkData(Context context, String str, String str2) {
if (context == null || z.a(str) || z.a(str2)) {
return;
}
String replace = str.replace("[a-zA-Z[0-9]]+", "");
if (replace.length() > 100) {
Log.w(x.a, String.format("putSdkData key length over limit %d, will be cutted.", 50));
replace = replace.substring(0, 50);
}
if (str2.length() > 500) {
Log.w(x.a, String.format("putSdkData value length over limit %d, will be cutted!", 200));
str2 = str2.substring(0, 200);
}
com.tencent.bugly.crashreport.common.info.a.a(context).c(replace, str2);
x.b(String.format("[param] putSdkData data: %s - %s", replace, str2), new Object[0]);
}
public static void putUserData(Context context, String str, String str2) {
if (!b.a) {
Log.w(x.a, "Can not put user data because bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "putUserData args context should not be null");
return;
}
if (str == null) {
String str3 = str;
x.d("putUserData args key should not be null or empty", new Object[0]);
return;
}
if (str2 == null) {
String str4 = str2;
x.d("putUserData args value should not be null", new Object[0]);
return;
}
if (!str.matches("[a-zA-Z[0-9]]+")) {
x.d("putUserData args key should match [a-zA-Z[0-9]]+ {" + str + "}", new Object[0]);
return;
}
if (str2.length() > 200) {
x.d("user data value length over limit %d, it will be cutted!", 200);
str2 = str2.substring(0, 200);
}
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
if (a2.E().contains(str)) {
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.putKeyValueToNative(str, str2);
}
com.tencent.bugly.crashreport.common.info.a.a(context).b(str, str2);
x.c("replace KV %s %s", str, str2);
return;
}
if (a2.D() >= 10) {
x.d("user data size is over limit %d, it will be cutted!", 10);
return;
}
if (str.length() > 50) {
x.d("user data key length over limit %d , will drop this new key %s", 50, str);
str = str.substring(0, 50);
}
NativeCrashHandler nativeCrashHandler2 = NativeCrashHandler.getInstance();
if (nativeCrashHandler2 != null) {
nativeCrashHandler2.putKeyValueToNative(str, str2);
}
com.tencent.bugly.crashreport.common.info.a.a(context).b(str, str2);
x.b("[param] set user data: %s - %s", str, str2);
}
public static String removeUserData(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not remove user data because bugly is disable.");
return CategoryModel.unknown;
}
if (context == null) {
Log.e(x.a, "removeUserData args context should not be null");
return CategoryModel.unknown;
}
if (z.a(str)) {
return null;
}
x.b("[param] remove user data: %s", str);
return com.tencent.bugly.crashreport.common.info.a.a(context).f(str);
}
public static void setAppChannel(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not set App channel because Bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "setAppChannel args context should not be null");
return;
}
if (str == null) {
Log.w(x.a, "App channel is null, will not set");
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).l = str;
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.setNativeAppChannel(str);
}
}
public static void setAppPackage(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not set App package because bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "setAppPackage args context should not be null");
return;
}
if (str == null) {
Log.w(x.a, "App package is null, will not set");
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).c = str;
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.setNativeAppPackage(str);
}
}
public static void setAppVersion(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not set App version because bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "setAppVersion args context should not be null");
return;
}
if (str == null) {
Log.w(x.a, "App version is null, will not set");
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).j = str;
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.setNativeAppVersion(str);
}
}
public static void setAuditEnable(Context context, boolean z) {
if (!b.a) {
Log.w(x.a, "Can not set App package because bugly is disable.");
return;
}
if (context == null) {
Log.w(x.a, "setAppPackage args context should not be null");
return;
}
Log.i(x.a, "Set audit enable: " + z);
com.tencent.bugly.crashreport.common.info.a.a(context).B = z;
}
public static void setBuglyDbName(String str) {
if (!b.a) {
Log.w(x.a, "Can not set DB name because bugly is disable.");
return;
}
Log.i(x.a, "Set Bugly DB name: " + str);
q.a = str;
}
public static void setContext(Context context) {
a = context;
}
public static void setCrashFilter(String str) {
if (!b.a) {
Log.w(x.a, "Can not set App package because bugly is disable.");
return;
}
Log.i(x.a, "Set crash stack filter: " + str);
c.n = str;
}
public static void setCrashRegularFilter(String str) {
if (!b.a) {
Log.w(x.a, "Can not set App package because bugly is disable.");
return;
}
Log.i(x.a, "Set crash stack filter: " + str);
c.o = str;
}
public static void setHandleNativeCrashInJava(boolean z) {
if (!b.a) {
Log.w(x.a, "Can not set App package because bugly is disable.");
return;
}
Log.i(x.a, "Should handle native crash in Java profile after handled in native profile: " + z);
NativeCrashHandler.setShouldHandleInJava(z);
}
public static void setHttpProxy(String str, int i) {
com.tencent.bugly.proguard.a.a(str, i);
}
public static void setIsAppForeground(Context context, boolean z) {
if (!b.a) {
Log.w(x.a, "Can not set 'isAppForeground' because bugly is disable.");
return;
}
if (context == null) {
x.d("Context should not be null.", new Object[0]);
return;
}
if (z) {
x.c("App is in foreground.", new Object[0]);
} else {
x.c("App is in background.", new Object[0]);
}
com.tencent.bugly.crashreport.common.info.a.a(context).a(z);
}
public static void setIsDevelopmentDevice(Context context, boolean z) {
if (!b.a) {
Log.w(x.a, "Can not set 'isDevelopmentDevice' because bugly is disable.");
return;
}
if (context == null) {
x.d("Context should not be null.", new Object[0]);
return;
}
if (z) {
x.c("This is a development device.", new Object[0]);
} else {
x.c("This is not a development device.", new Object[0]);
}
com.tencent.bugly.crashreport.common.info.a.a(context).y = z;
}
public static boolean setJavascriptMonitor(WebView webView, boolean z) {
return setJavascriptMonitor(webView, z, false);
}
public static void setSdkExtraData(Context context, String str, String str2) {
if (!b.a) {
Log.w(x.a, "Can not put SDK extra data because bugly is disable.");
} else {
if (context == null || z.a(str) || z.a(str2)) {
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).a(str, str2);
}
}
public static void setServerUrl(String str) {
if (z.a(str) || !z.c(str)) {
Log.i(x.a, "URL is invalid.");
return;
}
com.tencent.bugly.crashreport.common.strategy.a.a(str);
StrategyBean.b = str;
StrategyBean.c = str;
}
public static void setSessionIntervalMills(long j) {
if (b.a) {
com.tencent.bugly.crashreport.biz.b.a(j);
} else {
Log.w(x.a, "Can not set 'SessionIntervalMills' because bugly is disable.");
}
}
public static void setUserId(String str) {
if (!b.a) {
Log.w(x.a, "Can not set user ID because bugly is disable.");
} else if (CrashModule.getInstance().hasInitialized()) {
setUserId(a, str);
} else {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
}
}
public static void setUserSceneTag(Context context, int i) {
if (!b.a) {
Log.w(x.a, "Can not set tag caught because bugly is disable.");
return;
}
if (context == null) {
Log.e(x.a, "setTag args context should not be null");
return;
}
if (i <= 0) {
x.d("setTag args tagId should > 0", new Object[0]);
}
com.tencent.bugly.crashreport.common.info.a.a(context).a(i);
x.b("[param] set user scene tag: %d", Integer.valueOf(i));
}
public static void startCrashReport() {
if (!b.a) {
Log.w(x.a, "Can not start crash report because bugly is disable.");
} else if (CrashModule.getInstance().hasInitialized()) {
c.a().c();
} else {
Log.w(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
}
}
public static void testANRCrash() {
if (!b.a) {
Log.w(x.a, "Can not test ANR crash because bugly is disable.");
} else if (!CrashModule.getInstance().hasInitialized()) {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
} else {
x.a("start to create a anr crash for test!", new Object[0]);
c.a().j();
}
}
public static void testJavaCrash() {
if (!b.a) {
Log.w(x.a, "Can not test Java crash because bugly is disable.");
} else {
if (!CrashModule.getInstance().hasInitialized()) {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return;
}
com.tencent.bugly.crashreport.common.info.a b = com.tencent.bugly.crashreport.common.info.a.b();
if (b != null) {
b.b(24096);
}
throw new RuntimeException("This Crash create for Test! You can go to Bugly see more detail!");
}
}
public static void testNativeCrash() {
testNativeCrash(false, false, false);
}
public static void postCatchedException(Throwable th, Thread thread) {
postCatchedException(th, thread, false);
}
public static void setHttpProxy(InetAddress inetAddress, int i) {
com.tencent.bugly.proguard.a.a(inetAddress, i);
}
@SuppressLint({"SetJavaScriptEnabled"})
public static boolean setJavascriptMonitor(final WebView webView, boolean z, boolean z2) {
if (webView != null) {
return setJavascriptMonitor(new WebViewInterface() { // from class: com.tencent.bugly.crashreport.CrashReport.1
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
public final void addJavascriptInterface(H5JavaScriptInterface h5JavaScriptInterface, String str) {
webView.addJavascriptInterface(h5JavaScriptInterface, str);
}
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
public final CharSequence getContentDescription() {
return webView.getContentDescription();
}
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
public final String getUrl() {
return webView.getUrl();
}
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
public final void loadUrl(String str) {
webView.loadUrl(str);
}
@Override // com.tencent.bugly.crashreport.CrashReport.WebViewInterface
public final void setJavaScriptEnabled(boolean z3) {
WebSettings settings = webView.getSettings();
if (settings.getJavaScriptEnabled()) {
return;
}
settings.setJavaScriptEnabled(true);
}
}, z, z2);
}
Log.w(x.a, "WebView is null.");
return false;
}
public static void testNativeCrash(boolean z, boolean z2, boolean z3) {
if (!b.a) {
Log.w(x.a, "Can not test native crash because bugly is disable.");
} else if (!CrashModule.getInstance().hasInitialized()) {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
} else {
x.a("start to create a native crash for test!", new Object[0]);
c.a().a(z, z2, z3);
}
}
public static void postCatchedException(Throwable th, Thread thread, boolean z) {
if (!b.a) {
Log.w(x.a, "Can not post crash caught because bugly is disable.");
return;
}
if (!CrashModule.getInstance().hasInitialized()) {
Log.e(x.a, "CrashReport has not been initialed! pls to call method 'initCrashReport' first!");
return;
}
if (th == null) {
x.d("throwable is null, just return", new Object[0]);
return;
}
if (thread == null) {
thread = Thread.currentThread();
}
c.a().a(thread, th, false, (String) null, (byte[]) null, z);
}
public static void initCrashReport(Context context, UserStrategy userStrategy) {
a = context;
b.a(CrashModule.getInstance());
b.a(context, userStrategy);
}
public static boolean setJavascriptMonitor(WebViewInterface webViewInterface, boolean z) {
return setJavascriptMonitor(webViewInterface, z, false);
}
public static void postException(int i, String str, String str2, String str3, Map<String, String> map) {
postException(Thread.currentThread(), i, str, str2, str3, map);
}
@SuppressLint({"SetJavaScriptEnabled"})
public static boolean setJavascriptMonitor(WebViewInterface webViewInterface, boolean z, boolean z2) {
if (webViewInterface == null) {
Log.w(x.a, "WebViewInterface is null.");
return false;
}
if (!CrashModule.getInstance().hasInitialized()) {
x.e("CrashReport has not been initialed! please to call method 'initCrashReport' first!", new Object[0]);
return false;
}
x.a("Set Javascript exception monitor of webview.", new Object[0]);
if (!b.a) {
Log.w(x.a, "Can not set JavaScript monitor because bugly is disable.");
return false;
}
x.c("URL of webview is %s", webViewInterface.getUrl());
if (!z2 && Build.VERSION.SDK_INT < 19) {
x.e("This interface is only available for Android 4.4 or later.", new Object[0]);
return false;
}
x.a("Enable the javascript needed by webview monitor.", new Object[0]);
webViewInterface.setJavaScriptEnabled(true);
H5JavaScriptInterface h5JavaScriptInterface = H5JavaScriptInterface.getInstance(webViewInterface);
if (h5JavaScriptInterface != null) {
x.a("Add a secure javascript interface to the webview.", new Object[0]);
webViewInterface.addJavascriptInterface(h5JavaScriptInterface, "exceptionUploader");
}
if (z) {
x.a("Inject bugly.js(v%s) to the webview.", com.tencent.bugly.crashreport.crash.h5.b.b());
String a2 = com.tencent.bugly.crashreport.crash.h5.b.a();
if (a2 == null) {
x.e("Failed to inject Bugly.js.", com.tencent.bugly.crashreport.crash.h5.b.b());
return false;
}
webViewInterface.loadUrl("javascript:" + a2);
}
return true;
}
public static void setUserId(Context context, String str) {
if (!b.a) {
Log.w(x.a, "Can not set user ID because bugly is disable.");
return;
}
if (context == null) {
Log.e(x.a, "Context should not be null when bugly has not been initialed!");
return;
}
if (str == null) {
x.d("userId should not be null", new Object[0]);
return;
}
if (str.length() > 100) {
String substring = str.substring(0, 100);
x.d("userId %s length is over limit %d substring to %s", str, 100, substring);
str = substring;
}
if (str.equals(com.tencent.bugly.crashreport.common.info.a.a(context).g())) {
return;
}
com.tencent.bugly.crashreport.common.info.a.a(context).b(str);
x.b("[user] set userId : %s", str);
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
if (nativeCrashHandler != null) {
nativeCrashHandler.setNativeUserId(str);
}
if (CrashModule.getInstance().hasInitialized()) {
com.tencent.bugly.crashreport.biz.b.a();
}
}
public static Map<String, String> getSdkExtraData(Context context) {
if (!b.a) {
Log.w(x.a, "Can not get SDK extra data because bugly is disable.");
return new HashMap();
}
if (context == null) {
x.d("Context should not be null.", new Object[0]);
return null;
}
return com.tencent.bugly.crashreport.common.info.a.a(context).A;
}
public static void initCrashReport(Context context, String str, boolean z) {
if (context != null) {
a = context;
b.a(CrashModule.getInstance());
b.a(context, str, z, null);
}
}
public static void initCrashReport(Context context, String str, boolean z, UserStrategy userStrategy) {
if (context == null) {
return;
}
a = context;
b.a(CrashModule.getInstance());
b.a(context, str, z, userStrategy);
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.bugly.crashreport;
/* loaded from: classes.dex */
public final class R {
public static final class string {
public static final int app_name = 0x7f110069;
private string() {
}
}
private R() {
}
}

View File

@@ -0,0 +1,11 @@
package com.tencent.bugly.crashreport;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface a {
boolean appendLogToNative(String str, String str2, String str3);
String getLogFromNative();
boolean setNativeIsAppForeground(boolean z);
}

View File

@@ -0,0 +1,107 @@
package com.tencent.bugly.crashreport.biz;
import android.os.Parcel;
import android.os.Parcelable;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.diy.model.CategoryModel;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class UserInfoBean implements Parcelable {
public static final Parcelable.Creator<UserInfoBean> CREATOR = new Parcelable.Creator<UserInfoBean>() { // from class: com.tencent.bugly.crashreport.biz.UserInfoBean.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ UserInfoBean createFromParcel(Parcel parcel) {
return new UserInfoBean(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ UserInfoBean[] newArray(int i) {
return new UserInfoBean[i];
}
};
public long a;
public int b;
public String c;
public String d;
public long e;
public long f;
public long g;
public long h;
public long i;
public String j;
public long k;
public boolean l;
public String m;
public String n;
public int o;
public int p;
public int q;
public Map<String, String> r;
public Map<String, String> s;
public UserInfoBean() {
this.k = 0L;
this.l = false;
this.m = CategoryModel.unknown;
this.p = -1;
this.q = -1;
this.r = null;
this.s = null;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(this.b);
parcel.writeString(this.c);
parcel.writeString(this.d);
parcel.writeLong(this.e);
parcel.writeLong(this.f);
parcel.writeLong(this.g);
parcel.writeLong(this.h);
parcel.writeLong(this.i);
parcel.writeString(this.j);
parcel.writeLong(this.k);
parcel.writeByte(this.l ? (byte) 1 : (byte) 0);
parcel.writeString(this.m);
parcel.writeInt(this.p);
parcel.writeInt(this.q);
z.b(parcel, this.r);
z.b(parcel, this.s);
parcel.writeString(this.n);
parcel.writeInt(this.o);
}
public UserInfoBean(Parcel parcel) {
this.k = 0L;
this.l = false;
this.m = CategoryModel.unknown;
this.p = -1;
this.q = -1;
this.r = null;
this.s = null;
this.b = parcel.readInt();
this.c = parcel.readString();
this.d = parcel.readString();
this.e = parcel.readLong();
this.f = parcel.readLong();
this.g = parcel.readLong();
this.h = parcel.readLong();
this.i = parcel.readLong();
this.j = parcel.readString();
this.k = parcel.readLong();
this.l = parcel.readByte() == 1;
this.m = parcel.readString();
this.p = parcel.readInt();
this.q = parcel.readInt();
this.r = z.b(parcel);
this.s = z.b(parcel);
this.n = parcel.readString();
this.o = parcel.readInt();
}
}

View File

@@ -0,0 +1,332 @@
package com.tencent.bugly.crashreport.biz;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import com.tencent.bugly.proguard.o;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.util.ArrayList;
import java.util.List;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
private Context a;
private long b;
private int c;
private boolean d;
/* compiled from: BUGLY */
/* renamed from: com.tencent.bugly.crashreport.biz.a$2, reason: invalid class name */
final class AnonymousClass2 implements Runnable {
AnonymousClass2() {
}
@Override // java.lang.Runnable
public final void run() {
try {
a.this.c();
} catch (Throwable th) {
x.a(th);
}
}
}
/* compiled from: BUGLY */
/* renamed from: com.tencent.bugly.crashreport.biz.a$a, reason: collision with other inner class name */
class RunnableC0012a implements Runnable {
private boolean a;
private UserInfoBean b;
public RunnableC0012a(UserInfoBean userInfoBean, boolean z) {
this.b = userInfoBean;
this.a = z;
}
@Override // java.lang.Runnable
public final void run() {
com.tencent.bugly.crashreport.common.info.a b;
try {
if (this.b != null) {
UserInfoBean userInfoBean = this.b;
if (userInfoBean != null && (b = com.tencent.bugly.crashreport.common.info.a.b()) != null) {
userInfoBean.j = b.e();
}
x.c("[UserInfo] Record user info.", new Object[0]);
a.a(a.this, this.b, false);
}
if (this.a) {
a aVar = a.this;
w a = w.a();
if (a != null) {
a.a(aVar.new AnonymousClass2());
}
}
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
}
/* compiled from: BUGLY */
class b implements Runnable {
b() {
}
@Override // java.lang.Runnable
public final void run() {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis < a.this.b) {
w.a().a(a.this.new b(), (a.this.b - currentTimeMillis) + 5000);
} else {
a.this.a(3, false, 0L);
a.this.a();
}
}
}
/* compiled from: BUGLY */
class c implements Runnable {
private long a;
public c(long j) {
this.a = 21600000L;
this.a = j;
}
@Override // java.lang.Runnable
public final void run() {
a aVar = a.this;
w a = w.a();
if (a != null) {
a.a(aVar.new AnonymousClass2());
}
a aVar2 = a.this;
long j = this.a;
w.a().a(aVar2.new c(j), j);
}
}
public a(Context context, boolean z) {
this.d = true;
this.a = context;
this.d = z;
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:118:0x0116 */
/* JADX WARN: Removed duplicated region for block: B:76:0x00f2 A[Catch: all -> 0x018b, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
/* JADX WARN: Removed duplicated region for block: B:83:0x0114 */
/* JADX WARN: Removed duplicated region for block: B:86:0x011d A[Catch: all -> 0x018b, TRY_LEAVE, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
/* JADX WARN: Removed duplicated region for block: B:89:0x0126 A[Catch: all -> 0x018b, TRY_ENTER, TryCatch #0 {, blocks: (B:3:0x0001, B:8:0x0007, B:12:0x000f, B:16:0x0017, B:18:0x001d, B:22:0x0027, B:24:0x003c, B:27:0x0045, B:29:0x004c, B:30:0x004f, B:32:0x0055, B:34:0x0069, B:36:0x0079, B:43:0x0081, B:45:0x008b, B:46:0x0090, B:48:0x0096, B:50:0x00a4, B:52:0x00b1, B:53:0x00b4, B:56:0x00c2, B:58:0x00c6, B:60:0x00cb, B:63:0x00d0, B:73:0x00d7, B:74:0x00ec, B:76:0x00f2, B:78:0x00f7, B:81:0x00ff, B:84:0x0117, B:86:0x011d, B:89:0x0126, B:91:0x012c, B:94:0x0135, B:97:0x013e, B:99:0x0146, B:102:0x014f, B:104:0x0160, B:105:0x0165, B:107:0x016a, B:108:0x016f, B:111:0x017d, B:115:0x016d, B:116:0x0163, B:119:0x0182, B:123:0x00e6), top: B:2:0x0001 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized void c() {
/*
Method dump skipped, instructions count: 398
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.biz.a.c():void");
}
static /* synthetic */ void a(a aVar, UserInfoBean userInfoBean, boolean z) {
List<UserInfoBean> a;
if (userInfoBean != null) {
if (!z && userInfoBean.b != 1 && (a = aVar.a(com.tencent.bugly.crashreport.common.info.a.a(aVar.a).d)) != null && a.size() >= 20) {
x.a("[UserInfo] There are too many user info in local: %d", Integer.valueOf(a.size()));
return;
}
long a2 = p.a().a("t_ui", a(userInfoBean), (o) null, true);
if (a2 >= 0) {
x.c("[Database] insert %s success with ID: %d", "t_ui", Long.valueOf(a2));
userInfoBean.a = a2;
}
}
}
public final void b() {
w a = w.a();
if (a != null) {
a.a(new AnonymousClass2());
}
}
public final void a(int i, boolean z, long j) {
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
if (a != null && !a.c().h && i != 1 && i != 3) {
x.e("UserInfo is disable", new Object[0]);
return;
}
if (i == 1 || i == 3) {
this.c++;
}
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(this.a);
UserInfoBean userInfoBean = new UserInfoBean();
userInfoBean.b = i;
userInfoBean.c = a2.d;
userInfoBean.d = a2.g();
userInfoBean.e = System.currentTimeMillis();
userInfoBean.f = -1L;
userInfoBean.n = a2.j;
userInfoBean.o = i == 1 ? 1 : 0;
userInfoBean.l = a2.a();
userInfoBean.m = a2.p;
userInfoBean.g = a2.q;
userInfoBean.h = a2.r;
userInfoBean.i = a2.s;
userInfoBean.k = a2.t;
userInfoBean.r = a2.B();
userInfoBean.s = a2.G();
userInfoBean.p = a2.H();
userInfoBean.q = a2.I();
w.a().a(new RunnableC0012a(userInfoBean, z), 0L);
}
public final void a() {
this.b = z.b() + 86400000;
w.a().a(new b(), (this.b - System.currentTimeMillis()) + 5000);
}
public final List<UserInfoBean> a(String str) {
Cursor cursor;
String str2;
try {
if (z.a(str)) {
str2 = null;
} else {
str2 = "_pc = '" + str + "'";
}
cursor = p.a().a("t_ui", null, str2, null, null, true);
if (cursor == null) {
return null;
}
try {
StringBuilder sb = new StringBuilder();
ArrayList arrayList = new ArrayList();
while (cursor.moveToNext()) {
UserInfoBean a = a(cursor);
if (a != null) {
arrayList.add(a);
} else {
try {
long j = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
sb.append(" or _id");
sb.append(" = ");
sb.append(j);
} catch (Throwable unused) {
x.d("[Database] unknown id.", new Object[0]);
}
}
}
String sb2 = sb.toString();
if (sb2.length() > 0) {
x.d("[Database] deleted %s error data %d", "t_ui", Integer.valueOf(p.a().a("t_ui", sb2.substring(4), (String[]) null, (o) null, true)));
}
if (cursor != null) {
cursor.close();
}
return arrayList;
} catch (Throwable th) {
th = th;
try {
if (!x.a(th)) {
th.printStackTrace();
}
if (cursor != null) {
cursor.close();
}
return null;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
} catch (Throwable th2) {
th = th2;
cursor = null;
}
}
private static void a(List<UserInfoBean> list) {
if (list == null || list.size() == 0) {
return;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size() && i < 50; i++) {
UserInfoBean userInfoBean = list.get(i);
sb.append(" or _id");
sb.append(" = ");
sb.append(userInfoBean.a);
}
String sb2 = sb.toString();
if (sb2.length() > 0) {
sb2 = sb2.substring(4);
}
String str = sb2;
sb.setLength(0);
try {
x.c("[Database] deleted %s data %d", "t_ui", Integer.valueOf(p.a().a("t_ui", str, (String[]) null, (o) null, true)));
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
private static ContentValues a(UserInfoBean userInfoBean) {
if (userInfoBean == null) {
return null;
}
try {
ContentValues contentValues = new ContentValues();
if (userInfoBean.a > 0) {
contentValues.put(FileDownloadModel.ID, Long.valueOf(userInfoBean.a));
}
contentValues.put("_tm", Long.valueOf(userInfoBean.e));
contentValues.put("_ut", Long.valueOf(userInfoBean.f));
contentValues.put("_tp", Integer.valueOf(userInfoBean.b));
contentValues.put("_pc", userInfoBean.c);
contentValues.put("_dt", z.a(userInfoBean));
return contentValues;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
private static UserInfoBean a(Cursor cursor) {
if (cursor == null) {
return null;
}
try {
byte[] blob = cursor.getBlob(cursor.getColumnIndex("_dt"));
if (blob == null) {
return null;
}
long j = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
UserInfoBean userInfoBean = (UserInfoBean) z.a(blob, UserInfoBean.CREATOR);
if (userInfoBean != null) {
userInfoBean.a = j;
}
return userInfoBean;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
}

View File

@@ -0,0 +1,138 @@
package com.tencent.bugly.crashreport.biz;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.bugly.crashreport.biz.a.AnonymousClass2;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class b {
public static a a = null;
private static boolean b = false;
private static int c = 10;
private static long d = 300000;
private static long e = 30000;
private static long f = 0;
private static int g = 0;
private static long h = 0;
private static long i = 0;
private static long j = 0;
private static Application.ActivityLifecycleCallbacks k = null;
private static Class<?> l = null;
private static boolean m = true;
static /* synthetic */ String a(String str, String str2) {
return z.a() + " " + str + " " + str2 + "\n";
}
static /* synthetic */ int g() {
int i2 = g;
g = i2 + 1;
return i2;
}
public static void a(final Context context, final BuglyStrategy buglyStrategy) {
long j2;
if (b) {
return;
}
m = com.tencent.bugly.crashreport.common.info.a.a(context).e;
a = new a(context, m);
b = true;
if (buglyStrategy != null) {
l = buglyStrategy.getUserInfoActivity();
j2 = buglyStrategy.getAppReportDelay();
} else {
j2 = 0;
}
if (j2 <= 0) {
c(context, buglyStrategy);
} else {
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.biz.b.1
@Override // java.lang.Runnable
public final void run() {
b.c(context, buglyStrategy);
}
}, j2);
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:27:0x0068 A[RETURN] */
/* JADX WARN: Removed duplicated region for block: B:29:0x0069 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public static void c(android.content.Context r14, com.tencent.bugly.BuglyStrategy r15) {
/*
Method dump skipped, instructions count: 273
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.biz.b.c(android.content.Context, com.tencent.bugly.BuglyStrategy):void");
}
public static void a(long j2) {
if (j2 < 0) {
j2 = com.tencent.bugly.crashreport.common.strategy.a.a().c().q;
}
f = j2;
}
public static void a(StrategyBean strategyBean, boolean z) {
w a2;
a aVar = a;
if (aVar != null && !z && (a2 = w.a()) != null) {
a2.a(aVar.new AnonymousClass2());
}
if (strategyBean == null) {
return;
}
long j2 = strategyBean.q;
if (j2 > 0) {
e = j2;
}
int i2 = strategyBean.w;
if (i2 > 0) {
c = i2;
}
long j3 = strategyBean.x;
if (j3 > 0) {
d = j3;
}
}
public static void a() {
a aVar = a;
if (aVar != null) {
aVar.a(2, false, 0L);
}
}
public static void a(Context context) {
if (!b || context == null) {
return;
}
if (Build.VERSION.SDK_INT >= 14) {
Application application = context.getApplicationContext() instanceof Application ? (Application) context.getApplicationContext() : null;
if (application != null) {
try {
if (k != null) {
application.unregisterActivityLifecycleCallbacks(k);
}
} catch (Exception e2) {
if (!x.a(e2)) {
e2.printStackTrace();
}
}
}
}
b = false;
}
}

View File

@@ -0,0 +1,392 @@
package com.tencent.bugly.crashreport.common.info;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.base.util.FileUtil;
import com.ubt.jimu.diy.model.CategoryModel;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.ByteArrayInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.Principal;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class AppInfo {
private static ActivityManager a;
static {
"@buglyAllChannel@".split(",");
"@buglyAllChannelPriority@".split(",");
}
public static String a(Context context) {
if (context == null) {
return null;
}
try {
return context.getPackageName();
} catch (Throwable th) {
if (x.a(th)) {
return "fail";
}
th.printStackTrace();
return "fail";
}
}
public static PackageInfo b(Context context) {
try {
return context.getPackageManager().getPackageInfo(a(context), 0);
} catch (Throwable th) {
if (x.a(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
public static String c(Context context) {
CharSequence applicationLabel;
if (context == null) {
return null;
}
try {
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = context.getApplicationInfo();
if (packageManager != null && applicationInfo != null && (applicationLabel = packageManager.getApplicationLabel(applicationInfo)) != null) {
return applicationLabel.toString();
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
return null;
}
public static Map<String, String> d(Context context) {
if (context == null) {
return null;
}
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO);
if (applicationInfo.metaData == null) {
return null;
}
HashMap hashMap = new HashMap();
Object obj = applicationInfo.metaData.get("BUGLY_DISABLE");
if (obj != null) {
hashMap.put("BUGLY_DISABLE", obj.toString());
}
Object obj2 = applicationInfo.metaData.get("BUGLY_APPID");
if (obj2 != null) {
hashMap.put("BUGLY_APPID", obj2.toString());
}
Object obj3 = applicationInfo.metaData.get("BUGLY_APP_CHANNEL");
if (obj3 != null) {
hashMap.put("BUGLY_APP_CHANNEL", obj3.toString());
}
Object obj4 = applicationInfo.metaData.get("BUGLY_APP_VERSION");
if (obj4 != null) {
hashMap.put("BUGLY_APP_VERSION", obj4.toString());
}
Object obj5 = applicationInfo.metaData.get("BUGLY_ENABLE_DEBUG");
if (obj5 != null) {
hashMap.put("BUGLY_ENABLE_DEBUG", obj5.toString());
}
Object obj6 = applicationInfo.metaData.get("com.tencent.rdm.uuid");
if (obj6 != null) {
hashMap.put("com.tencent.rdm.uuid", obj6.toString());
}
return hashMap;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
public static String e(Context context) {
Signature[] signatureArr;
String a2 = a(context);
if (a2 == null) {
return null;
}
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(a2, 64);
if (packageInfo != null && (signatureArr = packageInfo.signatures) != null && signatureArr.length != 0) {
return a(signatureArr[0].toByteArray());
}
} catch (PackageManager.NameNotFoundException unused) {
}
return null;
}
public static boolean f(Context context) {
if (context == null) {
return false;
}
if (a == null) {
a = (ActivityManager) context.getSystemService("activity");
}
try {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
a.getMemoryInfo(memoryInfo);
if (!memoryInfo.lowMemory) {
return false;
}
x.c("Memory is low.", new Object[0]);
return true;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
}
}
public static String g(Context context) {
if (context == null) {
return "";
}
String h = h(context);
return !z.a(h) ? h : i(context);
}
private static String h(Context context) {
String str = "";
InputStream inputStream = null;
try {
} catch (IOException e) {
x.a(e);
}
try {
try {
String string = z.a("DENGTA_META", context).getString("key_channelpath", "");
if (z.a(string)) {
string = "channel.ini";
}
x.a("[AppInfo] Beacon channel file path: " + string, new Object[0]);
if (!string.equals("")) {
inputStream = context.getAssets().open(string);
Properties properties = new Properties();
properties.load(inputStream);
str = properties.getProperty("CHANNEL", "");
x.a("[AppInfo] Beacon channel read from assert: " + str, new Object[0]);
if (!z.a(str)) {
return str;
}
}
} catch (Exception unused) {
x.d("[AppInfo] Failed to get get beacon channel", new Object[0]);
if (inputStream != null) {
inputStream.close();
}
}
if (inputStream != null) {
inputStream.close();
}
return str;
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e2) {
x.a(e2);
}
}
}
}
private static String i(Context context) {
try {
Object obj = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO).metaData.get("CHANNEL_DENGTA");
return obj != null ? obj.toString() : "";
} catch (Throwable th) {
x.d("[AppInfo] Failed to read beacon channel from manifest.", new Object[0]);
x.a(th);
return "";
}
}
public static boolean a(Context context, String str) {
if (context != null && str != null && str.trim().length() > 0) {
try {
String[] strArr = context.getPackageManager().getPackageInfo(context.getPackageName(), FileUtil.ZIP_BUFFER_SIZE).requestedPermissions;
if (strArr != null) {
for (String str2 : strArr) {
if (str.equals(str2)) {
return true;
}
}
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return false;
}
public static String a(int i) {
FileReader fileReader;
FileReader fileReader2 = null;
try {
fileReader = new FileReader("/proc/" + i + "/cmdline");
} catch (Throwable th) {
th = th;
}
try {
char[] cArr = new char[DataDecryptTool.DECRYPT_DB_FILE];
fileReader.read(cArr);
int i2 = 0;
while (i2 < cArr.length && cArr[i2] != 0) {
i2++;
}
String substring = new String(cArr).substring(0, i2);
try {
fileReader.close();
} catch (Throwable unused) {
}
return substring;
} catch (Throwable th2) {
th = th2;
fileReader2 = fileReader;
try {
if (!x.a(th)) {
th.printStackTrace();
}
String valueOf = String.valueOf(i);
if (fileReader2 != null) {
try {
fileReader2.close();
} catch (Throwable unused2) {
}
}
return valueOf;
} catch (Throwable th3) {
if (fileReader2 != null) {
try {
fileReader2.close();
} catch (Throwable unused3) {
}
}
throw th3;
}
}
}
public static List<String> a(Map<String, String> map) {
if (map == null) {
return null;
}
try {
String str = map.get("BUGLY_DISABLE");
if (str != null && str.length() != 0) {
String[] split = str.split(",");
for (int i = 0; i < split.length; i++) {
split[i] = split[i].trim();
}
return Arrays.asList(split);
}
return null;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
private static String a(byte[] bArr) {
X509Certificate x509Certificate;
StringBuilder sb = new StringBuilder();
if (bArr != null && bArr.length > 0) {
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
if (certificateFactory == null || (x509Certificate = (X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(bArr))) == null) {
return null;
}
sb.append("Issuer|");
Principal issuerDN = x509Certificate.getIssuerDN();
if (issuerDN != null) {
sb.append(issuerDN.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("SerialNumber|");
BigInteger serialNumber = x509Certificate.getSerialNumber();
if (issuerDN != null) {
sb.append(serialNumber.toString(16));
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("NotBefore|");
Date notBefore = x509Certificate.getNotBefore();
if (issuerDN != null) {
sb.append(notBefore.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("NotAfter|");
Date notAfter = x509Certificate.getNotAfter();
if (issuerDN != null) {
sb.append(notAfter.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("SHA1|");
String a2 = z.a(MessageDigest.getInstance("SHA1").digest(x509Certificate.getEncoded()));
if (a2 != null && a2.length() > 0) {
sb.append(a2.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("MD5|");
String a3 = z.a(MessageDigest.getInstance("MD5").digest(x509Certificate.getEncoded()));
if (a3 != null && a3.length() > 0) {
sb.append(a3.toString());
} else {
sb.append(CategoryModel.unknown);
}
} catch (CertificateException e) {
if (!x.a(e)) {
e.printStackTrace();
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return sb.length() == 0 ? CategoryModel.unknown : sb.toString();
}
}

View File

@@ -0,0 +1,51 @@
package com.tencent.bugly.crashreport.common.info;
import android.os.Parcel;
import android.os.Parcelable;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class PlugInBean implements Parcelable {
public static final Parcelable.Creator<PlugInBean> CREATOR = new Parcelable.Creator<PlugInBean>() { // from class: com.tencent.bugly.crashreport.common.info.PlugInBean.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ PlugInBean createFromParcel(Parcel parcel) {
return new PlugInBean(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ PlugInBean[] newArray(int i) {
return new PlugInBean[i];
}
};
public final String a;
public final String b;
public final String c;
public PlugInBean(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public String toString() {
return "plid:" + this.a + " plV:" + this.b + " plUUID:" + this.c;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.a);
parcel.writeString(this.b);
parcel.writeString(this.c);
}
public PlugInBean(Parcel parcel) {
this.a = parcel.readString();
this.b = parcel.readString();
this.c = parcel.readString();
}
}

View File

@@ -0,0 +1,652 @@
package com.tencent.bugly.crashreport.common.info;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Process;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.diy.model.CategoryModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
private static a af;
public SharedPreferences E;
private final Context F;
private String G;
private String H;
private String I;
private String Y;
public String c;
public final String d;
public final String f;
public final String g;
public final String h;
public long i;
public String j;
public String k;
public String l;
public List<String> o;
public boolean u;
public String v;
public String w;
public String x;
public boolean z;
public boolean e = true;
private String J = CategoryModel.unknown;
private String K = CategoryModel.unknown;
private String L = "";
private String M = null;
private String N = null;
private String O = null;
private String P = null;
private long Q = -1;
private long R = -1;
private long S = -1;
private String T = null;
private String U = null;
private Map<String, PlugInBean> V = null;
private boolean W = true;
private String X = null;
private Boolean Z = null;
private String aa = null;
private String ab = null;
private String ac = null;
public String m = null;
public String n = null;
private Map<String, PlugInBean> ad = null;
private Map<String, PlugInBean> ae = null;
private int ag = -1;
private int ah = -1;
private Map<String, String> ai = new HashMap();
private Map<String, String> aj = new HashMap();
private Map<String, String> ak = new HashMap();
private boolean al = true;
public String p = CategoryModel.unknown;
public long q = 0;
public long r = 0;
public long s = 0;
public long t = 0;
public boolean y = false;
private Boolean am = null;
private Boolean an = null;
public HashMap<String, String> A = new HashMap<>();
private String ao = null;
private String ap = null;
private String aq = null;
private String ar = null;
private String as = null;
public boolean B = true;
public List<String> C = new ArrayList();
public com.tencent.bugly.crashreport.a D = null;
/* renamed from: at, reason: collision with root package name */
private final Object f1at = new Object();
private final Object au = new Object();
private final Object av = new Object();
private final Object aw = new Object();
private final Object ax = new Object();
private final Object ay = new Object();
private final Object az = new Object();
public final long a = System.currentTimeMillis();
public final byte b = 1;
private a(Context context) {
this.j = null;
this.k = null;
this.Y = null;
this.l = null;
this.o = null;
this.u = false;
this.v = null;
this.w = null;
this.x = null;
this.z = false;
this.F = z.a(context);
PackageInfo b = AppInfo.b(context);
if (b != null) {
try {
this.j = b.versionName;
this.v = this.j;
this.w = Integer.toString(b.versionCode);
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
this.c = AppInfo.a(context);
this.d = AppInfo.a(Process.myPid());
this.f = b.o();
this.g = b.a();
this.k = AppInfo.c(context);
this.h = "Android " + b.b() + ",level " + b.c();
String str = this.g + ";" + this.h;
Map<String, String> d = AppInfo.d(context);
if (d != null) {
try {
this.o = AppInfo.a(d);
String str2 = d.get("BUGLY_APPID");
if (str2 != null) {
this.Y = str2;
c("APP_ID", this.Y);
}
String str3 = d.get("BUGLY_APP_VERSION");
if (str3 != null) {
this.j = str3;
}
String str4 = d.get("BUGLY_APP_CHANNEL");
if (str4 != null) {
this.l = str4;
}
String str5 = d.get("BUGLY_ENABLE_DEBUG");
if (str5 != null) {
this.u = str5.equalsIgnoreCase("true");
}
String str6 = d.get("com.tencent.rdm.uuid");
if (str6 != null) {
this.x = str6;
}
} catch (Throwable th2) {
if (!x.a(th2)) {
th2.printStackTrace();
}
}
}
try {
if (!context.getDatabasePath("bugly_db_").exists()) {
this.z = true;
x.c("App is first time to be installed on the device.", new Object[0]);
}
} catch (Throwable th3) {
if (com.tencent.bugly.b.c) {
th3.printStackTrace();
}
}
this.E = z.a("BUGLY_COMMON_VALUES", context);
x.c("com info create end", new Object[0]);
}
public static int K() {
return b.c();
}
public static synchronized a b() {
a aVar;
synchronized (a.class) {
aVar = af;
}
return aVar;
}
public static String c() {
return "3.1.0";
}
public final String A() {
if (this.ac == null) {
this.ac = b.g();
x.a("Hardware serial number: %s", this.ac);
}
return this.ac;
}
public final Map<String, String> B() {
synchronized (this.av) {
if (this.ai.size() <= 0) {
return null;
}
return new HashMap(this.ai);
}
}
public final void C() {
synchronized (this.av) {
this.ai.clear();
}
}
public final int D() {
int size;
synchronized (this.av) {
size = this.ai.size();
}
return size;
}
public final Set<String> E() {
Set<String> keySet;
synchronized (this.av) {
keySet = this.ai.keySet();
}
return keySet;
}
public final Map<String, String> F() {
synchronized (this.az) {
if (this.aj.size() <= 0) {
return null;
}
return new HashMap(this.aj);
}
}
public final Map<String, String> G() {
synchronized (this.aw) {
if (this.ak.size() <= 0) {
return null;
}
return new HashMap(this.ak);
}
}
public final int H() {
int i;
synchronized (this.ax) {
i = this.ag;
}
return i;
}
public final int I() {
return this.ah;
}
public final synchronized Map<String, PlugInBean> J() {
return null;
}
public final String L() {
if (this.ao == null) {
this.ao = b.q();
}
return this.ao;
}
public final String M() {
if (this.ap == null) {
this.ap = b.f(this.F);
}
return this.ap;
}
public final String N() {
if (this.aq == null) {
this.aq = b.g(this.F);
}
return this.aq;
}
public final String O() {
return b.r();
}
public final String P() {
if (this.ar == null) {
this.ar = b.h(this.F);
}
return this.ar;
}
public final long Q() {
return b.s();
}
public final boolean R() {
if (this.am == null) {
this.am = Boolean.valueOf(b.i(this.F));
x.a("Is it a virtual machine? " + this.am, new Object[0]);
}
return this.am.booleanValue();
}
public final boolean S() {
if (this.an == null) {
this.an = Boolean.valueOf(b.j(this.F));
x.a("Does it has hook frame? " + this.an, new Object[0]);
}
return this.an.booleanValue();
}
public final String T() {
if (this.H == null) {
this.H = AppInfo.g(this.F);
x.a("Beacon channel " + this.H, new Object[0]);
}
return this.H;
}
public final boolean a() {
return this.al;
}
public final void c(String str) {
this.I = str;
synchronized (this.az) {
this.aj.put("E8", str);
}
}
public final void d() {
synchronized (this.f1at) {
this.G = UUID.randomUUID().toString();
}
}
public final String e() {
String str;
synchronized (this.f1at) {
if (this.G == null) {
synchronized (this.f1at) {
this.G = UUID.randomUUID().toString();
}
}
str = this.G;
}
return str;
}
public final String f() {
if (z.a((String) null)) {
return this.Y;
}
return null;
}
public final String g() {
String str;
synchronized (this.ay) {
str = this.J;
}
return str;
}
public final String h() {
String str = this.I;
if (str != null) {
return str;
}
this.I = k() + "|" + m() + "|" + n();
return this.I;
}
public final synchronized String i() {
return this.K;
}
public final synchronized String j() {
return this.L;
}
public final String k() {
if (!this.W) {
return "";
}
if (this.M == null) {
this.M = b.d();
}
return this.M;
}
public final String l() {
if (!this.W) {
return "";
}
String str = this.N;
if (str == null || !str.contains(":")) {
this.N = b.f();
}
return this.N;
}
public final String m() {
if (!this.W) {
return "";
}
if (this.O == null) {
this.O = b.e();
}
return this.O;
}
public final String n() {
if (!this.W) {
return "";
}
if (this.P == null) {
this.P = b.a(this.F);
}
return this.P;
}
public final long o() {
if (this.Q <= 0) {
this.Q = b.h();
}
return this.Q;
}
public final long p() {
if (this.R <= 0) {
this.R = b.j();
}
return this.R;
}
public final long q() {
if (this.S <= 0) {
this.S = b.l();
}
return this.S;
}
public final String r() {
if (this.T == null) {
this.T = b.a(this.F, true);
}
return this.T;
}
public final String s() {
if (this.U == null) {
this.U = b.e(this.F);
}
return this.U;
}
public final String t() {
try {
Map<String, ?> all = this.F.getSharedPreferences("BuglySdkInfos", 0).getAll();
if (!all.isEmpty()) {
synchronized (this.au) {
for (Map.Entry<String, ?> entry : all.entrySet()) {
try {
this.A.put(entry.getKey(), entry.getValue().toString());
} catch (Throwable th) {
x.a(th);
}
}
}
}
} catch (Throwable th2) {
x.a(th2);
}
if (this.A.isEmpty()) {
return null;
}
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry2 : this.A.entrySet()) {
sb.append("[");
sb.append(entry2.getKey());
sb.append(",");
sb.append(entry2.getValue());
sb.append("] ");
}
c("SDK_INFO", sb.toString());
return sb.toString();
}
public final String u() {
if (this.as == null) {
this.as = AppInfo.e(this.F);
}
return this.as;
}
public final synchronized Map<String, PlugInBean> v() {
return null;
}
public final String w() {
if (this.X == null) {
this.X = b.n();
}
return this.X;
}
public final Boolean x() {
if (this.Z == null) {
this.Z = Boolean.valueOf(b.p());
}
return this.Z;
}
public final String y() {
if (this.aa == null) {
this.aa = b.d(this.F);
x.a("ROM ID: %s", this.aa);
}
return this.aa;
}
public final String z() {
if (this.ab == null) {
this.ab = b.b(this.F);
x.a("SIM serial number: %s", this.ab);
}
return this.ab;
}
public final void a(boolean z) {
this.al = z;
com.tencent.bugly.crashreport.a aVar = this.D;
if (aVar != null) {
aVar.setNativeIsAppForeground(z);
}
}
public final void b(String str) {
synchronized (this.ay) {
if (str == null) {
str = "10000";
}
this.J = str;
}
}
public final String f(String str) {
String remove;
if (z.a(str)) {
x.d("key should not be empty %s", str);
return null;
}
synchronized (this.av) {
remove = this.ai.remove(str);
}
return remove;
}
public final synchronized void d(String str) {
this.K = str;
}
public final String g(String str) {
String str2;
if (z.a(str)) {
x.d("key should not be empty %s", str);
return null;
}
synchronized (this.av) {
str2 = this.ai.get(str);
}
return str2;
}
public static synchronized a a(Context context) {
a aVar;
synchronized (a.class) {
if (af == null) {
af = new a(context);
}
aVar = af;
}
return aVar;
}
public final void b(boolean z) {
this.W = z;
}
public final void c(String str, String str2) {
if (!z.a(str) && !z.a(str2)) {
synchronized (this.aw) {
this.ak.put(str, str2);
}
} else {
x.d("server key&value should not be empty %s %s", str, str2);
}
}
public final void b(String str, String str2) {
if (!z.a(str) && !z.a(str2)) {
synchronized (this.av) {
this.ai.put(str, str2);
}
} else {
x.d("key&value should not be empty %s %s", str, str2);
}
}
public final synchronized void e(String str) {
this.L = str;
}
public final void a(String str) {
this.Y = str;
c("APP_ID", str);
}
public final void a(String str, String str2) {
if (str == null || str2 == null) {
return;
}
synchronized (this.au) {
this.A.put(str, str2);
}
}
public final void b(int i) {
int i2 = this.ah;
if (i2 != 24096) {
this.ah = 24096;
x.a("server scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ah));
}
}
public final void a(int i) {
synchronized (this.ax) {
int i2 = this.ag;
if (i2 != i) {
this.ag = i;
x.a("user scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ag));
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,154 @@
package com.tencent.bugly.crashreport.common.strategy;
import android.os.Parcel;
import android.os.Parcelable;
import com.tencent.bugly.proguard.z;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class StrategyBean implements Parcelable {
public static final Parcelable.Creator<StrategyBean> CREATOR = new Parcelable.Creator<StrategyBean>() { // from class: com.tencent.bugly.crashreport.common.strategy.StrategyBean.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ StrategyBean createFromParcel(Parcel parcel) {
return new StrategyBean(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ StrategyBean[] newArray(int i) {
return new StrategyBean[i];
}
};
public static String a = "http://rqd.uu.qq.com/rqd/sync";
public static String b = "http://android.bugly.qq.com/rqd/async";
public static String c = "http://android.bugly.qq.com/rqd/async";
public static String d;
public long e;
public long f;
public boolean g;
public boolean h;
public boolean i;
public boolean j;
public boolean k;
public boolean l;
public boolean m;
public boolean n;
public boolean o;
public long p;
public long q;
public String r;
public String s;
public String t;
public String u;
public Map<String, String> v;
public int w;
public long x;
public long y;
public StrategyBean() {
this.e = -1L;
this.f = -1L;
this.g = true;
this.h = true;
this.i = true;
this.j = true;
this.k = false;
this.l = true;
this.m = true;
this.n = true;
this.o = true;
this.q = 30000L;
this.r = b;
this.s = c;
this.t = a;
this.w = 10;
this.x = 300000L;
this.y = -1L;
this.f = System.currentTimeMillis();
StringBuilder sb = new StringBuilder();
sb.append("S(@L@L");
sb.append("@)");
d = sb.toString();
sb.setLength(0);
sb.append("*^@K#K");
sb.append("@!");
this.u = sb.toString();
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeLong(this.f);
parcel.writeByte(this.g ? (byte) 1 : (byte) 0);
parcel.writeByte(this.h ? (byte) 1 : (byte) 0);
parcel.writeByte(this.i ? (byte) 1 : (byte) 0);
parcel.writeString(this.r);
parcel.writeString(this.s);
parcel.writeString(this.u);
z.b(parcel, this.v);
parcel.writeByte(this.j ? (byte) 1 : (byte) 0);
parcel.writeByte(this.k ? (byte) 1 : (byte) 0);
parcel.writeByte(this.n ? (byte) 1 : (byte) 0);
parcel.writeByte(this.o ? (byte) 1 : (byte) 0);
parcel.writeLong(this.q);
parcel.writeByte(this.l ? (byte) 1 : (byte) 0);
parcel.writeByte(this.m ? (byte) 1 : (byte) 0);
parcel.writeLong(this.p);
parcel.writeInt(this.w);
parcel.writeLong(this.x);
parcel.writeLong(this.y);
}
public StrategyBean(Parcel parcel) {
this.e = -1L;
this.f = -1L;
boolean z = true;
this.g = true;
this.h = true;
this.i = true;
this.j = true;
this.k = false;
this.l = true;
this.m = true;
this.n = true;
this.o = true;
this.q = 30000L;
this.r = b;
this.s = c;
this.t = a;
this.w = 10;
this.x = 300000L;
this.y = -1L;
try {
d = "S(@L@L@)";
this.f = parcel.readLong();
this.g = parcel.readByte() == 1;
this.h = parcel.readByte() == 1;
this.i = parcel.readByte() == 1;
this.r = parcel.readString();
this.s = parcel.readString();
this.u = parcel.readString();
this.v = z.b(parcel);
this.j = parcel.readByte() == 1;
this.k = parcel.readByte() == 1;
this.n = parcel.readByte() == 1;
this.o = parcel.readByte() == 1;
this.q = parcel.readLong();
this.l = parcel.readByte() == 1;
if (parcel.readByte() != 1) {
z = false;
}
this.m = z;
this.p = parcel.readLong();
this.w = parcel.readInt();
this.x = parcel.readLong();
this.y = parcel.readLong();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,202 @@
package com.tencent.bugly.crashreport.common.strategy;
import android.content.Context;
import com.tencent.bugly.crashreport.biz.b;
import com.tencent.bugly.proguard.ar;
import com.tencent.bugly.proguard.as;
import com.tencent.bugly.proguard.o;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.r;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
public static int a = 1000;
private static a b;
private static String h;
private final List<com.tencent.bugly.a> c;
private Context g;
private StrategyBean f = null;
private final StrategyBean e = new StrategyBean();
private final w d = w.a();
private a(Context context, List<com.tencent.bugly.a> list) {
this.g = context;
this.c = list;
}
public static StrategyBean d() {
byte[] bArr;
List<r> a2 = p.a().a(2);
if (a2 == null || a2.size() <= 0 || (bArr = a2.get(0).g) == null) {
return null;
}
return (StrategyBean) z.a(bArr, StrategyBean.CREATOR);
}
public final StrategyBean c() {
StrategyBean strategyBean = this.f;
return strategyBean != null ? strategyBean : this.e;
}
public final synchronized boolean b() {
return this.f != null;
}
public static synchronized a a(Context context, List<com.tencent.bugly.a> list) {
a aVar;
synchronized (a.class) {
if (b == null) {
b = new a(context, list);
}
aVar = b;
}
return aVar;
}
public final void a(long j) {
this.d.a(new Thread() { // from class: com.tencent.bugly.crashreport.common.strategy.a.1
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
try {
Map<String, byte[]> a2 = p.a().a(a.a, (o) null, true);
if (a2 != null) {
byte[] bArr = a2.get("device");
byte[] bArr2 = a2.get("gateway");
if (bArr != null) {
com.tencent.bugly.crashreport.common.info.a.a(a.this.g).e(new String(bArr));
}
if (bArr2 != null) {
com.tencent.bugly.crashreport.common.info.a.a(a.this.g).d(new String(bArr2));
}
}
a.this.f = a.d();
if (a.this.f != null && !z.a(a.h) && z.c(a.h)) {
a.this.f.r = a.h;
a.this.f.s = a.h;
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
a aVar = a.this;
aVar.a(aVar.f, false);
}
}, j);
}
public static synchronized a a() {
a aVar;
synchronized (a.class) {
aVar = b;
}
return aVar;
}
protected final void a(StrategyBean strategyBean, boolean z) {
x.c("[Strategy] Notify %s", b.class.getName());
b.a(strategyBean, z);
for (com.tencent.bugly.a aVar : this.c) {
try {
x.c("[Strategy] Notify %s", aVar.getClass().getName());
aVar.onServerStrategyChanged(strategyBean);
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
}
public static void a(String str) {
if (!z.a(str) && z.c(str)) {
h = str;
} else {
x.d("URL user set is invalid.", new Object[0]);
}
}
public final void a(as asVar) {
if (asVar == null) {
return;
}
StrategyBean strategyBean = this.f;
if (strategyBean == null || asVar.h != strategyBean.p) {
StrategyBean strategyBean2 = new StrategyBean();
strategyBean2.g = asVar.a;
strategyBean2.i = asVar.c;
strategyBean2.h = asVar.b;
if (z.a(h) || !z.c(h)) {
if (z.c(asVar.d)) {
x.c("[Strategy] Upload url changes to %s", asVar.d);
strategyBean2.r = asVar.d;
}
if (z.c(asVar.e)) {
x.c("[Strategy] Exception upload url changes to %s", asVar.e);
strategyBean2.s = asVar.e;
}
}
ar arVar = asVar.f;
if (arVar != null && !z.a(arVar.a)) {
strategyBean2.u = asVar.f.a;
}
long j = asVar.h;
if (j != 0) {
strategyBean2.p = j;
}
Map<String, String> map = asVar.g;
if (map != null && map.size() > 0) {
Map<String, String> map2 = asVar.g;
strategyBean2.v = map2;
String str = map2.get("B11");
if (str != null && str.equals("1")) {
strategyBean2.j = true;
} else {
strategyBean2.j = false;
}
String str2 = asVar.g.get("B3");
if (str2 != null) {
strategyBean2.y = Long.valueOf(str2).longValue();
}
int i = asVar.i;
strategyBean2.q = i;
strategyBean2.x = i;
String str3 = asVar.g.get("B27");
if (str3 != null && str3.length() > 0) {
try {
int parseInt = Integer.parseInt(str3);
if (parseInt > 0) {
strategyBean2.w = parseInt;
}
} catch (Exception e) {
if (!x.a(e)) {
e.printStackTrace();
}
}
}
String str4 = asVar.g.get("B25");
if (str4 != null && str4.equals("1")) {
strategyBean2.l = true;
} else {
strategyBean2.l = false;
}
}
x.a("[Strategy] enableCrashReport:%b, enableQuery:%b, enableUserInfo:%b, enableAnr:%b, enableBlock:%b, enableSession:%b, enableSessionTimer:%b, sessionOverTime:%d, enableCocos:%b, strategyLastUpdateTime:%d", Boolean.valueOf(strategyBean2.g), Boolean.valueOf(strategyBean2.i), Boolean.valueOf(strategyBean2.h), Boolean.valueOf(strategyBean2.j), Boolean.valueOf(strategyBean2.k), Boolean.valueOf(strategyBean2.n), Boolean.valueOf(strategyBean2.o), Long.valueOf(strategyBean2.q), Boolean.valueOf(strategyBean2.l), Long.valueOf(strategyBean2.p));
this.f = strategyBean2;
p.a().b(2);
r rVar = new r();
rVar.b = 2;
rVar.a = strategyBean2.e;
rVar.e = strategyBean2.f;
rVar.g = z.a(strategyBean2);
p.a().a(rVar);
a(strategyBean2, true);
}
}
}

View File

@@ -0,0 +1,122 @@
package com.tencent.bugly.crashreport.crash;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import com.tencent.bugly.proguard.u;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class BuglyBroadcastReceiver extends BroadcastReceiver {
private static BuglyBroadcastReceiver d;
private Context b;
private String c;
private boolean e = true;
private IntentFilter a = new IntentFilter();
public static synchronized BuglyBroadcastReceiver getInstance() {
BuglyBroadcastReceiver buglyBroadcastReceiver;
synchronized (BuglyBroadcastReceiver.class) {
if (d == null) {
d = new BuglyBroadcastReceiver();
}
buglyBroadcastReceiver = d;
}
return buglyBroadcastReceiver;
}
public synchronized void addFilter(String str) {
if (!this.a.hasAction(str)) {
this.a.addAction(str);
}
x.c("add action %s", str);
}
@Override // android.content.BroadcastReceiver
public final void onReceive(Context context, Intent intent) {
try {
a(context, intent);
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
public synchronized void register(Context context) {
this.b = context;
z.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.BuglyBroadcastReceiver.1
@Override // java.lang.Runnable
public final void run() {
try {
x.a(BuglyBroadcastReceiver.d.getClass(), "Register broadcast receiver of Bugly.", new Object[0]);
synchronized (this) {
BuglyBroadcastReceiver.this.b.registerReceiver(BuglyBroadcastReceiver.d, BuglyBroadcastReceiver.this.a);
}
} catch (Throwable th) {
th.printStackTrace();
}
}
});
}
public synchronized void unregister(Context context) {
try {
x.a(getClass(), "Unregister broadcast receiver of Bugly.", new Object[0]);
context.unregisterReceiver(this);
this.b = context;
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
private synchronized boolean a(Context context, Intent intent) {
if (context != null && intent != null) {
if (intent.getAction().equals("android.net.conn.CONNECTIVITY_CHANGE")) {
if (this.e) {
this.e = false;
return true;
}
String c = com.tencent.bugly.crashreport.common.info.b.c(this.b);
x.c("is Connect BC " + c, new Object[0]);
x.a("network %s changed to %s", this.c, c);
if (c == null) {
this.c = null;
return true;
}
String str = this.c;
this.c = c;
long currentTimeMillis = System.currentTimeMillis();
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
u a2 = u.a();
com.tencent.bugly.crashreport.common.info.a a3 = com.tencent.bugly.crashreport.common.info.a.a(context);
if (a != null && a2 != null && a3 != null) {
if (!c.equals(str)) {
if (currentTimeMillis - a2.a(c.a) > 30000) {
x.a("try to upload crash on network changed.", new Object[0]);
c a4 = c.a();
if (a4 != null) {
a4.a(0L);
}
}
if (currentTimeMillis - a2.a(1001) > 30000) {
x.a("try to upload userinfo on network changed.", new Object[0]);
com.tencent.bugly.crashreport.biz.b.a.b();
}
}
return true;
}
x.d("not inited BC not work", new Object[0]);
return true;
}
}
return false;
}
}

View File

@@ -0,0 +1,295 @@
package com.tencent.bugly.crashreport.crash;
import android.os.Parcel;
import android.os.Parcelable;
import com.tencent.bugly.crashreport.common.info.PlugInBean;
import com.tencent.bugly.proguard.z;
import java.util.Map;
import java.util.UUID;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class CrashDetailBean implements Parcelable, Comparable<CrashDetailBean> {
public static final Parcelable.Creator<CrashDetailBean> CREATOR = new Parcelable.Creator<CrashDetailBean>() { // from class: com.tencent.bugly.crashreport.crash.CrashDetailBean.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ CrashDetailBean createFromParcel(Parcel parcel) {
return new CrashDetailBean(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ CrashDetailBean[] newArray(int i) {
return new CrashDetailBean[i];
}
};
public String A;
public String B;
public long C;
public long D;
public long E;
public long F;
public long G;
public long H;
public String I;
public String J;
public String K;
public String L;
public long M;
public boolean N;
public Map<String, String> O;
public int P;
public int Q;
public Map<String, String> R;
public Map<String, String> S;
public byte[] T;
public String U;
public String V;
private String W;
public long a;
public int b;
public String c;
public boolean d;
public String e;
public String f;
public String g;
public Map<String, PlugInBean> h;
public Map<String, PlugInBean> i;
public boolean j;
public boolean k;
public int l;
public String m;
public String n;
public String o;
public String p;
public String q;
public long r;
public String s;
public int t;
public String u;
public String v;
public String w;
public String x;
public byte[] y;
public Map<String, String> z;
public CrashDetailBean() {
this.a = -1L;
this.b = 0;
this.c = UUID.randomUUID().toString();
this.d = false;
this.e = "";
this.f = "";
this.g = "";
this.h = null;
this.i = null;
this.j = false;
this.k = false;
this.l = 0;
this.m = "";
this.n = "";
this.o = "";
this.p = "";
this.q = "";
this.r = -1L;
this.s = null;
this.t = 0;
this.u = "";
this.v = "";
this.w = null;
this.x = null;
this.y = null;
this.z = null;
this.A = "";
this.B = "";
this.C = -1L;
this.D = -1L;
this.E = -1L;
this.F = -1L;
this.G = -1L;
this.H = -1L;
this.I = "";
this.W = "";
this.J = "";
this.K = "";
this.L = "";
this.M = -1L;
this.N = false;
this.O = null;
this.P = -1;
this.Q = -1;
this.R = null;
this.S = null;
this.T = null;
this.U = null;
this.V = null;
}
@Override // java.lang.Comparable
public /* bridge */ /* synthetic */ int compareTo(CrashDetailBean crashDetailBean) {
CrashDetailBean crashDetailBean2 = crashDetailBean;
if (crashDetailBean2 == null) {
return 1;
}
long j = this.r - crashDetailBean2.r;
if (j <= 0) {
return j < 0 ? -1 : 0;
}
return 1;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeInt(this.b);
parcel.writeString(this.c);
parcel.writeByte(this.d ? (byte) 1 : (byte) 0);
parcel.writeString(this.e);
parcel.writeString(this.f);
parcel.writeString(this.g);
parcel.writeByte(this.j ? (byte) 1 : (byte) 0);
parcel.writeByte(this.k ? (byte) 1 : (byte) 0);
parcel.writeInt(this.l);
parcel.writeString(this.m);
parcel.writeString(this.n);
parcel.writeString(this.o);
parcel.writeString(this.p);
parcel.writeString(this.q);
parcel.writeLong(this.r);
parcel.writeString(this.s);
parcel.writeInt(this.t);
parcel.writeString(this.u);
parcel.writeString(this.v);
parcel.writeString(this.w);
z.b(parcel, this.z);
parcel.writeString(this.A);
parcel.writeString(this.B);
parcel.writeLong(this.C);
parcel.writeLong(this.D);
parcel.writeLong(this.E);
parcel.writeLong(this.F);
parcel.writeLong(this.G);
parcel.writeLong(this.H);
parcel.writeString(this.I);
parcel.writeString(this.W);
parcel.writeString(this.J);
parcel.writeString(this.K);
parcel.writeString(this.L);
parcel.writeLong(this.M);
parcel.writeByte(this.N ? (byte) 1 : (byte) 0);
z.b(parcel, this.O);
z.a(parcel, this.h);
z.a(parcel, this.i);
parcel.writeInt(this.P);
parcel.writeInt(this.Q);
z.b(parcel, this.R);
z.b(parcel, this.S);
parcel.writeByteArray(this.T);
parcel.writeByteArray(this.y);
parcel.writeString(this.U);
parcel.writeString(this.V);
parcel.writeString(this.x);
}
public CrashDetailBean(Parcel parcel) {
this.a = -1L;
this.b = 0;
this.c = UUID.randomUUID().toString();
this.d = false;
this.e = "";
this.f = "";
this.g = "";
this.h = null;
this.i = null;
this.j = false;
this.k = false;
this.l = 0;
this.m = "";
this.n = "";
this.o = "";
this.p = "";
this.q = "";
this.r = -1L;
this.s = null;
this.t = 0;
this.u = "";
this.v = "";
this.w = null;
this.x = null;
this.y = null;
this.z = null;
this.A = "";
this.B = "";
this.C = -1L;
this.D = -1L;
this.E = -1L;
this.F = -1L;
this.G = -1L;
this.H = -1L;
this.I = "";
this.W = "";
this.J = "";
this.K = "";
this.L = "";
this.M = -1L;
this.N = false;
this.O = null;
this.P = -1;
this.Q = -1;
this.R = null;
this.S = null;
this.T = null;
this.U = null;
this.V = null;
this.b = parcel.readInt();
this.c = parcel.readString();
this.d = parcel.readByte() == 1;
this.e = parcel.readString();
this.f = parcel.readString();
this.g = parcel.readString();
this.j = parcel.readByte() == 1;
this.k = parcel.readByte() == 1;
this.l = parcel.readInt();
this.m = parcel.readString();
this.n = parcel.readString();
this.o = parcel.readString();
this.p = parcel.readString();
this.q = parcel.readString();
this.r = parcel.readLong();
this.s = parcel.readString();
this.t = parcel.readInt();
this.u = parcel.readString();
this.v = parcel.readString();
this.w = parcel.readString();
this.z = z.b(parcel);
this.A = parcel.readString();
this.B = parcel.readString();
this.C = parcel.readLong();
this.D = parcel.readLong();
this.E = parcel.readLong();
this.F = parcel.readLong();
this.G = parcel.readLong();
this.H = parcel.readLong();
this.I = parcel.readString();
this.W = parcel.readString();
this.J = parcel.readString();
this.K = parcel.readString();
this.L = parcel.readString();
this.M = parcel.readLong();
this.N = parcel.readByte() == 1;
this.O = z.b(parcel);
this.h = z.a(parcel);
this.i = z.a(parcel);
this.P = parcel.readInt();
this.Q = parcel.readInt();
this.R = z.b(parcel);
this.S = z.b(parcel);
this.T = parcel.createByteArray();
this.y = parcel.createByteArray();
this.U = parcel.readString();
this.V = parcel.readString();
this.x = parcel.readString();
}
}

View File

@@ -0,0 +1,25 @@
package com.tencent.bugly.crashreport.crash;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a implements Comparable<a> {
public long a = -1;
public long b = -1;
public String c = null;
public boolean d = false;
public boolean e = false;
public int f = 0;
@Override // java.lang.Comparable
public final /* bridge */ /* synthetic */ int compareTo(a aVar) {
a aVar2 = aVar;
if (aVar2 == null) {
return 1;
}
long j = this.b - aVar2.b;
if (j <= 0) {
return j < 0 ? -1 : 0;
}
return 1;
}
}

View File

@@ -0,0 +1,308 @@
package com.tencent.bugly.crashreport.crash.anr;
import com.tencent.bugly.proguard.x;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class TraceFileHelper {
/* compiled from: BUGLY */
public static class a {
public long a;
public String b;
public long c;
public Map<String, String[]> d;
}
/* compiled from: BUGLY */
public interface b {
boolean a(long j);
boolean a(long j, long j2, String str);
boolean a(String str, int i, String str2, String str3);
}
private static Object[] a(BufferedReader bufferedReader, Pattern... patternArr) throws IOException {
if (bufferedReader != null && patternArr != null) {
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
for (Pattern pattern : patternArr) {
if (pattern.matcher(readLine).matches()) {
return new Object[]{pattern, readLine};
}
}
}
}
return null;
}
private static String b(BufferedReader bufferedReader) throws IOException {
StringBuffer stringBuffer = new StringBuffer();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null || readLine.trim().length() <= 0) {
break;
}
stringBuffer.append(readLine + "\n");
}
return stringBuffer.toString();
}
public static a readFirstDumpInfo(String str, final boolean z) {
if (str == null) {
x.e("path:%s", str);
return null;
}
final a aVar = new a();
readTraceFile(str, new b() { // from class: com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.2
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(String str2, int i, String str3, String str4) {
x.c("new thread %s", str2);
a aVar2 = a.this;
if (aVar2.d == null) {
aVar2.d = new HashMap();
}
Map<String, String[]> map = a.this.d;
StringBuilder sb = new StringBuilder();
sb.append(i);
map.put(str2, new String[]{str3, str4, sb.toString()});
return true;
}
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(long j, long j2, String str2) {
x.c("new process %s", str2);
a aVar2 = a.this;
aVar2.a = j;
aVar2.b = str2;
aVar2.c = j2;
return z;
}
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(long j) {
x.c("process end %d", Long.valueOf(j));
return false;
}
});
if (aVar.a > 0 && aVar.c > 0 && aVar.b != null) {
return aVar;
}
x.e("first dump error %s", aVar.a + " " + aVar.c + " " + aVar.b);
return null;
}
public static a readTargetDumpInfo(final String str, String str2, final boolean z) {
if (str != null && str2 != null) {
final a aVar = new a();
readTraceFile(str2, new b() { // from class: com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.1
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(String str3, int i, String str4, String str5) {
x.c("new thread %s", str3);
a aVar2 = a.this;
if (aVar2.a > 0 && aVar2.c > 0 && aVar2.b != null) {
if (aVar2.d == null) {
aVar2.d = new HashMap();
}
Map<String, String[]> map = a.this.d;
StringBuilder sb = new StringBuilder();
sb.append(i);
map.put(str3, new String[]{str4, str5, sb.toString()});
}
return true;
}
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(long j, long j2, String str3) {
x.c("new process %s", str3);
if (!str3.equals(str)) {
return true;
}
a aVar2 = a.this;
aVar2.a = j;
aVar2.b = str3;
aVar2.c = j2;
return z;
}
@Override // com.tencent.bugly.crashreport.crash.anr.TraceFileHelper.b
public final boolean a(long j) {
x.c("process end %d", Long.valueOf(j));
a aVar2 = a.this;
return aVar2.a <= 0 || aVar2.c <= 0 || aVar2.b == null;
}
});
if (aVar.a > 0 && aVar.c > 0 && aVar.b != null) {
return aVar;
}
}
return null;
}
public static void readTraceFile(String str, b bVar) {
Throwable th;
BufferedReader bufferedReader;
if (str == null || bVar == null) {
return;
}
File file = new File(str);
if (!file.exists()) {
return;
}
file.lastModified();
file.length();
BufferedReader bufferedReader2 = null;
try {
try {
bufferedReader = new BufferedReader(new FileReader(file));
try {
Pattern compile = Pattern.compile("-{5}\\spid\\s\\d+\\sat\\s\\d+-\\d+-\\d+\\s\\d{2}:\\d{2}:\\d{2}\\s-{5}");
Pattern compile2 = Pattern.compile("-{5}\\send\\s\\d+\\s-{5}");
Pattern compile3 = Pattern.compile("Cmd\\sline:\\s(\\S+)");
Pattern compile4 = Pattern.compile("\".+\"\\s(daemon\\s){0,1}prio=\\d+\\stid=\\d+\\s.*");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
while (true) {
Object[] a2 = a(bufferedReader, compile);
if (a2 == null) {
try {
bufferedReader.close();
return;
} catch (IOException e) {
if (x.a(e)) {
return;
}
e.printStackTrace();
return;
}
}
String[] split = a2[1].toString().split("\\s");
long parseLong = Long.parseLong(split[2]);
long time = simpleDateFormat.parse(split[4] + " " + split[5]).getTime();
Object[] a3 = a(bufferedReader, compile3);
if (a3 == null) {
try {
bufferedReader.close();
return;
} catch (IOException e2) {
if (x.a(e2)) {
return;
}
e2.printStackTrace();
return;
}
}
Matcher matcher = compile3.matcher(a3[1].toString());
matcher.find();
matcher.group(1);
SimpleDateFormat simpleDateFormat2 = simpleDateFormat;
if (!bVar.a(parseLong, time, matcher.group(1))) {
try {
bufferedReader.close();
return;
} catch (IOException e3) {
if (x.a(e3)) {
return;
}
e3.printStackTrace();
return;
}
}
while (true) {
Object[] a4 = a(bufferedReader, compile4, compile2);
if (a4 == null) {
break;
}
if (a4[0] == compile4) {
String obj = a4[1].toString();
Matcher matcher2 = Pattern.compile("\".+\"").matcher(obj);
matcher2.find();
String group = matcher2.group();
String substring = group.substring(1, group.length() - 1);
obj.contains("NATIVE");
Matcher matcher3 = Pattern.compile("tid=\\d+").matcher(obj);
matcher3.find();
String group2 = matcher3.group();
bVar.a(substring, Integer.parseInt(group2.substring(group2.indexOf("=") + 1)), a(bufferedReader), b(bufferedReader));
} else if (!bVar.a(Long.parseLong(a4[1].toString().split("\\s")[2]))) {
try {
bufferedReader.close();
return;
} catch (IOException e4) {
if (x.a(e4)) {
return;
}
e4.printStackTrace();
return;
}
}
}
simpleDateFormat = simpleDateFormat2;
}
} catch (Exception e5) {
e = e5;
bufferedReader2 = bufferedReader;
if (!x.a(e)) {
e.printStackTrace();
}
x.d("trace open fail:%s : %s", e.getClass().getName(), e.getMessage());
if (bufferedReader2 != null) {
try {
bufferedReader2.close();
} catch (IOException e6) {
if (x.a(e6)) {
return;
}
e6.printStackTrace();
}
}
} catch (Throwable th2) {
th = th2;
if (bufferedReader == null) {
throw th;
}
try {
bufferedReader.close();
throw th;
} catch (IOException e7) {
if (x.a(e7)) {
throw th;
}
e7.printStackTrace();
throw th;
}
}
} catch (Exception e8) {
e = e8;
}
} catch (Throwable th3) {
th = th3;
bufferedReader = null;
}
}
private static String a(BufferedReader bufferedReader) throws IOException {
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < 3; i++) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
return null;
}
stringBuffer.append(readLine + "\n");
}
return stringBuffer.toString();
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.bugly.crashreport.crash.anr;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
public String a = null;
public Map<String, String> b = null;
public long c = -1;
public String d = null;
public String e = null;
public String f = null;
public String g = null;
}

View File

@@ -0,0 +1,548 @@
package com.tencent.bugly.crashreport.crash.anr;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.os.FileObserver;
import android.os.Process;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
import com.tencent.bugly.crashreport.crash.anr.TraceFileHelper;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.proguard.ab;
import com.tencent.bugly.proguard.ac;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.y;
import com.tencent.bugly.proguard.z;
import com.thoughtworks.xstream.XStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class b implements ac {
private final Context c;
private final com.tencent.bugly.crashreport.common.info.a d;
private final w e;
private final com.tencent.bugly.crashreport.common.strategy.a f;
private final String g;
private final com.tencent.bugly.crashreport.crash.b h;
private FileObserver i;
private ab k;
private int l;
private AtomicInteger a = new AtomicInteger(0);
private long b = -1;
private boolean j = true;
public b(Context context, com.tencent.bugly.crashreport.common.strategy.a aVar, com.tencent.bugly.crashreport.common.info.a aVar2, w wVar, com.tencent.bugly.crashreport.crash.b bVar) {
this.c = z.a(context);
this.g = context.getDir("bugly", 0).getAbsolutePath();
this.d = aVar2;
this.e = wVar;
this.f = aVar;
this.h = bVar;
}
private static ActivityManager.ProcessErrorStateInfo a(Context context, long j) {
try {
x.c("to find!", new Object[0]);
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
int i = 0;
while (true) {
x.c("waiting!", new Object[0]);
List<ActivityManager.ProcessErrorStateInfo> processesInErrorState = activityManager.getProcessesInErrorState();
if (processesInErrorState != null) {
for (ActivityManager.ProcessErrorStateInfo processErrorStateInfo : processesInErrorState) {
if (processErrorStateInfo.condition == 2) {
x.c("found!", new Object[0]);
return processErrorStateInfo;
}
}
}
z.b(500L);
int i2 = i + 1;
if (i >= 20) {
x.c("end!", new Object[0]);
return null;
}
i = i2;
}
} catch (Exception e) {
x.b(e);
return null;
}
}
private synchronized void b(boolean z) {
if (z) {
e();
} else {
f();
}
}
private synchronized void c(boolean z) {
if (this.j != z) {
x.a("user change anr %b", Boolean.valueOf(z));
this.j = z;
}
}
private synchronized void e() {
if (g()) {
x.d("start when started!", new Object[0]);
return;
}
this.i = new FileObserver("/data/anr/", 8) { // from class: com.tencent.bugly.crashreport.crash.anr.b.1
@Override // android.os.FileObserver
public final void onEvent(int i, String str) {
if (str == null) {
return;
}
String str2 = "/data/anr/" + str;
if (str2.contains("trace")) {
b.this.a(str2);
} else {
x.d("not anr file %s", str2);
}
}
};
try {
this.i.startWatching();
x.a("start anr monitor!", new Object[0]);
this.e.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.anr.b.2
@Override // java.lang.Runnable
public final void run() {
b.this.b();
}
});
} catch (Throwable th) {
this.i = null;
x.d("start anr monitor failed!", new Object[0]);
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
private synchronized void f() {
if (!g()) {
x.d("close when closed!", new Object[0]);
return;
}
try {
this.i.stopWatching();
this.i = null;
x.d("close anr monitor!", new Object[0]);
} catch (Throwable th) {
x.d("stop anr monitor failed!", new Object[0]);
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
private synchronized boolean g() {
return this.i != null;
}
private synchronized boolean h() {
return this.j;
}
public final boolean d() {
ab abVar = this.k;
if (abVar == null) {
return false;
}
abVar.b();
this.k.b(this);
boolean c = this.k.c();
this.k = null;
return c;
}
protected final void b() {
long b = z.b() - c.g;
File file = new File(this.g);
if (file.exists() && file.isDirectory()) {
try {
File[] listFiles = file.listFiles();
if (listFiles != null && listFiles.length != 0) {
int i = 0;
for (File file2 : listFiles) {
String name = file2.getName();
if (name.startsWith("bugly_trace_")) {
try {
int indexOf = name.indexOf(".txt");
if (indexOf > 0 && Long.parseLong(name.substring(12, indexOf)) >= b) {
}
} catch (Throwable unused) {
x.c("Trace file that has invalid format: " + name, new Object[0]);
}
if (file2.delete()) {
i++;
}
}
}
x.c("Number of overdue trace files that has deleted: " + i, new Object[0]);
}
} catch (Throwable th) {
x.a(th);
}
}
}
public final boolean c() {
ab abVar = this.k;
if (abVar != null && abVar.isAlive()) {
return false;
}
this.k = new ab();
ab abVar2 = this.k;
StringBuilder sb = new StringBuilder("Bugly-ThreadMonitor");
int i = this.l;
this.l = i + 1;
sb.append(i);
abVar2.setName(sb.toString());
this.k.a();
this.k.a(this);
return this.k.d();
}
private CrashDetailBean a(a aVar) {
CrashDetailBean crashDetailBean = new CrashDetailBean();
try {
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
crashDetailBean.F = this.d.p();
crashDetailBean.G = this.d.o();
crashDetailBean.H = this.d.q();
crashDetailBean.w = z.a(this.c, c.e, (String) null);
crashDetailBean.b = 3;
crashDetailBean.e = this.d.h();
crashDetailBean.f = this.d.j;
crashDetailBean.g = this.d.w();
crashDetailBean.m = this.d.g();
crashDetailBean.n = "ANR_EXCEPTION";
crashDetailBean.o = aVar.f;
crashDetailBean.q = aVar.g;
crashDetailBean.O = new HashMap();
crashDetailBean.O.put("BUGLY_CR_01", aVar.e);
int indexOf = crashDetailBean.q != null ? crashDetailBean.q.indexOf("\n") : -1;
crashDetailBean.p = indexOf > 0 ? crashDetailBean.q.substring(0, indexOf) : "GET_FAIL";
crashDetailBean.r = aVar.c;
if (crashDetailBean.q != null) {
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
}
crashDetailBean.z = aVar.b;
crashDetailBean.A = aVar.a;
crashDetailBean.B = "main(1)";
crashDetailBean.I = this.d.y();
crashDetailBean.h = this.d.v();
crashDetailBean.i = this.d.J();
crashDetailBean.v = aVar.d;
crashDetailBean.L = this.d.n;
crashDetailBean.M = this.d.a;
crashDetailBean.N = this.d.a();
crashDetailBean.P = this.d.H();
crashDetailBean.Q = this.d.I();
crashDetailBean.R = this.d.B();
crashDetailBean.S = this.d.G();
this.h.c(crashDetailBean);
crashDetailBean.y = y.a();
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
return crashDetailBean;
}
private static boolean a(String str, String str2, String str3) {
Map<String, String[]> map;
BufferedWriter bufferedWriter;
TraceFileHelper.a readTargetDumpInfo = TraceFileHelper.readTargetDumpInfo(str3, str, true);
if (readTargetDumpInfo != null && (map = readTargetDumpInfo.d) != null && map.size() > 0) {
File file = new File(str2);
try {
if (!file.exists()) {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
file.createNewFile();
}
if (file.exists() && file.canWrite()) {
BufferedWriter bufferedWriter2 = null;
try {
try {
bufferedWriter = new BufferedWriter(new FileWriter(file, false));
try {
String[] strArr = readTargetDumpInfo.d.get("main");
int i = 3;
if (strArr != null && strArr.length >= 3) {
String str4 = strArr[0];
String str5 = strArr[1];
bufferedWriter.write("\"main\" tid=" + strArr[2] + " :\n" + str4 + "\n" + str5 + "\n\n");
bufferedWriter.flush();
}
for (Map.Entry<String, String[]> entry : readTargetDumpInfo.d.entrySet()) {
if (!entry.getKey().equals("main")) {
if (entry.getValue() != null && entry.getValue().length >= i) {
String str6 = entry.getValue()[0];
String str7 = entry.getValue()[1];
bufferedWriter.write("\"" + entry.getKey() + "\" tid=" + entry.getValue()[2] + " :\n" + str6 + "\n" + str7 + "\n\n");
bufferedWriter.flush();
}
i = 3;
}
}
try {
bufferedWriter.close();
} catch (IOException e) {
if (!x.a(e)) {
e.printStackTrace();
}
}
return true;
} catch (IOException e2) {
e = e2;
bufferedWriter2 = bufferedWriter;
if (!x.a(e)) {
e.printStackTrace();
}
x.e("dump trace fail %s", e.getClass().getName() + ":" + e.getMessage());
if (bufferedWriter2 != null) {
try {
bufferedWriter2.close();
} catch (IOException e3) {
if (!x.a(e3)) {
e3.printStackTrace();
}
}
}
return false;
} catch (Throwable th) {
th = th;
Throwable th2 = th;
if (bufferedWriter != null) {
try {
bufferedWriter.close();
throw th2;
} catch (IOException e4) {
if (!x.a(e4)) {
e4.printStackTrace();
throw th2;
}
throw th2;
}
}
throw th2;
}
} catch (Throwable th3) {
th = th3;
bufferedWriter = bufferedWriter2;
}
} catch (IOException e5) {
e = e5;
}
} else {
x.e("backup file create fail %s", str2);
return false;
}
} catch (Exception e6) {
if (!x.a(e6)) {
e6.printStackTrace();
}
x.e("backup file create error! %s %s", e6.getClass().getName() + ":" + e6.getMessage(), str2);
return false;
}
} else {
x.e("not found trace dump for %s", str3);
return false;
}
}
public final boolean a() {
return this.a.get() != 0;
}
private boolean a(Context context, String str, ActivityManager.ProcessErrorStateInfo processErrorStateInfo, long j, Map<String, String> map) {
File file = new File(context.getFilesDir(), "bugly/bugly_trace_" + j + ".txt");
a aVar = new a();
aVar.c = j;
aVar.d = file.getAbsolutePath();
aVar.a = processErrorStateInfo != null ? processErrorStateInfo.processName : "";
aVar.f = processErrorStateInfo != null ? processErrorStateInfo.shortMsg : "";
aVar.e = processErrorStateInfo != null ? processErrorStateInfo.longMsg : "";
aVar.b = map;
if (map != null) {
for (String str2 : map.keySet()) {
if (str2.startsWith("main(")) {
aVar.g = map.get(str2);
}
}
}
Object[] objArr = new Object[6];
objArr[0] = Long.valueOf(aVar.c);
objArr[1] = aVar.d;
objArr[2] = aVar.a;
objArr[3] = aVar.f;
objArr[4] = aVar.e;
Map<String, String> map2 = aVar.b;
objArr[5] = Integer.valueOf(map2 == null ? 0 : map2.size());
x.c("anr tm:%d\ntr:%s\nproc:%s\nsMsg:%s\n lMsg:%s\n threads:%d", objArr);
if (!this.f.b()) {
x.e("crash report sync remote fail, will not upload to Bugly , print local for helpful!", new Object[0]);
com.tencent.bugly.crashreport.crash.b.a("ANR", z.a(), aVar.a, "main", aVar.e, null);
return false;
}
if (!this.f.c().j) {
x.d("ANR Report is closed!", new Object[0]);
return false;
}
x.a("found visiable anr , start to upload!", new Object[0]);
CrashDetailBean a = a(aVar);
if (a == null) {
x.e("pack anr fail!", new Object[0]);
return false;
}
c.a().a(a);
if (a.a >= 0) {
x.a("backup anr record success!", new Object[0]);
} else {
x.d("backup anr record fail!", new Object[0]);
}
if (str != null && new File(str).exists()) {
this.a.set(3);
if (a(str, aVar.d, aVar.a)) {
x.a("backup trace success", new Object[0]);
}
}
com.tencent.bugly.crashreport.crash.b.a("ANR", z.a(), aVar.a, "main", aVar.e, a);
if (!this.h.a(a)) {
this.h.a(a, 3000L, true);
}
this.h.b(a);
return true;
}
public final void a(String str) {
synchronized (this) {
if (this.a.get() != 0) {
x.c("trace started return ", new Object[0]);
return;
}
this.a.set(1);
try {
x.c("read trace first dump for create time!", new Object[0]);
TraceFileHelper.a readFirstDumpInfo = TraceFileHelper.readFirstDumpInfo(str, false);
long j = readFirstDumpInfo != null ? readFirstDumpInfo.c : -1L;
if (j == -1) {
x.d("trace dump fail could not get time!", new Object[0]);
j = System.currentTimeMillis();
}
long j2 = j;
if (Math.abs(j2 - this.b) < 10000) {
x.d("should not process ANR too Fre in %d", Integer.valueOf(XStream.PRIORITY_VERY_HIGH));
} else {
this.b = j2;
this.a.set(1);
try {
Map<String, String> a = z.a(c.f, false);
if (a != null && a.size() > 0) {
ActivityManager.ProcessErrorStateInfo a2 = a(this.c, 10000L);
if (a2 == null) {
x.c("proc state is unvisiable!", new Object[0]);
} else if (a2.pid != Process.myPid()) {
x.c("not mind proc!", a2.processName);
} else {
x.a("found visiable anr , start to process!", new Object[0]);
a(this.c, str, a2, j2, a);
}
}
x.d("can't get all thread skip this anr", new Object[0]);
} catch (Throwable th) {
x.a(th);
x.e("get all thread stack fail!", new Object[0]);
}
}
} finally {
try {
} finally {
}
}
}
}
public final void a(boolean z) {
c(z);
boolean h = h();
com.tencent.bugly.crashreport.common.strategy.a a = com.tencent.bugly.crashreport.common.strategy.a.a();
if (a != null) {
h = h && a.c().g;
}
if (h != g()) {
x.a("anr changed to %b", Boolean.valueOf(h));
b(h);
}
}
public final synchronized void a(StrategyBean strategyBean) {
if (strategyBean == null) {
return;
}
if (strategyBean.j != g()) {
x.d("server anr changed to %b", Boolean.valueOf(strategyBean.j));
}
if (Build.VERSION.SDK_INT <= 19) {
boolean z = strategyBean.j && h();
if (z != g()) {
x.a("anr changed to %b", Boolean.valueOf(z));
b(z);
}
return;
}
if (strategyBean.j) {
c();
} else {
d();
}
}
@Override // com.tencent.bugly.proguard.ac
public final boolean a(Thread thread) {
new HashMap();
if (thread.getName().contains("main")) {
ActivityManager.ProcessErrorStateInfo a = a(this.c, 10000L);
if (a == null) {
x.c("anr handler onThreadBlock proc state is unvisiable!", new Object[0]);
return false;
}
if (a.pid != Process.myPid()) {
x.c("onThreadBlock not mind proc!", a.processName);
return false;
}
try {
Map<String, String> a2 = z.a(200000, false);
x.a("onThreadBlock found visiable anr , start to process!", new Object[0]);
a(this.c, "", a, System.currentTimeMillis(), a2);
} catch (Throwable unused) {
return false;
}
} else {
x.c("anr handler onThreadBlock only care main thread", new Object[0]);
}
return true;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,260 @@
package com.tencent.bugly.crashreport.crash;
import android.content.Context;
import android.os.Build;
import com.tencent.bugly.BuglyStrategy;
import com.tencent.bugly.crashreport.common.info.AppInfo;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler;
import com.tencent.bugly.proguard.o;
import com.tencent.bugly.proguard.p;
import com.tencent.bugly.proguard.r;
import com.tencent.bugly.proguard.u;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class c {
public static int a = 0;
public static boolean b = false;
public static int c = 2;
public static boolean d = true;
public static int e = 20480;
public static int f = 20480;
public static long g = 604800000;
public static String h = null;
public static boolean i = false;
public static String j = null;
public static int k = 5000;
public static boolean l = true;
public static boolean m = false;
public static String n;
public static String o;
private static c r;
public final b p;
private final Context q;
private final e s;
private final NativeCrashHandler t;
private com.tencent.bugly.crashreport.common.strategy.a u;
private w v;
private final com.tencent.bugly.crashreport.crash.anr.b w;
private Boolean x;
/* compiled from: BUGLY */
/* renamed from: com.tencent.bugly.crashreport.crash.c$2, reason: invalid class name */
final class AnonymousClass2 extends Thread {
AnonymousClass2() {
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
List<CrashDetailBean> list;
if (z.a(c.this.q, "local_crash_lock", 10000L)) {
List<CrashDetailBean> a = c.this.p.a();
if (a != null && a.size() > 0) {
x.c("Size of crash list: %s", Integer.valueOf(a.size()));
int size = a.size();
if (size > 20) {
ArrayList arrayList = new ArrayList();
Collections.sort(a);
for (int i = 0; i < 20; i++) {
arrayList.add(a.get((size - 1) - i));
}
list = arrayList;
} else {
list = a;
}
c.this.p.a(list, 0L, false, false, false);
}
z.b(c.this.q, "local_crash_lock");
}
}
}
private c(int i2, Context context, w wVar, boolean z, BuglyStrategy.a aVar, o oVar, String str) {
a = i2;
Context a2 = z.a(context);
this.q = a2;
this.u = com.tencent.bugly.crashreport.common.strategy.a.a();
this.v = wVar;
this.p = new b(i2, a2, u.a(), p.a(), this.u, aVar, oVar);
com.tencent.bugly.crashreport.common.info.a a3 = com.tencent.bugly.crashreport.common.info.a.a(a2);
this.s = new e(a2, this.p, this.u, a3);
this.t = NativeCrashHandler.getInstance(a2, a3, this.p, this.u, wVar, z, str);
a3.D = this.t;
this.w = new com.tencent.bugly.crashreport.crash.anr.b(a2, this.u, a3, wVar, this.p);
}
public final synchronized void c() {
this.s.a();
this.t.setUserOpened(true);
if (Build.VERSION.SDK_INT <= 19) {
this.w.a(true);
} else {
this.w.c();
}
}
public final synchronized void d() {
this.s.b();
this.t.setUserOpened(false);
if (Build.VERSION.SDK_INT < 19) {
this.w.a(false);
} else {
this.w.d();
}
}
public final void e() {
this.s.a();
}
public final void f() {
this.t.setUserOpened(false);
}
public final void g() {
this.t.setUserOpened(true);
}
public final void h() {
if (Build.VERSION.SDK_INT <= 19) {
this.w.a(true);
} else {
this.w.c();
}
}
public final void i() {
if (Build.VERSION.SDK_INT < 19) {
this.w.a(false);
} else {
this.w.d();
}
}
public final synchronized void j() {
int i2 = 0;
while (true) {
int i3 = i2 + 1;
if (i2 < 30) {
try {
x.a("try main sleep for make a test anr! try:%d/30 , kill it if you don't want to wait!", Integer.valueOf(i3));
z.b(5000L);
i2 = i3;
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
return;
}
}
}
}
public final boolean k() {
return this.w.a();
}
public final void l() {
this.t.checkUploadRecordCrash();
}
public final void m() {
if (com.tencent.bugly.crashreport.common.info.a.b().d.equals(AppInfo.a(this.q))) {
this.t.removeEmptyNativeRecordFiles();
}
}
public static synchronized c a(int i2, Context context, boolean z, BuglyStrategy.a aVar, o oVar, String str) {
c cVar;
synchronized (c.class) {
if (r == null) {
r = new c(1004, context, w.a(), z, aVar, null, null);
}
cVar = r;
}
return cVar;
}
public final boolean b() {
Boolean bool = this.x;
if (bool != null) {
return bool.booleanValue();
}
String str = com.tencent.bugly.crashreport.common.info.a.b().d;
List<r> a2 = p.a().a(1);
ArrayList arrayList = new ArrayList();
if (a2 == null || a2.size() <= 0) {
this.x = false;
return false;
}
for (r rVar : a2) {
if (str.equals(rVar.c)) {
this.x = true;
arrayList.add(rVar);
}
}
if (arrayList.size() > 0) {
p.a().a(arrayList);
}
return true;
}
public static synchronized c a() {
c cVar;
synchronized (c.class) {
cVar = r;
}
return cVar;
}
public final void a(StrategyBean strategyBean) {
this.s.a(strategyBean);
this.t.onStrategyChanged(strategyBean);
this.w.a(strategyBean);
w.a().a(new AnonymousClass2(), 3000L);
}
public final synchronized void a(boolean z, boolean z2, boolean z3) {
this.t.testNativeCrash(z, z2, z3);
}
public final void a(final Thread thread, final Throwable th, boolean z, String str, byte[] bArr, final boolean z2) {
final boolean z3 = false;
final String str2 = null;
final byte[] bArr2 = null;
this.v.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.c.1
@Override // java.lang.Runnable
public final void run() {
try {
x.c("post a throwable %b", Boolean.valueOf(z3));
c.this.s.a(thread, th, false, str2, bArr2);
if (z2) {
x.a("clear user datas", new Object[0]);
com.tencent.bugly.crashreport.common.info.a.a(c.this.q).C();
}
} catch (Throwable th2) {
if (!x.b(th2)) {
th2.printStackTrace();
}
x.e("java catch error: %s", th.toString());
}
}
});
}
public final void a(CrashDetailBean crashDetailBean) {
this.p.d(crashDetailBean);
}
public final void a(long j2) {
w.a().a(new AnonymousClass2(), j2);
}
}

View File

@@ -0,0 +1,91 @@
package com.tencent.bugly.crashreport.crash;
import android.content.Context;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class d {
private static d a;
private com.tencent.bugly.crashreport.common.strategy.a b;
private com.tencent.bugly.crashreport.common.info.a c;
private b d;
private Context e;
private d(Context context) {
c a2 = c.a();
if (a2 == null) {
return;
}
this.b = com.tencent.bugly.crashreport.common.strategy.a.a();
this.c = com.tencent.bugly.crashreport.common.info.a.a(context);
this.d = a2.p;
this.e = context;
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.d.1
@Override // java.lang.Runnable
public final void run() {
d.a(d.this);
}
});
}
static /* synthetic */ void a(d dVar) {
x.c("[ExtraCrashManager] Trying to notify Bugly agents.", new Object[0]);
try {
Class<?> cls = Class.forName("com.tencent.bugly.agent.GameAgent");
dVar.c.getClass();
z.a(cls, "sdkPackageName", "com.tencent.bugly", (Object) null);
x.c("[ExtraCrashManager] Bugly game agent has been notified.", new Object[0]);
} catch (Throwable unused) {
x.a("[ExtraCrashManager] no game agent", new Object[0]);
}
}
/* JADX WARN: Removed duplicated region for block: B:38:0x00df */
/* JADX WARN: Removed duplicated region for block: B:42:0x015a A[Catch: all -> 0x0250, TRY_ENTER, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
/* JADX WARN: Removed duplicated region for block: B:48:0x01fa A[Catch: all -> 0x0250, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
/* JADX WARN: Removed duplicated region for block: B:50:0x0203 A[Catch: all -> 0x0250, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
/* JADX WARN: Removed duplicated region for block: B:53:0x0243 A[Catch: all -> 0x0250, TRY_LEAVE, TryCatch #1 {all -> 0x0250, blocks: (B:15:0x0045, B:17:0x004d, B:18:0x0054, B:21:0x0060, B:23:0x0068, B:32:0x00b6, B:34:0x00ba, B:39:0x00e0, B:42:0x015a, B:44:0x0161, B:46:0x0166, B:48:0x01fa, B:50:0x0203, B:51:0x0208, B:53:0x0243, B:57:0x00c8, B:59:0x00cc), top: B:14:0x0045 }] */
/* JADX WARN: Removed duplicated region for block: B:56:0x0165 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
static /* synthetic */ void a(com.tencent.bugly.crashreport.crash.d r16, java.lang.Thread r17, int r18, java.lang.String r19, java.lang.String r20, java.lang.String r21, java.util.Map r22) {
/*
Method dump skipped, instructions count: 615
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.d.a(com.tencent.bugly.crashreport.crash.d, java.lang.Thread, int, java.lang.String, java.lang.String, java.lang.String, java.util.Map):void");
}
public static d a(Context context) {
if (a == null) {
a = new d(context);
}
return a;
}
public static void a(final Thread thread, final int i, final String str, final String str2, final String str3, final Map<String, String> map) {
w.a().a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.d.2
@Override // java.lang.Runnable
public final void run() {
try {
if (d.a == null) {
x.e("[ExtraCrashManager] Extra crash manager has not been initialized.", new Object[0]);
} else {
d.a(d.a, thread, i, str, str2, str3, map);
}
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
x.e("[ExtraCrashManager] Crash error %s %s %s", str, str2, str3);
}
}
});
}
}

View File

@@ -0,0 +1,430 @@
package com.tencent.bugly.crashreport.crash;
import android.content.Context;
import android.os.Process;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.y;
import com.tencent.bugly.proguard.z;
import java.lang.Thread;
import java.util.HashMap;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class e implements Thread.UncaughtExceptionHandler {
private static String h;
private static final Object i = new Object();
private Context a;
private b b;
private com.tencent.bugly.crashreport.common.strategy.a c;
private com.tencent.bugly.crashreport.common.info.a d;
private Thread.UncaughtExceptionHandler e;
private Thread.UncaughtExceptionHandler f;
private boolean g = false;
private int j;
public e(Context context, b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar, com.tencent.bugly.crashreport.common.info.a aVar2) {
this.a = context;
this.b = bVar;
this.c = aVar;
this.d = aVar2;
}
public final synchronized void a() {
if (this.j >= 10) {
x.a("java crash handler over %d, no need set.", 10);
return;
}
this.g = true;
Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
if (defaultUncaughtExceptionHandler != null) {
if (getClass().getName().equals(defaultUncaughtExceptionHandler.getClass().getName())) {
return;
}
if ("com.android.internal.os.RuntimeInit$UncaughtHandler".equals(defaultUncaughtExceptionHandler.getClass().getName())) {
x.a("backup system java handler: %s", defaultUncaughtExceptionHandler.toString());
this.f = defaultUncaughtExceptionHandler;
this.e = defaultUncaughtExceptionHandler;
} else {
x.a("backup java handler: %s", defaultUncaughtExceptionHandler.toString());
this.e = defaultUncaughtExceptionHandler;
}
}
Thread.setDefaultUncaughtExceptionHandler(this);
this.j++;
x.a("registered java monitor: %s", toString());
}
public final synchronized void b() {
this.g = false;
x.a("close java monitor!", new Object[0]);
if (Thread.getDefaultUncaughtExceptionHandler().getClass().getName().contains("bugly")) {
x.a("Java monitor to unregister: %s", toString());
Thread.setDefaultUncaughtExceptionHandler(this.e);
this.j--;
}
}
@Override // java.lang.Thread.UncaughtExceptionHandler
public final void uncaughtException(Thread thread, Throwable th) {
synchronized (i) {
a(thread, th, true, null, null);
}
}
private CrashDetailBean b(Thread thread, Throwable th, boolean z, String str, byte[] bArr) {
String a;
boolean z2 = false;
if (th == null) {
x.d("We can do nothing with a null throwable.", new Object[0]);
return null;
}
boolean k = c.a().k();
String str2 = (k && z) ? " This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful![Bugly]" : "";
if (k && z) {
x.e("This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful!", new Object[0]);
}
CrashDetailBean crashDetailBean = new CrashDetailBean();
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
crashDetailBean.F = this.d.p();
crashDetailBean.G = this.d.o();
crashDetailBean.H = this.d.q();
crashDetailBean.w = z.a(this.a, c.e, (String) null);
crashDetailBean.y = y.a();
Object[] objArr = new Object[1];
byte[] bArr2 = crashDetailBean.y;
objArr[0] = Integer.valueOf(bArr2 == null ? 0 : bArr2.length);
x.a("user log size:%d", objArr);
crashDetailBean.b = z ? 0 : 2;
crashDetailBean.e = this.d.h();
com.tencent.bugly.crashreport.common.info.a aVar = this.d;
crashDetailBean.f = aVar.j;
crashDetailBean.g = aVar.w();
crashDetailBean.m = this.d.g();
String name = th.getClass().getName();
String b = b(th, 1000);
if (b == null) {
b = "";
}
Object[] objArr2 = new Object[2];
objArr2[0] = Integer.valueOf(th.getStackTrace().length);
objArr2[1] = Boolean.valueOf(th.getCause() != null);
x.e("stack frame :%d, has cause %b", objArr2);
String stackTraceElement = th.getStackTrace().length > 0 ? th.getStackTrace()[0].toString() : "";
Throwable th2 = th;
while (th2 != null && th2.getCause() != null) {
th2 = th2.getCause();
}
if (th2 != null && th2 != th) {
crashDetailBean.n = th2.getClass().getName();
crashDetailBean.o = b(th2, 1000);
if (crashDetailBean.o == null) {
crashDetailBean.o = "";
}
if (th2.getStackTrace().length > 0) {
crashDetailBean.p = th2.getStackTrace()[0].toString();
}
StringBuilder sb = new StringBuilder();
sb.append(name);
sb.append(":");
sb.append(b);
sb.append("\n");
sb.append(stackTraceElement);
sb.append("\n......");
sb.append("\nCaused by:\n");
sb.append(crashDetailBean.n);
sb.append(":");
sb.append(crashDetailBean.o);
sb.append("\n");
a = a(th2, c.f);
sb.append(a);
crashDetailBean.q = sb.toString();
} else {
crashDetailBean.n = name;
crashDetailBean.o = b + str2;
if (crashDetailBean.o == null) {
crashDetailBean.o = "";
}
crashDetailBean.p = stackTraceElement;
a = a(th, c.f);
crashDetailBean.q = a;
}
crashDetailBean.r = System.currentTimeMillis();
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
try {
crashDetailBean.z = z.a(c.f, false);
crashDetailBean.A = this.d.d;
crashDetailBean.B = thread.getName() + "(" + thread.getId() + ")";
crashDetailBean.z.put(crashDetailBean.B, a);
crashDetailBean.I = this.d.y();
crashDetailBean.h = this.d.v();
crashDetailBean.i = this.d.J();
crashDetailBean.M = this.d.a;
crashDetailBean.N = this.d.a();
crashDetailBean.P = this.d.H();
crashDetailBean.Q = this.d.I();
crashDetailBean.R = this.d.B();
crashDetailBean.S = this.d.G();
} catch (Throwable th3) {
x.e("handle crash error %s", th3.toString());
}
if (z) {
this.b.c(crashDetailBean);
} else {
boolean z3 = str != null && str.length() > 0;
if (bArr != null && bArr.length > 0) {
z2 = true;
}
if (z3) {
crashDetailBean.O = new HashMap(1);
crashDetailBean.O.put("UserData", str);
}
if (z2) {
crashDetailBean.T = bArr;
}
}
return crashDetailBean;
}
private static boolean a(Thread thread) {
synchronized (i) {
if (h != null && thread.getName().equals(h)) {
return true;
}
h = thread.getName();
return false;
}
}
public final void a(Thread thread, Throwable th, boolean z, String str, byte[] bArr) {
if (z) {
x.e("Java Crash Happen cause by %s(%d)", thread.getName(), Long.valueOf(thread.getId()));
if (a(thread)) {
x.a("this class has handled this exception", new Object[0]);
if (this.f != null) {
x.a("call system handler", new Object[0]);
this.f.uncaughtException(thread, th);
} else {
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
}
}
} else {
x.e("Java Catch Happen", new Object[0]);
}
try {
if (!this.g) {
x.c("Java crash handler is disable. Just return.", new Object[0]);
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.e;
if (uncaughtExceptionHandler != null && a(uncaughtExceptionHandler)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
return;
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
return;
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
return;
}
}
return;
}
if (!this.c.b()) {
x.d("no remote but still store!", new Object[0]);
}
if (!this.c.c().g && this.c.b()) {
x.e("crash report was closed by remote , will not upload to Bugly , print local for helpful!", new Object[0]);
b.a(z ? "JAVA_CRASH" : "JAVA_CATCH", z.a(), this.d.d, thread.getName(), z.a(th), null);
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler2 = this.e;
if (uncaughtExceptionHandler2 != null && a(uncaughtExceptionHandler2)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
return;
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
return;
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
return;
}
}
return;
}
CrashDetailBean b = b(thread, th, z, str, bArr);
if (b == null) {
x.e("pkg crash datas fail!", new Object[0]);
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler3 = this.e;
if (uncaughtExceptionHandler3 != null && a(uncaughtExceptionHandler3)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
return;
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
return;
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
return;
}
}
return;
}
b.a(z ? "JAVA_CRASH" : "JAVA_CATCH", z.a(), this.d.d, thread.getName(), z.a(th), b);
if (!this.b.a(b)) {
this.b.a(b, 3000L, z);
}
if (z) {
this.b.b(b);
}
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler4 = this.e;
if (uncaughtExceptionHandler4 != null && a(uncaughtExceptionHandler4)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
}
}
} catch (Throwable th2) {
try {
if (!x.a(th2)) {
th2.printStackTrace();
}
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler5 = this.e;
if (uncaughtExceptionHandler5 != null && a(uncaughtExceptionHandler5)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
}
}
} catch (Throwable th3) {
if (z) {
Thread.UncaughtExceptionHandler uncaughtExceptionHandler6 = this.e;
if (uncaughtExceptionHandler6 != null && a(uncaughtExceptionHandler6)) {
x.e("sys default last handle start!", new Object[0]);
this.e.uncaughtException(thread, th);
x.e("sys default last handle end!", new Object[0]);
} else if (this.f != null) {
x.e("system handle start!", new Object[0]);
this.f.uncaughtException(thread, th);
x.e("system handle end!", new Object[0]);
} else {
x.e("crashreport last handle start!", new Object[0]);
x.e("current process die", new Object[0]);
Process.killProcess(Process.myPid());
System.exit(1);
x.e("crashreport last handle end!", new Object[0]);
}
}
throw th3;
}
}
}
private static String b(Throwable th, int i2) {
if (th.getMessage() == null) {
return "";
}
if (th.getMessage().length() <= 1000) {
return th.getMessage();
}
return th.getMessage().substring(0, 1000) + "\n[Message over limit size:1000, has been cutted!]";
}
private static boolean a(Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
if (uncaughtExceptionHandler == null) {
return true;
}
String name = uncaughtExceptionHandler.getClass().getName();
for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace()) {
String className = stackTraceElement.getClassName();
String methodName = stackTraceElement.getMethodName();
if (name.equals(className) && "uncaughtException".equals(methodName)) {
return false;
}
}
return true;
}
public final synchronized void a(StrategyBean strategyBean) {
if (strategyBean != null) {
if (strategyBean.g != this.g) {
x.a("java changed to %b", Boolean.valueOf(strategyBean.g));
if (strategyBean.g) {
a();
return;
}
b();
}
}
}
private static String a(Throwable th, int i2) {
if (th == null) {
return null;
}
StringBuilder sb = new StringBuilder();
try {
if (th.getStackTrace() != null) {
for (StackTraceElement stackTraceElement : th.getStackTrace()) {
if (i2 > 0 && sb.length() >= i2) {
sb.append("\n[Stack over limit size :" + i2 + " , has been cutted !]");
return sb.toString();
}
sb.append(stackTraceElement.toString());
sb.append("\n");
}
}
} catch (Throwable th2) {
x.e("gen stack error %s", th2.toString());
}
return sb.toString();
}
}

View File

@@ -0,0 +1,190 @@
package com.tencent.bugly.crashreport.crash.h5;
import android.webkit.JavascriptInterface;
import com.tencent.bugly.crashreport.CrashReport;
import com.tencent.bugly.crashreport.inner.InnerApi;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import org.json.JSONObject;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class H5JavaScriptInterface {
private static HashSet<Integer> a = new HashSet<>();
private String b = null;
private Thread c = null;
private String d = null;
private Map<String, String> e = null;
private H5JavaScriptInterface() {
}
private static a a(String str) {
String string;
if (str != null && str.length() > 0) {
try {
JSONObject jSONObject = new JSONObject(str);
a aVar = new a();
aVar.a = jSONObject.getString("projectRoot");
if (aVar.a == null) {
return null;
}
aVar.b = jSONObject.getString("context");
if (aVar.b == null) {
return null;
}
aVar.c = jSONObject.getString("url");
if (aVar.c == null) {
return null;
}
aVar.d = jSONObject.getString("userAgent");
if (aVar.d == null) {
return null;
}
aVar.e = jSONObject.getString("language");
if (aVar.e == null) {
return null;
}
aVar.f = jSONObject.getString(MediationMetaData.KEY_NAME);
if (aVar.f == null || aVar.f.equals("null") || (string = jSONObject.getString("stacktrace")) == null) {
return null;
}
int indexOf = string.indexOf("\n");
if (indexOf < 0) {
x.d("H5 crash stack's format is wrong!", new Object[0]);
return null;
}
aVar.h = string.substring(indexOf + 1);
aVar.g = string.substring(0, indexOf);
int indexOf2 = aVar.g.indexOf(":");
if (indexOf2 > 0) {
aVar.g = aVar.g.substring(indexOf2 + 1);
}
aVar.i = jSONObject.getString("file");
if (aVar.f == null) {
return null;
}
aVar.j = jSONObject.getLong("lineNumber");
if (aVar.j < 0) {
return null;
}
aVar.k = jSONObject.getLong("columnNumber");
if (aVar.k < 0) {
return null;
}
x.a("H5 crash information is following: ", new Object[0]);
x.a("[projectRoot]: " + aVar.a, new Object[0]);
x.a("[context]: " + aVar.b, new Object[0]);
x.a("[url]: " + aVar.c, new Object[0]);
x.a("[userAgent]: " + aVar.d, new Object[0]);
x.a("[language]: " + aVar.e, new Object[0]);
x.a("[name]: " + aVar.f, new Object[0]);
x.a("[message]: " + aVar.g, new Object[0]);
x.a("[stacktrace]: \n" + aVar.h, new Object[0]);
x.a("[file]: " + aVar.i, new Object[0]);
x.a("[lineNumber]: " + aVar.j, new Object[0]);
x.a("[columnNumber]: " + aVar.k, new Object[0]);
return aVar;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return null;
}
public static H5JavaScriptInterface getInstance(CrashReport.WebViewInterface webViewInterface) {
String str = null;
if (webViewInterface == null || a.contains(Integer.valueOf(webViewInterface.hashCode()))) {
return null;
}
H5JavaScriptInterface h5JavaScriptInterface = new H5JavaScriptInterface();
a.add(Integer.valueOf(webViewInterface.hashCode()));
h5JavaScriptInterface.c = Thread.currentThread();
Thread thread = h5JavaScriptInterface.c;
if (thread != null) {
StringBuilder sb = new StringBuilder();
sb.append("\n");
for (int i = 2; i < thread.getStackTrace().length; i++) {
StackTraceElement stackTraceElement = thread.getStackTrace()[i];
if (!stackTraceElement.toString().contains("crashreport")) {
sb.append(stackTraceElement.toString());
sb.append("\n");
}
}
str = sb.toString();
}
h5JavaScriptInterface.d = str;
HashMap hashMap = new HashMap();
StringBuilder sb2 = new StringBuilder();
sb2.append((Object) webViewInterface.getContentDescription());
hashMap.put("[WebView] ContentDescription", sb2.toString());
h5JavaScriptInterface.e = hashMap;
return h5JavaScriptInterface;
}
@JavascriptInterface
public void printLog(String str) {
x.d("Log from js: %s", str);
}
@JavascriptInterface
public void reportJSException(String str) {
if (str == null) {
x.d("Payload from JS is null.", new Object[0]);
return;
}
String b = z.b(str.getBytes());
String str2 = this.b;
if (str2 != null && str2.equals(b)) {
x.d("Same payload from js. Please check whether you've injected bugly.js more than one times.", new Object[0]);
return;
}
this.b = b;
x.d("Handling JS exception ...", new Object[0]);
a a2 = a(str);
if (a2 == null) {
x.d("Failed to parse payload.", new Object[0]);
return;
}
LinkedHashMap linkedHashMap = new LinkedHashMap();
LinkedHashMap linkedHashMap2 = new LinkedHashMap();
String str3 = a2.a;
if (str3 != null) {
linkedHashMap2.put("[JS] projectRoot", str3);
}
String str4 = a2.b;
if (str4 != null) {
linkedHashMap2.put("[JS] context", str4);
}
String str5 = a2.c;
if (str5 != null) {
linkedHashMap2.put("[JS] url", str5);
}
String str6 = a2.d;
if (str6 != null) {
linkedHashMap2.put("[JS] userAgent", str6);
}
String str7 = a2.i;
if (str7 != null) {
linkedHashMap2.put("[JS] file", str7);
}
long j = a2.j;
if (j != 0) {
linkedHashMap2.put("[JS] lineNumber", Long.toString(j));
}
linkedHashMap.putAll(linkedHashMap2);
linkedHashMap.putAll(this.e);
linkedHashMap.put("Java Stack", this.d);
Thread thread = this.c;
if (a2 != null) {
InnerApi.postH5CrashAsync(thread, a2.f, a2.g, a2.h, linkedHashMap);
}
}
}

View File

@@ -0,0 +1,17 @@
package com.tencent.bugly.crashreport.crash.h5;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
public String a = null;
public String b = null;
public String c = null;
public String d = null;
public String e = null;
public String f = null;
public String g = null;
public String h = null;
public String i = null;
public long j = 0;
public long k = 0;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,458 @@
package com.tencent.bugly.crashreport.crash.jni;
import android.annotation.SuppressLint;
import android.content.Context;
import com.tencent.bugly.Bugly;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.proguard.w;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import java.io.File;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class NativeCrashHandler implements com.tencent.bugly.crashreport.a {
private static NativeCrashHandler a = null;
private static boolean l = false;
private static boolean m = false;
private static boolean o = true;
private final Context b;
private final com.tencent.bugly.crashreport.common.info.a c;
private final w d;
private NativeExceptionHandler e;
private String f;
private final boolean g;
private boolean h = false;
private boolean i = false;
private boolean j = false;
private boolean k = false;
private com.tencent.bugly.crashreport.crash.b n;
@SuppressLint({"SdCardPath"})
private NativeCrashHandler(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, w wVar, boolean z, String str) {
this.b = z.a(context);
try {
if (z.a(str)) {
str = context.getDir("bugly", 0).getAbsolutePath();
}
} catch (Throwable unused) {
str = "/data/data/" + com.tencent.bugly.crashreport.common.info.a.a(context).c + "/app_bugly";
}
this.n = bVar;
this.f = str;
this.c = aVar;
this.d = wVar;
this.g = z;
this.e = new a(context, aVar, bVar, com.tencent.bugly.crashreport.common.strategy.a.a());
}
public static synchronized NativeCrashHandler getInstance(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar2, w wVar, boolean z, String str) {
NativeCrashHandler nativeCrashHandler;
synchronized (NativeCrashHandler.class) {
if (a == null) {
a = new NativeCrashHandler(context, aVar, bVar, wVar, z, str);
}
nativeCrashHandler = a;
}
return nativeCrashHandler;
}
public static boolean isShouldHandleInJava() {
return o;
}
public static void setShouldHandleInJava(boolean z) {
o = z;
NativeCrashHandler nativeCrashHandler = a;
if (nativeCrashHandler != null) {
StringBuilder sb = new StringBuilder();
sb.append(z);
nativeCrashHandler.a(999, sb.toString());
}
}
@Override // com.tencent.bugly.crashreport.a
public boolean appendLogToNative(String str, String str2, String str3) {
if ((this.h || this.i) && l && str != null && str2 != null && str3 != null) {
try {
if (this.i) {
return appendNativeLog(str, str2, str3);
}
Boolean bool = (Boolean) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "appendNativeLog", null, new Class[]{String.class, String.class, String.class}, new Object[]{str, str2, str3});
if (bool != null) {
return bool.booleanValue();
}
return false;
} catch (UnsatisfiedLinkError unused) {
l = false;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
}
}
return false;
}
protected native boolean appendNativeLog(String str, String str2, String str3);
protected native boolean appendWholeNativeLog(String str);
public void checkUploadRecordCrash() {
this.d.a(new Runnable() { // from class: com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler.1
@Override // java.lang.Runnable
public final void run() {
if (!z.a(NativeCrashHandler.this.b, "native_record_lock", 10000L)) {
x.a("[Native] Failed to lock file for handling native crash record.", new Object[0]);
return;
}
if (!NativeCrashHandler.o) {
NativeCrashHandler.a(NativeCrashHandler.this, 999, Bugly.SDK_IS_DEV);
}
CrashDetailBean a2 = b.a(NativeCrashHandler.this.b, NativeCrashHandler.this.f, NativeCrashHandler.this.e);
if (a2 != null) {
x.a("[Native] Get crash from native record.", new Object[0]);
if (!NativeCrashHandler.this.n.a(a2)) {
NativeCrashHandler.this.n.a(a2, 3000L, false);
}
b.a(false, NativeCrashHandler.this.f);
}
NativeCrashHandler.this.a();
z.b(NativeCrashHandler.this.b, "native_record_lock");
}
});
}
public boolean filterSigabrtSysLog() {
return a(998, "true");
}
public synchronized String getDumpFilePath() {
return this.f;
}
@Override // com.tencent.bugly.crashreport.a
public String getLogFromNative() {
if ((!this.h && !this.i) || !l) {
return null;
}
try {
return this.i ? getNativeLog() : (String) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "getNativeLog", null, null, null);
} catch (UnsatisfiedLinkError unused) {
l = false;
return null;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
public NativeExceptionHandler getNativeExceptionHandler() {
return this.e;
}
protected native String getNativeKeyValueList();
protected native String getNativeLog();
public synchronized boolean isUserOpened() {
return this.k;
}
public synchronized void onStrategyChanged(StrategyBean strategyBean) {
if (strategyBean != null) {
if (strategyBean.g != this.j) {
x.d("server native changed to %b", Boolean.valueOf(strategyBean.g));
}
}
boolean z = com.tencent.bugly.crashreport.common.strategy.a.a().c().g && this.k;
if (z != this.j) {
x.a("native changed to %b", Boolean.valueOf(z));
b(z);
}
}
public boolean putKeyValueToNative(String str, String str2) {
if ((this.h || this.i) && l && str != null && str2 != null) {
try {
if (this.i) {
return putNativeKeyValue(str, str2);
}
Boolean bool = (Boolean) z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "putNativeKeyValue", null, new Class[]{String.class, String.class}, new Object[]{str, str2});
if (bool != null) {
return bool.booleanValue();
}
return false;
} catch (UnsatisfiedLinkError unused) {
l = false;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
}
}
return false;
}
protected native boolean putNativeKeyValue(String str, String str2);
protected native String regist(String str, boolean z, int i);
public void removeEmptyNativeRecordFiles() {
b.c(this.f);
}
protected native String removeNativeKeyValue(String str);
public synchronized void setDumpFilePath(String str) {
this.f = str;
}
public boolean setNativeAppChannel(String str) {
return a(12, str);
}
public boolean setNativeAppPackage(String str) {
return a(13, str);
}
public boolean setNativeAppVersion(String str) {
return a(10, str);
}
protected native void setNativeInfo(int i, String str);
@Override // com.tencent.bugly.crashreport.a
public boolean setNativeIsAppForeground(boolean z) {
return a(14, z ? "true" : Bugly.SDK_IS_DEV);
}
public boolean setNativeLaunchTime(long j) {
try {
return a(15, String.valueOf(j));
} catch (NumberFormatException e) {
if (x.a(e)) {
return false;
}
e.printStackTrace();
return false;
}
}
public boolean setNativeUserId(String str) {
return a(11, str);
}
public synchronized void setUserOpened(boolean z) {
c(z);
boolean isUserOpened = isUserOpened();
com.tencent.bugly.crashreport.common.strategy.a a2 = com.tencent.bugly.crashreport.common.strategy.a.a();
if (a2 != null) {
isUserOpened = isUserOpened && a2.c().g;
}
if (isUserOpened != this.j) {
x.a("native changed to %b", Boolean.valueOf(isUserOpened));
b(isUserOpened);
}
}
public synchronized void startNativeMonitor() {
if (!this.i && !this.h) {
String str = "Bugly";
boolean z = !z.a(this.c.m);
String str2 = this.c.m;
if (z) {
str = str2;
} else {
this.c.getClass();
}
this.i = a(str, z);
if (this.i || this.h) {
a(this.g);
if (l) {
setNativeAppVersion(this.c.j);
setNativeAppChannel(this.c.l);
setNativeAppPackage(this.c.c);
setNativeUserId(this.c.g());
setNativeIsAppForeground(this.c.a());
setNativeLaunchTime(this.c.a);
}
return;
}
return;
}
a(this.g);
}
protected native void testCrash();
public void testNativeCrash() {
if (this.i) {
testCrash();
} else {
x.d("[Native] Bugly SO file has not been load.", new Object[0]);
}
}
protected native String unregist();
static /* synthetic */ boolean a(NativeCrashHandler nativeCrashHandler, int i, String str) {
return nativeCrashHandler.a(999, str);
}
private synchronized void c() {
if (!this.j) {
x.d("[Native] Native crash report has already unregistered.", new Object[0]);
return;
}
try {
if (unregist() != null) {
x.a("[Native] Successfully closed native crash report.", new Object[0]);
this.j = false;
return;
}
} catch (Throwable unused) {
x.c("[Native] Failed to close native crash report.", new Object[0]);
}
try {
z.a("com.tencent.feedback.eup.jni.NativeExceptionUpload", "enableHandler", null, new Class[]{Boolean.TYPE}, new Object[]{false});
this.j = false;
x.a("[Native] Successfully closed native crash report.", new Object[0]);
} catch (Throwable unused2) {
x.c("[Native] Failed to close native crash report.", new Object[0]);
this.i = false;
this.h = false;
}
}
/* JADX WARN: Can't wrap try/catch for region: R(15:40|(1:42)(14:65|(1:67)|44|45|(1:47)|48|(1:50)|52|(1:54)(1:63)|55|(1:57)(1:62)|58|59|60)|43|44|45|(0)|48|(0)|52|(0)(0)|55|(0)(0)|58|59|60) */
/* JADX WARN: Removed duplicated region for block: B:47:0x007c A[Catch: all -> 0x008a, TryCatch #1 {all -> 0x008a, blocks: (B:45:0x0072, B:47:0x007c, B:48:0x007e, B:50:0x0088), top: B:44:0x0072 }] */
/* JADX WARN: Removed duplicated region for block: B:50:0x0088 A[Catch: all -> 0x008a, TRY_LEAVE, TryCatch #1 {all -> 0x008a, blocks: (B:45:0x0072, B:47:0x007c, B:48:0x007e, B:50:0x0088), top: B:44:0x0072 }] */
/* JADX WARN: Removed duplicated region for block: B:54:0x008e A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
/* JADX WARN: Removed duplicated region for block: B:57:0x00a1 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
/* JADX WARN: Removed duplicated region for block: B:62:0x00a9 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
/* JADX WARN: Removed duplicated region for block: B:63:0x0096 A[Catch: all -> 0x00bd, TryCatch #3 {all -> 0x00bd, blocks: (B:38:0x0015, B:40:0x001d, B:42:0x004f, B:43:0x0059, B:52:0x008a, B:54:0x008e, B:55:0x009d, B:57:0x00a1, B:58:0x00b0, B:62:0x00a9, B:63:0x0096, B:65:0x0061, B:67:0x0067), top: B:37:0x0015, outer: #2 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private synchronized void a(boolean r11) {
/*
Method dump skipped, instructions count: 415
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.NativeCrashHandler.a(boolean):void");
}
private synchronized void b(boolean z) {
if (z) {
startNativeMonitor();
} else {
c();
}
}
public static synchronized NativeCrashHandler getInstance() {
NativeCrashHandler nativeCrashHandler;
synchronized (NativeCrashHandler.class) {
nativeCrashHandler = a;
}
return nativeCrashHandler;
}
public void testNativeCrash(boolean z, boolean z2, boolean z3) {
StringBuilder sb = new StringBuilder();
sb.append(z);
a(16, sb.toString());
StringBuilder sb2 = new StringBuilder();
sb2.append(z2);
a(17, sb2.toString());
StringBuilder sb3 = new StringBuilder();
sb3.append(z3);
a(18, sb3.toString());
testNativeCrash();
}
private synchronized void c(boolean z) {
if (this.k != z) {
x.a("user change native %b", Boolean.valueOf(z));
this.k = z;
}
}
private static boolean a(String str, boolean z) {
boolean z2;
try {
x.a("[Native] Trying to load so: %s", str);
if (z) {
System.load(str);
} else {
System.loadLibrary(str);
}
try {
x.a("[Native] Successfully loaded SO: %s", str);
return true;
} catch (Throwable th) {
th = th;
z2 = true;
x.d(th.getMessage(), new Object[0]);
x.d("[Native] Failed to load so: %s", str);
return z2;
}
} catch (Throwable th2) {
th = th2;
z2 = false;
}
}
protected final void a() {
long b = z.b() - c.g;
long b2 = z.b() + 86400000;
File file = new File(this.f);
if (file.exists() && file.isDirectory()) {
try {
File[] listFiles = file.listFiles();
if (listFiles != null && listFiles.length != 0) {
int i = 0;
int i2 = 0;
for (File file2 : listFiles) {
long lastModified = file2.lastModified();
if (lastModified < b || lastModified >= b2) {
x.a("[Native] Delete record file: %s", file2.getAbsolutePath());
i++;
if (file2.delete()) {
i2++;
}
}
}
x.c("[Native] Number of record files overdue: %d, has deleted: %d", Integer.valueOf(i), Integer.valueOf(i2));
}
} catch (Throwable th) {
x.a(th);
}
}
}
private boolean a(int i, String str) {
if (this.i && m) {
try {
setNativeInfo(i, str);
return true;
} catch (UnsatisfiedLinkError unused) {
m = false;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
}
}
return false;
}
}

View File

@@ -0,0 +1,14 @@
package com.tencent.bugly.crashreport.crash.jni;
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface NativeExceptionHandler {
void handleNativeException(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7);
void handleNativeException2(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7, String[] strArr);
CrashDetailBean packageCrashDatas(String str, String str2, long j, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, byte[] bArr, Map<String, String> map, boolean z, boolean z2);
}

View File

@@ -0,0 +1,149 @@
package com.tencent.bugly.crashreport.crash.jni;
import android.content.Context;
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
import com.tencent.bugly.crashreport.crash.c;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.y;
import com.tencent.bugly.proguard.z;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a implements NativeExceptionHandler {
private final Context a;
private final com.tencent.bugly.crashreport.crash.b b;
private final com.tencent.bugly.crashreport.common.info.a c;
private final com.tencent.bugly.crashreport.common.strategy.a d;
public a(Context context, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.crash.b bVar, com.tencent.bugly.crashreport.common.strategy.a aVar2) {
this.a = context;
this.b = bVar;
this.c = aVar;
this.d = aVar2;
}
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
public final void handleNativeException(int i, int i2, long j, long j2, String str, String str2, String str3, String str4, int i3, String str5, int i4, int i5, int i6, String str6, String str7) {
x.a("Native Crash Happen v1", new Object[0]);
handleNativeException2(i, i2, j, j2, str, str2, str3, str4, i3, str5, i4, i5, i6, str6, str7, null);
}
/* JADX WARN: Removed duplicated region for block: B:42:0x0122 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:47:0x0152 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:51:0x01b4 A[Catch: all -> 0x029d, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:55:0x01c7 A[Catch: all -> 0x029d, TRY_ENTER, TryCatch #2 {all -> 0x029d, blocks: (B:3:0x0012, B:6:0x001e, B:7:0x006e, B:10:0x0076, B:12:0x0079, B:14:0x007d, B:16:0x0098, B:19:0x00a1, B:18:0x00ab, B:23:0x00b5, B:25:0x00bf, B:27:0x00c7, B:28:0x00d3, B:30:0x00dd, B:33:0x00e4, B:34:0x00f3, B:36:0x00ff, B:39:0x0106, B:40:0x011c, B:42:0x0122, B:45:0x0132, B:47:0x0152, B:49:0x0191, B:51:0x01b4, B:52:0x01bb, B:55:0x01c7, B:57:0x01cf, B:94:0x016d, B:95:0x00ef, B:97:0x00ae, B:100:0x0044, B:101:0x0048, B:103:0x0052), top: B:2:0x0012 }] */
/* JADX WARN: Removed duplicated region for block: B:65:0x022f A[Catch: all -> 0x0299, TryCatch #1 {all -> 0x0299, blocks: (B:63:0x0229, B:65:0x022f, B:67:0x0238), top: B:62:0x0229 }] */
/* JADX WARN: Removed duplicated region for block: B:67:0x0238 A[Catch: all -> 0x0299, TRY_LEAVE, TryCatch #1 {all -> 0x0299, blocks: (B:63:0x0229, B:65:0x022f, B:67:0x0238), top: B:62:0x0229 }] */
/* JADX WARN: Removed duplicated region for block: B:90:0x016a */
/* JADX WARN: Removed duplicated region for block: B:92:0x014e A[SYNTHETIC] */
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public final void handleNativeException2(int r28, int r29, long r30, long r32, java.lang.String r34, java.lang.String r35, java.lang.String r36, java.lang.String r37, int r38, java.lang.String r39, int r40, int r41, int r42, java.lang.String r43, java.lang.String r44, java.lang.String[] r45) {
/*
Method dump skipped, instructions count: 681
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.a.handleNativeException2(int, int, long, long, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, int, int, int, java.lang.String, java.lang.String, java.lang.String[]):void");
}
@Override // com.tencent.bugly.crashreport.crash.jni.NativeExceptionHandler
public final CrashDetailBean packageCrashDatas(String str, String str2, long j, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, byte[] bArr, Map<String, String> map, boolean z, boolean z2) {
int i;
String str12;
int indexOf;
boolean k = c.a().k();
if (k) {
x.e("This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful!", new Object[0]);
}
CrashDetailBean crashDetailBean = new CrashDetailBean();
crashDetailBean.b = 1;
crashDetailBean.e = this.c.h();
com.tencent.bugly.crashreport.common.info.a aVar = this.c;
crashDetailBean.f = aVar.j;
crashDetailBean.g = aVar.w();
crashDetailBean.m = this.c.g();
crashDetailBean.n = str3;
crashDetailBean.o = k ? " This Crash Caused By ANR , PLS To Fix ANR , This Trace May Be Not Useful![Bugly]" : "";
crashDetailBean.p = str4;
crashDetailBean.q = str5 != null ? str5 : "";
crashDetailBean.r = j;
crashDetailBean.u = z.b(crashDetailBean.q.getBytes());
crashDetailBean.A = str;
crashDetailBean.B = str2;
crashDetailBean.I = this.c.y();
crashDetailBean.h = this.c.v();
crashDetailBean.i = this.c.J();
crashDetailBean.v = str8;
NativeCrashHandler nativeCrashHandler = NativeCrashHandler.getInstance();
String dumpFilePath = nativeCrashHandler != null ? nativeCrashHandler.getDumpFilePath() : null;
String a = b.a(dumpFilePath, str8);
if (!z.a(a)) {
crashDetailBean.U = a;
}
crashDetailBean.V = b.b(dumpFilePath);
crashDetailBean.w = b.a(str9, c.e, null, false);
crashDetailBean.x = b.a(str10, c.e, null, true);
crashDetailBean.J = str7;
crashDetailBean.K = str6;
crashDetailBean.L = str11;
crashDetailBean.F = this.c.p();
crashDetailBean.G = this.c.o();
crashDetailBean.H = this.c.q();
if (z) {
crashDetailBean.C = com.tencent.bugly.crashreport.common.info.b.k();
crashDetailBean.D = com.tencent.bugly.crashreport.common.info.b.i();
crashDetailBean.E = com.tencent.bugly.crashreport.common.info.b.m();
if (crashDetailBean.w == null) {
crashDetailBean.w = z.a(this.a, c.e, (String) null);
}
crashDetailBean.y = y.a();
com.tencent.bugly.crashreport.common.info.a aVar2 = this.c;
crashDetailBean.M = aVar2.a;
crashDetailBean.N = aVar2.a();
crashDetailBean.P = this.c.H();
crashDetailBean.Q = this.c.I();
crashDetailBean.R = this.c.B();
crashDetailBean.S = this.c.G();
crashDetailBean.z = z.a(c.f, false);
int indexOf2 = crashDetailBean.q.indexOf("java:\n");
if (indexOf2 > 0 && (i = indexOf2 + 6) < crashDetailBean.q.length()) {
String str13 = crashDetailBean.q;
String substring = str13.substring(i, str13.length() - 1);
if (substring.length() > 0 && crashDetailBean.z.containsKey(crashDetailBean.B) && (indexOf = (str12 = crashDetailBean.z.get(crashDetailBean.B)).indexOf(substring)) > 0) {
String substring2 = str12.substring(indexOf);
crashDetailBean.z.put(crashDetailBean.B, substring2);
crashDetailBean.q = crashDetailBean.q.substring(0, i);
crashDetailBean.q += substring2;
}
}
if (str == null) {
crashDetailBean.A = this.c.d;
}
this.b.c(crashDetailBean);
} else {
crashDetailBean.C = -1L;
crashDetailBean.D = -1L;
crashDetailBean.E = -1L;
if (crashDetailBean.w == null) {
crashDetailBean.w = "this crash is occurred at last process! Log is miss, when get an terrible ABRT Native Exception etc.";
}
crashDetailBean.M = -1L;
crashDetailBean.P = -1;
crashDetailBean.Q = -1;
crashDetailBean.R = map;
crashDetailBean.S = this.c.G();
crashDetailBean.z = null;
if (str == null) {
crashDetailBean.A = "unknown(record)";
}
if (bArr != null) {
crashDetailBean.y = bArr;
}
}
return crashDetailBean;
}
}

View File

@@ -0,0 +1,693 @@
package com.tencent.bugly.crashreport.crash.jni;
import android.content.Context;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.bugly.crashreport.crash.CrashDetailBean;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.diy.model.CategoryModel;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class b {
private static List<File> a = new ArrayList();
protected static String a(String str) {
if (str == null) {
return "";
}
String[] split = str.split("\n");
if (split == null || split.length == 0) {
return str;
}
StringBuilder sb = new StringBuilder();
for (String str2 : split) {
if (!str2.contains("java.lang.Thread.getStackTrace(")) {
sb.append(str2);
sb.append("\n");
}
}
return sb.toString();
}
/* JADX WARN: Code restructure failed: missing block: B:40:0x006d, code lost:
r9.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:42:0x0071, code lost:
r9 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:43:0x0072, code lost:
com.tencent.bugly.proguard.x.a(r9);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private static java.lang.String b(java.lang.String r9, java.lang.String r10) {
/*
java.lang.String r0 = "reg_record.txt"
java.io.BufferedReader r9 = com.tencent.bugly.proguard.z.a(r9, r0)
r0 = 0
if (r9 != 0) goto La
return r0
La:
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L76
r1.<init>() // Catch: java.lang.Throwable -> L76
java.lang.String r2 = r9.readLine() // Catch: java.lang.Throwable -> L76
if (r2 == 0) goto L6b
boolean r10 = r2.startsWith(r10) // Catch: java.lang.Throwable -> L76
if (r10 != 0) goto L1c
goto L6b
L1c:
java.lang.String r10 = " "
r2 = 18
r3 = 0
r2 = 0
r4 = 18
r5 = 0
L25:
java.lang.String r6 = r9.readLine() // Catch: java.lang.Throwable -> L76
java.lang.String r7 = "\n"
if (r6 == 0) goto L59
int r8 = r2 % 4
if (r8 != 0) goto L3c
if (r2 <= 0) goto L36
r1.append(r7) // Catch: java.lang.Throwable -> L76
L36:
java.lang.String r5 = " "
r1.append(r5) // Catch: java.lang.Throwable -> L76
goto L4f
L3c:
int r7 = r6.length() // Catch: java.lang.Throwable -> L76
r8 = 16
if (r7 <= r8) goto L46
r4 = 28
L46:
int r5 = r4 - r5
java.lang.String r5 = r10.substring(r3, r5) // Catch: java.lang.Throwable -> L76
r1.append(r5) // Catch: java.lang.Throwable -> L76
L4f:
int r5 = r6.length() // Catch: java.lang.Throwable -> L76
r1.append(r6) // Catch: java.lang.Throwable -> L76
int r2 = r2 + 1
goto L25
L59:
r1.append(r7) // Catch: java.lang.Throwable -> L76
java.lang.String r10 = r1.toString() // Catch: java.lang.Throwable -> L76
if (r9 == 0) goto L6a
r9.close() // Catch: java.lang.Exception -> L66
goto L6a
L66:
r9 = move-exception
com.tencent.bugly.proguard.x.a(r9)
L6a:
return r10
L6b:
if (r9 == 0) goto L75
r9.close() // Catch: java.lang.Exception -> L71
goto L75
L71:
r9 = move-exception
com.tencent.bugly.proguard.x.a(r9)
L75:
return r0
L76:
r10 = move-exception
com.tencent.bugly.proguard.x.a(r10) // Catch: java.lang.Throwable -> L85
if (r9 == 0) goto L84
r9.close() // Catch: java.lang.Exception -> L80
goto L84
L80:
r9 = move-exception
com.tencent.bugly.proguard.x.a(r9)
L84:
return r0
L85:
r10 = move-exception
if (r9 == 0) goto L90
r9.close() // Catch: java.lang.Exception -> L8c
goto L90
L8c:
r9 = move-exception
com.tencent.bugly.proguard.x.a(r9)
L90:
throw r10
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.b.b(java.lang.String, java.lang.String):java.lang.String");
}
/* JADX WARN: Code restructure failed: missing block: B:27:0x0041, code lost:
r3.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x0045, code lost:
r3 = move-exception;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x0046, code lost:
com.tencent.bugly.proguard.x.a(r3);
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private static java.lang.String c(java.lang.String r3, java.lang.String r4) {
/*
java.lang.String r0 = "map_record.txt"
java.io.BufferedReader r3 = com.tencent.bugly.proguard.z.a(r3, r0)
r0 = 0
if (r3 != 0) goto La
return r0
La:
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L4a
r1.<init>() // Catch: java.lang.Throwable -> L4a
java.lang.String r2 = r3.readLine() // Catch: java.lang.Throwable -> L4a
if (r2 == 0) goto L3f
boolean r4 = r2.startsWith(r4) // Catch: java.lang.Throwable -> L4a
if (r4 != 0) goto L1c
goto L3f
L1c:
java.lang.String r4 = r3.readLine() // Catch: java.lang.Throwable -> L4a
if (r4 == 0) goto L30
java.lang.String r2 = " "
r1.append(r2) // Catch: java.lang.Throwable -> L4a
r1.append(r4) // Catch: java.lang.Throwable -> L4a
java.lang.String r4 = "\n"
r1.append(r4) // Catch: java.lang.Throwable -> L4a
goto L1c
L30:
java.lang.String r4 = r1.toString() // Catch: java.lang.Throwable -> L4a
if (r3 == 0) goto L3e
r3.close() // Catch: java.lang.Exception -> L3a
goto L3e
L3a:
r3 = move-exception
com.tencent.bugly.proguard.x.a(r3)
L3e:
return r4
L3f:
if (r3 == 0) goto L49
r3.close() // Catch: java.lang.Exception -> L45
goto L49
L45:
r3 = move-exception
com.tencent.bugly.proguard.x.a(r3)
L49:
return r0
L4a:
r4 = move-exception
com.tencent.bugly.proguard.x.a(r4) // Catch: java.lang.Throwable -> L59
if (r3 == 0) goto L58
r3.close() // Catch: java.lang.Exception -> L54
goto L58
L54:
r3 = move-exception
com.tencent.bugly.proguard.x.a(r3)
L58:
return r0
L59:
r4 = move-exception
if (r3 == 0) goto L64
r3.close() // Catch: java.lang.Exception -> L60
goto L64
L60:
r3 = move-exception
com.tencent.bugly.proguard.x.a(r3)
L64:
throw r4
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.crashreport.crash.jni.b.c(java.lang.String, java.lang.String):java.lang.String");
}
private static Map<String, Integer> d(String str) {
if (str == null) {
return null;
}
try {
HashMap hashMap = new HashMap();
for (String str2 : str.split(",")) {
String[] split = str2.split(":");
if (split.length != 2) {
x.e("error format at %s", str2);
return null;
}
hashMap.put(split[0], Integer.valueOf(Integer.parseInt(split[1])));
}
return hashMap;
} catch (Exception e) {
x.e("error format intStateStr %s", str);
e.printStackTrace();
return null;
}
}
private static CrashDetailBean a(Context context, Map<String, String> map, NativeExceptionHandler nativeExceptionHandler) {
String str;
String str2;
HashMap hashMap;
if (map == null) {
return null;
}
if (com.tencent.bugly.crashreport.common.info.a.a(context) == null) {
x.e("abnormal com info not created", new Object[0]);
return null;
}
String str3 = map.get("intStateStr");
if (str3 != null && str3.trim().length() > 0) {
Map<String, Integer> d = d(str3);
if (d == null) {
x.e("parse intSateMap fail", Integer.valueOf(map.size()));
return null;
}
try {
d.get("sino").intValue();
d.get("sud").intValue();
String str4 = map.get("soVersion");
if (str4 == null) {
x.e("error format at version", new Object[0]);
return null;
}
String str5 = map.get("errorAddr");
String str6 = CategoryModel.unknown;
String str7 = str5 == null ? CategoryModel.unknown : str5;
String str8 = map.get("codeMsg");
if (str8 == null) {
str8 = CategoryModel.unknown;
}
String str9 = map.get("tombPath");
String str10 = str9 == null ? CategoryModel.unknown : str9;
String str11 = map.get("signalName");
if (str11 == null) {
str11 = CategoryModel.unknown;
}
map.get("errnoMsg");
String str12 = map.get("stack");
if (str12 == null) {
str12 = CategoryModel.unknown;
}
String str13 = map.get("jstack");
if (str13 != null) {
str12 = str12 + "java:\n" + str13;
}
Integer num = d.get("sico");
if (num == null || num.intValue() <= 0) {
str = str8;
str2 = str11;
} else {
str2 = str11 + "(" + str8 + ")";
str = "KERNEL";
}
String str14 = map.get("nativeLog");
byte[] a2 = (str14 == null || str14.isEmpty()) ? null : z.a((File) null, str14, "BuglyNativeLog.txt");
String str15 = map.get("sendingProcess");
if (str15 == null) {
str15 = CategoryModel.unknown;
}
Integer num2 = d.get("spd");
if (num2 != null) {
str15 = str15 + "(" + num2 + ")";
}
String str16 = str15;
String str17 = map.get("threadName");
if (str17 == null) {
str17 = CategoryModel.unknown;
}
Integer num3 = d.get("et");
if (num3 != null) {
str17 = str17 + "(" + num3 + ")";
}
String str18 = str17;
String str19 = map.get("processName");
if (str19 != null) {
str6 = str19;
}
Integer num4 = d.get("ep");
if (num4 != null) {
str6 = str6 + "(" + num4 + ")";
}
String str20 = str6;
String str21 = map.get("key-value");
if (str21 != null) {
HashMap hashMap2 = new HashMap();
String[] split = str21.split("\n");
int length = split.length;
int i = 0;
while (i < length) {
String[] split2 = split[i].split("=");
String[] strArr = split;
if (split2.length == 2) {
hashMap2.put(split2[0], split2[1]);
}
i++;
split = strArr;
}
hashMap = hashMap2;
} else {
hashMap = null;
}
CrashDetailBean packageCrashDatas = nativeExceptionHandler.packageCrashDatas(str20, str18, (d.get("etms").intValue() / 1000) + (d.get("ets").intValue() * 1000), str2, str7, a(str12), str, str16, str10, map.get("sysLogPath"), map.get("jniLogPath"), str4, a2, hashMap, false, false);
if (packageCrashDatas != null) {
String str22 = map.get("userId");
if (str22 != null) {
x.c("[Native record info] userId: %s", str22);
packageCrashDatas.m = str22;
}
String str23 = map.get("sysLog");
if (str23 != null) {
packageCrashDatas.w = str23;
}
String str24 = map.get("appVersion");
if (str24 != null) {
x.c("[Native record info] appVersion: %s", str24);
packageCrashDatas.f = str24;
}
String str25 = map.get("isAppForeground");
if (str25 != null) {
x.c("[Native record info] isAppForeground: %s", str25);
packageCrashDatas.N = str25.equalsIgnoreCase("true");
}
String str26 = map.get("launchTime");
if (str26 != null) {
x.c("[Native record info] launchTime: %s", str26);
try {
packageCrashDatas.M = Long.parseLong(str26);
} catch (NumberFormatException e) {
if (!x.a(e)) {
e.printStackTrace();
}
}
}
packageCrashDatas.z = null;
packageCrashDatas.k = true;
}
return packageCrashDatas;
} catch (Throwable th) {
x.e("error format", new Object[0]);
th.printStackTrace();
return null;
}
}
x.e("no intStateStr", new Object[0]);
return null;
}
public static void c(String str) {
File[] listFiles;
if (str == null) {
return;
}
try {
File file = new File(str);
if (file.canRead() && file.isDirectory() && (listFiles = file.listFiles()) != null) {
for (File file2 : listFiles) {
if (file2.canRead() && file2.canWrite() && file2.length() == 0) {
file2.delete();
x.c("Delete empty record file %s", file2.getAbsoluteFile());
}
}
}
} catch (Throwable th) {
x.a(th);
}
}
public static String b(String str) {
if (str == null) {
return null;
}
File file = new File(str, "backup_record.txt");
if (file.exists()) {
return file.getAbsolutePath();
}
return null;
}
private static String a(BufferedInputStream bufferedInputStream) throws IOException {
ByteArrayOutputStream byteArrayOutputStream;
if (bufferedInputStream == null) {
return null;
}
try {
byteArrayOutputStream = new ByteArrayOutputStream(DataDecryptTool.DECRYPT_SP_FILE);
while (true) {
try {
int read = bufferedInputStream.read();
if (read == -1) {
byteArrayOutputStream.close();
break;
}
if (read == 0) {
String str = new String(byteArrayOutputStream.toByteArray(), "UTf-8");
byteArrayOutputStream.close();
return str;
}
byteArrayOutputStream.write(read);
} catch (Throwable th) {
th = th;
try {
x.a(th);
return null;
} finally {
if (byteArrayOutputStream != null) {
byteArrayOutputStream.close();
}
}
}
}
} catch (Throwable th2) {
th = th2;
byteArrayOutputStream = null;
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r7v3, types: [boolean] */
/* JADX WARN: Type inference failed for: r7v6 */
public static CrashDetailBean a(Context context, String str, NativeExceptionHandler nativeExceptionHandler) {
BufferedInputStream bufferedInputStream;
String str2;
String a2;
if (context != null && str != null && nativeExceptionHandler != null) {
File file = new File(str, "rqd_record.eup");
if (file.exists()) {
BufferedInputStream canRead = file.canRead();
try {
if (canRead != 0) {
try {
bufferedInputStream = new BufferedInputStream(new FileInputStream(file));
} catch (IOException e) {
e = e;
bufferedInputStream = null;
} catch (Throwable th) {
th = th;
canRead = 0;
if (canRead != 0) {
try {
canRead.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
throw th;
}
try {
String a3 = a(bufferedInputStream);
if (a3 != null && a3.equals("NATIVE_RQD_REPORT")) {
HashMap hashMap = new HashMap();
loop0: while (true) {
str2 = null;
while (true) {
a2 = a(bufferedInputStream);
if (a2 == null) {
break loop0;
}
if (str2 == null) {
str2 = a2;
}
}
hashMap.put(str2, a2);
}
if (str2 != null) {
x.e("record not pair! drop! %s", str2);
try {
bufferedInputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
return null;
}
CrashDetailBean a4 = a(context, hashMap, nativeExceptionHandler);
try {
bufferedInputStream.close();
} catch (IOException e4) {
e4.printStackTrace();
}
return a4;
}
x.e("record read fail! %s", a3);
try {
bufferedInputStream.close();
} catch (IOException e5) {
e5.printStackTrace();
}
return null;
} catch (IOException e6) {
e = e6;
e.printStackTrace();
if (bufferedInputStream != null) {
try {
bufferedInputStream.close();
} catch (IOException e7) {
e7.printStackTrace();
}
}
return null;
}
}
} catch (Throwable th2) {
th = th2;
}
}
return null;
}
x.e("get eup record file args error", new Object[0]);
return null;
}
public static String a(String str, String str2) {
if (str == null || str2 == null) {
return null;
}
StringBuilder sb = new StringBuilder();
String b = b(str, str2);
if (b != null && !b.isEmpty()) {
sb.append("Register infos:\n");
sb.append(b);
}
String c = c(str, str2);
if (c != null && !c.isEmpty()) {
if (sb.length() > 0) {
sb.append("\n");
}
sb.append("System SO infos:\n");
sb.append(c);
}
return sb.toString();
}
public static void a(boolean z, String str) {
if (str != null) {
a.add(new File(str, "rqd_record.eup"));
a.add(new File(str, "reg_record.txt"));
a.add(new File(str, "map_record.txt"));
a.add(new File(str, "backup_record.txt"));
if (z) {
c(str);
}
}
List<File> list = a;
if (list == null || list.size() <= 0) {
return;
}
for (File file : a) {
if (file.exists() && file.canWrite()) {
file.delete();
x.c("Delete record file %s", file.getAbsoluteFile());
}
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r6v1, types: [java.lang.StringBuilder] */
/* JADX WARN: Type inference failed for: r6v10 */
/* JADX WARN: Type inference failed for: r6v11 */
/* JADX WARN: Type inference failed for: r6v6, types: [java.lang.String] */
public static String a(String str, int i, String str2, boolean z) {
BufferedReader bufferedReader;
if (str != null && i > 0) {
File file = new File(str);
if (file.exists() && file.canRead()) {
x.a("Read system log from native record file(length: %s bytes): %s", Long.valueOf(file.length()), file.getAbsolutePath());
a.add(file);
x.c("Add this record file to list for cleaning lastly.", new Object[0]);
if (str2 == null) {
return z.a(new File(str), i, z);
}
String sb = new StringBuilder();
try {
try {
bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), "utf-8"));
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (Pattern.compile(str2 + "[ ]*:").matcher(readLine).find()) {
sb.append(readLine);
sb.append("\n");
}
if (i > 0 && sb.length() > i) {
if (z) {
sb.delete(i, sb.length());
break;
}
sb.delete(0, sb.length() - i);
}
} catch (Throwable th) {
th = th;
try {
x.a(th);
sb.append("\n[error:" + th.toString() + "]");
String sb2 = sb.toString();
if (bufferedReader == null) {
return sb2;
}
bufferedReader.close();
sb = sb2;
return sb;
} catch (Throwable th2) {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception e) {
x.a(e);
}
}
throw th2;
}
}
}
String sb3 = sb.toString();
bufferedReader.close();
sb = sb3;
} catch (Throwable th3) {
th = th3;
bufferedReader = null;
}
return sb;
} catch (Exception e2) {
x.a(e2);
return sb;
}
}
}
return null;
}
}

View File

@@ -0,0 +1,37 @@
package com.tencent.bugly.crashreport.inner;
import com.tencent.bugly.crashreport.crash.d;
import com.tencent.bugly.proguard.x;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class InnerApi {
public static void postCocos2dxCrashAsync(int i, String str, String str2, String str3) {
if (str == null || str2 == null || str3 == null) {
x.e("post cocos2d-x fail args null", new Object[0]);
} else if (i != 5 && i != 6) {
x.e("post cocos2d-x fail category illeagle: %d", Integer.valueOf(i));
} else {
x.a("post cocos2d-x crash %s %s", str, str2);
d.a(Thread.currentThread(), i, str, str2, str3, null);
}
}
public static void postH5CrashAsync(Thread thread, String str, String str2, String str3, Map<String, String> map) {
if (str == null || str2 == null || str3 == null) {
x.e("post h5 fail args null", new Object[0]);
} else {
x.a("post h5 crash %s %s", str, str2);
d.a(thread, 8, str, str2, str3, map);
}
}
public static void postU3dCrashAsync(String str, String str2, String str3) {
if (str == null || str2 == null || str3 == null) {
x.e("post u3d fail args null", new Object[0]);
}
x.a("post u3d crash %s %s", str, str2);
d.a(Thread.currentThread(), 4, str, str2, str3, null);
}
}

View File

@@ -0,0 +1,15 @@
package com.tencent.bugly.nativecrashreport;
/* loaded from: classes.dex */
public final class R {
public static final class string {
public static final int app_name = 0x7f110069;
private string() {
}
}
private R() {
}
}

View File

@@ -0,0 +1,532 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import android.text.TextUtils;
import com.tencent.bugly.crashreport.biz.UserInfoBean;
import com.tencent.bugly.crashreport.common.strategy.StrategyBean;
import java.lang.reflect.Array;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class a {
private static Proxy e;
protected HashMap<String, HashMap<String, byte[]>> a = new HashMap<>();
protected String b;
i c;
private HashMap<String, Object> d;
a() {
new HashMap();
this.d = new HashMap<>();
this.b = "GBK";
this.c = new i();
}
public static aj a(int i) {
if (i == 1) {
return new ai();
}
if (i == 3) {
return new ah();
}
return null;
}
public static Proxy b() {
return e;
}
public static void a(String str, int i) {
if (TextUtils.isEmpty(str)) {
e = null;
} else {
e = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(str, i));
}
}
public static void a(InetAddress inetAddress, int i) {
if (inetAddress == null) {
e = null;
} else {
e = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(inetAddress, i));
}
}
public void a(String str) {
this.b = str;
}
public static at a(UserInfoBean userInfoBean) {
if (userInfoBean == null) {
return null;
}
at atVar = new at();
atVar.a = userInfoBean.e;
atVar.e = userInfoBean.j;
atVar.d = userInfoBean.c;
atVar.c = userInfoBean.d;
atVar.g = com.tencent.bugly.crashreport.common.info.a.b().i();
atVar.h = userInfoBean.o == 1;
int i = userInfoBean.b;
if (i == 1) {
atVar.b = (byte) 1;
} else if (i == 2) {
atVar.b = (byte) 4;
} else if (i == 3) {
atVar.b = (byte) 2;
} else if (i != 4) {
if (i < 10 || i >= 20) {
x.e("unknown uinfo type %d ", Integer.valueOf(userInfoBean.b));
return null;
}
atVar.b = (byte) i;
} else {
atVar.b = (byte) 3;
}
atVar.f = new HashMap();
if (userInfoBean.p >= 0) {
Map<String, String> map = atVar.f;
StringBuilder sb = new StringBuilder();
sb.append(userInfoBean.p);
map.put("C01", sb.toString());
}
if (userInfoBean.q >= 0) {
Map<String, String> map2 = atVar.f;
StringBuilder sb2 = new StringBuilder();
sb2.append(userInfoBean.q);
map2.put("C02", sb2.toString());
}
Map<String, String> map3 = userInfoBean.r;
if (map3 != null && map3.size() > 0) {
for (Map.Entry<String, String> entry : userInfoBean.r.entrySet()) {
atVar.f.put("C03_" + entry.getKey(), entry.getValue());
}
}
Map<String, String> map4 = userInfoBean.s;
if (map4 != null && map4.size() > 0) {
for (Map.Entry<String, String> entry2 : userInfoBean.s.entrySet()) {
atVar.f.put("C04_" + entry2.getKey(), entry2.getValue());
}
}
Map<String, String> map5 = atVar.f;
StringBuilder sb3 = new StringBuilder();
sb3.append(!userInfoBean.l);
map5.put("A36", sb3.toString());
Map<String, String> map6 = atVar.f;
StringBuilder sb4 = new StringBuilder();
sb4.append(userInfoBean.g);
map6.put("F02", sb4.toString());
Map<String, String> map7 = atVar.f;
StringBuilder sb5 = new StringBuilder();
sb5.append(userInfoBean.h);
map7.put("F03", sb5.toString());
atVar.f.put("F04", userInfoBean.j);
Map<String, String> map8 = atVar.f;
StringBuilder sb6 = new StringBuilder();
sb6.append(userInfoBean.i);
map8.put("F05", sb6.toString());
atVar.f.put("F06", userInfoBean.m);
Map<String, String> map9 = atVar.f;
StringBuilder sb7 = new StringBuilder();
sb7.append(userInfoBean.k);
map9.put("F10", sb7.toString());
x.c("summary type %d vm:%d", Byte.valueOf(atVar.b), Integer.valueOf(atVar.f.size()));
return atVar;
}
public static String a(ArrayList<String> arrayList) {
StringBuffer stringBuffer = new StringBuffer();
int i = 0;
while (true) {
String str = "map";
if (i < arrayList.size()) {
String str2 = arrayList.get(i);
if (str2.equals("java.lang.Integer") || str2.equals("int")) {
str = "int32";
} else if (str2.equals("java.lang.Boolean") || str2.equals("boolean")) {
str = "bool";
} else if (str2.equals("java.lang.Byte") || str2.equals("byte")) {
str = "char";
} else if (str2.equals("java.lang.Double") || str2.equals("double")) {
str = "double";
} else if (str2.equals("java.lang.Float") || str2.equals("float")) {
str = "float";
} else if (str2.equals("java.lang.Long") || str2.equals("long")) {
str = "int64";
} else if (str2.equals("java.lang.Short") || str2.equals("short")) {
str = "short";
} else {
if (str2.equals("java.lang.Character")) {
throw new IllegalArgumentException("can not support java.lang.Character");
}
if (str2.equals("java.lang.String")) {
str = "string";
} else if (str2.equals("java.util.List")) {
str = "list";
} else if (!str2.equals("java.util.Map")) {
str = str2;
}
}
arrayList.set(i, str);
i++;
} else {
Collections.reverse(arrayList);
for (int i2 = 0; i2 < arrayList.size(); i2++) {
String str3 = arrayList.get(i2);
if (str3.equals("list")) {
int i3 = i2 - 1;
arrayList.set(i3, "<" + arrayList.get(i3));
arrayList.set(0, arrayList.get(0) + ">");
} else if (str3.equals("map")) {
int i4 = i2 - 1;
arrayList.set(i4, "<" + arrayList.get(i4) + ",");
arrayList.set(0, arrayList.get(0) + ">");
} else if (str3.equals("Array")) {
int i5 = i2 - 1;
arrayList.set(i5, "<" + arrayList.get(i5));
arrayList.set(0, arrayList.get(0) + ">");
}
}
Collections.reverse(arrayList);
Iterator<String> it = arrayList.iterator();
while (it.hasNext()) {
stringBuffer.append(it.next());
}
return stringBuffer.toString();
}
}
}
public <T> void a(String str, T t) {
if (str == null) {
throw new IllegalArgumentException("put key can not is null");
}
if (t != null) {
if (!(t instanceof Set)) {
j jVar = new j();
jVar.a(this.b);
jVar.a(t, 0);
byte[] a = l.a(jVar.a());
HashMap<String, byte[]> hashMap = new HashMap<>(1);
ArrayList<String> arrayList = new ArrayList<>(1);
a(arrayList, t);
hashMap.put(a(arrayList), a);
this.d.remove(str);
this.a.put(str, hashMap);
return;
}
throw new IllegalArgumentException("can not support Set");
}
throw new IllegalArgumentException("put value can not is null");
}
public static au a(List<UserInfoBean> list, int i) {
com.tencent.bugly.crashreport.common.info.a b;
if (list == null || list.size() == 0 || (b = com.tencent.bugly.crashreport.common.info.a.b()) == null) {
return null;
}
b.t();
au auVar = new au();
auVar.b = b.d;
auVar.c = b.h();
ArrayList<at> arrayList = new ArrayList<>();
Iterator<UserInfoBean> it = list.iterator();
while (it.hasNext()) {
at a = a(it.next());
if (a != null) {
arrayList.add(a);
}
}
auVar.d = arrayList;
auVar.e = new HashMap();
auVar.e.put("A7", b.f);
auVar.e.put("A6", b.s());
auVar.e.put("A5", b.r());
Map<String, String> map = auVar.e;
StringBuilder sb = new StringBuilder();
sb.append(b.p());
map.put("A2", sb.toString());
Map<String, String> map2 = auVar.e;
StringBuilder sb2 = new StringBuilder();
sb2.append(b.p());
map2.put("A1", sb2.toString());
auVar.e.put("A24", b.h);
Map<String, String> map3 = auVar.e;
StringBuilder sb3 = new StringBuilder();
sb3.append(b.q());
map3.put("A17", sb3.toString());
auVar.e.put("A15", b.w());
Map<String, String> map4 = auVar.e;
StringBuilder sb4 = new StringBuilder();
sb4.append(b.x());
map4.put("A13", sb4.toString());
auVar.e.put("F08", b.v);
auVar.e.put("F09", b.w);
Map<String, String> G = b.G();
if (G != null && G.size() > 0) {
for (Map.Entry<String, String> entry : G.entrySet()) {
auVar.e.put("C04_" + entry.getKey(), entry.getValue());
}
}
if (i != 1) {
if (i != 2) {
x.e("unknown up type %d ", Integer.valueOf(i));
return null;
}
auVar.a = (byte) 2;
} else {
auVar.a = (byte) 1;
}
return auVar;
}
public static <T extends k> T a(byte[] bArr, Class<T> cls) {
if (bArr != null && bArr.length > 0) {
try {
T newInstance = cls.newInstance();
i iVar = new i(bArr);
iVar.a("utf-8");
newInstance.a(iVar);
return newInstance;
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
}
}
return null;
}
public static ap a(Context context, int i, byte[] bArr) {
com.tencent.bugly.crashreport.common.info.a b = com.tencent.bugly.crashreport.common.info.a.b();
StrategyBean c = com.tencent.bugly.crashreport.common.strategy.a.a().c();
if (b != null && c != null) {
try {
ap apVar = new ap();
synchronized (b) {
apVar.a = 1;
apVar.b = b.f();
apVar.c = b.c;
apVar.d = b.j;
apVar.e = b.l;
b.getClass();
apVar.f = "3.1.0";
apVar.g = i;
apVar.h = bArr == null ? "".getBytes() : bArr;
apVar.i = b.g;
apVar.j = b.h;
apVar.k = new HashMap();
apVar.l = b.e();
apVar.m = c.p;
apVar.o = b.h();
apVar.p = com.tencent.bugly.crashreport.common.info.b.c(context);
apVar.q = System.currentTimeMillis();
apVar.r = b.k();
apVar.s = b.j();
apVar.t = b.m();
apVar.u = b.l();
apVar.v = b.n();
apVar.w = apVar.p;
b.getClass();
apVar.n = "com.tencent.bugly";
apVar.k.put("A26", b.y());
apVar.k.put("A60", b.z());
apVar.k.put("A61", b.A());
Map<String, String> map = apVar.k;
StringBuilder sb = new StringBuilder();
sb.append(b.R());
map.put("A62", sb.toString());
Map<String, String> map2 = apVar.k;
StringBuilder sb2 = new StringBuilder();
sb2.append(b.S());
map2.put("A63", sb2.toString());
Map<String, String> map3 = apVar.k;
StringBuilder sb3 = new StringBuilder();
sb3.append(b.z);
map3.put("F11", sb3.toString());
Map<String, String> map4 = apVar.k;
StringBuilder sb4 = new StringBuilder();
sb4.append(b.y);
map4.put("F12", sb4.toString());
apVar.k.put("G1", b.u());
apVar.k.put("A64", b.T());
if (b.B) {
apVar.k.put("G2", b.L());
apVar.k.put("G3", b.M());
apVar.k.put("G4", b.N());
apVar.k.put("G5", b.O());
apVar.k.put("G6", b.P());
apVar.k.put("G7", Long.toString(b.Q()));
}
apVar.k.put("D3", b.k);
if (com.tencent.bugly.b.b != null) {
for (com.tencent.bugly.a aVar : com.tencent.bugly.b.b) {
if (aVar.versionKey != null && aVar.version != null) {
apVar.k.put(aVar.versionKey, aVar.version);
}
}
}
apVar.k.put("G15", z.b("G15", ""));
apVar.k.put("D4", z.b("D4", "0"));
}
u a = u.a();
if (a != null && !a.a && bArr != null) {
apVar.h = z.a(apVar.h, 2, 1, c.u);
if (apVar.h == null) {
x.e("reqPkg sbuffer error!", new Object[0]);
return null;
}
}
Map<String, String> F = b.F();
if (F != null) {
for (Map.Entry<String, String> entry : F.entrySet()) {
apVar.k.put(entry.getKey(), entry.getValue());
}
}
return apVar;
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
return null;
}
}
x.e("Can not create request pkg for parameters is invalid.", new Object[0]);
return null;
}
private void a(ArrayList<String> arrayList, Object obj) {
if (obj.getClass().isArray()) {
if (obj.getClass().getComponentType().toString().equals("byte")) {
if (Array.getLength(obj) > 0) {
arrayList.add("java.util.List");
a(arrayList, Array.get(obj, 0));
return;
} else {
arrayList.add("Array");
arrayList.add("?");
return;
}
}
throw new IllegalArgumentException("only byte[] is supported");
}
if (!(obj instanceof Array)) {
if (obj instanceof List) {
arrayList.add("java.util.List");
List list = (List) obj;
if (list.size() > 0) {
a(arrayList, list.get(0));
return;
} else {
arrayList.add("?");
return;
}
}
if (obj instanceof Map) {
arrayList.add("java.util.Map");
Map map = (Map) obj;
if (map.size() > 0) {
Object next = map.keySet().iterator().next();
Object obj2 = map.get(next);
arrayList.add(next.getClass().getName());
a(arrayList, obj2);
return;
}
arrayList.add("?");
arrayList.add("?");
return;
}
arrayList.add(obj.getClass().getName());
return;
}
throw new IllegalArgumentException("can not support Array, please use List");
}
public byte[] a() {
j jVar = new j(0);
jVar.a(this.b);
jVar.a((Map) this.a, 0);
return l.a(jVar.a());
}
public void a(byte[] bArr) {
this.c.a(bArr);
this.c.a(this.b);
HashMap hashMap = new HashMap(1);
HashMap hashMap2 = new HashMap(1);
hashMap2.put("", new byte[0]);
hashMap.put("", hashMap2);
this.a = this.c.a((Map) hashMap, 0, false);
}
public static byte[] a(Object obj) {
try {
d dVar = new d();
dVar.c();
dVar.a("utf-8");
dVar.b(1);
dVar.b("RqdServer");
dVar.c("sync");
dVar.a("detail", (String) obj);
return dVar.a();
} catch (Throwable th) {
if (x.b(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
public static aq a(byte[] bArr, boolean z) {
if (bArr != null) {
try {
d dVar = new d();
dVar.c();
dVar.a("utf-8");
dVar.a(bArr);
Object b = dVar.b("detail", new aq());
aq aqVar = aq.class.isInstance(b) ? (aq) aq.class.cast(b) : null;
if (!z && aqVar != null && aqVar.c != null && aqVar.c.length > 0) {
x.c("resp buf %d", Integer.valueOf(aqVar.c.length));
aqVar.c = z.b(aqVar.c, 2, 1, StrategyBean.d);
if (aqVar.c == null) {
x.e("resp sbuffer error!", new Object[0]);
return null;
}
}
return aqVar;
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
}
}
return null;
}
public static byte[] a(k kVar) {
try {
j jVar = new j();
jVar.a("utf-8");
kVar.a(jVar);
return jVar.b();
} catch (Throwable th) {
if (x.b(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
}

View File

@@ -0,0 +1,63 @@
package com.tencent.bugly.proguard;
import android.os.Handler;
import android.os.SystemClock;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class aa implements Runnable {
private final Handler a;
private final String b;
private long c;
private final long d;
private boolean e = true;
private long f;
aa(Handler handler, String str, long j) {
this.a = handler;
this.b = str;
this.c = j;
this.d = j;
}
public final void a() {
if (this.e) {
this.e = false;
this.f = SystemClock.uptimeMillis();
this.a.postAtFrontOfQueue(this);
}
}
public final boolean b() {
return !this.e && SystemClock.uptimeMillis() > this.f + this.c;
}
public final int c() {
if (this.e) {
return 0;
}
return SystemClock.uptimeMillis() - this.f < this.c ? 1 : 3;
}
public final Thread d() {
return this.a.getLooper().getThread();
}
public final String e() {
return this.b;
}
public final void f() {
this.c = this.d;
}
@Override // java.lang.Runnable
public final void run() {
this.e = true;
this.c = this.d;
}
public final void a(long j) {
this.c = Long.MAX_VALUE;
}
}

View File

@@ -0,0 +1,139 @@
package com.tencent.bugly.proguard;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ab extends Thread {
private boolean a = false;
private List<aa> b = Collections.synchronizedList(new ArrayList());
private List<ac> c = Collections.synchronizedList(new ArrayList());
public final void a() {
a(new Handler(Looper.getMainLooper()), 5000L);
}
public final void b() {
a(new Handler(Looper.getMainLooper()));
}
public final boolean c() {
this.a = true;
if (!isAlive()) {
return false;
}
try {
interrupt();
} catch (Exception e) {
x.e(e.getStackTrace().toString(), new Object[0]);
}
return true;
}
public final boolean d() {
if (isAlive()) {
return false;
}
try {
start();
return true;
} catch (Exception e) {
x.e(e.getStackTrace().toString(), new Object[0]);
return false;
}
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
while (!this.a) {
for (int i = 0; i < this.b.size(); i++) {
this.b.get(i).a();
}
long uptimeMillis = SystemClock.uptimeMillis();
for (long j = 2000; j > 0 && !isInterrupted(); j = 2000 - (SystemClock.uptimeMillis() - uptimeMillis)) {
try {
Thread.sleep(j);
} catch (Exception e) {
e.printStackTrace();
}
}
int i2 = 0;
for (int i3 = 0; i3 < this.b.size(); i3++) {
i2 = Math.max(i2, this.b.get(i3).c());
}
if (i2 != 0 && i2 != 1) {
ArrayList arrayList = new ArrayList();
for (int i4 = 0; i4 < this.b.size(); i4++) {
aa aaVar = this.b.get(i4);
if (aaVar.b()) {
arrayList.add(aaVar);
aaVar.a(Long.MAX_VALUE);
}
}
int i5 = 0;
boolean z = false;
while (i5 < arrayList.size()) {
aa aaVar2 = (aa) arrayList.get(i5);
Thread d = aaVar2.d();
boolean z2 = z;
for (int i6 = 0; i6 < this.c.size(); i6++) {
if (this.c.get(i6).a(d)) {
z2 = true;
}
}
if (!z2 && aaVar2.e().contains("main")) {
aaVar2.f();
x.d("although thread is blocked ,may not be anr error,so restore handler check wait time and restart check main thread", new Object[0]);
}
i5++;
z = z2;
}
}
}
}
private void a(Handler handler, long j) {
if (handler == null) {
x.e("addThread handler should not be null", new Object[0]);
return;
}
String name = handler.getLooper().getThread().getName();
for (int i = 0; i < this.b.size(); i++) {
if (this.b.get(i).e().equals(handler.getLooper().getThread().getName())) {
x.e("addThread fail ,this thread has been added in monitor queue", new Object[0]);
return;
}
}
this.b.add(new aa(handler, name, 5000L));
}
public final void b(ac acVar) {
this.c.remove(acVar);
}
private void a(Handler handler) {
if (handler == null) {
x.e("removeThread handler should not be null", new Object[0]);
return;
}
for (int i = 0; i < this.b.size(); i++) {
if (this.b.get(i).e().equals(handler.getLooper().getThread().getName())) {
x.c("remove handler::%s", this.b.get(i));
this.b.remove(i);
}
}
}
public final void a(ac acVar) {
if (this.c.contains(acVar)) {
x.e("addThreadMonitorListeners fail ,this threadMonitorListener has been added in monitor queue", new Object[0]);
} else {
this.c.add(acVar);
}
}
}

View File

@@ -0,0 +1,7 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface ac {
boolean a(Thread thread);
}

View File

@@ -0,0 +1,15 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ad {
public static ae a(int i) {
if (i == 1) {
return new ag();
}
if (i == 2) {
return new af();
}
return null;
}
}

View File

@@ -0,0 +1,9 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface ae {
byte[] a(byte[] bArr) throws Exception;
byte[] b(byte[] bArr) throws Exception;
}

View File

@@ -0,0 +1,43 @@
package com.tencent.bugly.proguard;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class af implements ae {
@Override // com.tencent.bugly.proguard.ae
public final byte[] a(byte[] bArr) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
gZIPOutputStream.write(bArr);
gZIPOutputStream.finish();
gZIPOutputStream.close();
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
return byteArray;
}
@Override // com.tencent.bugly.proguard.ae
public final byte[] b(byte[] bArr) throws Exception {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
GZIPInputStream gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
byte[] bArr2 = new byte[DataDecryptTool.DECRYPT_SP_FILE];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
int read = gZIPInputStream.read(bArr2, 0, bArr2.length);
if (read == -1) {
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.flush();
byteArrayOutputStream.close();
gZIPInputStream.close();
byteArrayInputStream.close();
return byteArray;
}
byteArrayOutputStream.write(bArr2, 0, read);
}
}
}

View File

@@ -0,0 +1,50 @@
package com.tencent.bugly.proguard;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ag implements ae {
@Override // com.tencent.bugly.proguard.ae
public final byte[] a(byte[] bArr) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ZipOutputStream zipOutputStream = new ZipOutputStream(byteArrayOutputStream);
ZipEntry zipEntry = new ZipEntry("zip");
zipEntry.setSize(bArr.length);
zipOutputStream.putNextEntry(zipEntry);
zipOutputStream.write(bArr);
zipOutputStream.closeEntry();
zipOutputStream.close();
byte[] byteArray = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.close();
return byteArray;
}
@Override // com.tencent.bugly.proguard.ae
public final byte[] b(byte[] bArr) throws Exception {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
ZipInputStream zipInputStream = new ZipInputStream(byteArrayInputStream);
byte[] bArr2 = null;
while (zipInputStream.getNextEntry() != null) {
byte[] bArr3 = new byte[DataDecryptTool.DECRYPT_SP_FILE];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
int read = zipInputStream.read(bArr3, 0, bArr3.length);
if (read != -1) {
byteArrayOutputStream.write(bArr3, 0, read);
}
}
bArr2 = byteArrayOutputStream.toByteArray();
byteArrayOutputStream.flush();
byteArrayOutputStream.close();
}
zipInputStream.close();
byteArrayInputStream.close();
return bArr2;
}
}

View File

@@ -0,0 +1,62 @@
package com.tencent.bugly.proguard;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ah implements aj {
private String a = null;
@Override // com.tencent.bugly.proguard.aj
public final byte[] a(byte[] bArr) throws Exception {
if (this.a == null || bArr == null) {
return null;
}
StringBuffer stringBuffer = new StringBuffer();
for (byte b : bArr) {
stringBuffer.append(((int) b) + " ");
}
SecretKeySpec secretKeySpec = new SecretKeySpec(this.a.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(2, secretKeySpec, new IvParameterSpec(this.a.getBytes()));
byte[] doFinal = cipher.doFinal(bArr);
StringBuffer stringBuffer2 = new StringBuffer();
for (byte b2 : doFinal) {
stringBuffer2.append(((int) b2) + " ");
}
return doFinal;
}
@Override // com.tencent.bugly.proguard.aj
public final byte[] b(byte[] bArr) throws Exception, NoSuchAlgorithmException {
if (this.a == null || bArr == null) {
return null;
}
StringBuffer stringBuffer = new StringBuffer();
for (byte b : bArr) {
stringBuffer.append(((int) b) + " ");
}
SecretKeySpec secretKeySpec = new SecretKeySpec(this.a.getBytes(), "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(1, secretKeySpec, new IvParameterSpec(this.a.getBytes()));
byte[] doFinal = cipher.doFinal(bArr);
StringBuffer stringBuffer2 = new StringBuffer();
for (byte b2 : doFinal) {
stringBuffer2.append(((int) b2) + " ");
}
return doFinal;
}
@Override // com.tencent.bugly.proguard.aj
public final void a(String str) {
if (str != null) {
for (int length = str.length(); length < 16; length++) {
str = str + "0";
}
this.a = str.substring(0, 16);
}
}
}

View File

@@ -0,0 +1,40 @@
package com.tencent.bugly.proguard;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Cipher;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ai implements aj {
private String a = null;
@Override // com.tencent.bugly.proguard.aj
public final byte[] a(byte[] bArr) throws Exception {
if (this.a == null || bArr == null) {
return null;
}
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(2, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(this.a.getBytes("UTF-8"))), new IvParameterSpec(this.a.getBytes("UTF-8")));
return cipher.doFinal(bArr);
}
@Override // com.tencent.bugly.proguard.aj
public final byte[] b(byte[] bArr) throws Exception, NoSuchAlgorithmException {
if (this.a == null || bArr == null) {
return null;
}
Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(1, SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(this.a.getBytes("UTF-8"))), new IvParameterSpec(this.a.getBytes("UTF-8")));
return cipher.doFinal(bArr);
}
@Override // com.tencent.bugly.proguard.aj
public final void a(String str) {
if (str != null) {
this.a = str;
}
}
}

View File

@@ -0,0 +1,13 @@
package com.tencent.bugly.proguard;
import java.security.NoSuchAlgorithmException;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface aj {
void a(String str);
byte[] a(byte[] bArr) throws Exception;
byte[] b(byte[] bArr) throws Exception, NoSuchAlgorithmException;
}

View File

@@ -0,0 +1,45 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ak extends k implements Cloneable {
public String a = "";
public String b = "";
public String c = "";
private String e = "";
public String d = "";
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
String str = this.b;
if (str != null) {
jVar.a(str, 1);
}
String str2 = this.c;
if (str2 != null) {
jVar.a(str2, 2);
}
String str3 = this.e;
if (str3 != null) {
jVar.a(str3, 3);
}
String str4 = this.d;
if (str4 != null) {
jVar.a(str4, 4);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.b(0, true);
this.b = iVar.b(1, false);
this.c = iVar.b(2, false);
this.e = iVar.b(3, false);
this.d = iVar.b(4, false);
}
}

View File

@@ -0,0 +1,35 @@
package com.tencent.bugly.proguard;
import java.util.ArrayList;
import java.util.Collection;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class al extends k implements Cloneable {
private static ArrayList<String> c;
private String a = "";
private ArrayList<String> b = null;
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
ArrayList<String> arrayList = this.b;
if (arrayList != null) {
jVar.a((Collection) arrayList, 1);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.b(0, true);
if (c == null) {
c = new ArrayList<>();
c.add("");
}
this.b = (ArrayList) iVar.a((i) c, 1, false);
}
}

View File

@@ -0,0 +1,49 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class am extends k implements Cloneable {
private static byte[] d;
private byte a;
private String b;
private byte[] c;
public am() {
this.a = (byte) 0;
this.b = "";
this.c = null;
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
byte[] bArr = this.c;
if (bArr != null) {
jVar.a(bArr, 2);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
public am(byte b, String str, byte[] bArr) {
this.a = (byte) 0;
this.b = "";
this.c = null;
this.a = b;
this.b = str;
this.c = bArr;
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(this.a, 0, true);
this.b = iVar.b(1, true);
if (d == null) {
d = new byte[]{0};
}
this.c = iVar.c(2, false);
}
}

View File

@@ -0,0 +1,154 @@
package com.tencent.bugly.proguard;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class an extends k {
private static ArrayList<am> A;
private static Map<String, String> B;
private static Map<String, String> C;
private static Map<String, String> v = new HashMap();
private static al w;
private static ak x;
private static ArrayList<ak> y;
private static ArrayList<ak> z;
public String a = "";
public long b = 0;
public String c = "";
public String d = "";
public String e = "";
public String f = "";
public String g = "";
public Map<String, String> h = null;
public String i = "";
public al j = null;
public int k = 0;
public String l = "";
public String m = "";
public ak n = null;
public ArrayList<ak> o = null;
public ArrayList<ak> p = null;
public ArrayList<am> q = null;
public Map<String, String> r = null;
public Map<String, String> s = null;
public String t = "";
private boolean u = true;
static {
v.put("", "");
w = new al();
x = new ak();
y = new ArrayList<>();
y.add(new ak());
z = new ArrayList<>();
z.add(new ak());
A = new ArrayList<>();
A.add(new am());
B = new HashMap();
B.put("", "");
C = new HashMap();
C.put("", "");
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
jVar.a(this.c, 2);
String str = this.d;
if (str != null) {
jVar.a(str, 3);
}
String str2 = this.e;
if (str2 != null) {
jVar.a(str2, 4);
}
String str3 = this.f;
if (str3 != null) {
jVar.a(str3, 5);
}
String str4 = this.g;
if (str4 != null) {
jVar.a(str4, 6);
}
Map<String, String> map = this.h;
if (map != null) {
jVar.a((Map) map, 7);
}
String str5 = this.i;
if (str5 != null) {
jVar.a(str5, 8);
}
al alVar = this.j;
if (alVar != null) {
jVar.a((k) alVar, 9);
}
jVar.a(this.k, 10);
String str6 = this.l;
if (str6 != null) {
jVar.a(str6, 11);
}
String str7 = this.m;
if (str7 != null) {
jVar.a(str7, 12);
}
ak akVar = this.n;
if (akVar != null) {
jVar.a((k) akVar, 13);
}
ArrayList<ak> arrayList = this.o;
if (arrayList != null) {
jVar.a((Collection) arrayList, 14);
}
ArrayList<ak> arrayList2 = this.p;
if (arrayList2 != null) {
jVar.a((Collection) arrayList2, 15);
}
ArrayList<am> arrayList3 = this.q;
if (arrayList3 != null) {
jVar.a((Collection) arrayList3, 16);
}
Map<String, String> map2 = this.r;
if (map2 != null) {
jVar.a((Map) map2, 17);
}
Map<String, String> map3 = this.s;
if (map3 != null) {
jVar.a((Map) map3, 18);
}
String str8 = this.t;
if (str8 != null) {
jVar.a(str8, 19);
}
jVar.a(this.u, 20);
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.b(0, true);
this.b = iVar.a(this.b, 1, true);
this.c = iVar.b(2, true);
this.d = iVar.b(3, false);
this.e = iVar.b(4, false);
this.f = iVar.b(5, false);
this.g = iVar.b(6, false);
this.h = (Map) iVar.a((i) v, 7, false);
this.i = iVar.b(8, false);
this.j = (al) iVar.a((k) w, 9, false);
this.k = iVar.a(this.k, 10, false);
this.l = iVar.b(11, false);
this.m = iVar.b(12, false);
this.n = (ak) iVar.a((k) x, 13, false);
this.o = (ArrayList) iVar.a((i) y, 14, false);
this.p = (ArrayList) iVar.a((i) z, 15, false);
this.q = (ArrayList) iVar.a((i) A, 16, false);
this.r = (Map) iVar.a((i) B, 17, false);
this.s = (Map) iVar.a((i) C, 18, false);
this.t = iVar.b(19, false);
this.u = iVar.a(20, false);
}
}

View File

@@ -0,0 +1,29 @@
package com.tencent.bugly.proguard;
import java.util.ArrayList;
import java.util.Collection;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ao extends k implements Cloneable {
private static ArrayList<an> b;
public ArrayList<an> a = null;
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a((Collection) this.a, 0);
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
if (b == null) {
b = new ArrayList<>();
b.add(new an());
}
this.a = (ArrayList) iVar.a((i) b, 0, true);
}
}

View File

@@ -0,0 +1,140 @@
package com.tencent.bugly.proguard;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ap extends k {
private static byte[] y = {0};
private static Map<String, String> z = new HashMap();
public int a = 0;
public String b = "";
public String c = "";
public String d = "";
public String e = "";
public String f = "";
public int g = 0;
public byte[] h = null;
public String i = "";
public String j = "";
public Map<String, String> k = null;
public String l = "";
public long m = 0;
public String n = "";
public String o = "";
public String p = "";
public long q = 0;
public String r = "";
public String s = "";
public String t = "";
public String u = "";
public String v = "";
public String w = "";
private String x = "";
static {
z.put("", "");
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
jVar.a(this.c, 2);
jVar.a(this.d, 3);
String str = this.e;
if (str != null) {
jVar.a(str, 4);
}
jVar.a(this.f, 5);
jVar.a(this.g, 6);
jVar.a(this.h, 7);
String str2 = this.i;
if (str2 != null) {
jVar.a(str2, 8);
}
String str3 = this.j;
if (str3 != null) {
jVar.a(str3, 9);
}
Map<String, String> map = this.k;
if (map != null) {
jVar.a((Map) map, 10);
}
String str4 = this.l;
if (str4 != null) {
jVar.a(str4, 11);
}
jVar.a(this.m, 12);
String str5 = this.n;
if (str5 != null) {
jVar.a(str5, 13);
}
String str6 = this.o;
if (str6 != null) {
jVar.a(str6, 14);
}
String str7 = this.p;
if (str7 != null) {
jVar.a(str7, 15);
}
jVar.a(this.q, 16);
String str8 = this.r;
if (str8 != null) {
jVar.a(str8, 17);
}
String str9 = this.s;
if (str9 != null) {
jVar.a(str9, 18);
}
String str10 = this.t;
if (str10 != null) {
jVar.a(str10, 19);
}
String str11 = this.u;
if (str11 != null) {
jVar.a(str11, 20);
}
String str12 = this.v;
if (str12 != null) {
jVar.a(str12, 21);
}
String str13 = this.w;
if (str13 != null) {
jVar.a(str13, 22);
}
String str14 = this.x;
if (str14 != null) {
jVar.a(str14, 23);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(this.a, 0, true);
this.b = iVar.b(1, true);
this.c = iVar.b(2, true);
this.d = iVar.b(3, true);
this.e = iVar.b(4, false);
this.f = iVar.b(5, true);
this.g = iVar.a(this.g, 6, true);
this.h = iVar.c(7, true);
this.i = iVar.b(8, false);
this.j = iVar.b(9, false);
this.k = (Map) iVar.a((i) z, 10, false);
this.l = iVar.b(11, false);
this.m = iVar.a(this.m, 12, false);
this.n = iVar.b(13, false);
this.o = iVar.b(14, false);
this.p = iVar.b(15, false);
this.q = iVar.a(this.q, 16, false);
this.r = iVar.b(17, false);
this.s = iVar.b(18, false);
this.t = iVar.b(19, false);
this.u = iVar.b(20, false);
this.v = iVar.b(21, false);
this.w = iVar.b(22, false);
this.x = iVar.b(23, false);
}
}

View File

@@ -0,0 +1,62 @@
package com.tencent.bugly.proguard;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class aq extends k {
private static byte[] i = {0};
private static Map<String, String> j = new HashMap();
public byte a = 0;
public int b = 0;
public byte[] c = null;
public String d = "";
public long e = 0;
private String h = "";
public String f = "";
public Map<String, String> g = null;
static {
j.put("", "");
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
byte[] bArr = this.c;
if (bArr != null) {
jVar.a(bArr, 2);
}
String str = this.d;
if (str != null) {
jVar.a(str, 3);
}
jVar.a(this.e, 4);
String str2 = this.h;
if (str2 != null) {
jVar.a(str2, 5);
}
String str3 = this.f;
if (str3 != null) {
jVar.a(str3, 6);
}
Map<String, String> map = this.g;
if (map != null) {
jVar.a((Map) map, 7);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(this.a, 0, true);
this.b = iVar.a(this.b, 1, true);
this.c = iVar.c(2, false);
this.d = iVar.b(3, false);
this.e = iVar.a(this.e, 4, false);
this.h = iVar.b(5, false);
this.f = iVar.b(6, false);
this.g = (Map) iVar.a((i) j, 7, false);
}
}

View File

@@ -0,0 +1,24 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class ar extends k implements Cloneable {
public String a = "";
private String b = "";
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.b(0, true);
this.b = iVar.b(1, true);
}
}

View File

@@ -0,0 +1,123 @@
package com.tencent.bugly.proguard;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class as extends k implements Cloneable {
private static /* synthetic */ boolean o = !as.class.desiredAssertionStatus();
private static ar m = new ar();
private static Map<String, String> n = new HashMap();
public boolean a = true;
public boolean b = true;
public boolean c = true;
public String d = "";
public String e = "";
public ar f = null;
public Map<String, String> g = null;
public long h = 0;
private String j = "";
private String k = "";
private int l = 0;
public int i = 0;
static {
n.put("", "");
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
jVar.a(this.c, 2);
String str = this.d;
if (str != null) {
jVar.a(str, 3);
}
String str2 = this.e;
if (str2 != null) {
jVar.a(str2, 4);
}
ar arVar = this.f;
if (arVar != null) {
jVar.a((k) arVar, 5);
}
Map<String, String> map = this.g;
if (map != null) {
jVar.a((Map) map, 6);
}
jVar.a(this.h, 7);
String str3 = this.j;
if (str3 != null) {
jVar.a(str3, 8);
}
String str4 = this.k;
if (str4 != null) {
jVar.a(str4, 9);
}
jVar.a(this.l, 10);
jVar.a(this.i, 11);
}
public final Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException unused) {
if (o) {
return null;
}
throw new AssertionError();
}
}
public final boolean equals(Object obj) {
if (obj == null) {
return false;
}
as asVar = (as) obj;
return l.a(this.a, asVar.a) && l.a(this.b, asVar.b) && l.a(this.c, asVar.c) && l.a(this.d, asVar.d) && l.a(this.e, asVar.e) && l.a(this.f, asVar.f) && l.a(this.g, asVar.g) && l.a(this.h, asVar.h) && l.a(this.j, asVar.j) && l.a(this.k, asVar.k) && l.a(this.l, asVar.l) && l.a(this.i, asVar.i);
}
public final int hashCode() {
try {
throw new Exception("Need define key first!");
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(0, true);
this.b = iVar.a(1, true);
this.c = iVar.a(2, true);
this.d = iVar.b(3, false);
this.e = iVar.b(4, false);
this.f = (ar) iVar.a((k) m, 5, false);
this.g = (Map) iVar.a((i) n, 6, false);
this.h = iVar.a(this.h, 7, false);
this.j = iVar.b(8, false);
this.k = iVar.b(9, false);
this.l = iVar.a(this.l, 10, false);
this.i = iVar.a(this.i, 11, false);
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
h hVar = new h(sb, i);
hVar.a(this.a, "enable");
hVar.a(this.b, "enableUserInfo");
hVar.a(this.c, "enableQuery");
hVar.a(this.d, "url");
hVar.a(this.e, "expUrl");
hVar.a((k) this.f, "security");
hVar.a((Map) this.g, "valueMap");
hVar.a(this.h, "strategylastUpdateTime");
hVar.a(this.j, "httpsUrl");
hVar.a(this.k, "httpsExpUrl");
hVar.a(this.l, "eventRecordCount");
hVar.a(this.i, "eventTimeInterval");
}
}

View File

@@ -0,0 +1,61 @@
package com.tencent.bugly.proguard;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class at extends k {
private static Map<String, String> i = new HashMap();
public long a = 0;
public byte b = 0;
public String c = "";
public String d = "";
public String e = "";
public Map<String, String> f = null;
public String g = "";
public boolean h = true;
static {
i.put("", "");
}
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
jVar.a(this.b, 1);
String str = this.c;
if (str != null) {
jVar.a(str, 2);
}
String str2 = this.d;
if (str2 != null) {
jVar.a(str2, 3);
}
String str3 = this.e;
if (str3 != null) {
jVar.a(str3, 4);
}
Map<String, String> map = this.f;
if (map != null) {
jVar.a((Map) map, 5);
}
String str4 = this.g;
if (str4 != null) {
jVar.a(str4, 6);
}
jVar.a(this.h, 7);
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(this.a, 0, true);
this.b = iVar.a(this.b, 1, true);
this.c = iVar.b(2, false);
this.d = iVar.b(3, false);
this.e = iVar.b(4, false);
this.f = (Map) iVar.a((i) i, 5, false);
this.g = iVar.b(6, false);
this.h = iVar.a(7, false);
}
}

View File

@@ -0,0 +1,60 @@
package com.tencent.bugly.proguard;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class au extends k implements Cloneable {
private static ArrayList<at> f;
private static Map<String, String> g;
public byte a = 0;
public String b = "";
public String c = "";
public ArrayList<at> d = null;
public Map<String, String> e = null;
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 0);
String str = this.b;
if (str != null) {
jVar.a(str, 1);
}
String str2 = this.c;
if (str2 != null) {
jVar.a(str2, 2);
}
ArrayList<at> arrayList = this.d;
if (arrayList != null) {
jVar.a((Collection) arrayList, 3);
}
Map<String, String> map = this.e;
if (map != null) {
jVar.a((Map) map, 4);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
this.a = iVar.a(this.a, 0, true);
this.b = iVar.b(1, false);
this.c = iVar.b(2, false);
if (f == null) {
f = new ArrayList<>();
f.add(new at());
}
this.d = (ArrayList) iVar.a((i) f, 3, false);
if (g == null) {
g = new HashMap();
g.put("", "");
}
this.e = (Map) iVar.a((i) g, 4, false);
}
}

View File

@@ -0,0 +1,13 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class b extends RuntimeException {
public b(String str) {
super(str);
}
public b(Exception exc) {
super(exc);
}
}

View File

@@ -0,0 +1,113 @@
package com.tencent.bugly.proguard;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class c extends a {
protected HashMap<String, byte[]> d = null;
private HashMap<String, Object> e = new HashMap<>();
private i f = new i();
@Override // com.tencent.bugly.proguard.a
public final /* bridge */ /* synthetic */ void a(String str) {
super.a(str);
}
public final <T> T b(String str, T t) throws b {
HashMap<String, byte[]> hashMap = this.d;
if (hashMap != null) {
if (!hashMap.containsKey(str)) {
return null;
}
if (this.e.containsKey(str)) {
return (T) this.e.get(str);
}
try {
this.f.a(this.d.get(str));
this.f.a(this.b);
T t2 = (T) this.f.a((i) t, 0, true);
if (t2 != null) {
this.e.put(str, t2);
}
return t2;
} catch (Exception e) {
throw new b(e);
}
}
if (!this.a.containsKey(str)) {
return null;
}
if (this.e.containsKey(str)) {
return (T) this.e.get(str);
}
byte[] bArr = new byte[0];
Iterator<Map.Entry<String, byte[]>> it = this.a.get(str).entrySet().iterator();
if (it.hasNext()) {
Map.Entry<String, byte[]> next = it.next();
next.getKey();
bArr = next.getValue();
}
try {
this.f.a(bArr);
this.f.a(this.b);
T t3 = (T) this.f.a((i) t, 0, true);
this.e.put(str, t3);
return t3;
} catch (Exception e2) {
throw new b(e2);
}
}
public void c() {
this.d = new HashMap<>();
}
@Override // com.tencent.bugly.proguard.a
public <T> void a(String str, T t) {
if (this.d == null) {
super.a(str, (String) t);
return;
}
if (str == null) {
throw new IllegalArgumentException("put key can not is null");
}
if (t == null) {
throw new IllegalArgumentException("put value can not is null");
}
if (t instanceof Set) {
throw new IllegalArgumentException("can not support Set");
}
j jVar = new j();
jVar.a(this.b);
jVar.a(t, 0);
this.d.put(str, l.a(jVar.a()));
}
@Override // com.tencent.bugly.proguard.a
public byte[] a() {
if (this.d != null) {
j jVar = new j(0);
jVar.a(this.b);
jVar.a((Map) this.d, 0);
return l.a(jVar.a());
}
return super.a();
}
@Override // com.tencent.bugly.proguard.a
public void a(byte[] bArr) {
try {
super.a(bArr);
} catch (Exception unused) {
this.f.a(bArr);
this.f.a(this.b);
HashMap hashMap = new HashMap(1);
hashMap.put("", new byte[0]);
this.d = this.f.a((Map) hashMap, 0, false);
}
}
}

View File

@@ -0,0 +1,118 @@
package com.tencent.bugly.proguard;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class d extends c {
private static HashMap<String, byte[]> f;
private static HashMap<String, HashMap<String, byte[]>> g;
private f e = new f();
public d() {
this.e.a = (short) 2;
}
@Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a
public final <T> void a(String str, T t) {
if (!str.startsWith(".")) {
super.a(str, (String) t);
} else {
throw new IllegalArgumentException("put name can not startwith . , now is " + str);
}
}
public final void b(String str) {
this.e.c = str;
}
@Override // com.tencent.bugly.proguard.c
public final void c() {
super.c();
this.e.a = (short) 3;
}
public final void b(int i) {
this.e.b = 1;
}
public final void c(String str) {
this.e.d = str;
}
@Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a
public final byte[] a() {
f fVar = this.e;
if (fVar.a == 2) {
if (!fVar.c.equals("")) {
if (this.e.d.equals("")) {
throw new IllegalArgumentException("funcName can not is null");
}
} else {
throw new IllegalArgumentException("servantName can not is null");
}
} else {
if (fVar.c == null) {
fVar.c = "";
}
f fVar2 = this.e;
if (fVar2.d == null) {
fVar2.d = "";
}
}
j jVar = new j(0);
jVar.a(this.b);
if (this.e.a == 2) {
jVar.a((Map) this.a, 0);
} else {
jVar.a((Map) ((c) this).d, 0);
}
this.e.e = l.a(jVar.a());
j jVar2 = new j(0);
jVar2.a(this.b);
this.e.a(jVar2);
byte[] a = l.a(jVar2.a());
int length = a.length + 4;
ByteBuffer allocate = ByteBuffer.allocate(length);
allocate.putInt(length).put(a).flip();
return allocate.array();
}
@Override // com.tencent.bugly.proguard.c, com.tencent.bugly.proguard.a
public final void a(byte[] bArr) {
if (bArr.length >= 4) {
try {
i iVar = new i(bArr, 4);
iVar.a(this.b);
this.e.a(iVar);
if (this.e.a == 3) {
i iVar2 = new i(this.e.e);
iVar2.a(this.b);
if (f == null) {
HashMap<String, byte[]> hashMap = new HashMap<>();
f = hashMap;
hashMap.put("", new byte[0]);
}
((c) this).d = iVar2.a((Map) f, 0, false);
return;
}
i iVar3 = new i(this.e.e);
iVar3.a(this.b);
if (g == null) {
g = new HashMap<>();
HashMap<String, byte[]> hashMap2 = new HashMap<>();
hashMap2.put("", new byte[0]);
g.put("", hashMap2);
}
this.a = iVar3.a((Map) g, 0, false);
new HashMap();
return;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
throw new IllegalArgumentException("decode package must include size head");
}
}

View File

@@ -0,0 +1,22 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class e {
private static final char[] a = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
public static String a(byte[] bArr) {
if (bArr == null || bArr.length == 0) {
return null;
}
char[] cArr = new char[bArr.length * 2];
for (int i = 0; i < bArr.length; i++) {
byte b = bArr[i];
int i2 = i * 2;
char[] cArr2 = a;
cArr[i2 + 1] = cArr2[b & 15];
cArr[i2] = cArr2[((byte) (b >>> 4)) & 15];
}
return new String(cArr);
}
}

View File

@@ -0,0 +1,101 @@
package com.tencent.bugly.proguard;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import java.util.HashMap;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class f extends k {
public byte[] e;
private Map<String, String> i;
private Map<String, String> j;
private static /* synthetic */ boolean m = !f.class.desiredAssertionStatus();
private static byte[] k = null;
private static Map<String, String> l = null;
public short a = 0;
private byte f = 0;
private int g = 0;
public int b = 0;
public String c = null;
public String d = null;
private int h = 0;
@Override // com.tencent.bugly.proguard.k
public final void a(j jVar) {
jVar.a(this.a, 1);
jVar.a(this.f, 2);
jVar.a(this.g, 3);
jVar.a(this.b, 4);
jVar.a(this.c, 5);
jVar.a(this.d, 6);
jVar.a(this.e, 7);
jVar.a(this.h, 8);
jVar.a((Map) this.i, 9);
jVar.a((Map) this.j, 10);
}
public final Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException unused) {
if (m) {
return null;
}
throw new AssertionError();
}
}
public final boolean equals(Object obj) {
f fVar = (f) obj;
return l.a(1, (int) fVar.a) && l.a(1, (int) fVar.f) && l.a(1, fVar.g) && l.a(1, fVar.b) && l.a((Object) 1, (Object) fVar.c) && l.a((Object) 1, (Object) fVar.d) && l.a((Object) 1, (Object) fVar.e) && l.a(1, fVar.h) && l.a((Object) 1, (Object) fVar.i) && l.a((Object) 1, (Object) fVar.j);
}
@Override // com.tencent.bugly.proguard.k
public final void a(i iVar) {
try {
this.a = iVar.a(this.a, 1, true);
this.f = iVar.a(this.f, 2, true);
this.g = iVar.a(this.g, 3, true);
this.b = iVar.a(this.b, 4, true);
this.c = iVar.b(5, true);
this.d = iVar.b(6, true);
if (k == null) {
k = new byte[]{0};
}
this.e = iVar.c(7, true);
this.h = iVar.a(this.h, 8, true);
if (l == null) {
HashMap hashMap = new HashMap();
l = hashMap;
hashMap.put("", "");
}
this.i = (Map) iVar.a((i) l, 9, true);
if (l == null) {
HashMap hashMap2 = new HashMap();
l = hashMap2;
hashMap2.put("", "");
}
this.j = (Map) iVar.a((i) l, 10, true);
} catch (Exception e) {
e.printStackTrace();
System.out.println("RequestPacket decode error " + e.a(this.e));
throw new RuntimeException(e);
}
}
@Override // com.tencent.bugly.proguard.k
public final void a(StringBuilder sb, int i) {
h hVar = new h(sb, i);
hVar.a(this.a, "iVersion");
hVar.a(this.f, "cPacketType");
hVar.a(this.g, "iMessageType");
hVar.a(this.b, "iRequestId");
hVar.a(this.c, "sServantName");
hVar.a(this.d, "sFuncName");
hVar.a(this.e, "sBuffer");
hVar.a(this.h, "iTimeout");
hVar.a((Map) this.i, "context");
hVar.a((Map) this.j, FileDownloadModel.STATUS);
}
}

View File

@@ -0,0 +1,9 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class g extends RuntimeException {
public g(String str) {
super(str);
}
}

View File

@@ -0,0 +1,405 @@
package com.tencent.bugly.proguard;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class h {
private StringBuilder a;
private int b;
public h(StringBuilder sb, int i) {
this.b = 0;
this.a = sb;
this.b = i;
}
private void a(String str) {
for (int i = 0; i < this.b; i++) {
this.a.append('\t');
}
if (str != null) {
StringBuilder sb = this.a;
sb.append(str);
sb.append(": ");
}
}
public final h a(boolean z, String str) {
a(str);
StringBuilder sb = this.a;
sb.append(z ? 'T' : 'F');
sb.append('\n');
return this;
}
public final h a(byte b, String str) {
a(str);
StringBuilder sb = this.a;
sb.append((int) b);
sb.append('\n');
return this;
}
public final h a(short s, String str) {
a(str);
StringBuilder sb = this.a;
sb.append((int) s);
sb.append('\n');
return this;
}
public final h a(int i, String str) {
a(str);
StringBuilder sb = this.a;
sb.append(i);
sb.append('\n');
return this;
}
public final h a(long j, String str) {
a(str);
StringBuilder sb = this.a;
sb.append(j);
sb.append('\n');
return this;
}
public final h a(String str, String str2) {
a(str2);
if (str == null) {
this.a.append("null\n");
} else {
StringBuilder sb = this.a;
sb.append(str);
sb.append('\n');
}
return this;
}
public final h a(byte[] bArr, String str) {
a(str);
if (bArr == null) {
this.a.append("null\n");
return this;
}
if (bArr.length == 0) {
StringBuilder sb = this.a;
sb.append(bArr.length);
sb.append(", []\n");
return this;
}
StringBuilder sb2 = this.a;
sb2.append(bArr.length);
sb2.append(", [\n");
h hVar = new h(this.a, this.b + 1);
for (byte b : bArr) {
hVar.a(null);
StringBuilder sb3 = hVar.a;
sb3.append((int) b);
sb3.append('\n');
}
a(null);
StringBuilder sb4 = this.a;
sb4.append(']');
sb4.append('\n');
return this;
}
public final <K, V> h a(Map<K, V> map, String str) {
a(str);
if (map == null) {
this.a.append("null\n");
return this;
}
if (map.isEmpty()) {
StringBuilder sb = this.a;
sb.append(map.size());
sb.append(", {}\n");
return this;
}
StringBuilder sb2 = this.a;
sb2.append(map.size());
sb2.append(", {\n");
h hVar = new h(this.a, this.b + 1);
h hVar2 = new h(this.a, this.b + 2);
for (Map.Entry<K, V> entry : map.entrySet()) {
hVar.a(null);
StringBuilder sb3 = hVar.a;
sb3.append('(');
sb3.append('\n');
hVar2.a((h) entry.getKey(), (String) null);
hVar2.a((h) entry.getValue(), (String) null);
hVar.a(null);
StringBuilder sb4 = hVar.a;
sb4.append(')');
sb4.append('\n');
}
a(null);
StringBuilder sb5 = this.a;
sb5.append('}');
sb5.append('\n');
return this;
}
private <T> h a(T[] tArr, String str) {
a(str);
if (tArr == null) {
this.a.append("null\n");
return this;
}
if (tArr.length == 0) {
StringBuilder sb = this.a;
sb.append(tArr.length);
sb.append(", []\n");
return this;
}
StringBuilder sb2 = this.a;
sb2.append(tArr.length);
sb2.append(", [\n");
h hVar = new h(this.a, this.b + 1);
for (T t : tArr) {
hVar.a((h) t, (String) null);
}
a(null);
StringBuilder sb3 = this.a;
sb3.append(']');
sb3.append('\n');
return this;
}
/* JADX WARN: Multi-variable type inference failed */
private <T> h a(T t, String str) {
if (t == 0) {
this.a.append("null\n");
} else if (t instanceof Byte) {
byte byteValue = ((Byte) t).byteValue();
a(str);
StringBuilder sb = this.a;
sb.append((int) byteValue);
sb.append('\n');
} else if (t instanceof Boolean) {
boolean booleanValue = ((Boolean) t).booleanValue();
a(str);
StringBuilder sb2 = this.a;
sb2.append(booleanValue ? 'T' : 'F');
sb2.append('\n');
} else if (t instanceof Short) {
short shortValue = ((Short) t).shortValue();
a(str);
StringBuilder sb3 = this.a;
sb3.append((int) shortValue);
sb3.append('\n');
} else if (t instanceof Integer) {
int intValue = ((Integer) t).intValue();
a(str);
StringBuilder sb4 = this.a;
sb4.append(intValue);
sb4.append('\n');
} else if (t instanceof Long) {
long longValue = ((Long) t).longValue();
a(str);
StringBuilder sb5 = this.a;
sb5.append(longValue);
sb5.append('\n');
} else if (t instanceof Float) {
float floatValue = ((Float) t).floatValue();
a(str);
StringBuilder sb6 = this.a;
sb6.append(floatValue);
sb6.append('\n');
} else if (t instanceof Double) {
double doubleValue = ((Double) t).doubleValue();
a(str);
StringBuilder sb7 = this.a;
sb7.append(doubleValue);
sb7.append('\n');
} else if (t instanceof String) {
a((String) t, str);
} else if (t instanceof Map) {
a((Map) t, str);
} else if (t instanceof List) {
List list = (List) t;
if (list == null) {
a(str);
this.a.append("null\t");
} else {
a(list.toArray(), str);
}
} else if (t instanceof k) {
a((k) t, str);
} else if (t instanceof byte[]) {
a((byte[]) t, str);
} else if (t instanceof boolean[]) {
a((h) t, str);
} else {
int i = 0;
if (t instanceof short[]) {
short[] sArr = (short[]) t;
a(str);
if (sArr == null) {
this.a.append("null\n");
} else if (sArr.length == 0) {
StringBuilder sb8 = this.a;
sb8.append(sArr.length);
sb8.append(", []\n");
} else {
StringBuilder sb9 = this.a;
sb9.append(sArr.length);
sb9.append(", [\n");
h hVar = new h(this.a, this.b + 1);
int length = sArr.length;
while (i < length) {
short s = sArr[i];
hVar.a(null);
StringBuilder sb10 = hVar.a;
sb10.append((int) s);
sb10.append('\n');
i++;
}
a(null);
StringBuilder sb11 = this.a;
sb11.append(']');
sb11.append('\n');
}
} else if (t instanceof int[]) {
int[] iArr = (int[]) t;
a(str);
if (iArr == null) {
this.a.append("null\n");
} else if (iArr.length == 0) {
StringBuilder sb12 = this.a;
sb12.append(iArr.length);
sb12.append(", []\n");
} else {
StringBuilder sb13 = this.a;
sb13.append(iArr.length);
sb13.append(", [\n");
h hVar2 = new h(this.a, this.b + 1);
int length2 = iArr.length;
while (i < length2) {
int i2 = iArr[i];
hVar2.a(null);
StringBuilder sb14 = hVar2.a;
sb14.append(i2);
sb14.append('\n');
i++;
}
a(null);
StringBuilder sb15 = this.a;
sb15.append(']');
sb15.append('\n');
}
} else if (t instanceof long[]) {
long[] jArr = (long[]) t;
a(str);
if (jArr == null) {
this.a.append("null\n");
} else if (jArr.length == 0) {
StringBuilder sb16 = this.a;
sb16.append(jArr.length);
sb16.append(", []\n");
} else {
StringBuilder sb17 = this.a;
sb17.append(jArr.length);
sb17.append(", [\n");
h hVar3 = new h(this.a, this.b + 1);
int length3 = jArr.length;
while (i < length3) {
long j = jArr[i];
hVar3.a(null);
StringBuilder sb18 = hVar3.a;
sb18.append(j);
sb18.append('\n');
i++;
}
a(null);
StringBuilder sb19 = this.a;
sb19.append(']');
sb19.append('\n');
}
} else if (t instanceof float[]) {
float[] fArr = (float[]) t;
a(str);
if (fArr == null) {
this.a.append("null\n");
} else if (fArr.length == 0) {
StringBuilder sb20 = this.a;
sb20.append(fArr.length);
sb20.append(", []\n");
} else {
StringBuilder sb21 = this.a;
sb21.append(fArr.length);
sb21.append(", [\n");
h hVar4 = new h(this.a, this.b + 1);
int length4 = fArr.length;
while (i < length4) {
float f = fArr[i];
hVar4.a(null);
StringBuilder sb22 = hVar4.a;
sb22.append(f);
sb22.append('\n');
i++;
}
a(null);
StringBuilder sb23 = this.a;
sb23.append(']');
sb23.append('\n');
}
} else if (t instanceof double[]) {
double[] dArr = (double[]) t;
a(str);
if (dArr == null) {
this.a.append("null\n");
} else if (dArr.length == 0) {
StringBuilder sb24 = this.a;
sb24.append(dArr.length);
sb24.append(", []\n");
} else {
StringBuilder sb25 = this.a;
sb25.append(dArr.length);
sb25.append(", [\n");
h hVar5 = new h(this.a, this.b + 1);
int length5 = dArr.length;
while (i < length5) {
double d = dArr[i];
hVar5.a(null);
StringBuilder sb26 = hVar5.a;
sb26.append(d);
sb26.append('\n');
i++;
}
a(null);
StringBuilder sb27 = this.a;
sb27.append(']');
sb27.append('\n');
}
} else if (t.getClass().isArray()) {
a((Object[]) t, str);
} else {
throw new b("write object error: unsupport type.");
}
}
return this;
}
public final h a(k kVar, String str) {
a(str);
StringBuilder sb = this.a;
sb.append('{');
sb.append('\n');
if (kVar == null) {
StringBuilder sb2 = this.a;
sb2.append('\t');
sb2.append("null");
} else {
kVar.a(this.a, this.b + 1);
}
a(null);
StringBuilder sb3 = this.a;
sb3.append('}');
sb3.append('\n');
return this;
}
}

View File

@@ -0,0 +1,680 @@
package com.tencent.bugly.proguard;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Array;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class i {
private ByteBuffer a;
private String b = "GBK";
/* compiled from: BUGLY */
public static class a {
public byte a;
public int b;
}
public i() {
}
private boolean[] d(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
boolean[] zArr = new boolean[a2];
for (int i2 = 0; i2 < a2; i2++) {
zArr[i2] = a((byte) 0, 0, true) != 0;
}
return zArr;
}
private short[] e(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
short[] sArr = new short[a2];
for (int i2 = 0; i2 < a2; i2++) {
sArr[i2] = a(sArr[0], 0, true);
}
return sArr;
}
private int[] f(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
int[] iArr = new int[a2];
for (int i2 = 0; i2 < a2; i2++) {
iArr[i2] = a(iArr[0], 0, true);
}
return iArr;
}
private long[] g(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
long[] jArr = new long[a2];
for (int i2 = 0; i2 < a2; i2++) {
jArr[i2] = a(jArr[0], 0, true);
}
return jArr;
}
private float[] h(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
float[] fArr = new float[a2];
for (int i2 = 0; i2 < a2; i2++) {
fArr[i2] = a(fArr[0], 0, true);
}
return fArr;
}
private double[] i(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a != 9) {
throw new g("type mismatch.");
}
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
double[] dArr = new double[a2];
for (int i2 = 0; i2 < a2; i2++) {
dArr[i2] = a(dArr[0], 0, true);
}
return dArr;
}
public final void a(byte[] bArr) {
ByteBuffer byteBuffer = this.a;
if (byteBuffer != null) {
byteBuffer.clear();
}
this.a = ByteBuffer.wrap(bArr);
}
public final String b(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 6) {
int i2 = this.a.get();
if (i2 < 0) {
i2 += DataDecryptTool.DECRYPT_ALL_FILE;
}
byte[] bArr = new byte[i2];
this.a.get(bArr);
try {
return new String(bArr, this.b);
} catch (UnsupportedEncodingException unused) {
return new String(bArr);
}
}
if (b != 7) {
throw new g("type mismatch.");
}
int i3 = this.a.getInt();
if (i3 > 104857600 || i3 < 0) {
throw new g("String too long: " + i3);
}
byte[] bArr2 = new byte[i3];
this.a.get(bArr2);
try {
return new String(bArr2, this.b);
} catch (UnsupportedEncodingException unused2) {
return new String(bArr2);
}
}
public final byte[] c(int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 9) {
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
byte[] bArr = new byte[a2];
for (int i2 = 0; i2 < a2; i2++) {
bArr[i2] = a(bArr[0], 0, true);
}
return bArr;
}
if (b != 13) {
throw new g("type mismatch.");
}
a aVar2 = new a();
a(aVar2, this.a);
if (aVar2.a != 0) {
throw new g("type mismatch, tag: " + i + ", type: " + ((int) aVar.a) + ", " + ((int) aVar2.a));
}
int a3 = a(0, 0, true);
if (a3 >= 0) {
byte[] bArr2 = new byte[a3];
this.a.get(bArr2);
return bArr2;
}
throw new g("invalid size, tag: " + i + ", type: " + ((int) aVar.a) + ", " + ((int) aVar2.a) + ", size: " + a3);
}
public i(byte[] bArr) {
this.a = ByteBuffer.wrap(bArr);
}
private static int a(a aVar, ByteBuffer byteBuffer) {
byte b = byteBuffer.get();
aVar.a = (byte) (b & 15);
aVar.b = (b & 240) >> 4;
if (aVar.b != 15) {
return 1;
}
aVar.b = byteBuffer.get();
return 2;
}
public i(byte[] bArr, int i) {
this.a = ByteBuffer.wrap(bArr);
this.a.position(4);
}
private boolean a(int i) {
a aVar;
try {
aVar = new a();
while (true) {
int a2 = a(aVar, this.a.duplicate());
if (i <= aVar.b || aVar.a == 11) {
break;
}
this.a.position(this.a.position() + a2);
a(aVar.a);
}
} catch (g | BufferUnderflowException unused) {
}
return i == aVar.b;
}
private void a() {
a aVar = new a();
do {
a(aVar, this.a);
a(aVar.a);
} while (aVar.a != 11);
}
/* JADX WARN: Multi-variable type inference failed */
private <T> T[] b(T t, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
a aVar = new a();
a(aVar, this.a);
if (aVar.a == 9) {
int a2 = a(0, 0, true);
if (a2 >= 0) {
T[] tArr = (T[]) ((Object[]) Array.newInstance(t.getClass(), a2));
for (int i2 = 0; i2 < a2; i2++) {
tArr[i2] = a((i) t, 0, true);
}
return tArr;
}
throw new g("size invalid: " + a2);
}
throw new g("type mismatch.");
}
private void a(byte b) {
int i = 0;
switch (b) {
case 0:
ByteBuffer byteBuffer = this.a;
byteBuffer.position(byteBuffer.position() + 1);
return;
case 1:
ByteBuffer byteBuffer2 = this.a;
byteBuffer2.position(byteBuffer2.position() + 2);
return;
case 2:
ByteBuffer byteBuffer3 = this.a;
byteBuffer3.position(byteBuffer3.position() + 4);
return;
case 3:
ByteBuffer byteBuffer4 = this.a;
byteBuffer4.position(byteBuffer4.position() + 8);
return;
case 4:
ByteBuffer byteBuffer5 = this.a;
byteBuffer5.position(byteBuffer5.position() + 4);
return;
case 5:
ByteBuffer byteBuffer6 = this.a;
byteBuffer6.position(byteBuffer6.position() + 8);
return;
case 6:
int i2 = this.a.get();
if (i2 < 0) {
i2 += DataDecryptTool.DECRYPT_ALL_FILE;
}
ByteBuffer byteBuffer7 = this.a;
byteBuffer7.position(byteBuffer7.position() + i2);
return;
case 7:
int i3 = this.a.getInt();
ByteBuffer byteBuffer8 = this.a;
byteBuffer8.position(byteBuffer8.position() + i3);
return;
case 8:
int a2 = a(0, 0, true);
while (i < (a2 << 1)) {
a aVar = new a();
a(aVar, this.a);
a(aVar.a);
i++;
}
return;
case 9:
int a3 = a(0, 0, true);
while (i < a3) {
a aVar2 = new a();
a(aVar2, this.a);
a(aVar2.a);
i++;
}
return;
case 10:
a();
return;
case 11:
case 12:
return;
case 13:
a aVar3 = new a();
a(aVar3, this.a);
if (aVar3.a == 0) {
int a4 = a(0, 0, true);
ByteBuffer byteBuffer9 = this.a;
byteBuffer9.position(byteBuffer9.position() + a4);
return;
} else {
throw new g("skipField with invalid type, type value: " + ((int) b) + ", " + ((int) aVar3.a));
}
default:
throw new g("invalid type.");
}
}
public final boolean a(int i, boolean z) {
return a((byte) 0, i, z) != 0;
}
public final byte a(byte b, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return b;
}
a aVar = new a();
a(aVar, this.a);
byte b2 = aVar.a;
if (b2 == 0) {
return this.a.get();
}
if (b2 == 12) {
return (byte) 0;
}
throw new g("type mismatch.");
}
public final short a(short s, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return s;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 0) {
return this.a.get();
}
if (b == 1) {
return this.a.getShort();
}
if (b == 12) {
return (short) 0;
}
throw new g("type mismatch.");
}
public final int a(int i, int i2, boolean z) {
if (!a(i2)) {
if (z) {
throw new g("require field not exist.");
}
return i;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 0) {
return this.a.get();
}
if (b == 1) {
return this.a.getShort();
}
if (b == 2) {
return this.a.getInt();
}
if (b == 12) {
return 0;
}
throw new g("type mismatch.");
}
public final long a(long j, int i, boolean z) {
int i2;
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return j;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 0) {
i2 = this.a.get();
} else if (b == 1) {
i2 = this.a.getShort();
} else {
if (b != 2) {
if (b == 3) {
return this.a.getLong();
}
if (b == 12) {
return 0L;
}
throw new g("type mismatch.");
}
i2 = this.a.getInt();
}
return i2;
}
private float a(float f, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return f;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 4) {
return this.a.getFloat();
}
if (b == 12) {
return 0.0f;
}
throw new g("type mismatch.");
}
private double a(double d, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return d;
}
a aVar = new a();
a(aVar, this.a);
byte b = aVar.a;
if (b == 4) {
return this.a.getFloat();
}
if (b == 5) {
return this.a.getDouble();
}
if (b == 12) {
return 0.0d;
}
throw new g("type mismatch.");
}
public final <K, V> HashMap<K, V> a(Map<K, V> map, int i, boolean z) {
return (HashMap) a(new HashMap(), map, i, z);
}
/* JADX WARN: Multi-variable type inference failed */
private <K, V> Map<K, V> a(Map<K, V> map, Map<K, V> map2, int i, boolean z) {
if (map2 != null && !map2.isEmpty()) {
Map.Entry<K, V> next = map2.entrySet().iterator().next();
K key = next.getKey();
V value = next.getValue();
if (a(i)) {
a aVar = new a();
a(aVar, this.a);
if (aVar.a == 8) {
int a2 = a(0, 0, true);
if (a2 < 0) {
throw new g("size invalid: " + a2);
}
for (int i2 = 0; i2 < a2; i2++) {
map.put(a((i) key, 0, true), a((i) value, 1, true));
}
} else {
throw new g("type mismatch.");
}
} else if (z) {
throw new g("require field not exist.");
}
return map;
}
return new HashMap();
}
private <T> T[] a(T[] tArr, int i, boolean z) {
if (tArr != null && tArr.length != 0) {
return (T[]) b(tArr[0], i, z);
}
throw new g("unable to get type of key and value.");
}
public final k a(k kVar, int i, boolean z) {
if (!a(i)) {
if (z) {
throw new g("require field not exist.");
}
return null;
}
try {
k kVar2 = (k) kVar.getClass().newInstance();
a aVar = new a();
a(aVar, this.a);
if (aVar.a == 10) {
kVar2.a(this);
a();
return kVar2;
}
throw new g("type mismatch.");
} catch (Exception e) {
throw new g(e.getMessage());
}
}
/* JADX WARN: Multi-variable type inference failed */
public final <T> Object a(T t, int i, boolean z) {
if (t instanceof Byte) {
return Byte.valueOf(a((byte) 0, i, z));
}
if (t instanceof Boolean) {
return Boolean.valueOf(a((byte) 0, i, z) != 0);
}
if (t instanceof Short) {
return Short.valueOf(a((short) 0, i, z));
}
if (t instanceof Integer) {
return Integer.valueOf(a(0, i, z));
}
if (t instanceof Long) {
return Long.valueOf(a(0L, i, z));
}
if (t instanceof Float) {
return Float.valueOf(a(0.0f, i, z));
}
if (t instanceof Double) {
return Double.valueOf(a(0.0d, i, z));
}
if (t instanceof String) {
return String.valueOf(b(i, z));
}
if (t instanceof Map) {
return (HashMap) a(new HashMap(), (Map) t, i, z);
}
if (t instanceof List) {
List list = (List) t;
if (list == null || list.isEmpty()) {
return new ArrayList();
}
Object[] b = b(list.get(0), i, z);
if (b == null) {
return null;
}
ArrayList arrayList = new ArrayList();
for (Object obj : b) {
arrayList.add(obj);
}
return arrayList;
}
if (t instanceof k) {
return a((k) t, i, z);
}
if (t.getClass().isArray()) {
if (!(t instanceof byte[]) && !(t instanceof Byte[])) {
if (t instanceof boolean[]) {
return d(i, z);
}
if (t instanceof short[]) {
return e(i, z);
}
if (t instanceof int[]) {
return f(i, z);
}
if (t instanceof long[]) {
return g(i, z);
}
if (t instanceof float[]) {
return h(i, z);
}
if (t instanceof double[]) {
return i(i, z);
}
return a((Object[]) t, i, z);
}
return c(i, z);
}
throw new g("read object error: unsupport type.");
}
public final int a(String str) {
this.b = str;
return 0;
}
}

View File

@@ -0,0 +1,302 @@
package com.tencent.bugly.proguard;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class j {
private ByteBuffer a;
private String b;
public j(int i) {
this.b = "GBK";
this.a = ByteBuffer.allocate(i);
}
public final ByteBuffer a() {
return this.a;
}
public final byte[] b() {
byte[] bArr = new byte[this.a.position()];
System.arraycopy(this.a.array(), 0, bArr, 0, this.a.position());
return bArr;
}
private void a(int i) {
if (this.a.remaining() < i) {
ByteBuffer allocate = ByteBuffer.allocate((this.a.capacity() + i) << 1);
allocate.put(this.a.array(), 0, this.a.position());
this.a = allocate;
}
}
private void b(byte b, int i) {
if (i < 15) {
this.a.put((byte) (b | (i << 4)));
} else if (i < 256) {
this.a.put((byte) (b | 240));
this.a.put((byte) i);
} else {
throw new b("tag is too large: " + i);
}
}
public j() {
this(PeripheralType.SERVO);
}
public final void a(boolean z, int i) {
a(z ? (byte) 1 : (byte) 0, i);
}
public final void a(byte b, int i) {
a(3);
if (b == 0) {
b((byte) 12, i);
} else {
b((byte) 0, i);
this.a.put(b);
}
}
public final void a(short s, int i) {
a(4);
if (s >= -128 && s <= 127) {
a((byte) s, i);
} else {
b((byte) 1, i);
this.a.putShort(s);
}
}
public final void a(int i, int i2) {
a(6);
if (i >= -32768 && i <= 32767) {
a((short) i, i2);
} else {
b((byte) 2, i2);
this.a.putInt(i);
}
}
public final void a(long j, int i) {
a(10);
if (j >= -2147483648L && j <= 2147483647L) {
a((int) j, i);
} else {
b((byte) 3, i);
this.a.putLong(j);
}
}
public final void a(String str, int i) {
byte[] bytes;
try {
bytes = str.getBytes(this.b);
} catch (UnsupportedEncodingException unused) {
bytes = str.getBytes();
}
a(bytes.length + 10);
if (bytes.length > 255) {
b((byte) 7, i);
this.a.putInt(bytes.length);
this.a.put(bytes);
} else {
b((byte) 6, i);
this.a.put((byte) bytes.length);
this.a.put(bytes);
}
}
public final <K, V> void a(Map<K, V> map, int i) {
a(8);
b((byte) 8, i);
a(map == null ? 0 : map.size(), 0);
if (map != null) {
for (Map.Entry<K, V> entry : map.entrySet()) {
a(entry.getKey(), 0);
a(entry.getValue(), 1);
}
}
}
public final void a(byte[] bArr, int i) {
a(bArr.length + 8);
b((byte) 13, i);
b((byte) 0, 0);
a(bArr.length, 0);
this.a.put(bArr);
}
public final <T> void a(Collection<T> collection, int i) {
a(8);
b((byte) 9, i);
a(collection == null ? 0 : collection.size(), 0);
if (collection != null) {
Iterator<T> it = collection.iterator();
while (it.hasNext()) {
a(it.next(), 0);
}
}
}
public final void a(k kVar, int i) {
a(2);
b((byte) 10, i);
kVar.a(this);
a(2);
b((byte) 11, 0);
}
public final void a(Object obj, int i) {
if (obj instanceof Byte) {
a(((Byte) obj).byteValue(), i);
return;
}
if (obj instanceof Boolean) {
a(((Boolean) obj).booleanValue() ? (byte) 1 : (byte) 0, i);
return;
}
if (obj instanceof Short) {
a(((Short) obj).shortValue(), i);
return;
}
if (obj instanceof Integer) {
a(((Integer) obj).intValue(), i);
return;
}
if (obj instanceof Long) {
a(((Long) obj).longValue(), i);
return;
}
if (obj instanceof Float) {
float floatValue = ((Float) obj).floatValue();
a(6);
b((byte) 4, i);
this.a.putFloat(floatValue);
return;
}
if (obj instanceof Double) {
double doubleValue = ((Double) obj).doubleValue();
a(10);
b((byte) 5, i);
this.a.putDouble(doubleValue);
return;
}
if (obj instanceof String) {
a((String) obj, i);
return;
}
if (obj instanceof Map) {
a((Map) obj, i);
return;
}
if (obj instanceof List) {
a((Collection) obj, i);
return;
}
if (obj instanceof k) {
a(2);
b((byte) 10, i);
((k) obj).a(this);
a(2);
b((byte) 11, 0);
return;
}
if (obj instanceof byte[]) {
a((byte[]) obj, i);
return;
}
if (obj instanceof boolean[]) {
boolean[] zArr = (boolean[]) obj;
a(8);
b((byte) 9, i);
a(zArr.length, 0);
for (boolean z : zArr) {
a(z ? (byte) 1 : (byte) 0, 0);
}
return;
}
if (obj instanceof short[]) {
short[] sArr = (short[]) obj;
a(8);
b((byte) 9, i);
a(sArr.length, 0);
for (short s : sArr) {
a(s, 0);
}
return;
}
if (obj instanceof int[]) {
int[] iArr = (int[]) obj;
a(8);
b((byte) 9, i);
a(iArr.length, 0);
for (int i2 : iArr) {
a(i2, 0);
}
return;
}
if (obj instanceof long[]) {
long[] jArr = (long[]) obj;
a(8);
b((byte) 9, i);
a(jArr.length, 0);
for (long j : jArr) {
a(j, 0);
}
return;
}
if (obj instanceof float[]) {
float[] fArr = (float[]) obj;
a(8);
b((byte) 9, i);
a(fArr.length, 0);
for (float f : fArr) {
a(6);
b((byte) 4, 0);
this.a.putFloat(f);
}
return;
}
if (obj instanceof double[]) {
double[] dArr = (double[]) obj;
a(8);
b((byte) 9, i);
a(dArr.length, 0);
for (double d : dArr) {
a(10);
b((byte) 5, 0);
this.a.putDouble(d);
}
return;
}
if (obj.getClass().isArray()) {
Object[] objArr = (Object[]) obj;
a(8);
b((byte) 9, i);
a(objArr.length, 0);
for (Object obj2 : objArr) {
a(obj2, 0);
}
return;
}
if (obj instanceof Collection) {
a((Collection) obj, i);
} else {
throw new b("write object error: unsupport type. " + obj.getClass());
}
}
public final int a(String str) {
this.b = str;
return 0;
}
}

View File

@@ -0,0 +1,19 @@
package com.tencent.bugly.proguard;
import java.io.Serializable;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public abstract class k implements Serializable {
public abstract void a(i iVar);
public abstract void a(j jVar);
public abstract void a(StringBuilder sb, int i);
public String toString() {
StringBuilder sb = new StringBuilder();
a(sb, 0);
return sb.toString();
}
}

View File

@@ -0,0 +1,40 @@
package com.tencent.bugly.proguard;
import com.ijm.dataencryption.de.DataDecryptTool;
import java.nio.ByteBuffer;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class l {
static {
byte[] bArr = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70};
byte[] bArr2 = new byte[DataDecryptTool.DECRYPT_ALL_FILE];
byte[] bArr3 = new byte[DataDecryptTool.DECRYPT_ALL_FILE];
for (int i = 0; i < 256; i++) {
bArr2[i] = bArr[i >>> 4];
bArr3[i] = bArr[i & 15];
}
}
public static boolean a(int i, int i2) {
return i == i2;
}
public static boolean a(long j, long j2) {
return j == j2;
}
public static boolean a(Object obj, Object obj2) {
return obj.equals(obj2);
}
public static boolean a(boolean z, boolean z2) {
return z == z2;
}
public static byte[] a(ByteBuffer byteBuffer) {
byte[] bArr = new byte[byteBuffer.position()];
System.arraycopy(byteBuffer.array(), 0, bArr, 0, bArr.length);
return bArr;
}
}

View File

@@ -0,0 +1,20 @@
package com.tencent.bugly.proguard;
import java.io.Serializable;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class m implements Serializable, Comparable<m> {
public long a;
public String b;
public long c;
public int d;
public String e;
public String f;
public long g;
@Override // java.lang.Comparable
public final /* bridge */ /* synthetic */ int compareTo(m mVar) {
return (int) (this.c - mVar.c);
}
}

View File

@@ -0,0 +1,301 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class n {
public static final long a = System.currentTimeMillis();
private static n b;
private Context c;
private SharedPreferences f;
private Map<Integer, Map<String, m>> e = new HashMap();
private String d = com.tencent.bugly.crashreport.common.info.a.b().d;
private n(Context context) {
this.c = context;
this.f = context.getSharedPreferences("crashrecord", 0);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:21:0x0052, code lost:
if (r6 == null) goto L31;
*/
/* JADX WARN: Code restructure failed: missing block: B:24:0x0046, code lost:
r6.close();
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x0044, code lost:
if (r6 == null) goto L31;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r6v4, types: [boolean] */
/* JADX WARN: Type inference failed for: r6v5, types: [java.io.ObjectInputStream] */
/* JADX WARN: Type inference failed for: r6v6 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized <T extends java.util.List<?>> T c(int r6) {
/*
r5 = this;
monitor-enter(r5)
r0 = 0
r1 = 0
java.io.File r2 = new java.io.File // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
android.content.Context r3 = r5.c // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
java.lang.String r4 = "crashrecord"
java.io.File r3 = r3.getDir(r4, r1) // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
r4.<init>() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
r4.append(r6) // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
java.lang.String r6 = r4.toString() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
r2.<init>(r3, r6) // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
boolean r6 = r2.exists() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
if (r6 != 0) goto L24
monitor-exit(r5)
return r0
L24:
java.io.ObjectInputStream r6 = new java.io.ObjectInputStream // Catch: java.lang.Throwable -> L39 java.lang.ClassNotFoundException -> L3c java.io.IOException -> L4a
java.io.FileInputStream r3 = new java.io.FileInputStream // Catch: java.lang.Throwable -> L39 java.lang.ClassNotFoundException -> L3c java.io.IOException -> L4a
r3.<init>(r2) // Catch: java.lang.Throwable -> L39 java.lang.ClassNotFoundException -> L3c java.io.IOException -> L4a
r6.<init>(r3) // Catch: java.lang.Throwable -> L39 java.lang.ClassNotFoundException -> L3c java.io.IOException -> L4a
java.lang.Object r2 = r6.readObject() // Catch: java.lang.ClassNotFoundException -> L3d java.io.IOException -> L4b java.lang.Throwable -> L55
java.util.List r2 = (java.util.List) r2 // Catch: java.lang.ClassNotFoundException -> L3d java.io.IOException -> L4b java.lang.Throwable -> L55
r6.close() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
monitor-exit(r5)
return r2
L39:
r2 = move-exception
r6 = r0
goto L56
L3c:
r6 = r0
L3d:
java.lang.String r2 = "get object error"
java.lang.Object[] r3 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L55
com.tencent.bugly.proguard.x.a(r2, r3) // Catch: java.lang.Throwable -> L55
if (r6 == 0) goto L65
L46:
r6.close() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
goto L65
L4a:
r6 = r0
L4b:
java.lang.String r2 = "open record file error"
java.lang.Object[] r3 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L55
com.tencent.bugly.proguard.x.a(r2, r3) // Catch: java.lang.Throwable -> L55
if (r6 == 0) goto L65
goto L46
L55:
r2 = move-exception
L56:
if (r6 == 0) goto L5b
r6.close() // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
L5b:
throw r2 // Catch: java.lang.Throwable -> L5c java.lang.Exception -> L5e
L5c:
r6 = move-exception
goto L67
L5e:
java.lang.String r6 = "readCrashRecord error"
java.lang.Object[] r1 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L5c
com.tencent.bugly.proguard.x.e(r6, r1) // Catch: java.lang.Throwable -> L5c
L65:
monitor-exit(r5)
return r0
L67:
monitor-exit(r5)
throw r6
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.n.c(int):java.util.List");
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized boolean b(int i) {
try {
List<m> c = c(i);
if (c == null) {
return false;
}
long currentTimeMillis = System.currentTimeMillis();
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
for (m mVar : c) {
if (mVar.b != null && mVar.b.equalsIgnoreCase(this.d) && mVar.d > 0) {
arrayList.add(mVar);
}
if (mVar.c + 86400000 < currentTimeMillis) {
arrayList2.add(mVar);
}
}
Collections.sort(arrayList);
if (arrayList.size() >= 2) {
if (arrayList.size() <= 0 || ((m) arrayList.get(arrayList.size() - 1)).c + 86400000 >= currentTimeMillis) {
return true;
}
c.clear();
a(i, (int) c);
return false;
}
c.removeAll(arrayList2);
a(i, (int) c);
return false;
} catch (Exception unused) {
x.e("isFrequentCrash failed", new Object[0]);
return false;
}
}
public static synchronized n a(Context context) {
n nVar;
synchronized (n.class) {
if (b == null) {
b = new n(context);
}
nVar = b;
}
return nVar;
}
public static synchronized n a() {
n nVar;
synchronized (n.class) {
nVar = b;
}
return nVar;
}
public final void a(int i, final int i2) {
final int i3 = 1004;
w.a().a(new Runnable() { // from class: com.tencent.bugly.proguard.n.1
@Override // java.lang.Runnable
public final void run() {
m mVar;
try {
if (TextUtils.isEmpty(n.this.d)) {
return;
}
List<m> c = n.this.c(i3);
if (c == null) {
c = new ArrayList();
}
if (n.this.e.get(Integer.valueOf(i3)) == null) {
n.this.e.put(Integer.valueOf(i3), new HashMap());
}
if (((Map) n.this.e.get(Integer.valueOf(i3))).get(n.this.d) == null) {
mVar = new m();
mVar.a = i3;
mVar.g = n.a;
mVar.b = n.this.d;
mVar.f = com.tencent.bugly.crashreport.common.info.a.b().j;
com.tencent.bugly.crashreport.common.info.a.b().getClass();
mVar.e = "3.1.0";
mVar.c = System.currentTimeMillis();
mVar.d = i2;
((Map) n.this.e.get(Integer.valueOf(i3))).put(n.this.d, mVar);
} else {
mVar = (m) ((Map) n.this.e.get(Integer.valueOf(i3))).get(n.this.d);
mVar.d = i2;
}
ArrayList arrayList = new ArrayList();
boolean z = false;
for (m mVar2 : c) {
if (mVar2.g == mVar.g && mVar2.b != null && mVar2.b.equalsIgnoreCase(mVar.b)) {
z = true;
mVar2.d = mVar.d;
}
if ((mVar2.e != null && !mVar2.e.equalsIgnoreCase(mVar.e)) || ((mVar2.f != null && !mVar2.f.equalsIgnoreCase(mVar.f)) || mVar2.d <= 0)) {
arrayList.add(mVar2);
}
}
c.removeAll(arrayList);
if (!z) {
c.add(mVar);
}
n.this.a(i3, (int) c);
} catch (Exception unused) {
x.e("saveCrashRecord failed", new Object[0]);
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized <T extends List<?>> void a(int i, T t) {
File dir;
StringBuilder sb;
ObjectOutputStream objectOutputStream;
if (t == null) {
return;
}
try {
dir = this.c.getDir("crashrecord", 0);
sb = new StringBuilder();
sb.append(i);
objectOutputStream = null;
} catch (Exception unused) {
x.e("writeCrashRecord error", new Object[0]);
}
try {
try {
ObjectOutputStream objectOutputStream2 = new ObjectOutputStream(new FileOutputStream(new File(dir, sb.toString())));
try {
objectOutputStream2.writeObject(t);
objectOutputStream2.close();
} catch (IOException e) {
e = e;
objectOutputStream = objectOutputStream2;
e.printStackTrace();
x.a("open record file error", new Object[0]);
if (objectOutputStream != null) {
objectOutputStream.close();
}
} catch (Throwable th) {
th = th;
objectOutputStream = objectOutputStream2;
if (objectOutputStream != null) {
objectOutputStream.close();
}
throw th;
}
} catch (IOException e2) {
e = e2;
}
} catch (Throwable th2) {
th = th2;
}
}
public final synchronized boolean a(final int i) {
boolean z;
z = true;
try {
z = this.f.getBoolean(i + "_" + this.d, true);
w.a().a(new Runnable() { // from class: com.tencent.bugly.proguard.n.2
@Override // java.lang.Runnable
public final void run() {
boolean b2 = n.this.b(i);
n.this.f.edit().putBoolean(i + "_" + n.this.d, !b2).commit();
}
});
} catch (Exception unused) {
x.e("canInit error", new Object[0]);
return z;
}
return z;
}
}

View File

@@ -0,0 +1,11 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface o {
byte[] a();
String b();
boolean c();
}

View File

@@ -0,0 +1,811 @@
package com.tencent.bugly.proguard;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.liulishuo.filedownloader.model.FileDownloadModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class p {
private static p a = null;
private static q b = null;
private static boolean c = false;
/* compiled from: BUGLY */
class a extends Thread {
private int a;
private o b;
private String c;
private ContentValues d;
private boolean e;
private String[] f;
private String g;
private String[] h;
private String i;
private String j;
private String k;
private String l;
private String m;
private String[] n;
private int o;
private String p;
private byte[] q;
public a(int i, o oVar) {
this.a = i;
this.b = oVar;
}
public final void a(int i, String str, byte[] bArr) {
this.o = i;
this.p = str;
this.q = bArr;
}
@Override // java.lang.Thread, java.lang.Runnable
public final void run() {
switch (this.a) {
case 1:
p.this.a(this.c, this.d, this.b);
break;
case 2:
p.this.a(this.c, this.m, this.n, this.b);
break;
case 3:
Cursor a = p.this.a(this.e, this.c, this.f, this.g, this.h, this.i, this.j, this.k, this.l, this.b);
if (a != null) {
a.close();
break;
}
break;
case 4:
p.this.a(this.o, this.p, this.q, this.b);
break;
case 5:
p.this.a(this.o, this.b);
break;
case 6:
p.this.a(this.o, this.p, this.b);
break;
}
}
}
private p(Context context, List<com.tencent.bugly.a> list) {
b = new q(context, list);
}
private synchronized boolean b(r rVar) {
ContentValues d;
if (rVar == null) {
return false;
}
try {
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase == null || (d = d(rVar)) == null) {
return false;
}
long replace = writableDatabase.replace("t_pf", FileDownloadModel.ID, d);
if (replace < 0) {
return false;
}
x.c("[Database] insert %s success.", "t_pf");
rVar.a = replace;
return true;
} catch (Throwable th) {
try {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
} finally {
}
}
}
private static ContentValues c(r rVar) {
if (rVar == null) {
return null;
}
try {
ContentValues contentValues = new ContentValues();
if (rVar.a > 0) {
contentValues.put(FileDownloadModel.ID, Long.valueOf(rVar.a));
}
contentValues.put("_tp", Integer.valueOf(rVar.b));
contentValues.put("_pc", rVar.c);
contentValues.put("_th", rVar.d);
contentValues.put("_tm", Long.valueOf(rVar.e));
if (rVar.g != null) {
contentValues.put("_dt", rVar.g);
}
return contentValues;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
private static ContentValues d(r rVar) {
if (rVar != null && !z.a(rVar.f)) {
try {
ContentValues contentValues = new ContentValues();
if (rVar.a > 0) {
contentValues.put(FileDownloadModel.ID, Long.valueOf(rVar.a));
}
contentValues.put("_tp", rVar.f);
contentValues.put("_tm", Long.valueOf(rVar.e));
if (rVar.g != null) {
contentValues.put("_dt", rVar.g);
}
return contentValues;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return null;
}
public static synchronized p a(Context context, List<com.tencent.bugly.a> list) {
p pVar;
synchronized (p.class) {
if (a == null) {
a = new p(context, list);
}
pVar = a;
}
return pVar;
}
public static synchronized p a() {
p pVar;
synchronized (p.class) {
pVar = a;
}
return pVar;
}
public final long a(String str, ContentValues contentValues, o oVar, boolean z) {
return a(str, contentValues, (o) null);
}
private synchronized List<r> c(int i) {
Cursor cursor;
try {
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase != null) {
String str = "_id = " + i;
cursor = writableDatabase.query("t_pf", null, str, null, null, null, null);
if (cursor == null) {
return null;
}
try {
StringBuilder sb = new StringBuilder();
ArrayList arrayList = new ArrayList();
while (cursor.moveToNext()) {
r b2 = b(cursor);
if (b2 != null) {
arrayList.add(b2);
} else {
try {
String string = cursor.getString(cursor.getColumnIndex("_tp"));
sb.append(" or _tp");
sb.append(" = ");
sb.append(string);
} catch (Throwable unused) {
x.d("[Database] unknown id.", new Object[0]);
}
}
}
if (sb.length() > 0) {
sb.append(" and _id");
sb.append(" = ");
sb.append(i);
x.d("[Database] deleted %s illegal data %d.", "t_pf", Integer.valueOf(writableDatabase.delete("t_pf", str.substring(4), null)));
}
if (cursor != null) {
cursor.close();
}
return arrayList;
} catch (Throwable th) {
th = th;
try {
if (!x.a(th)) {
th.printStackTrace();
}
if (cursor != null) {
cursor.close();
}
return null;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
}
} catch (Throwable th2) {
th = th2;
cursor = null;
}
return null;
}
public final Cursor a(String str, String[] strArr, String str2, String[] strArr2, o oVar, boolean z) {
return a(false, str, strArr, str2, null, null, null, null, null, null);
}
public final int a(String str, String str2, String[] strArr, o oVar, boolean z) {
return a(str, str2, (String[]) null, (o) null);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:25:0x003f, code lost:
if (r9 != null) goto L13;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized long a(java.lang.String r7, android.content.ContentValues r8, com.tencent.bugly.proguard.o r9) {
/*
r6 = this;
monitor-enter(r6)
r0 = 0
com.tencent.bugly.proguard.q r2 = com.tencent.bugly.proguard.p.b // Catch: java.lang.Throwable -> L35
android.database.sqlite.SQLiteDatabase r2 = r2.getWritableDatabase() // Catch: java.lang.Throwable -> L35
if (r2 == 0) goto L2d
if (r8 == 0) goto L2d
java.lang.String r3 = "_id"
long r2 = r2.replace(r7, r3, r8) // Catch: java.lang.Throwable -> L35
r8 = 0
r4 = 1
int r5 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1))
if (r5 < 0) goto L23
java.lang.String r5 = "[Database] insert %s success."
java.lang.Object[] r4 = new java.lang.Object[r4] // Catch: java.lang.Throwable -> L35
r4[r8] = r7 // Catch: java.lang.Throwable -> L35
com.tencent.bugly.proguard.x.c(r5, r4) // Catch: java.lang.Throwable -> L35
goto L2c
L23:
java.lang.String r5 = "[Database] replace %s error."
java.lang.Object[] r4 = new java.lang.Object[r4] // Catch: java.lang.Throwable -> L35
r4[r8] = r7 // Catch: java.lang.Throwable -> L35
com.tencent.bugly.proguard.x.d(r5, r4) // Catch: java.lang.Throwable -> L35
L2c:
r0 = r2
L2d:
if (r9 == 0) goto L42
L2f:
java.lang.Long.valueOf(r0) // Catch: java.lang.Throwable -> L33
goto L42
L33:
r7 = move-exception
goto L4b
L35:
r7 = move-exception
boolean r8 = com.tencent.bugly.proguard.x.a(r7) // Catch: java.lang.Throwable -> L44
if (r8 != 0) goto L3f
r7.printStackTrace() // Catch: java.lang.Throwable -> L44
L3f:
if (r9 == 0) goto L42
goto L2f
L42:
monitor-exit(r6)
return r0
L44:
r7 = move-exception
if (r9 == 0) goto L4a
java.lang.Long.valueOf(r0) // Catch: java.lang.Throwable -> L33
L4a:
throw r7 // Catch: java.lang.Throwable -> L33
L4b:
monitor-exit(r6)
throw r7
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.p.a(java.lang.String, android.content.ContentValues, com.tencent.bugly.proguard.o):long");
}
public final synchronized void b(int i) {
String str;
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase != null) {
if (i >= 0) {
try {
str = "_tp = " + i;
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
return;
}
} else {
str = null;
}
x.c("[Database] deleted %s data %d", "t_lr", Integer.valueOf(writableDatabase.delete("t_lr", str, null)));
}
}
/* JADX INFO: Access modifiers changed from: private */
public synchronized Cursor a(boolean z, String str, String[] strArr, String str2, String[] strArr2, String str3, String str4, String str5, String str6, o oVar) {
Cursor cursor;
cursor = null;
try {
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase != null) {
cursor = writableDatabase.query(z, str, strArr, str2, strArr2, str3, str4, str5, str6);
}
} finally {
try {
return cursor;
} finally {
}
}
return cursor;
}
private static r b(Cursor cursor) {
if (cursor == null) {
return null;
}
try {
r rVar = new r();
rVar.a = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
rVar.e = cursor.getLong(cursor.getColumnIndex("_tm"));
rVar.f = cursor.getString(cursor.getColumnIndex("_tp"));
rVar.g = cursor.getBlob(cursor.getColumnIndex("_dt"));
return rVar;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:21:0x0020, code lost:
if (r6 != null) goto L8;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized int a(java.lang.String r3, java.lang.String r4, java.lang.String[] r5, com.tencent.bugly.proguard.o r6) {
/*
r2 = this;
monitor-enter(r2)
r0 = 0
com.tencent.bugly.proguard.q r1 = com.tencent.bugly.proguard.p.b // Catch: java.lang.Throwable -> L16
android.database.sqlite.SQLiteDatabase r1 = r1.getWritableDatabase() // Catch: java.lang.Throwable -> L16
if (r1 == 0) goto Le
int r0 = r1.delete(r3, r4, r5) // Catch: java.lang.Throwable -> L16
Le:
if (r6 == 0) goto L23
L10:
java.lang.Integer.valueOf(r0) // Catch: java.lang.Throwable -> L14
goto L23
L14:
r3 = move-exception
goto L2c
L16:
r3 = move-exception
boolean r4 = com.tencent.bugly.proguard.x.a(r3) // Catch: java.lang.Throwable -> L25
if (r4 != 0) goto L20
r3.printStackTrace() // Catch: java.lang.Throwable -> L25
L20:
if (r6 == 0) goto L23
goto L10
L23:
monitor-exit(r2)
return r0
L25:
r3 = move-exception
if (r6 == 0) goto L2b
java.lang.Integer.valueOf(r0) // Catch: java.lang.Throwable -> L14
L2b:
throw r3 // Catch: java.lang.Throwable -> L14
L2c:
monitor-exit(r2)
throw r3
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.p.a(java.lang.String, java.lang.String, java.lang.String[], com.tencent.bugly.proguard.o):int");
}
public final boolean a(int i, String str, byte[] bArr, o oVar, boolean z) {
if (!z) {
a aVar = new a(4, null);
aVar.a(i, str, bArr);
w.a().a(aVar);
return true;
}
return a(i, str, bArr, (o) null);
}
public final Map<String, byte[]> a(int i, o oVar, boolean z) {
return a(i, (o) null);
}
public final boolean a(int i, String str, o oVar, boolean z) {
return a(555, str, (o) null);
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:15:0x0027, code lost:
if (r8 != null) goto L5;
*/
/* JADX WARN: Code restructure failed: missing block: B:6:0x002a, code lost:
return r0;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean a(int r5, java.lang.String r6, byte[] r7, com.tencent.bugly.proguard.o r8) {
/*
r4 = this;
r0 = 0
com.tencent.bugly.proguard.r r1 = new com.tencent.bugly.proguard.r // Catch: java.lang.Throwable -> L1d
r1.<init>() // Catch: java.lang.Throwable -> L1d
long r2 = (long) r5 // Catch: java.lang.Throwable -> L1d
r1.a = r2 // Catch: java.lang.Throwable -> L1d
r1.f = r6 // Catch: java.lang.Throwable -> L1d
long r5 = java.lang.System.currentTimeMillis() // Catch: java.lang.Throwable -> L1d
r1.e = r5 // Catch: java.lang.Throwable -> L1d
r1.g = r7 // Catch: java.lang.Throwable -> L1d
boolean r0 = r4.b(r1) // Catch: java.lang.Throwable -> L1d
if (r8 == 0) goto L2a
L19:
java.lang.Boolean.valueOf(r0)
goto L2a
L1d:
r5 = move-exception
boolean r6 = com.tencent.bugly.proguard.x.a(r5) // Catch: java.lang.Throwable -> L2b
if (r6 != 0) goto L27
r5.printStackTrace() // Catch: java.lang.Throwable -> L2b
L27:
if (r8 == 0) goto L2a
goto L19
L2a:
return r0
L2b:
r5 = move-exception
if (r8 == 0) goto L31
java.lang.Boolean.valueOf(r0)
L31:
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.p.a(int, java.lang.String, byte[], com.tencent.bugly.proguard.o):boolean");
}
/* JADX INFO: Access modifiers changed from: private */
public Map<String, byte[]> a(int i, o oVar) {
HashMap hashMap = null;
try {
List<r> c2 = c(i);
if (c2 == null) {
return null;
}
HashMap hashMap2 = new HashMap();
try {
for (r rVar : c2) {
byte[] bArr = rVar.g;
if (bArr != null) {
hashMap2.put(rVar.f, bArr);
}
}
return hashMap2;
} catch (Throwable th) {
th = th;
hashMap = hashMap2;
if (x.a(th)) {
return hashMap;
}
th.printStackTrace();
return hashMap;
}
} catch (Throwable th2) {
th = th2;
}
}
public final synchronized boolean a(r rVar) {
ContentValues c2;
if (rVar == null) {
return false;
}
try {
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase == null || (c2 = c(rVar)) == null) {
return false;
}
long replace = writableDatabase.replace("t_lr", FileDownloadModel.ID, c2);
if (replace < 0) {
return false;
}
x.c("[Database] insert %s success.", "t_lr");
rVar.a = replace;
return true;
} catch (Throwable th) {
try {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
} finally {
}
}
}
/* JADX WARN: Removed duplicated region for block: B:44:0x00a8 A[Catch: all -> 0x00b1, TRY_LEAVE, TryCatch #0 {all -> 0x00b1, blocks: (B:42:0x00a2, B:44:0x00a8), top: B:41:0x00a2, outer: #3 }] */
/* JADX WARN: Removed duplicated region for block: B:47:0x00ad A[Catch: all -> 0x00ba, TRY_ENTER, TryCatch #3 {, blocks: (B:3:0x0001, B:11:0x0032, B:37:0x009c, B:47:0x00ad, B:50:0x00b4, B:51:0x00b7, B:42:0x00a2, B:44:0x00a8), top: B:2:0x0001, inners: #0 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public final synchronized java.util.List<com.tencent.bugly.proguard.r> a(int r11) {
/*
r10 = this;
monitor-enter(r10)
com.tencent.bugly.proguard.q r0 = com.tencent.bugly.proguard.p.b // Catch: java.lang.Throwable -> Lba
android.database.sqlite.SQLiteDatabase r0 = r0.getWritableDatabase() // Catch: java.lang.Throwable -> Lba
r9 = 0
if (r0 == 0) goto Lb8
if (r11 < 0) goto L21
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L1c
java.lang.String r2 = "_tp = "
r1.<init>(r2) // Catch: java.lang.Throwable -> L1c
r1.append(r11) // Catch: java.lang.Throwable -> L1c
java.lang.String r11 = r1.toString() // Catch: java.lang.Throwable -> L1c
r4 = r11
goto L22
L1c:
r11 = move-exception
r0 = r11
r11 = r9
goto La2
L21:
r4 = r9
L22:
java.lang.String r2 = "t_lr"
r3 = 0
r5 = 0
r6 = 0
r7 = 0
r8 = 0
r1 = r0
android.database.Cursor r11 = r1.query(r2, r3, r4, r5, r6, r7, r8) // Catch: java.lang.Throwable -> L1c
if (r11 != 0) goto L37
if (r11 == 0) goto L35
r11.close() // Catch: java.lang.Throwable -> Lba
L35:
monitor-exit(r10)
return r9
L37:
java.lang.StringBuilder r1 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> La1
r1.<init>() // Catch: java.lang.Throwable -> La1
java.util.ArrayList r2 = new java.util.ArrayList // Catch: java.lang.Throwable -> La1
r2.<init>() // Catch: java.lang.Throwable -> La1
L41:
boolean r3 = r11.moveToNext() // Catch: java.lang.Throwable -> La1
r4 = 0
if (r3 == 0) goto L72
com.tencent.bugly.proguard.r r3 = a(r11) // Catch: java.lang.Throwable -> La1
if (r3 == 0) goto L52
r2.add(r3) // Catch: java.lang.Throwable -> La1
goto L41
L52:
java.lang.String r3 = "_id"
int r3 = r11.getColumnIndex(r3) // Catch: java.lang.Throwable -> L6a
long r5 = r11.getLong(r3) // Catch: java.lang.Throwable -> L6a
java.lang.String r3 = " or _id"
r1.append(r3) // Catch: java.lang.Throwable -> L6a
java.lang.String r3 = " = "
r1.append(r3) // Catch: java.lang.Throwable -> L6a
r1.append(r5) // Catch: java.lang.Throwable -> L6a
goto L41
L6a:
java.lang.String r3 = "[Database] unknown id."
java.lang.Object[] r4 = new java.lang.Object[r4] // Catch: java.lang.Throwable -> La1
com.tencent.bugly.proguard.x.d(r3, r4) // Catch: java.lang.Throwable -> La1
goto L41
L72:
java.lang.String r1 = r1.toString() // Catch: java.lang.Throwable -> La1
int r3 = r1.length() // Catch: java.lang.Throwable -> La1
if (r3 <= 0) goto L9a
r3 = 4
java.lang.String r1 = r1.substring(r3) // Catch: java.lang.Throwable -> La1
java.lang.String r3 = "t_lr"
int r0 = r0.delete(r3, r1, r9) // Catch: java.lang.Throwable -> La1
java.lang.String r1 = "[Database] deleted %s illegal data %d"
r3 = 2
java.lang.Object[] r3 = new java.lang.Object[r3] // Catch: java.lang.Throwable -> La1
java.lang.String r5 = "t_lr"
r3[r4] = r5 // Catch: java.lang.Throwable -> La1
r4 = 1
java.lang.Integer r0 = java.lang.Integer.valueOf(r0) // Catch: java.lang.Throwable -> La1
r3[r4] = r0 // Catch: java.lang.Throwable -> La1
com.tencent.bugly.proguard.x.d(r1, r3) // Catch: java.lang.Throwable -> La1
L9a:
if (r11 == 0) goto L9f
r11.close() // Catch: java.lang.Throwable -> Lba
L9f:
monitor-exit(r10)
return r2
La1:
r0 = move-exception
La2:
boolean r1 = com.tencent.bugly.proguard.x.a(r0) // Catch: java.lang.Throwable -> Lb1
if (r1 != 0) goto Lab
r0.printStackTrace() // Catch: java.lang.Throwable -> Lb1
Lab:
if (r11 == 0) goto Lb8
r11.close() // Catch: java.lang.Throwable -> Lba
goto Lb8
Lb1:
r0 = move-exception
if (r11 == 0) goto Lb7
r11.close() // Catch: java.lang.Throwable -> Lba
Lb7:
throw r0 // Catch: java.lang.Throwable -> Lba
Lb8:
monitor-exit(r10)
return r9
Lba:
r11 = move-exception
monitor-exit(r10)
throw r11
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.p.a(int):java.util.List");
}
public final synchronized void a(List<r> list) {
if (list != null) {
if (list.size() != 0) {
SQLiteDatabase writableDatabase = b.getWritableDatabase();
if (writableDatabase != null) {
StringBuilder sb = new StringBuilder();
for (r rVar : list) {
sb.append(" or _id");
sb.append(" = ");
sb.append(rVar.a);
}
String sb2 = sb.toString();
if (sb2.length() > 0) {
sb2 = sb2.substring(4);
}
sb.setLength(0);
try {
x.c("[Database] deleted %s data %d", "t_lr", Integer.valueOf(writableDatabase.delete("t_lr", sb2, null)));
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
}
}
}
private static r a(Cursor cursor) {
if (cursor == null) {
return null;
}
try {
r rVar = new r();
rVar.a = cursor.getLong(cursor.getColumnIndex(FileDownloadModel.ID));
rVar.b = cursor.getInt(cursor.getColumnIndex("_tp"));
rVar.c = cursor.getString(cursor.getColumnIndex("_pc"));
rVar.d = cursor.getString(cursor.getColumnIndex("_th"));
rVar.e = cursor.getLong(cursor.getColumnIndex("_tm"));
rVar.g = cursor.getBlob(cursor.getColumnIndex("_dt"));
return rVar;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Code restructure failed: missing block: B:27:0x006e, code lost:
if (r7 != null) goto L14;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public synchronized boolean a(int r5, java.lang.String r6, com.tencent.bugly.proguard.o r7) {
/*
r4 = this;
monitor-enter(r4)
r0 = 0
com.tencent.bugly.proguard.q r1 = com.tencent.bugly.proguard.p.b // Catch: java.lang.Throwable -> L64
android.database.sqlite.SQLiteDatabase r1 = r1.getWritableDatabase() // Catch: java.lang.Throwable -> L64
if (r1 == 0) goto L5c
boolean r2 = com.tencent.bugly.proguard.z.a(r6) // Catch: java.lang.Throwable -> L64
if (r2 == 0) goto L1f
java.lang.StringBuilder r6 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L64
java.lang.String r2 = "_id = "
r6.<init>(r2) // Catch: java.lang.Throwable -> L64
r6.append(r5) // Catch: java.lang.Throwable -> L64
java.lang.String r5 = r6.toString() // Catch: java.lang.Throwable -> L64
goto L3f
L1f:
java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L64
java.lang.String r3 = "_id = "
r2.<init>(r3) // Catch: java.lang.Throwable -> L64
r2.append(r5) // Catch: java.lang.Throwable -> L64
java.lang.String r5 = " and _tp"
r2.append(r5) // Catch: java.lang.Throwable -> L64
java.lang.String r5 = " = \""
r2.append(r5) // Catch: java.lang.Throwable -> L64
r2.append(r6) // Catch: java.lang.Throwable -> L64
java.lang.String r5 = "\""
r2.append(r5) // Catch: java.lang.Throwable -> L64
java.lang.String r5 = r2.toString() // Catch: java.lang.Throwable -> L64
L3f:
java.lang.String r6 = "t_pf"
r2 = 0
int r5 = r1.delete(r6, r5, r2) // Catch: java.lang.Throwable -> L64
java.lang.String r6 = "[Database] deleted %s data %d"
r1 = 2
java.lang.Object[] r1 = new java.lang.Object[r1] // Catch: java.lang.Throwable -> L64
java.lang.String r2 = "t_pf"
r1[r0] = r2 // Catch: java.lang.Throwable -> L64
java.lang.Integer r2 = java.lang.Integer.valueOf(r5) // Catch: java.lang.Throwable -> L64
r3 = 1
r1[r3] = r2 // Catch: java.lang.Throwable -> L64
com.tencent.bugly.proguard.x.c(r6, r1) // Catch: java.lang.Throwable -> L64
if (r5 <= 0) goto L5c
r0 = 1
L5c:
if (r7 == 0) goto L71
L5e:
java.lang.Boolean.valueOf(r0) // Catch: java.lang.Throwable -> L62
goto L71
L62:
r5 = move-exception
goto L7a
L64:
r5 = move-exception
boolean r6 = com.tencent.bugly.proguard.x.a(r5) // Catch: java.lang.Throwable -> L73
if (r6 != 0) goto L6e
r5.printStackTrace() // Catch: java.lang.Throwable -> L73
L6e:
if (r7 == 0) goto L71
goto L5e
L71:
monitor-exit(r4)
return r0
L73:
r5 = move-exception
if (r7 == 0) goto L79
java.lang.Boolean.valueOf(r0) // Catch: java.lang.Throwable -> L62
L79:
throw r5 // Catch: java.lang.Throwable -> L62
L7a:
monitor-exit(r4)
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.p.a(int, java.lang.String, com.tencent.bugly.proguard.o):boolean");
}
}

View File

@@ -0,0 +1,273 @@
package com.tencent.bugly.proguard;
import android.annotation.TargetApi;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.io.File;
import java.util.Iterator;
import java.util.List;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class q extends SQLiteOpenHelper {
public static String a = "bugly_db";
private static int b = 15;
private Context c;
private List<com.tencent.bugly.a> d;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public q(Context context, List<com.tencent.bugly.a> list) {
super(context, a + "_", (SQLiteDatabase.CursorFactory) null, b);
com.tencent.bugly.crashreport.common.info.a.a(context).getClass();
this.c = context;
this.d = list;
}
private synchronized boolean a(SQLiteDatabase sQLiteDatabase) {
try {
for (String str : new String[]{"t_lr", "t_ui", "t_pf"}) {
sQLiteDatabase.execSQL("DROP TABLE IF EXISTS " + str, new String[0]);
}
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
return false;
}
return true;
}
@Override // android.database.sqlite.SQLiteOpenHelper
public final synchronized SQLiteDatabase getReadableDatabase() {
SQLiteDatabase sQLiteDatabase;
sQLiteDatabase = null;
int i = 0;
while (sQLiteDatabase == null && i < 5) {
i++;
try {
sQLiteDatabase = super.getReadableDatabase();
} catch (Throwable unused) {
x.d("[Database] Try to get db(count: %d).", Integer.valueOf(i));
if (i == 5) {
x.e("[Database] Failed to get db.", new Object[0]);
}
try {
Thread.sleep(200L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
return sQLiteDatabase;
}
@Override // android.database.sqlite.SQLiteOpenHelper
public final synchronized SQLiteDatabase getWritableDatabase() {
SQLiteDatabase sQLiteDatabase;
sQLiteDatabase = null;
int i = 0;
while (sQLiteDatabase == null && i < 5) {
i++;
try {
sQLiteDatabase = super.getWritableDatabase();
} catch (Throwable unused) {
x.d("[Database] Try to get db(count: %d).", Integer.valueOf(i));
if (i == 5) {
x.e("[Database] Failed to get db.", new Object[0]);
}
try {
Thread.sleep(200L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
if (sQLiteDatabase == null) {
x.d("[Database] db error delay error record 1min.", new Object[0]);
}
return sQLiteDatabase;
}
@Override // android.database.sqlite.SQLiteOpenHelper
public final synchronized void onCreate(SQLiteDatabase sQLiteDatabase) {
try {
StringBuilder sb = new StringBuilder();
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS t_ui");
sb.append(" ( _id");
sb.append(" INTEGER PRIMARY KEY");
sb.append(" , _tm");
sb.append(" int");
sb.append(" , _ut");
sb.append(" int");
sb.append(" , _tp");
sb.append(" int");
sb.append(" , _dt");
sb.append(" blob");
sb.append(" , _pc");
sb.append(" text");
sb.append(" ) ");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS t_lr");
sb.append(" ( _id");
sb.append(" INTEGER PRIMARY KEY");
sb.append(" , _tp");
sb.append(" int");
sb.append(" , _tm");
sb.append(" int");
sb.append(" , _pc");
sb.append(" text");
sb.append(" , _th");
sb.append(" text");
sb.append(" , _dt");
sb.append(" blob");
sb.append(" ) ");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS t_pf");
sb.append(" ( _id");
sb.append(" integer");
sb.append(" , _tp");
sb.append(" text");
sb.append(" , _tm");
sb.append(" int");
sb.append(" , _dt");
sb.append(" blob");
sb.append(",primary key(_id");
sb.append(",_tp");
sb.append(" )) ");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS t_cr");
sb.append(" ( _id");
sb.append(" INTEGER PRIMARY KEY");
sb.append(" , _tm");
sb.append(" int");
sb.append(" , _s1");
sb.append(" text");
sb.append(" , _up");
sb.append(" int");
sb.append(" , _me");
sb.append(" int");
sb.append(" , _uc");
sb.append(" int");
sb.append(" , _dt");
sb.append(" blob");
sb.append(" ) ");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS dl_1002");
sb.append(" (_id");
sb.append(" integer primary key autoincrement, _dUrl");
sb.append(" varchar(100), _sFile");
sb.append(" varchar(100), _sLen");
sb.append(" INTEGER, _tLen");
sb.append(" INTEGER, _MD5");
sb.append(" varchar(100), _DLTIME");
sb.append(" INTEGER)");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append("CREATE TABLE IF NOT EXISTS ge_1002");
sb.append(" (_id");
sb.append(" integer primary key autoincrement, _time");
sb.append(" INTEGER, _datas");
sb.append(" blob)");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
sb.setLength(0);
sb.append(" CREATE TABLE IF NOT EXISTS st_1002");
sb.append(" ( _id");
sb.append(" integer");
sb.append(" , _tp");
sb.append(" text");
sb.append(" , _tm");
sb.append(" int");
sb.append(" , _dt");
sb.append(" blob");
sb.append(",primary key(_id");
sb.append(",_tp");
sb.append(" )) ");
x.c(sb.toString(), new Object[0]);
sQLiteDatabase.execSQL(sb.toString(), new String[0]);
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
}
if (this.d == null) {
return;
}
Iterator<com.tencent.bugly.a> it = this.d.iterator();
while (it.hasNext()) {
try {
it.next().onDbCreate(sQLiteDatabase);
} catch (Throwable th2) {
if (!x.b(th2)) {
th2.printStackTrace();
}
}
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
@TargetApi(11)
public final synchronized void onDowngrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
if (com.tencent.bugly.crashreport.common.info.b.c() >= 11) {
x.d("[Database] Downgrade %d to %d drop tables.", Integer.valueOf(i), Integer.valueOf(i2));
if (this.d != null) {
Iterator<com.tencent.bugly.a> it = this.d.iterator();
while (it.hasNext()) {
try {
it.next().onDbDowngrade(sQLiteDatabase, i, i2);
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
}
}
}
if (a(sQLiteDatabase)) {
onCreate(sQLiteDatabase);
return;
}
x.d("[Database] Failed to drop, delete db.", new Object[0]);
File databasePath = this.c.getDatabasePath(a);
if (databasePath != null && databasePath.canWrite()) {
databasePath.delete();
}
}
}
@Override // android.database.sqlite.SQLiteOpenHelper
public final synchronized void onUpgrade(SQLiteDatabase sQLiteDatabase, int i, int i2) {
x.d("[Database] Upgrade %d to %d , drop tables!", Integer.valueOf(i), Integer.valueOf(i2));
if (this.d != null) {
Iterator<com.tencent.bugly.a> it = this.d.iterator();
while (it.hasNext()) {
try {
it.next().onDbUpgrade(sQLiteDatabase, i, i2);
} catch (Throwable th) {
if (!x.b(th)) {
th.printStackTrace();
}
}
}
}
if (a(sQLiteDatabase)) {
onCreate(sQLiteDatabase);
return;
}
x.d("[Database] Failed to drop, delete db.", new Object[0]);
File databasePath = this.c.getDatabasePath(a);
if (databasePath != null && databasePath.canWrite()) {
databasePath.delete();
}
}
}

View File

@@ -0,0 +1,13 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class r {
public long a;
public int b;
public String c;
public String d;
public long e;
public String f;
public byte[] g;
}

View File

@@ -0,0 +1,177 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.bugly.BuglyStrategy;
import com.thoughtworks.xstream.XStream;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class s {
private static s b;
public Map<String, String> a = null;
private Context c;
private s(Context context) {
this.c = context;
}
public static s a(Context context) {
if (b == null) {
b = new s(context);
}
return b;
}
private static byte[] b(HttpURLConnection httpURLConnection) {
BufferedInputStream bufferedInputStream;
if (httpURLConnection == null) {
return null;
}
try {
bufferedInputStream = new BufferedInputStream(httpURLConnection.getInputStream());
} catch (Throwable th) {
th = th;
bufferedInputStream = null;
}
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[DataDecryptTool.DECRYPT_SP_FILE];
while (true) {
int read = bufferedInputStream.read(bArr);
if (read <= 0) {
break;
}
byteArrayOutputStream.write(bArr, 0, read);
}
byteArrayOutputStream.flush();
byte[] byteArray = byteArrayOutputStream.toByteArray();
try {
bufferedInputStream.close();
} catch (Throwable th2) {
th2.printStackTrace();
}
return byteArray;
} catch (Throwable th3) {
th = th3;
try {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
} finally {
if (bufferedInputStream != null) {
try {
bufferedInputStream.close();
} catch (Throwable th4) {
th4.printStackTrace();
}
}
}
}
}
/* JADX WARN: Removed duplicated region for block: B:72:0x018a A[Catch: all -> 0x017d, TRY_LEAVE, TryCatch #9 {all -> 0x017d, blocks: (B:24:0x009b, B:26:0x00a3, B:29:0x00b4, B:39:0x00b2, B:85:0x00dd, B:104:0x00e5, B:91:0x0116, B:94:0x0120, B:52:0x013f, B:57:0x0162, B:70:0x0184, B:72:0x018a), top: B:23:0x009b }] */
/* JADX WARN: Unreachable blocks removed: 2, instructions: 2 */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public final byte[] a(java.lang.String r23, byte[] r24, com.tencent.bugly.proguard.v r25, java.util.Map<java.lang.String, java.lang.String> r26) {
/*
Method dump skipped, instructions count: 456
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.s.a(java.lang.String, byte[], com.tencent.bugly.proguard.v, java.util.Map):byte[]");
}
private static Map<String, String> a(HttpURLConnection httpURLConnection) {
HashMap hashMap = new HashMap();
Map<String, List<String>> headerFields = httpURLConnection.getHeaderFields();
if (headerFields == null || headerFields.size() == 0) {
return null;
}
for (String str : headerFields.keySet()) {
List<String> list = headerFields.get(str);
if (list.size() > 0) {
hashMap.put(str, list.get(0));
}
}
return hashMap;
}
private HttpURLConnection a(String str, byte[] bArr, String str2, Map<String, String> map) {
if (str == null) {
x.e("destUrl is null.", new Object[0]);
return null;
}
HttpURLConnection a = a(str2, str);
if (a == null) {
x.e("Failed to get HttpURLConnection object.", new Object[0]);
return null;
}
try {
a.setRequestProperty("wup_version", "3.0");
if (map != null && map.size() > 0) {
for (Map.Entry<String, String> entry : map.entrySet()) {
a.setRequestProperty(entry.getKey(), URLEncoder.encode(entry.getValue(), "utf-8"));
}
}
a.setRequestProperty("A37", URLEncoder.encode(str2, "utf-8"));
a.setRequestProperty("A38", URLEncoder.encode(str2, "utf-8"));
OutputStream outputStream = a.getOutputStream();
if (bArr == null) {
outputStream.write(0);
} else {
outputStream.write(bArr);
}
return a;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
x.e("Failed to upload, please check your network.", new Object[0]);
return null;
}
}
private static HttpURLConnection a(String str, String str2) {
HttpURLConnection httpURLConnection;
try {
URL url = new URL(str2);
if (a.b() != null) {
httpURLConnection = (HttpURLConnection) url.openConnection(a.b());
} else if (str != null && str.toLowerCase(Locale.US).contains("wap")) {
httpURLConnection = (HttpURLConnection) url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(System.getProperty("http.proxyHost"), Integer.parseInt(System.getProperty("http.proxyPort")))));
} else {
httpURLConnection = (HttpURLConnection) url.openConnection();
}
httpURLConnection.setConnectTimeout(BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH);
httpURLConnection.setReadTimeout(XStream.PRIORITY_VERY_HIGH);
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(false);
return httpURLConnection;
} catch (Throwable th) {
if (x.a(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
}

View File

@@ -0,0 +1,7 @@
package com.tencent.bugly.proguard;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public interface t {
void a(boolean z);
}

View File

@@ -0,0 +1,620 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import android.os.Process;
import android.util.Base64;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class u {
private static u b;
public boolean a;
private final Context d;
private long f;
private long g;
private String k;
private Map<Integer, Long> e = new HashMap();
private LinkedBlockingQueue<Runnable> h = new LinkedBlockingQueue<>();
private LinkedBlockingQueue<Runnable> i = new LinkedBlockingQueue<>();
private final Object j = new Object();
private byte[] l = null;
private long m = 0;
private byte[] n = null;
private long o = 0;
private String p = null;
private long q = 0;
private final Object r = new Object();
private boolean s = false;
private final Object t = new Object();
private int u = 0;
private final p c = p.a();
private u(Context context) {
this.k = null;
this.a = true;
this.d = context;
try {
Class.forName("android.util.Base64");
} catch (ClassNotFoundException unused) {
x.a("[UploadManager] Error: Can not find Base64 class, will not use stronger security way to upload", new Object[0]);
this.a = false;
}
if (this.a) {
this.k = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDP9x32s5pPtZBXzJBz2GWM/sbTvVO2+RvW0PH01IdaBxc/fB6fbHZocC9T3nl1+J5eAFjIRVuV8vHDky7Qo82Mnh0PVvcZIEQvMMVKU8dsMQopxgsOs2gkSHJwgWdinKNS8CmWobo6pFwPUW11lMv714jAUZRq2GBOqiO2vQI6iwIDAQAB";
}
}
static /* synthetic */ int b(u uVar) {
int i = uVar.u - 1;
uVar.u = i;
return i;
}
private static boolean c() {
x.c("[UploadManager] Drop security info of database (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
try {
p a2 = p.a();
if (a2 != null) {
return a2.a(555, "security_info", (o) null, true);
}
x.d("[UploadManager] Failed to get Database", new Object[0]);
return false;
} catch (Throwable th) {
x.a(th);
return false;
}
}
private boolean d() {
x.c("[UploadManager] Record security info to database (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
try {
p a2 = p.a();
if (a2 == null) {
x.d("[UploadManager] Failed to get database", new Object[0]);
return false;
}
StringBuilder sb = new StringBuilder();
if (this.n == null) {
x.c("[UploadManager] AES key is null, will not record", new Object[0]);
return false;
}
sb.append(Base64.encodeToString(this.n, 0));
sb.append("#");
if (this.o != 0) {
sb.append(Long.toString(this.o));
} else {
sb.append("null");
}
sb.append("#");
if (this.p != null) {
sb.append(this.p);
} else {
sb.append("null");
}
sb.append("#");
if (this.q != 0) {
sb.append(Long.toString(this.q));
} else {
sb.append("null");
}
a2.a(555, "security_info", sb.toString().getBytes(), (o) null, true);
return true;
} catch (Throwable th) {
x.a(th);
c();
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:52:0x00de A[Catch: all -> 0x00e2, TRY_LEAVE, TryCatch #0 {all -> 0x00e2, blocks: (B:3:0x0020, B:5:0x0026, B:8:0x002e, B:10:0x0037, B:12:0x003d, B:14:0x0052, B:17:0x005c, B:23:0x006e, B:25:0x0076, B:27:0x007e, B:33:0x0090, B:35:0x0096, B:37:0x009e, B:39:0x00a6, B:41:0x00ac, B:43:0x00b5, B:49:0x00c7, B:52:0x00de, B:54:0x00cb, B:46:0x00bd, B:20:0x0064, B:30:0x0086), top: B:2:0x0020, inners: #1, #2, #3 }] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public boolean e() {
/*
Method dump skipped, instructions count: 231
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.u.e():boolean");
}
public final boolean b(int i) {
if (com.tencent.bugly.b.c) {
x.c("Uploading frequency will not be checked if SDK is in debug mode.", new Object[0]);
return true;
}
long currentTimeMillis = System.currentTimeMillis() - a(i);
x.c("[UploadManager] Time interval is %d seconds since last uploading(ID: %d).", Long.valueOf(currentTimeMillis / 1000), Integer.valueOf(i));
if (currentTimeMillis >= 30000) {
return true;
}
x.a("[UploadManager] Data only be uploaded once in %d seconds.", 30L);
return false;
}
/* compiled from: BUGLY */
class a implements Runnable {
private final Context a;
private final Runnable b;
private final long c;
public a(Context context) {
this.a = context;
this.b = null;
this.c = 0L;
}
@Override // java.lang.Runnable
public final void run() {
if (!z.a(this.a, "security_info", 30000L)) {
x.c("[UploadManager] Sleep %d try to lock security file again (pid=%d | tid=%d)", 5000, Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
z.b(5000L);
if (z.a(this, "BUGLY_ASYNC_UPLOAD") == null) {
x.d("[UploadManager] Failed to start a thread to execute task of initializing security context, try to post it into thread pool.", new Object[0]);
w a = w.a();
if (a != null) {
a.a(this);
return;
} else {
x.e("[UploadManager] Asynchronous thread pool is unavailable now, try next time.", new Object[0]);
return;
}
}
return;
}
if (!u.this.e()) {
x.d("[UploadManager] Failed to load security info from database", new Object[0]);
u.this.b(false);
}
if (u.this.p != null) {
if (u.this.b()) {
x.c("[UploadManager] Sucessfully got session ID, try to execute upload tasks now (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
Runnable runnable = this.b;
if (runnable != null) {
u.this.a(runnable, this.c);
}
u.this.c(0);
z.b(this.a, "security_info");
synchronized (u.this.t) {
u.a(u.this, false);
}
return;
}
x.a("[UploadManager] Session ID is expired, drop it.", new Object[0]);
u.this.b(true);
}
byte[] a2 = z.a(PeripheralType.SERVO);
if (a2 == null || (a2.length << 3) != 128) {
x.d("[UploadManager] Failed to create AES key (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
u.this.b(false);
z.b(this.a, "security_info");
synchronized (u.this.t) {
u.a(u.this, false);
}
return;
}
u.this.n = a2;
x.c("[UploadManager] Execute one upload task for requesting session ID (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
Runnable runnable2 = this.b;
if (runnable2 != null) {
u.this.a(runnable2, this.c);
} else {
u.this.c(1);
}
}
public a(Context context, Runnable runnable, long j) {
this.a = context;
this.b = runnable;
this.c = j;
}
}
static /* synthetic */ boolean a(u uVar, boolean z) {
uVar.s = false;
return false;
}
public static synchronized u a(Context context) {
u uVar;
synchronized (u.class) {
if (b == null) {
b = new u(context);
}
uVar = b;
}
return uVar;
}
/* JADX INFO: Access modifiers changed from: private */
/* JADX WARN: Removed duplicated region for block: B:23:0x006c A[Catch: all -> 0x0159, TRY_LEAVE, TryCatch #3 {, blocks: (B:9:0x001c, B:12:0x0049, B:13:0x0050, B:19:0x0062, B:23:0x006c, B:29:0x008d, B:31:0x0080, B:36:0x0093, B:42:0x00b4, B:44:0x00a7, B:47:0x00b7, B:93:0x0059, B:95:0x005d, B:39:0x009d, B:26:0x0076), top: B:8:0x001c, inners: #0, #4 }] */
/* JADX WARN: Removed duplicated region for block: B:36:0x0093 A[Catch: all -> 0x0159, TRY_LEAVE, TryCatch #3 {, blocks: (B:9:0x001c, B:12:0x0049, B:13:0x0050, B:19:0x0062, B:23:0x006c, B:29:0x008d, B:31:0x0080, B:36:0x0093, B:42:0x00b4, B:44:0x00a7, B:47:0x00b7, B:93:0x0059, B:95:0x005d, B:39:0x009d, B:26:0x0076), top: B:8:0x001c, inners: #0, #4 }] */
/* JADX WARN: Removed duplicated region for block: B:50:0x00bb */
/* JADX WARN: Removed duplicated region for block: B:53:0x00df */
/* JADX WARN: Removed duplicated region for block: B:84:0x012d */
/* JADX WARN: Removed duplicated region for block: B:86:0x0150 */
/* JADX WARN: Removed duplicated region for block: B:88:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void c(int r13) {
/*
Method dump skipped, instructions count: 348
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.u.c(int):void");
}
protected final boolean b() {
if (this.p == null || this.q == 0) {
return false;
}
long currentTimeMillis = System.currentTimeMillis() + this.m;
long j = this.q;
if (j >= currentTimeMillis) {
return true;
}
x.c("[UploadManager] Session ID expired time from server is: %d(%s), but now is: %d(%s)", Long.valueOf(j), new Date(this.q).toString(), Long.valueOf(currentTimeMillis), new Date(currentTimeMillis).toString());
return false;
}
public static synchronized u a() {
u uVar;
synchronized (u.class) {
uVar = b;
}
return uVar;
}
public final void a(int i, ap apVar, String str, String str2, t tVar, long j, boolean z) {
try {
a(new v(this.d, i, apVar.g, com.tencent.bugly.proguard.a.a((Object) apVar), str, str2, tVar, this.a, z), true, true, j);
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
public final void a(int i, int i2, byte[] bArr, String str, String str2, t tVar, int i3, int i4, boolean z, Map<String, String> map) {
try {
a(new v(this.d, i, i2, bArr, str, str2, tVar, this.a, i3, i4, false, map), z, false, 0L);
} catch (Throwable th) {
if (x.a(th)) {
return;
}
th.printStackTrace();
}
}
protected final void b(boolean z) {
synchronized (this.r) {
x.c("[UploadManager] Clear security context (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
this.n = null;
this.p = null;
this.q = 0L;
}
if (z) {
c();
}
}
public final void a(int i, ap apVar, String str, String str2, t tVar, boolean z) {
a(i, apVar.g, com.tencent.bugly.proguard.a.a((Object) apVar), str, str2, tVar, 0, 0, z, null);
}
public final long a(boolean z) {
long j;
long b2 = z.b();
int i = z ? 5 : 3;
List<r> a2 = this.c.a(i);
if (a2 != null && a2.size() > 0) {
j = 0;
try {
r rVar = a2.get(0);
if (rVar.e >= b2) {
j = z.c(rVar.g);
if (i == 3) {
this.f = j;
} else {
this.g = j;
}
a2.remove(rVar);
}
} catch (Throwable th) {
x.a(th);
}
if (a2.size() > 0) {
this.c.a(a2);
}
} else {
j = z ? this.g : this.f;
}
x.c("[UploadManager] Local network consume: %d KB", Long.valueOf(j / 1024));
return j;
}
public final byte[] b(byte[] bArr) {
byte[] bArr2 = this.n;
if (bArr2 != null && (bArr2.length << 3) == 128) {
return z.a(2, bArr, bArr2);
}
x.d("[UploadManager] AES key is invalid (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
return null;
}
protected final synchronized void a(long j, boolean z) {
int i = z ? 5 : 3;
r rVar = new r();
rVar.b = i;
rVar.e = z.b();
rVar.c = "";
rVar.d = "";
rVar.g = z.c(j);
this.c.b(i);
this.c.a(rVar);
if (z) {
this.g = j;
} else {
this.f = j;
}
x.c("[UploadManager] Network total consume: %d KB", Long.valueOf(j / 1024));
}
public final synchronized void a(int i, long j) {
if (i < 0) {
x.e("[UploadManager] Unknown uploading ID: %d", Integer.valueOf(i));
return;
}
this.e.put(Integer.valueOf(i), Long.valueOf(j));
r rVar = new r();
rVar.b = i;
rVar.e = j;
rVar.c = "";
rVar.d = "";
rVar.g = new byte[0];
this.c.b(i);
this.c.a(rVar);
x.c("[UploadManager] Uploading(ID:%d) time: %s", Integer.valueOf(i), z.a(j));
}
public final synchronized long a(int i) {
long j = 0;
if (i >= 0) {
Long l = this.e.get(Integer.valueOf(i));
if (l != null) {
return l.longValue();
}
List<r> a2 = this.c.a(i);
if (a2 != null && a2.size() > 0) {
if (a2.size() > 1) {
for (r rVar : a2) {
if (rVar.e > j) {
j = rVar.e;
}
}
this.c.b(i);
} else {
try {
j = a2.get(0).e;
} catch (Throwable th) {
x.a(th);
}
}
}
} else {
x.e("[UploadManager] Unknown upload ID: %d", Integer.valueOf(i));
}
return j;
}
private boolean a(Runnable runnable, boolean z) {
if (runnable == null) {
x.a("[UploadManager] Upload task should not be null", new Object[0]);
return false;
}
try {
x.c("[UploadManager] Add upload task to queue (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
synchronized (this.j) {
if (z) {
this.h.put(runnable);
} else {
this.i.put(runnable);
}
}
return true;
} catch (Throwable th) {
x.e("[UploadManager] Failed to add upload task to queue: %s", th.getMessage());
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(Runnable runnable, long j) {
if (runnable == null) {
x.d("[UploadManager] Upload task should not be null", new Object[0]);
return;
}
x.c("[UploadManager] Execute synchronized upload task (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
Thread a2 = z.a(runnable, "BUGLY_SYNC_UPLOAD");
if (a2 == null) {
x.e("[UploadManager] Failed to start a thread to execute synchronized upload task, add it to queue.", new Object[0]);
a(runnable, true);
return;
}
try {
a2.join(j);
} catch (Throwable th) {
x.e("[UploadManager] Failed to join upload synchronized task with message: %s. Add it to queue.", th.getMessage());
a(runnable, true);
c(0);
}
}
private void a(Runnable runnable, boolean z, boolean z2, long j) {
if (runnable == null) {
x.d("[UploadManager] Upload task should not be null", new Object[0]);
}
x.c("[UploadManager] Add upload task (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
if (this.p != null) {
if (b()) {
x.c("[UploadManager] Sucessfully got session ID, try to execute upload task now (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
if (z2) {
a(runnable, j);
return;
} else {
a(runnable, z);
c(0);
return;
}
}
x.a("[UploadManager] Session ID is expired, drop it (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
b(false);
}
synchronized (this.t) {
if (this.s) {
a(runnable, z);
return;
}
this.s = true;
x.c("[UploadManager] Initialize security context now (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
if (z2) {
a(new a(this.d, runnable, j), 0L);
return;
}
a(runnable, z);
a aVar = new a(this.d);
x.a("[UploadManager] Create and start a new thread to execute a task of initializing security context: %s", "BUGLY_ASYNC_UPLOAD");
if (z.a(aVar, "BUGLY_ASYNC_UPLOAD") == null) {
x.d("[UploadManager] Failed to start a thread to execute task of initializing security context, try to post it into thread pool.", new Object[0]);
w a2 = w.a();
if (a2 != null) {
a2.a(aVar);
return;
}
x.e("[UploadManager] Asynchronous thread pool is unavailable now, try next time.", new Object[0]);
synchronized (this.t) {
this.s = false;
}
}
}
}
public final void a(int i, aq aqVar) {
if (this.a) {
boolean z = true;
if (i == 2) {
x.c("[UploadManager] Session ID is invalid, will clear security context (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
b(true);
} else {
synchronized (this.t) {
if (!this.s) {
return;
}
if (aqVar != null) {
x.c("[UploadManager] Record security context (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
try {
Map<String, String> map = aqVar.g;
if (map != null && map.containsKey("S1") && map.containsKey("S2")) {
this.m = aqVar.e - System.currentTimeMillis();
x.c("[UploadManager] Time lag of server is: %d", Long.valueOf(this.m));
this.p = map.get("S1");
x.c("[UploadManager] Session ID from server is: %s", this.p);
if (this.p.length() > 0) {
try {
this.q = Long.parseLong(map.get("S2"));
x.c("[UploadManager] Session expired time from server is: %d(%s)", Long.valueOf(this.q), new Date(this.q).toString());
if (this.q < 1000) {
x.d("[UploadManager] Session expired time from server is less than 1 second, will set to default value", new Object[0]);
this.q = 259200000L;
}
} catch (NumberFormatException unused) {
x.d("[UploadManager] Session expired time is invalid, will set to default value", new Object[0]);
this.q = 259200000L;
}
if (d()) {
z = false;
} else {
x.c("[UploadManager] Failed to record database", new Object[0]);
}
c(0);
} else {
x.c("[UploadManager] Session ID from server is invalid, try next time", new Object[0]);
}
}
} catch (Throwable th) {
x.a(th);
}
if (z) {
b(false);
}
} else {
x.c("[UploadManager] Fail to init security context and clear local info (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
b(false);
}
}
}
synchronized (this.t) {
if (this.s) {
this.s = false;
z.b(this.d, "security_info");
}
}
}
}
public final byte[] a(byte[] bArr) {
byte[] bArr2 = this.n;
if (bArr2 != null && (bArr2.length << 3) == 128) {
return z.a(1, bArr, bArr2);
}
x.d("[UploadManager] AES key is invalid (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
return null;
}
public final boolean a(Map<String, String> map) {
if (map == null) {
return false;
}
x.c("[UploadManager] Integrate security to HTTP headers (pid=%d | tid=%d)", Integer.valueOf(Process.myPid()), Integer.valueOf(Process.myTid()));
String str = this.p;
if (str != null) {
map.put("secureSessionId", str);
return true;
}
byte[] bArr = this.n;
if (bArr != null && (bArr.length << 3) == 128) {
if (this.l == null) {
this.l = Base64.decode(this.k, 0);
if (this.l == null) {
x.d("[UploadManager] Failed to decode RSA public key", new Object[0]);
return false;
}
}
byte[] b2 = z.b(1, this.n, this.l);
if (b2 == null) {
x.d("[UploadManager] Failed to encrypt AES key", new Object[0]);
return false;
}
String encodeToString = Base64.encodeToString(b2, 0);
if (encodeToString == null) {
x.d("[UploadManager] Failed to encode AES key", new Object[0]);
return false;
}
map.put("raKey", encodeToString);
return true;
}
x.d("[UploadManager] AES key is invalid", new Object[0]);
return false;
}
}

View File

@@ -0,0 +1,227 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import com.tencent.bugly.BuglyStrategy;
import java.util.Map;
import java.util.UUID;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class v implements Runnable {
private int a;
private int b;
private final Context c;
private final int d;
private final byte[] e;
private final com.tencent.bugly.crashreport.common.info.a f;
private final com.tencent.bugly.crashreport.common.strategy.a g;
private final s h;
private final u i;
private final int j;
private final t k;
private final t l;
private String m;
private final String n;
private final Map<String, String> o;
private int p;
private long q;
private long r;
private boolean s;
private boolean t;
public v(Context context, int i, int i2, byte[] bArr, String str, String str2, t tVar, boolean z, boolean z2) {
this(context, i, i2, bArr, str, str2, tVar, z, 2, BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH, z2, null);
}
/* JADX WARN: Removed duplicated region for block: B:12:0x0020 */
/* JADX WARN: Removed duplicated region for block: B:15:0x0052 */
/* JADX WARN: Removed duplicated region for block: B:18:0x006b */
/* JADX WARN: Removed duplicated region for block: B:21:0x0072 */
/* JADX WARN: Removed duplicated region for block: B:24:? A[RETURN, SYNTHETIC] */
/* JADX WARN: Removed duplicated region for block: B:25:0x002a */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
private void a(com.tencent.bugly.proguard.aq r4, boolean r5, int r6, java.lang.String r7, int r8) {
/*
r3 = this;
int r4 = r3.d
r0 = 630(0x276, float:8.83E-43)
if (r4 == r0) goto L1a
r0 = 640(0x280, float:8.97E-43)
if (r4 == r0) goto L17
r0 = 830(0x33e, float:1.163E-42)
if (r4 == r0) goto L1a
r0 = 840(0x348, float:1.177E-42)
if (r4 == r0) goto L17
java.lang.String r4 = java.lang.String.valueOf(r4)
goto L1c
L17:
java.lang.String r4 = "userinfo"
goto L1c
L1a:
java.lang.String r4 = "crash"
L1c:
r0 = 1
r1 = 0
if (r5 == 0) goto L2a
java.lang.Object[] r6 = new java.lang.Object[r0]
r6[r1] = r4
java.lang.String r4 = "[Upload] Success: %s"
com.tencent.bugly.proguard.x.a(r4, r6)
goto L47
L2a:
r2 = 3
java.lang.Object[] r2 = new java.lang.Object[r2]
java.lang.Integer r6 = java.lang.Integer.valueOf(r6)
r2[r1] = r6
r2[r0] = r4
r4 = 2
r2[r4] = r7
java.lang.String r4 = "[Upload] Failed to upload(%d) %s: %s"
com.tencent.bugly.proguard.x.e(r4, r2)
boolean r4 = r3.s
if (r4 == 0) goto L47
com.tencent.bugly.proguard.u r4 = r3.i
r6 = 0
r4.a(r8, r6)
L47:
long r6 = r3.q
long r0 = r3.r
long r6 = r6 + r0
r0 = 0
int r4 = (r6 > r0 ? 1 : (r6 == r0 ? 0 : -1))
if (r4 <= 0) goto L67
com.tencent.bugly.proguard.u r4 = r3.i
boolean r6 = r3.t
long r6 = r4.a(r6)
long r0 = r3.q
long r6 = r6 + r0
long r0 = r3.r
long r6 = r6 + r0
com.tencent.bugly.proguard.u r4 = r3.i
boolean r8 = r3.t
r4.a(r6, r8)
L67:
com.tencent.bugly.proguard.t r4 = r3.k
if (r4 == 0) goto L6e
r4.a(r5)
L6e:
com.tencent.bugly.proguard.t r4 = r3.l
if (r4 == 0) goto L75
r4.a(r5)
L75:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.v.a(com.tencent.bugly.proguard.aq, boolean, int, java.lang.String, int):void");
}
public final void b(long j) {
this.r += j;
}
/* JADX WARN: Removed duplicated region for block: B:70:0x01fc A[Catch: all -> 0x0430, TryCatch #0 {all -> 0x0430, blocks: (B:3:0x0007, B:5:0x0019, B:9:0x0027, B:12:0x002c, B:14:0x0040, B:16:0x0044, B:18:0x0048, B:21:0x004e, B:23:0x0056, B:25:0x0062, B:27:0x0088, B:28:0x008d, B:30:0x0092, B:32:0x00c5, B:34:0x00d1, B:36:0x00d7, B:38:0x00e3, B:40:0x00eb, B:42:0x00f7, B:43:0x010d, B:46:0x0115, B:48:0x012c, B:49:0x0139, B:51:0x014b, B:52:0x0150, B:148:0x0181, B:56:0x0196, B:60:0x01a2, B:63:0x01a9, B:66:0x01b1, B:70:0x01fc, B:72:0x0228, B:73:0x0230, B:75:0x0236, B:77:0x0257, B:91:0x0294, B:93:0x029f, B:94:0x02b4, B:96:0x02f6, B:98:0x033e, B:100:0x0350, B:102:0x0353, B:103:0x035b, B:105:0x0361, B:107:0x037c, B:109:0x0388, B:111:0x0390, B:113:0x039c, B:115:0x03a3, B:117:0x03af, B:119:0x03b7, B:121:0x03c3, B:123:0x03c7, B:124:0x03cc, B:127:0x03e1, B:129:0x03f4, B:131:0x0400, B:133:0x03de, B:135:0x0314, B:137:0x01bb, B:139:0x01c1, B:140:0x01c9, B:142:0x01d7, B:143:0x01e3, B:144:0x01f0, B:151:0x040c, B:153:0x0418, B:155:0x0424), top: B:2:0x0007 }] */
/* JADX WARN: Removed duplicated region for block: B:82:0x0263 A[EXC_TOP_SPLITTER, SYNTHETIC] */
@Override // java.lang.Runnable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public final void run() {
/*
Method dump skipped, instructions count: 1083
To view this dump change 'Code comments level' option to 'DEBUG'
*/
throw new UnsupportedOperationException("Method not decompiled: com.tencent.bugly.proguard.v.run():void");
}
public v(Context context, int i, int i2, byte[] bArr, String str, String str2, t tVar, boolean z, int i3, int i4, boolean z2, Map<String, String> map) {
this.a = 2;
this.b = BuglyStrategy.a.MAX_USERDATA_VALUE_LENGTH;
this.m = null;
this.p = 0;
this.q = 0L;
this.r = 0L;
this.s = true;
this.t = false;
this.c = context;
this.f = com.tencent.bugly.crashreport.common.info.a.a(context);
this.e = bArr;
this.g = com.tencent.bugly.crashreport.common.strategy.a.a();
this.h = s.a(context);
this.i = u.a();
this.j = i;
this.m = str;
this.n = str2;
this.k = tVar;
this.l = null;
this.s = z;
this.d = i2;
if (i3 > 0) {
this.a = i3;
}
if (i4 > 0) {
this.b = i4;
}
this.t = z2;
this.o = map;
}
private static boolean a(aq aqVar, com.tencent.bugly.crashreport.common.info.a aVar, com.tencent.bugly.crashreport.common.strategy.a aVar2) {
if (aqVar == null) {
x.d("resp == null!", new Object[0]);
return false;
}
byte b = aqVar.a;
if (b != 0) {
x.e("resp result error %d", Byte.valueOf(b));
return false;
}
try {
if (!z.a(aqVar.d) && !com.tencent.bugly.crashreport.common.info.a.b().i().equals(aqVar.d)) {
p.a().a(com.tencent.bugly.crashreport.common.strategy.a.a, "gateway", aqVar.d.getBytes("UTF-8"), (o) null, true);
aVar.d(aqVar.d);
}
if (!z.a(aqVar.f) && !com.tencent.bugly.crashreport.common.info.a.b().j().equals(aqVar.f)) {
p.a().a(com.tencent.bugly.crashreport.common.strategy.a.a, "device", aqVar.f.getBytes("UTF-8"), (o) null, true);
aVar.e(aqVar.f);
}
} catch (Throwable th) {
x.a(th);
}
aVar.i = aqVar.e;
int i = aqVar.b;
if (i == 510) {
byte[] bArr = aqVar.c;
if (bArr == null) {
x.e("[Upload] Strategy data is null. Response cmd: %d", Integer.valueOf(i));
return false;
}
as asVar = (as) a.a(bArr, as.class);
if (asVar == null) {
x.e("[Upload] Failed to decode strategy from server. Response cmd: %d", Integer.valueOf(aqVar.b));
return false;
}
aVar2.a(asVar);
}
return true;
}
public final void a(long j) {
this.p++;
this.q += j;
}
private static String a(String str) {
if (z.a(str)) {
return str;
}
try {
return String.format("%s?aid=%s", str, UUID.randomUUID().toString());
} catch (Throwable th) {
x.a(th);
return str;
}
}
}

View File

@@ -0,0 +1,102 @@
package com.tencent.bugly.proguard;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class w {
private static final AtomicInteger a = new AtomicInteger(1);
private static w b;
private ScheduledExecutorService c;
protected w() {
this.c = null;
this.c = Executors.newScheduledThreadPool(3, new ThreadFactory(this) { // from class: com.tencent.bugly.proguard.w.1
@Override // java.util.concurrent.ThreadFactory
public final Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable);
thread.setName("BuglyThread-" + w.a.getAndIncrement());
return thread;
}
});
ScheduledExecutorService scheduledExecutorService = this.c;
if (scheduledExecutorService == null || scheduledExecutorService.isShutdown()) {
x.d("[AsyncTaskHandler] ScheduledExecutorService is not valiable!", new Object[0]);
}
}
public static synchronized w a() {
w wVar;
synchronized (w.class) {
if (b == null) {
b = new w();
}
wVar = b;
}
return wVar;
}
public final synchronized void b() {
if (this.c != null && !this.c.isShutdown()) {
x.c("[AsyncTaskHandler] Close async handler.", new Object[0]);
this.c.shutdownNow();
}
}
public final synchronized boolean c() {
boolean z;
if (this.c != null) {
z = this.c.isShutdown() ? false : true;
}
return z;
}
public final synchronized boolean a(Runnable runnable, long j) {
if (!c()) {
x.d("[AsyncTaskHandler] Async handler was closed, should not post task.", new Object[0]);
return false;
}
if (runnable == null) {
x.d("[AsyncTaskHandler] Task input is null.", new Object[0]);
return false;
}
if (j <= 0) {
j = 0;
}
x.c("[AsyncTaskHandler] Post a delay(time: %dms) task: %s", Long.valueOf(j), runnable.getClass().getName());
try {
this.c.schedule(runnable, j, TimeUnit.MILLISECONDS);
return true;
} catch (Throwable th) {
if (com.tencent.bugly.b.c) {
th.printStackTrace();
}
return false;
}
}
public final synchronized boolean a(Runnable runnable) {
if (!c()) {
x.d("[AsyncTaskHandler] Async handler was closed, should not post task.", new Object[0]);
return false;
}
if (runnable == null) {
x.d("[AsyncTaskHandler] Task input is null.", new Object[0]);
return false;
}
x.c("[AsyncTaskHandler] Post a normal task: %s", runnable.getClass().getName());
try {
this.c.execute(runnable);
return true;
} catch (Throwable th) {
if (com.tencent.bugly.b.c) {
th.printStackTrace();
}
return false;
}
}
}

View File

@@ -0,0 +1,86 @@
package com.tencent.bugly.proguard;
import android.util.Log;
import java.util.Locale;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class x {
public static String a = "CrashReport";
public static boolean b = false;
private static String c = "CrashReportInfo";
private static boolean a(int i, String str, Object... objArr) {
if (!b) {
return false;
}
if (str == null) {
str = "null";
} else if (objArr != null && objArr.length != 0) {
str = String.format(Locale.US, str, objArr);
}
if (i == 0) {
Log.i(a, str);
return true;
}
if (i == 1) {
Log.d(a, str);
return true;
}
if (i == 2) {
Log.w(a, str);
return true;
}
if (i == 3) {
Log.e(a, str);
return true;
}
if (i != 5) {
return false;
}
Log.i(c, str);
return true;
}
public static boolean b(String str, Object... objArr) {
return a(5, str, objArr);
}
public static boolean c(String str, Object... objArr) {
return a(1, str, objArr);
}
public static boolean d(String str, Object... objArr) {
return a(2, str, objArr);
}
public static boolean e(String str, Object... objArr) {
return a(3, str, objArr);
}
public static boolean b(Class cls, String str, Object... objArr) {
return a(1, String.format(Locale.US, "[%s] %s", cls.getSimpleName(), str), objArr);
}
public static boolean b(Throwable th) {
if (b) {
return a(3, z.a(th), new Object[0]);
}
return false;
}
public static boolean a(String str, Object... objArr) {
return a(0, str, objArr);
}
public static boolean a(Class cls, String str, Object... objArr) {
return a(0, String.format(Locale.US, "[%s] %s", cls.getSimpleName(), str), objArr);
}
public static boolean a(Throwable th) {
if (b) {
return a(2, z.a(th), new Object[0]);
}
return false;
}
}

View File

@@ -0,0 +1,304 @@
package com.tencent.bugly.proguard;
import android.content.Context;
import android.os.Process;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class y {
public static boolean a = true;
private static SimpleDateFormat b = null;
private static int c = 5120;
private static StringBuilder d = null;
private static StringBuilder e = null;
private static boolean f = false;
private static a g = null;
private static String h = null;
private static String i = null;
private static Context j = null;
private static String k = null;
private static boolean l = false;
private static boolean m = false;
private static ExecutorService n;
private static int o;
private static final Object p = new Object();
/* compiled from: BUGLY */
public static class a {
private boolean a;
private File b;
private String c;
private long d;
private long e = 30720;
public a(String str) {
if (str == null || str.equals("")) {
return;
}
this.c = str;
this.a = a();
}
/* JADX INFO: Access modifiers changed from: private */
public boolean a() {
try {
this.b = new File(this.c);
if (this.b.exists() && !this.b.delete()) {
this.a = false;
return false;
}
if (this.b.createNewFile()) {
return true;
}
this.a = false;
return false;
} catch (Throwable th) {
x.a(th);
this.a = false;
return false;
}
}
public final boolean a(String str) {
FileOutputStream fileOutputStream;
if (!this.a) {
return false;
}
try {
fileOutputStream = new FileOutputStream(this.b, true);
} catch (Throwable th) {
th = th;
fileOutputStream = null;
}
try {
fileOutputStream.write(str.getBytes("UTF-8"));
fileOutputStream.flush();
fileOutputStream.close();
this.d += r10.length;
this.a = true;
try {
fileOutputStream.close();
} catch (IOException unused) {
}
return true;
} catch (Throwable th2) {
th = th2;
try {
x.a(th);
this.a = false;
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException unused2) {
}
}
return false;
} catch (Throwable th3) {
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException unused3) {
}
}
throw th3;
}
}
}
}
static {
try {
b = new SimpleDateFormat("MM-dd HH:mm:ss");
} catch (Throwable unused) {
}
}
public static synchronized void a(Context context) {
synchronized (y.class) {
if (l || context == null || !a) {
return;
}
try {
n = Executors.newSingleThreadExecutor();
e = new StringBuilder(0);
d = new StringBuilder(0);
j = context;
com.tencent.bugly.crashreport.common.info.a a2 = com.tencent.bugly.crashreport.common.info.a.a(context);
h = a2.d;
a2.getClass();
i = "";
k = j.getFilesDir().getPath() + "/buglylog_" + h + "_" + i + ".txt";
o = Process.myPid();
} catch (Throwable unused) {
}
l = true;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static boolean d(String str, String str2, String str3) {
try {
com.tencent.bugly.crashreport.common.info.a b2 = com.tencent.bugly.crashreport.common.info.a.b();
if (b2 == null || b2.D == null) {
return false;
}
return b2.D.appendLogToNative(str, str2, str3);
} catch (Throwable th) {
if (x.a(th)) {
return false;
}
th.printStackTrace();
return false;
}
}
/* JADX INFO: Access modifiers changed from: private */
public static synchronized void e(String str, String str2, String str3) {
synchronized (y.class) {
long myTid = Process.myTid();
d.setLength(0);
if (str3.length() > 30720) {
str3 = str3.substring(str3.length() - 30720, str3.length() - 1);
}
Date date = new Date();
String format = b != null ? b.format(date) : date.toString();
StringBuilder sb = d;
sb.append(format);
sb.append(" ");
sb.append(o);
sb.append(" ");
sb.append(myTid);
sb.append(" ");
sb.append(str);
sb.append(" ");
sb.append(str2);
sb.append(": ");
sb.append(str3);
sb.append("\u0001\r\n");
String sb2 = d.toString();
synchronized (p) {
try {
e.append(sb2);
} catch (Throwable unused) {
}
if (e.length() <= c) {
return;
}
if (f) {
return;
}
f = true;
if (g == null) {
g = new a(k);
} else if (g.b == null || g.b.length() + e.length() > g.e) {
g.a();
}
if (g.a(e.toString())) {
e.setLength(0);
f = false;
}
}
}
}
private static String b() {
try {
com.tencent.bugly.crashreport.common.info.a b2 = com.tencent.bugly.crashreport.common.info.a.b();
if (b2 == null || b2.D == null) {
return null;
}
return b2.D.getLogFromNative();
} catch (Throwable th) {
if (x.a(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
public static void a(int i2) {
synchronized (p) {
c = i2;
if (i2 < 0) {
c = 0;
} else if (i2 > 10240) {
c = 10240;
}
}
}
public static void a(boolean z) {
x.a("[LogUtil] Whether can record user log into native: " + z, new Object[0]);
m = z;
}
public static void a(String str, String str2, Throwable th) {
if (th == null) {
return;
}
String message = th.getMessage();
if (message == null) {
message = "";
}
a(str, str2, message + '\n' + z.b(th));
}
public static synchronized void a(final String str, final String str2, final String str3) {
synchronized (y.class) {
if (l && a) {
try {
} catch (Exception e2) {
x.b(e2);
}
if (m) {
n.execute(new Runnable() { // from class: com.tencent.bugly.proguard.y.1
@Override // java.lang.Runnable
public final void run() {
if (y.d(str, str2, str3)) {
}
}
});
} else {
n.execute(new Runnable() { // from class: com.tencent.bugly.proguard.y.2
@Override // java.lang.Runnable
public final void run() {
y.e(str, str2, str3);
}
});
}
}
}
}
public static byte[] a() {
if (!a) {
return null;
}
if (m) {
x.a("[LogUtil] Get user log from native.", new Object[0]);
String b2 = b();
if (b2 != null) {
x.a("[LogUtil] Got user log from native: %d bytes", Integer.valueOf(b2.length()));
return z.a((File) null, b2, "BuglyNativeLog.txt");
}
}
StringBuilder sb = new StringBuilder();
synchronized (p) {
if (g != null && g.a && g.b != null && g.b.length() > 0) {
sb.append(z.a(g.b, 30720, true));
}
if (e != null && e.length() > 0) {
sb.append(e.toString());
}
}
return z.a((File) null, sb.toString(), "BuglyLog.txt");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
package com.tencent.connect;
import android.content.Context;
import com.tencent.connect.auth.QQToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.d;
import com.tencent.tauth.IUiListener;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class UserInfo extends BaseApi {
public UserInfo(Context context, QQToken qQToken) {
super(qQToken);
}
public void a(IUiListener iUiListener) {
HttpUtils.requestAsync(this.b, d.a(), "user/get_simple_userinfo", a(), "GET", new BaseApi.TempRequestListener(this, iUiListener));
}
}

View File

@@ -0,0 +1,85 @@
package com.tencent.connect.a;
import android.content.Context;
import com.tencent.connect.auth.QQToken;
import com.tencent.open.utils.e;
import java.lang.reflect.Method;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a {
private static Class<?> a = null;
private static Class<?> b = null;
private static Method c = null;
private static Method d = null;
private static Method e = null;
private static boolean f = false;
public static boolean a(Context context, QQToken qQToken) {
return e.a(context, qQToken.b()).b("Common_ta_enable");
}
public static void b(Context context, QQToken qQToken) {
try {
if (a(context, qQToken)) {
e.invoke(a, true);
} else {
e.invoke(a, false);
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
public static void c(Context context, QQToken qQToken) {
String str = "Aqc" + qQToken.b();
try {
a = Class.forName("com.tencent.stat.StatConfig");
b = Class.forName("com.tencent.stat.StatService");
c = b.getMethod("reportQQ", Context.class, String.class);
d = b.getMethod("trackCustomEvent", Context.class, String.class, String[].class);
b.getMethod("commitEvents", Context.class, Integer.TYPE);
e = a.getMethod("setEnableStatService", Boolean.TYPE);
b(context, qQToken);
a.getMethod("setAutoExceptionCaught", Boolean.TYPE).invoke(a, false);
a.getMethod("setEnableSmartReporting", Boolean.TYPE).invoke(a, true);
a.getMethod("setSendPeriodMinutes", Integer.TYPE).invoke(a, 1440);
Class<?> cls = Class.forName("com.tencent.stat.StatReportStrategy");
a.getMethod("setStatSendStrategy", cls).invoke(a, cls.getField("PERIOD").get(null));
Method method = b.getMethod("startStatService", Context.class, String.class, String.class);
Class<?> cls2 = b;
Object[] objArr = new Object[3];
objArr[0] = context;
objArr[1] = str;
objArr[2] = Class.forName("com.tencent.stat.common.StatConstants").getField("VERSION").get(null);
method.invoke(cls2, objArr);
f = true;
} catch (Exception e2) {
e2.printStackTrace();
}
}
public static void d(Context context, QQToken qQToken) {
if (f) {
b(context, qQToken);
if (qQToken.c() != null) {
try {
c.invoke(b, context, qQToken.c());
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}
public static void a(Context context, QQToken qQToken, String str, String... strArr) {
if (f) {
b(context, qQToken);
try {
d.invoke(b, context, str, strArr);
} catch (Exception e2) {
e2.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,531 @@
package com.tencent.connect.auth;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.facebook.AccessToken;
import com.tencent.connect.common.BaseApi;
import com.tencent.connect.common.UIListenerManager;
import com.tencent.open.SocialConstants;
import com.tencent.open.TDialog;
import com.tencent.open.a.f;
import com.tencent.open.b.d;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.e;
import com.tencent.open.utils.g;
import com.tencent.open.utils.h;
import com.tencent.open.utils.i;
import com.tencent.open.web.security.JniInterface;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.net.URLDecoder;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class AuthAgent extends BaseApi {
public static String f = "libwbsafeedit";
public static String g;
private IUiListener c;
private String d;
private WeakReference<Activity> e;
/* compiled from: ProGuard */
private class c implements IUiListener {
private final IUiListener a;
private final boolean b;
private final Context c;
public c(Context context, IUiListener iUiListener, boolean z, boolean z2) {
this.c = context;
this.a = iUiListener;
this.b = z;
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener()");
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onCancel");
this.a.onCancel();
f.b();
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete");
JSONObject jSONObject = (JSONObject) obj;
try {
String string = jSONObject.getString(AccessToken.ACCESS_TOKEN_KEY);
String string2 = jSONObject.getString(AccessToken.EXPIRES_IN_KEY);
String string3 = jSONObject.getString(SocialConstants.PARAM_OPEN_ID);
if (string != null && ((BaseApi) AuthAgent.this).b != null && string3 != null) {
((BaseApi) AuthAgent.this).b.a(string, string2);
((BaseApi) AuthAgent.this).b.a(string3);
com.tencent.connect.a.a.d(this.c, ((BaseApi) AuthAgent.this).b);
}
String string4 = jSONObject.getString("pf");
if (string4 != null) {
try {
this.c.getSharedPreferences("pfStore", 0).edit().putString("pf", string4).commit();
} catch (Exception e) {
e.printStackTrace();
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e);
}
}
if (this.b) {
CookieSyncManager.getInstance().sync();
}
} catch (JSONException e2) {
e2.printStackTrace();
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onComplete error", e2);
}
this.a.onComplete(jSONObject);
AuthAgent.this.releaseResource();
f.b();
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
f.b("openSDK_LOG.AuthAgent", "OpenUi, TokenListener() onError");
this.a.onError(uiError);
f.b();
}
}
static {
g = f + ".so";
String str = Build.CPU_ABI;
if (str == null || str.equals("")) {
f = "libwbsafeedit";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm(default) architecture");
return;
}
if (str.equalsIgnoreCase("arm64-v8a")) {
f = "libwbsafeedit_64";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm64-v8a architecture");
return;
}
if (str.equalsIgnoreCase("x86")) {
f = "libwbsafeedit_x86";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is x86 architecture");
return;
}
if (str.equalsIgnoreCase("x86_64")) {
f = "libwbsafeedit_x86_64";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is x86_64 architecture");
return;
}
f = "libwbsafeedit";
g = f + ".so";
f.c("openSDK_LOG.AuthAgent", "is arm(default) architecture");
}
public AuthAgent(QQToken qQToken) {
super(qQToken);
}
@Override // com.tencent.connect.common.BaseApi
public void releaseResource() {
this.c = null;
}
public int a(Activity activity, String str, IUiListener iUiListener) {
return a(activity, str, iUiListener, false, null);
}
public int a(Activity activity, String str, IUiListener iUiListener, boolean z, Fragment fragment) {
this.d = str;
this.e = new WeakReference<>(activity);
this.c = iUiListener;
if (!e.a(activity, this.b.b()).b("C_LoginWeb") && a(activity, fragment, z)) {
f.c("openSDK_LOG.AuthAgent", "OpenUi, showUi, return Constants.UI_ACTIVITY");
d.a().a(this.b.c(), this.b.b(), "2", "1", "5", "0", "0", "0");
return 1;
}
d.a().a(this.b.c(), this.b.b(), "2", "1", "5", "1", "0", "0");
f.d("openSDK_LOG.AuthAgent", "doLogin startActivity fail show dialog.");
this.c = new b(this.c);
return a(z, this.c);
}
private int a(boolean z, IUiListener iUiListener) {
f.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- start");
CookieSyncManager.createInstance(com.tencent.open.utils.d.a());
Bundle a = a();
if (z) {
a.putString("isadd", "1");
}
a.putString("scope", this.d);
a.putString("client_id", this.b.b());
if (BaseApi.isOEM) {
a.putString("pf", "desktop_m_qq-" + BaseApi.installChannel + "-android-" + BaseApi.registerChannel + "-" + BaseApi.businessId);
} else {
a.putString("pf", "openmobile_android");
}
String str = (System.currentTimeMillis() / 1000) + "";
a.putString("sign", g.b(com.tencent.open.utils.d.a(), str));
a.putString("time", str);
a.putString("display", "mobile");
a.putString("response_type", "token");
a.putString("redirect_uri", "auth://tauth.qq.com/");
a.putString("cancel_display", "1");
a.putString("switch", "1");
a.putString("status_userip", i.a());
final String str2 = com.tencent.open.utils.f.a().a(com.tencent.open.utils.d.a(), "https://openmobile.qq.com/oauth2.0/m_authorize?") + HttpUtils.encodeUrl(a);
final c cVar = new c(com.tencent.open.utils.d.a(), iUiListener, true, false);
f.b("openSDK_LOG.AuthAgent", "OpenUi, showDialog TDialog");
h.a(new Runnable() { // from class: com.tencent.connect.auth.AuthAgent.1
@Override // java.lang.Runnable
public void run() {
final Activity activity;
g.a(AuthAgent.f, AuthAgent.g, 3);
JniInterface.loadSo();
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
activity.runOnUiThread(new Runnable() { // from class: com.tencent.connect.auth.AuthAgent.1.1
@Override // java.lang.Runnable
public void run() {
if (!JniInterface.isJniOk) {
f.d("openSDK_LOG.AuthAgent", "OpenUi, secure so load failed, goto download QQ.");
TDialog tDialog = new TDialog(activity, "", AuthAgent.this.a(""), null, ((BaseApi) AuthAgent.this).b);
if (activity.isFinishing()) {
return;
}
tDialog.show();
return;
}
Activity activity2 = activity;
AnonymousClass1 anonymousClass1 = AnonymousClass1.this;
a aVar = new a(activity2, "action_login", str2, cVar, ((BaseApi) AuthAgent.this).b);
if (activity.isFinishing()) {
return;
}
aVar.show();
}
});
}
});
f.c("openSDK_LOG.AuthAgent", "OpenUi, showDialog -- end");
return 2;
}
/* compiled from: ProGuard */
private class b implements IUiListener {
IUiListener a;
/* compiled from: ProGuard */
private abstract class a implements View.OnClickListener {
Dialog a;
a(b bVar, Dialog dialog) {
this.a = dialog;
}
}
public b(IUiListener iUiListener) {
this.a = iUiListener;
}
private void a(String str, final IUiListener iUiListener, final Object obj) {
Activity activity;
PackageInfo packageInfo;
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(1);
PackageManager packageManager = activity.getPackageManager();
try {
packageInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
packageInfo = null;
}
Drawable loadIcon = packageInfo != null ? packageInfo.applicationInfo.loadIcon(packageManager) : null;
View.OnClickListener onClickListener = new a(dialog) { // from class: com.tencent.connect.auth.AuthAgent.b.1
@Override // android.view.View.OnClickListener
public void onClick(View view) {
b.this.a();
Dialog dialog2 = this.a;
if (dialog2 != null && dialog2.isShowing()) {
this.a.dismiss();
}
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
};
View.OnClickListener onClickListener2 = new a(this, dialog) { // from class: com.tencent.connect.auth.AuthAgent.b.2
@Override // android.view.View.OnClickListener
public void onClick(View view) {
Dialog dialog2 = this.a;
if (dialog2 != null && dialog2.isShowing()) {
this.a.dismiss();
}
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
};
ColorDrawable colorDrawable = new ColorDrawable();
colorDrawable.setAlpha(0);
dialog.getWindow().setBackgroundDrawable(colorDrawable);
dialog.setContentView(a(activity, loadIcon, str, onClickListener, onClickListener2));
dialog.setOnCancelListener(new DialogInterface.OnCancelListener(this) { // from class: com.tencent.connect.auth.AuthAgent.b.3
@Override // android.content.DialogInterface.OnCancelListener
public void onCancel(DialogInterface dialogInterface) {
IUiListener iUiListener2 = iUiListener;
if (iUiListener2 != null) {
iUiListener2.onComplete(obj);
}
}
});
if (activity == null || activity.isFinishing()) {
return;
}
dialog.show();
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onCancel();
}
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
JSONObject jSONObject;
String str;
if (obj == null || (jSONObject = (JSONObject) obj) == null) {
return;
}
try {
r2 = jSONObject.getInt("sendinstall") == 1;
str = jSONObject.getString("installwording");
} catch (JSONException unused) {
f.d("openSDK_LOG.AuthAgent", "FeedConfirmListener onComplete There is no value for sendinstall.");
str = "";
}
String decode = URLDecoder.decode(str);
f.a("openSDK_LOG.AuthAgent", " WORDING = " + decode + "xx");
if (r2 && !TextUtils.isEmpty(decode)) {
a(decode, this.a, obj);
return;
}
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onComplete(obj);
}
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
IUiListener iUiListener = this.a;
if (iUiListener != null) {
iUiListener.onError(uiError);
}
}
private Drawable a(String str, Context context) {
Bitmap bitmap;
try {
InputStream open = context.getApplicationContext().getAssets().open(str);
if (open == null) {
return null;
}
if (str.endsWith(".9.png")) {
try {
bitmap = BitmapFactory.decodeStream(open);
} catch (OutOfMemoryError e) {
e.printStackTrace();
bitmap = null;
}
if (bitmap == null) {
return null;
}
byte[] ninePatchChunk = bitmap.getNinePatchChunk();
NinePatch.isNinePatchChunk(ninePatchChunk);
return new NinePatchDrawable(bitmap, ninePatchChunk, new Rect(), null);
}
Drawable createFromStream = Drawable.createFromStream(open, str);
open.close();
return createFromStream;
} catch (IOException e2) {
e2.printStackTrace();
return null;
}
}
private View a(Context context, Drawable drawable, String str, View.OnClickListener onClickListener, View.OnClickListener onClickListener2) {
DisplayMetrics displayMetrics = new DisplayMetrics();
((WindowManager) context.getSystemService("window")).getDefaultDisplay().getMetrics(displayMetrics);
float f = displayMetrics.density;
RelativeLayout relativeLayout = new RelativeLayout(context);
ImageView imageView = new ImageView(context);
imageView.setImageDrawable(drawable);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setId(1);
int i = (int) (60.0f * f);
int i2 = (int) (f * 14.0f);
int i3 = (int) (18.0f * f);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(i, i);
layoutParams.addRule(9);
layoutParams.setMargins(0, i3, (int) (6.0f * f), i3);
relativeLayout.addView(imageView, layoutParams);
TextView textView = new TextView(context);
textView.setText(str);
textView.setTextSize(14.0f);
textView.setGravity(3);
textView.setIncludeFontPadding(false);
textView.setPadding(0, 0, 0, 0);
textView.setLines(2);
textView.setId(5);
textView.setMinWidth((int) (185.0f * f));
RelativeLayout.LayoutParams layoutParams2 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams2.addRule(1, 1);
layoutParams2.addRule(6, 1);
float f2 = 5.0f * f;
layoutParams2.setMargins(0, 0, (int) f2, 0);
relativeLayout.addView(textView, layoutParams2);
View view = new View(context);
view.setBackgroundColor(Color.rgb(214, 214, 214));
view.setId(3);
RelativeLayout.LayoutParams layoutParams3 = new RelativeLayout.LayoutParams(-2, 2);
layoutParams3.addRule(3, 1);
layoutParams3.addRule(5, 1);
layoutParams3.addRule(7, 5);
int i4 = (int) (12.0f * f);
layoutParams3.setMargins(0, 0, 0, i4);
relativeLayout.addView(view, layoutParams3);
LinearLayout linearLayout = new LinearLayout(context);
RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
layoutParams4.addRule(5, 1);
layoutParams4.addRule(7, 5);
layoutParams4.addRule(3, 3);
Button button = new Button(context);
button.setText("跳过");
button.setBackgroundDrawable(a("buttonNegt.png", context));
button.setTextColor(Color.rgb(36, 97, 131));
button.setTextSize(20.0f);
button.setOnClickListener(onClickListener2);
button.setId(4);
int i5 = (int) (45.0f * f);
LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams(0, i5);
layoutParams5.rightMargin = i2;
int i6 = (int) (4.0f * f);
layoutParams5.leftMargin = i6;
layoutParams5.weight = 1.0f;
linearLayout.addView(button, layoutParams5);
Button button2 = new Button(context);
button2.setText("确定");
button2.setTextSize(20.0f);
button2.setTextColor(Color.rgb(255, 255, 255));
button2.setBackgroundDrawable(a("buttonPost.png", context));
button2.setOnClickListener(onClickListener);
LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams(0, i5);
layoutParams6.weight = 1.0f;
layoutParams6.rightMargin = i6;
linearLayout.addView(button2, layoutParams6);
relativeLayout.addView(linearLayout, layoutParams4);
ViewGroup.LayoutParams layoutParams7 = new FrameLayout.LayoutParams((int) (279.0f * f), (int) (f * 163.0f));
relativeLayout.setPadding(i2, 0, i4, i4);
relativeLayout.setLayoutParams(layoutParams7);
relativeLayout.setBackgroundColor(Color.rgb(247, 251, 247));
PaintDrawable paintDrawable = new PaintDrawable(Color.rgb(247, 251, 247));
paintDrawable.setCornerRadius(f2);
relativeLayout.setBackgroundDrawable(paintDrawable);
return relativeLayout;
}
protected void a() {
Activity activity;
Bundle b = AuthAgent.this.b();
if (AuthAgent.this.e == null || (activity = (Activity) AuthAgent.this.e.get()) == null) {
return;
}
HttpUtils.requestAsync(((BaseApi) AuthAgent.this).b, activity, "http://appsupport.qq.com/cgi-bin/qzapps/mapp_addapp.cgi", b, "POST", null);
}
}
private boolean a(Activity activity, Fragment fragment, boolean z) {
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- start");
Intent b2 = b("com.tencent.open.agent.AgentActivity");
if (b2 != null) {
Bundle a = a();
if (z) {
a.putString("isadd", "1");
}
a.putString("scope", this.d);
a.putString("client_id", this.b.b());
if (BaseApi.isOEM) {
a.putString("pf", "desktop_m_qq-" + BaseApi.installChannel + "-android-" + BaseApi.registerChannel + "-" + BaseApi.businessId);
} else {
a.putString("pf", "openmobile_android");
}
a.putString("need_pay", "1");
a.putString("oauth_app_name", g.a(com.tencent.open.utils.d.a()));
b2.putExtra("key_action", "action_login");
b2.putExtra("key_params", a);
b2.putExtra(SocialConstants.PARAM_APP_ID, this.b.b());
if (a(b2)) {
this.c = new b(this.c);
UIListenerManager.a().a(11101, this.c);
if (fragment != null) {
f.b("openSDK_LOG.AuthAgent", "startAssitActivity fragment");
a(fragment, b2, 11101);
} else {
f.b("openSDK_LOG.AuthAgent", "startAssitActivity activity");
a(activity, b2, 11101);
}
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, found activity for loginIntent");
d.a().a(0, "LOGIN_CHECK_SDK", "1000", this.b.b(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "");
return true;
}
}
d.a().a(1, "LOGIN_CHECK_SDK", "1000", this.b.b(), "", Long.valueOf(SystemClock.elapsedRealtime()), 0, 1, "startActionActivity fail");
f.c("openSDK_LOG.AuthAgent", "startActionActivity() -- end, no target activity for loginIntent");
return false;
}
}

View File

@@ -0,0 +1,42 @@
package com.tencent.connect.auth;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class QQToken {
private String a;
private String b;
private String c;
private long d = -1;
public QQToken(String str) {
this.a = str;
}
public String a() {
return this.b;
}
public String b() {
return this.a;
}
public String c() {
return this.c;
}
public boolean d() {
return this.b != null && System.currentTimeMillis() < this.d;
}
public void a(String str, String str2) throws NumberFormatException {
this.b = str;
this.d = 0L;
if (str2 != null) {
this.d = System.currentTimeMillis() + (Long.parseLong(str2) * 1000);
}
}
public void a(String str) {
this.c = str;
}
}

View File

@@ -0,0 +1,557 @@
package com.tencent.connect.auth;
import android.R;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.tencent.connect.auth.b;
import com.tencent.open.SocialConstants;
import com.tencent.open.a.f;
import com.tencent.open.b.g;
import com.tencent.open.utils.HttpUtils;
import com.tencent.open.utils.i;
import com.tencent.open.web.security.JniInterface;
import com.tencent.open.web.security.SecureJsInterface;
import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class a extends Dialog {
private String a;
private b b;
private IUiListener c;
private Handler d;
private FrameLayout e;
private LinearLayout f;
private FrameLayout g;
private ProgressBar h;
private String i;
private com.tencent.open.c.c j;
private Context k;
private com.tencent.open.web.security.b l;
private boolean m;
private int n;
private String o;
private String p;
private long q;
private long r;
private HashMap<String, Runnable> s;
/* compiled from: ProGuard */
/* renamed from: com.tencent.connect.auth.a$a, reason: collision with other inner class name */
private class C0014a extends WebViewClient {
private C0014a() {
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
f.a("openSDK_LOG.AuthDialog", "-->onPageFinished, url: " + str);
a.this.g.setVisibility(8);
if (a.this.j != null) {
a.this.j.setVisibility(0);
}
if (TextUtils.isEmpty(str)) {
return;
}
a.this.d.removeCallbacks((Runnable) a.this.s.remove(str));
}
@Override // android.webkit.WebViewClient
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
f.a("openSDK_LOG.AuthDialog", "-->onPageStarted, url: " + str);
super.onPageStarted(webView, str, bitmap);
a.this.g.setVisibility(0);
a.this.q = SystemClock.elapsedRealtime();
if (!TextUtils.isEmpty(a.this.o)) {
a.this.d.removeCallbacks((Runnable) a.this.s.remove(a.this.o));
}
a.this.o = str;
a aVar = a.this;
d dVar = aVar.new d(aVar.o);
a.this.s.put(str, dVar);
a.this.d.postDelayed(dVar, 120000L);
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
f.c("openSDK_LOG.AuthDialog", "-->onReceivedError, errorCode: " + i + " | description: " + str);
if (!i.b(a.this.k)) {
a.this.b.onError(new UiError(9001, "当前网络不可用,请稍后重试!", str2));
a.this.dismiss();
return;
}
if (a.this.o.startsWith("http://qzs.qq.com/open/mobile/login/qzsjump.html?")) {
a.this.b.onError(new UiError(i, str, str2));
a.this.dismiss();
return;
}
long elapsedRealtime = SystemClock.elapsedRealtime() - a.this.q;
if (a.this.n >= 1 || elapsedRealtime >= a.this.r) {
a.this.j.loadUrl(a.this.a());
} else {
a.m(a.this);
a.this.d.postDelayed(new Runnable() { // from class: com.tencent.connect.auth.a.a.1
@Override // java.lang.Runnable
public void run() {
a.this.j.loadUrl(a.this.o);
}
}, 500L);
}
}
@Override // android.webkit.WebViewClient
@TargetApi(8)
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
f.e("openSDK_LOG.AuthDialog", "-->onReceivedSslError " + sslError.getPrimaryError() + "请求不合法,请检查手机安全设置,如系统时间、代理等");
sslErrorHandler.cancel();
a.this.b.onError(new UiError(sslError.getPrimaryError(), "请求不合法,请检查手机安全设置,如系统时间、代理等。", "ssl error"));
a.this.dismiss();
}
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
List<String> pathSegments;
f.a("openSDK_LOG.AuthDialog", "-->Redirect URL: " + str);
if (str.startsWith("auth://browser")) {
JSONObject c = i.c(str);
a aVar = a.this;
aVar.m = aVar.e();
if (!a.this.m) {
if (c.optString("fail_cb", null) != null) {
a.this.a(c.optString("fail_cb"), "");
} else if (c.optInt("fall_to_wv") == 1) {
a aVar2 = a.this;
a.a(aVar2, (Object) (aVar2.a.indexOf("?") > -1 ? "&" : "?"));
a.a(a.this, (Object) "browser_error=1");
a.this.j.loadUrl(a.this.a);
} else {
String optString = c.optString("redir", null);
if (optString != null) {
a.this.j.loadUrl(optString);
}
}
}
return true;
}
if (str.startsWith("auth://tauth.qq.com/")) {
a.this.b.onComplete(i.c(str));
a.this.dismiss();
return true;
}
if (str.startsWith("auth://cancel")) {
a.this.b.onCancel();
a.this.dismiss();
return true;
}
if (str.startsWith("auth://close")) {
a.this.dismiss();
return true;
}
if (str.startsWith("download://")) {
try {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(Uri.decode(str.substring(11))));
intent.addFlags(268435456);
a.this.k.startActivity(intent);
} catch (Exception e) {
f.b("openSDK_LOG.AuthDialog", "-->start download activity exception, e: ", e);
}
return true;
}
if (!str.startsWith("auth://progress")) {
if (str.startsWith("auth://onLoginSubmit")) {
try {
List<String> pathSegments2 = Uri.parse(str).getPathSegments();
if (!pathSegments2.isEmpty()) {
a.this.p = pathSegments2.get(0);
}
} catch (Exception unused) {
}
return true;
}
if (a.this.l.a(a.this.j, str)) {
return true;
}
f.c("openSDK_LOG.AuthDialog", "-->Redirect URL: return false");
return false;
}
try {
pathSegments = Uri.parse(str).getPathSegments();
} catch (Exception unused2) {
}
if (pathSegments.isEmpty()) {
return true;
}
int intValue = Integer.valueOf(pathSegments.get(0)).intValue();
if (intValue == 0) {
a.this.g.setVisibility(8);
a.this.j.setVisibility(0);
} else if (intValue == 1) {
a.this.g.setVisibility(0);
}
return true;
}
}
/* compiled from: ProGuard */
private class b implements IUiListener {
private String a;
String b;
private IUiListener c;
public b(String str, String str2, String str3, IUiListener iUiListener) {
this.a = str;
this.b = str2;
this.c = iUiListener;
}
@Override // com.tencent.tauth.IUiListener
public void onCancel() {
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onCancel();
this.c = null;
}
}
@Override // com.tencent.tauth.IUiListener
public void onComplete(Object obj) {
JSONObject jSONObject = (JSONObject) obj;
g.a().a(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, jSONObject.optInt("ret", -6), this.b, false);
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onComplete(jSONObject);
this.c = null;
}
}
@Override // com.tencent.tauth.IUiListener
public void onError(UiError uiError) {
String str;
if (uiError.b != null) {
str = uiError.b + this.b;
} else {
str = this.b;
}
g.a().a(this.a + "_H5", SystemClock.elapsedRealtime(), 0L, 0L, uiError.a, str, false);
a.this.a(str);
IUiListener iUiListener = this.c;
if (iUiListener != null) {
iUiListener.onError(uiError);
this.c = null;
}
}
/* JADX INFO: Access modifiers changed from: private */
public void a(String str) {
try {
onComplete(i.d(str));
} catch (JSONException e) {
e.printStackTrace();
onError(new UiError(-4, "服务器返回数据格式有误!", str));
}
}
}
/* compiled from: ProGuard */
private class c extends Handler {
private b a;
public c(b bVar, Looper looper) {
super(looper);
this.a = bVar;
}
@Override // android.os.Handler
public void handleMessage(Message message) {
int i = message.what;
if (i == 1) {
this.a.a((String) message.obj);
} else if (i == 2) {
this.a.onCancel();
} else {
if (i != 3) {
return;
}
a.b(a.this.k, (String) message.obj);
}
}
}
/* compiled from: ProGuard */
class d implements Runnable {
String a;
public d(String str) {
this.a = "";
this.a = str;
}
@Override // java.lang.Runnable
public void run() {
f.a("openSDK_LOG.AuthDialog", "-->timeoutUrl: " + this.a + " | mRetryUrl: " + a.this.o);
if (this.a.equals(a.this.o)) {
a.this.b.onError(new UiError(9002, "请求页面超时,请稍后重试!", a.this.o));
a.this.dismiss();
}
}
}
public a(Context context, String str, String str2, IUiListener iUiListener, QQToken qQToken) {
super(context, R.style.Theme.Translucent.NoTitleBar);
this.m = false;
this.q = 0L;
this.r = 30000L;
this.k = context;
this.a = str2;
this.b = new b(str, str2, qQToken.b(), iUiListener);
this.d = new c(this.b, context.getMainLooper());
this.c = iUiListener;
this.i = str;
this.l = new com.tencent.open.web.security.b();
getWindow().setSoftInputMode(32);
}
static /* synthetic */ int m(a aVar) {
int i = aVar.n;
aVar.n = i + 1;
return i;
}
@Override // android.app.Dialog, android.content.DialogInterface
public void dismiss() {
this.s.clear();
this.d.removeCallbacksAndMessages(null);
if (isShowing()) {
super.dismiss();
}
com.tencent.open.c.c cVar = this.j;
if (cVar != null) {
cVar.destroy();
this.j = null;
}
}
@Override // android.app.Dialog
public void onBackPressed() {
if (!this.m) {
this.b.onCancel();
}
super.onBackPressed();
}
@Override // android.app.Dialog
protected void onCreate(Bundle bundle) {
requestWindowFeature(1);
super.onCreate(bundle);
b();
d();
this.s = new HashMap<>();
}
@Override // android.app.Dialog
protected void onStop() {
super.onStop();
}
@SuppressLint({"SetJavaScriptEnabled"})
private void d() {
this.j.setVerticalScrollBarEnabled(false);
this.j.setHorizontalScrollBarEnabled(false);
this.j.setWebViewClient(new C0014a());
this.j.setWebChromeClient(new WebChromeClient());
this.j.clearFormData();
this.j.clearSslPreferences();
this.j.setOnLongClickListener(new View.OnLongClickListener(this) { // from class: com.tencent.connect.auth.a.1
@Override // android.view.View.OnLongClickListener
public boolean onLongClick(View view) {
return true;
}
});
this.j.setOnTouchListener(new View.OnTouchListener(this) { // from class: com.tencent.connect.auth.a.2
@Override // android.view.View.OnTouchListener
public boolean onTouch(View view, MotionEvent motionEvent) {
int action = motionEvent.getAction();
if ((action != 0 && action != 1) || view.hasFocus()) {
return false;
}
view.requestFocus();
return false;
}
});
WebSettings settings = this.j.getSettings();
settings.setSavePassword(false);
settings.setSaveFormData(false);
settings.setCacheMode(-1);
settings.setNeedInitialFocus(false);
settings.setBuiltInZoomControls(true);
settings.setSupportZoom(true);
settings.setRenderPriority(WebSettings.RenderPriority.HIGH);
settings.setJavaScriptEnabled(true);
settings.setDatabaseEnabled(true);
settings.setDatabasePath(this.k.getDir("databases", 0).getPath());
settings.setDomStorageEnabled(true);
f.a("openSDK_LOG.AuthDialog", "-->mUrl : " + this.a);
String str = this.a;
this.o = str;
this.j.loadUrl(str);
this.j.setVisibility(4);
this.j.getSettings().setSavePassword(false);
this.l.a(new SecureJsInterface(), "SecureJsInterface");
SecureJsInterface.isPWDEdit = false;
super.setOnDismissListener(new DialogInterface.OnDismissListener(this) { // from class: com.tencent.connect.auth.a.3
@Override // android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
try {
JniInterface.clearAllPWD();
} catch (Exception unused) {
}
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public boolean e() {
com.tencent.connect.auth.b b2 = com.tencent.connect.auth.b.b();
String a = b2.a();
String a2 = b2.a(new b.a());
String str = this.a;
String substring = str.substring(0, str.indexOf("?"));
Bundle b3 = i.b(this.a);
b3.putString("token_key", a);
b3.putString("serial", a2);
b3.putString("browser", "1");
this.a = substring + "?" + HttpUtils.encodeUrl(b3);
return i.a(this.k, this.a);
}
static /* synthetic */ String a(a aVar, Object obj) {
String str = aVar.a + obj;
aVar.a = str;
return str;
}
private void b() {
c();
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -1);
this.j = new com.tencent.open.c.c(this.k);
if (Build.VERSION.SDK_INT >= 11) {
this.j.setLayerType(1, null);
}
this.j.setLayoutParams(layoutParams);
this.e = new FrameLayout(this.k);
layoutParams.gravity = 17;
this.e.setLayoutParams(layoutParams);
this.e.addView(this.j);
this.e.addView(this.g);
setContentView(this.e);
}
private void c() {
TextView textView;
this.h = new ProgressBar(this.k);
this.h.setLayoutParams(new LinearLayout.LayoutParams(-2, -2));
this.f = new LinearLayout(this.k);
if (this.i.equals("action_login")) {
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
layoutParams.gravity = 16;
layoutParams.leftMargin = 5;
textView = new TextView(this.k);
if (Locale.getDefault().getLanguage().equals("zh")) {
textView.setText("登录中...");
} else {
textView.setText("Logging in...");
}
textView.setTextColor(Color.rgb(255, 255, 255));
textView.setTextSize(18.0f);
textView.setLayoutParams(layoutParams);
} else {
textView = null;
}
FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(-2, -2);
layoutParams2.gravity = 17;
this.f.setLayoutParams(layoutParams2);
this.f.addView(this.h);
if (textView != null) {
this.f.addView(textView);
}
this.g = new FrameLayout(this.k);
FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(-1, -2);
layoutParams3.leftMargin = 80;
layoutParams3.rightMargin = 80;
layoutParams3.topMargin = 40;
layoutParams3.bottomMargin = 40;
layoutParams3.gravity = 17;
this.g.setLayoutParams(layoutParams3);
this.g.setBackgroundResource(R.drawable.alert_dark_frame);
this.g.addView(this.f);
}
/* JADX INFO: Access modifiers changed from: private */
public String a(String str) {
StringBuilder sb = new StringBuilder(str);
if (!TextUtils.isEmpty(this.p) && this.p.length() >= 4) {
String str2 = this.p;
String substring = str2.substring(str2.length() - 4);
sb.append("_u_");
sb.append(substring);
}
return sb.toString();
}
/* JADX INFO: Access modifiers changed from: private */
public String a() {
String str = this.a;
String str2 = "http://qzs.qq.com/open/mobile/login/qzsjump.html?" + str.substring(str.indexOf("?") + 1);
f.c("openSDK_LOG.AuthDialog", "-->generateDownloadUrl, url: http://qzs.qq.com/open/mobile/login/qzsjump.html?");
return str2;
}
/* JADX INFO: Access modifiers changed from: private */
public static void b(Context context, String str) {
try {
JSONObject d2 = i.d(str);
int i = d2.getInt("type");
Toast.makeText(context.getApplicationContext(), d2.getString(SocialConstants.PARAM_SEND_MSG), i).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
public void a(String str, String str2) {
this.j.loadUrl("javascript:" + str + "(" + str2 + ");void(" + System.currentTimeMillis() + ");");
}
}

View File

@@ -0,0 +1,55 @@
package com.tencent.connect.auth;
import com.ubt.jimu.base.http.interceptor.CommonParamsInterceptor;
import java.util.HashMap;
/* compiled from: ProGuard */
/* loaded from: classes.dex */
public class b {
private static int b;
public static b c;
public HashMap<String, a> a = new HashMap<>();
/* compiled from: ProGuard */
public static class a {
}
static {
b.class.desiredAssertionStatus();
b = 0;
}
public static b b() {
if (c == null) {
c = new b();
}
return c;
}
public static int c() {
int i = b + 1;
b = i;
return i;
}
public String a(a aVar) {
int c2 = c();
try {
this.a.put("" + c2, aVar);
} catch (Throwable th) {
th.printStackTrace();
}
return "" + c2;
}
public String a() {
int ceil = (int) Math.ceil((Math.random() * 20.0d) + 3.0d);
char[] charArray = CommonParamsInterceptor.CHARACTER.toCharArray();
int length = charArray.length;
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < ceil; i++) {
stringBuffer.append(charArray[(int) (Math.random() * length)]);
}
return stringBuffer.toString();
}
}

Some files were not shown because too many files have changed in this diff Show More