jimu-decompiled/sources/com/baidu/uaq/agent/android/harvest/a.java
2025-05-13 19:24:51 +02:00

125 lines
4.4 KiB
Java

package com.baidu.uaq.agent.android.harvest;
import com.baidu.uaq.agent.android.UAQ;
import com.baidu.uaq.agent.android.harvest.bean.g;
import com.baidu.uaq.agent.android.harvest.bean.i;
import com.baidu.uaq.agent.android.harvest.bean.k;
import com.baidu.uaq.agent.android.harvest.type.c;
import com.unity3d.ads.metadata.MediationMetaData;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* compiled from: HarvestData.java */
/* loaded from: classes.dex */
public class a extends c {
private static final UAQ i = UAQ.getInstance();
private static final com.baidu.uaq.agent.android.logging.a j = com.baidu.uaq.agent.android.logging.b.a();
private com.baidu.uaq.agent.android.harvest.bean.c c;
private com.baidu.uaq.agent.android.harvest.bean.a e;
private com.baidu.uaq.agent.android.harvest.bean.b b = new com.baidu.uaq.agent.android.harvest.bean.b();
private com.baidu.uaq.agent.android.harvest.health.a d = new com.baidu.uaq.agent.android.harvest.health.a();
private k f = new k(new com.baidu.uaq.agent.android.transmission.lss.a());
private i g = new i(new com.baidu.uaq.agent.android.trace.lss.a());
private g h = new g();
private JSONObject l() throws JSONException {
JSONObject jSONObject = new JSONObject();
jSONObject.put("wanType", com.baidu.uaq.agent.android.a.c());
jSONObject.put("carrier", com.baidu.uaq.agent.android.a.d());
jSONObject.put("timestamp", System.currentTimeMillis());
i.getConfig().getChannel();
if (i.getConfig().isThingsMonitor()) {
if (this.h.e() > 0) {
jSONObject.put("resourceData", this.h.b());
}
jSONObject.put("gateToken", i.getConfig().getAPIKey());
}
return jSONObject;
}
@Override // com.baidu.uaq.agent.android.harvest.type.a
public JSONArray a() {
JSONArray jSONArray = new JSONArray();
try {
jSONArray.put(0, this.b.b());
if (i.isNeedBasicInfo()) {
jSONArray.put(1, h().b());
} else {
jSONArray.put(1, new JSONArray());
}
jSONArray.put(2, this.g.b());
jSONArray.put(3, new JSONArray());
JSONArray jSONArray2 = new JSONArray();
for (Map.Entry<String, com.baidu.uaq.agent.android.metric.a> entry : com.baidu.uaq.agent.android.stats.a.b().a().entrySet()) {
JSONArray jSONArray3 = new JSONArray();
com.baidu.uaq.agent.android.metric.a value = entry.getValue();
JSONObject jSONObject = new JSONObject();
jSONObject.put(MediationMetaData.KEY_NAME, value.f());
jSONObject.put("scope", value.e());
jSONArray3.put(jSONObject);
jSONArray3.put(value.d());
jSONArray2.put(jSONArray3);
}
jSONArray.put(4, jSONArray2);
jSONArray.put(5, new JSONObject());
jSONArray.put(6, new JSONArray());
jSONArray.put(7, this.d.b());
if (i.isNeedBasicInfo()) {
jSONArray.put(8, i().b());
} else {
jSONArray.put(8, new JSONArray());
}
jSONArray.put(9, new JSONArray());
jSONArray.put(10, this.f.b());
jSONArray.put(11, l());
} catch (JSONException e) {
j.a("Caught error while HarvestData asJSONArray: ", e);
com.baidu.uaq.agent.android.harvest.health.a.a(e);
}
return jSONArray;
}
public com.baidu.uaq.agent.android.harvest.health.a e() {
return this.d;
}
public i f() {
return this.g;
}
public g g() {
return this.h;
}
public com.baidu.uaq.agent.android.harvest.bean.c h() {
if (this.c == null) {
this.c = com.baidu.uaq.agent.android.a.e();
}
return this.c;
}
public com.baidu.uaq.agent.android.harvest.bean.a i() {
if (this.e == null) {
this.e = com.baidu.uaq.agent.android.a.f();
}
return this.e;
}
public com.baidu.uaq.agent.android.harvest.bean.b j() {
return this.b;
}
public void k() {
this.d.e();
}
public void a(com.baidu.uaq.agent.android.harvest.bean.b bVar) {
if (bVar == null) {
return;
}
this.b = bVar;
}
}