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,40 @@
package com.baidu.uaq.agent.android.harvest.health;
import com.baidu.uaq.agent.android.UAQ;
import com.baidu.uaq.agent.android.g;
import org.json.JSONArray;
/* compiled from: AgentHealth.java */
/* loaded from: classes.dex */
public class a extends com.baidu.uaq.agent.android.harvest.type.c {
private static final UAQ c;
private final c b = new c();
static {
com.baidu.uaq.agent.android.logging.b.a();
c = UAQ.getInstance();
}
public static void a(Exception exc) {
if (c.getConfig().isCollectAgentHealth() && exc != null) {
g.a(new b(exc));
}
}
public void e() {
this.b.e();
}
public void a(b bVar) {
this.b.a(bVar);
}
@Override // com.baidu.uaq.agent.android.harvest.type.a
public JSONArray a() {
JSONArray jSONArray = new JSONArray();
if (!this.b.f()) {
jSONArray.put(this.b.d());
}
return jSONArray;
}
}

View File

@@ -0,0 +1,89 @@
package com.baidu.uaq.agent.android.harvest.health;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: AgentHealthException.java */
/* loaded from: classes.dex */
public class b extends com.baidu.uaq.agent.android.harvest.type.c {
private String b;
private String c;
private String d;
private StackTraceElement[] e;
private final AtomicLong f;
private Map<String, String> g;
public b(Exception exc) {
this(exc, Thread.currentThread().getName());
}
private JSONArray h() {
JSONArray jSONArray = new JSONArray();
for (StackTraceElement stackTraceElement : this.e) {
jSONArray.put(stackTraceElement.toString());
}
return jSONArray;
}
private JSONObject i() {
JSONObject jSONObject = new JSONObject();
try {
if (this.g != null) {
for (Map.Entry<String, String> entry : this.g.entrySet()) {
jSONObject.put(entry.getKey(), entry.getValue());
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject;
}
@Override // com.baidu.uaq.agent.android.harvest.type.a
public JSONArray a() {
JSONArray jSONArray = new JSONArray();
try {
jSONArray.put(0, this.b);
jSONArray.put(1, this.c != null ? this.c : "");
jSONArray.put(2, this.d);
jSONArray.put(3, h());
jSONArray.put(4, this.f.get());
jSONArray.put(5, i());
} catch (JSONException e) {
e.printStackTrace();
}
return jSONArray;
}
public String e() {
return this.b;
}
public StackTraceElement[] f() {
return this.e;
}
public void g() {
this.f.getAndIncrement();
}
public b(Exception exc, String str) {
this(exc.getClass().getName(), exc.getMessage(), str, exc.getStackTrace());
}
public b(String str, String str2, String str3, StackTraceElement[] stackTraceElementArr) {
this(str, str2, str3, stackTraceElementArr, null);
}
public b(String str, String str2, String str3, StackTraceElement[] stackTraceElementArr, Map<String, String> map) {
this.f = new AtomicLong(1L);
this.b = str;
this.c = str2;
this.d = str3;
this.e = stackTraceElementArr;
this.g = map;
}
}

View File

@@ -0,0 +1,54 @@
package com.baidu.uaq.agent.android.harvest.health;
import com.baidu.uaq.agent.android.harvest.type.d;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: AgentHealthExceptions.java */
/* loaded from: classes.dex */
public class c extends d {
private final Map<String, b> b = new ConcurrentHashMap();
public void a(b bVar) {
String str = bVar.e() + bVar.f()[0].toString();
synchronized (this.b) {
b bVar2 = this.b.get(str);
if (bVar2 == null) {
this.b.put(str, bVar);
} else {
bVar2.g();
}
}
}
@Override // com.baidu.uaq.agent.android.harvest.type.a
public JSONObject d() {
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
try {
Iterator<b> it = this.b.values().iterator();
while (it.hasNext()) {
jSONArray.put(it.next().a());
}
jSONObject.put("Type", "AgentErrors");
jSONObject.put("Data", jSONArray);
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject;
}
public void e() {
synchronized (this.b) {
this.b.clear();
}
}
public boolean f() {
return this.b.isEmpty();
}
}