Initial commit
This commit is contained in:
124
sources/com/baidu/uaq/agent/android/harvest/a.java
Normal file
124
sources/com/baidu/uaq/agent/android/harvest/a.java
Normal file
@@ -0,0 +1,124 @@
|
||||
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;
|
||||
}
|
||||
}
|
46
sources/com/baidu/uaq/agent/android/harvest/b.java
Normal file
46
sources/com/baidu/uaq/agent/android/harvest/b.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package com.baidu.uaq.agent.android.harvest;
|
||||
|
||||
/* compiled from: HarvestResponse.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class b {
|
||||
private int a;
|
||||
private String b;
|
||||
private long c;
|
||||
|
||||
public boolean a() {
|
||||
return this.a == 200;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
int i = this.a;
|
||||
return i == 200 || i == 201 || i == 202 || i == 203 || i == 204 || i == 205 || i == 206 || i == 207 || i == 208;
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public long d() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean f() {
|
||||
return this.a != 200;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.a = i;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.c = j;
|
||||
}
|
||||
}
|
48
sources/com/baidu/uaq/agent/android/harvest/bean/a.java
Normal file
48
sources/com/baidu/uaq/agent/android/harvest/bean/a.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* compiled from: ApplicationInformation.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class a extends com.baidu.uaq.agent.android.harvest.type.c {
|
||||
private static final com.baidu.uaq.agent.android.logging.a e = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private String b;
|
||||
private String c;
|
||||
private String d;
|
||||
|
||||
public a(String str, String str2, String str3) {
|
||||
this.b = str;
|
||||
this.c = str2;
|
||||
this.d = str3;
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONArray a() {
|
||||
JSONArray jSONArray = new JSONArray();
|
||||
try {
|
||||
a(this.b);
|
||||
jSONArray.put(0, this.b);
|
||||
a(this.c);
|
||||
jSONArray.put(1, this.c);
|
||||
a(this.d);
|
||||
jSONArray.put(2, this.d);
|
||||
} catch (JSONException e2) {
|
||||
e.a("Caught error while ApplicationInformation asJSONArray", e2);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e2);
|
||||
}
|
||||
return jSONArray;
|
||||
}
|
||||
|
||||
public String e() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public String f() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public String g() {
|
||||
return this.b;
|
||||
}
|
||||
}
|
71
sources/com/baidu/uaq/agent/android/harvest/bean/b.java
Normal file
71
sources/com/baidu/uaq/agent/android/harvest/bean/b.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* compiled from: DataToken.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class b extends com.baidu.uaq.agent.android.harvest.type.c {
|
||||
private static final com.baidu.uaq.agent.android.logging.a d = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private long b;
|
||||
private long c;
|
||||
|
||||
public b() {
|
||||
}
|
||||
|
||||
@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);
|
||||
} catch (JSONException e) {
|
||||
d.a("Caught error while DataToken asJSONArray: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
return jSONArray;
|
||||
}
|
||||
|
||||
public void b(long j) {
|
||||
this.c = j;
|
||||
}
|
||||
|
||||
public long e() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || b.class != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
b bVar = (b) obj;
|
||||
return this.b == bVar.b && this.c == bVar.c;
|
||||
}
|
||||
|
||||
public long f() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
long j = this.b;
|
||||
int i = ((int) (j ^ (j >>> 32))) * 31;
|
||||
long j2 = this.c;
|
||||
return i + ((int) (j2 ^ (j2 >>> 32)));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "DataToken{accountId=" + this.b + ", agentId=" + this.c + '}';
|
||||
}
|
||||
|
||||
public b(long j, long j2) {
|
||||
this.b = j;
|
||||
this.c = j2;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.b = j;
|
||||
}
|
||||
}
|
147
sources/com/baidu/uaq/agent/android/harvest/bean/c.java
Normal file
147
sources/com/baidu/uaq/agent/android/harvest/bean/c.java
Normal file
@@ -0,0 +1,147 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: DeviceInformation.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class c extends com.baidu.uaq.agent.android.harvest.type.c {
|
||||
private static final com.baidu.uaq.agent.android.logging.a o = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private String b;
|
||||
private String c;
|
||||
private String d;
|
||||
private String 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 boolean n = false;
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONArray a() {
|
||||
JSONArray jSONArray = new JSONArray();
|
||||
try {
|
||||
a(this.b);
|
||||
jSONArray.put(0, this.b);
|
||||
a(this.c);
|
||||
jSONArray.put(1, this.c);
|
||||
a(this.d);
|
||||
a(this.e);
|
||||
jSONArray.put(2, this.d + " " + this.e);
|
||||
a(this.f);
|
||||
jSONArray.put(3, this.f);
|
||||
a(this.g);
|
||||
jSONArray.put(4, this.g);
|
||||
a(this.h);
|
||||
jSONArray.put(5, this.h);
|
||||
jSONArray.put(6, "");
|
||||
jSONArray.put(7, "");
|
||||
jSONArray.put(8, this.d);
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
jSONObject.put("size", this.i);
|
||||
jSONObject.put("CUID", this.j);
|
||||
jSONArray.put(9, jSONObject);
|
||||
} catch (JSONException e) {
|
||||
o.a("Caught error while DeviceInformation asJSONArray: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
return jSONArray;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
public void c(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public void d(String str) {
|
||||
this.d = str;
|
||||
}
|
||||
|
||||
public void e(String str) {
|
||||
this.e = str;
|
||||
}
|
||||
|
||||
public void f(String str) {
|
||||
this.f = str;
|
||||
}
|
||||
|
||||
public void g(String str) {
|
||||
this.g = str;
|
||||
}
|
||||
|
||||
public void h(String str) {
|
||||
this.h = str;
|
||||
}
|
||||
|
||||
public void i(String str) {
|
||||
this.k = str;
|
||||
}
|
||||
|
||||
public void j(String str) {
|
||||
this.l = str;
|
||||
}
|
||||
|
||||
public void k(String str) {
|
||||
this.m = str;
|
||||
}
|
||||
|
||||
public String l() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public String m() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public String n() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public String e() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public String f() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public String g() {
|
||||
return this.m;
|
||||
}
|
||||
|
||||
public String h() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
public String i() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
public boolean j() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
public String k() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public void l(String str) {
|
||||
this.i = str;
|
||||
}
|
||||
|
||||
public void m(String str) {
|
||||
this.j = str;
|
||||
}
|
||||
|
||||
public void a(boolean z) {
|
||||
this.n = z;
|
||||
}
|
||||
}
|
55
sources/com/baidu/uaq/agent/android/harvest/bean/d.java
Normal file
55
sources/com/baidu/uaq/agent/android/harvest/bean/d.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
/* compiled from: EnvironmentInformation.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class d {
|
||||
private long a;
|
||||
private int b;
|
||||
private String c;
|
||||
private long[] d;
|
||||
|
||||
public d() {
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.a = j;
|
||||
}
|
||||
|
||||
public String b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void b(String str) {
|
||||
}
|
||||
|
||||
public long[] c() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public d(long j, int i, String str, String str2, long[] jArr) {
|
||||
this.a = j;
|
||||
this.b = i;
|
||||
this.c = str;
|
||||
this.d = jArr;
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.b = i;
|
||||
}
|
||||
|
||||
public void a(String str) {
|
||||
this.c = str;
|
||||
}
|
||||
|
||||
public void a(long[] jArr) {
|
||||
this.d = jArr;
|
||||
}
|
||||
|
||||
public long a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
38
sources/com/baidu/uaq/agent/android/harvest/bean/f.java
Normal file
38
sources/com/baidu/uaq/agent/android/harvest/bean/f.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: ResourceData.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class f extends com.baidu.uaq.agent.android.harvest.type.d {
|
||||
private static final com.baidu.uaq.agent.android.logging.a d = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private long b;
|
||||
private JSONObject c = new JSONObject();
|
||||
|
||||
public void a(String str, Object obj) {
|
||||
try {
|
||||
this.c.put(str, obj);
|
||||
} catch (JSONException e) {
|
||||
d.a("Caught error while addResourceValue: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONObject d() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("timestamp", this.b);
|
||||
jSONObject.put("value", this.c);
|
||||
} catch (JSONException e) {
|
||||
d.a("Caught error while ResourceData asJSONObject: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
return jSONObject;
|
||||
}
|
||||
|
||||
public void a(long j) {
|
||||
this.b = j;
|
||||
}
|
||||
}
|
67
sources/com/baidu/uaq/agent/android/harvest/bean/g.java
Normal file
67
sources/com/baidu/uaq/agent/android/harvest/bean/g.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: ResourceDatas.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class g extends com.baidu.uaq.agent.android.harvest.type.d {
|
||||
private static final com.baidu.uaq.agent.android.logging.a c = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private static final UAQ d = UAQ.getInstance();
|
||||
private final List<f> b = new ArrayList();
|
||||
|
||||
public static void b(f fVar) {
|
||||
if (d.getConfig().isThingsMonitor()) {
|
||||
com.baidu.uaq.agent.android.g.a(fVar);
|
||||
}
|
||||
}
|
||||
|
||||
private List<f> f() {
|
||||
synchronized (this) {
|
||||
if (this.b.size() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(this.b);
|
||||
this.b.clear();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(f fVar) {
|
||||
this.b.add(fVar);
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONObject d() {
|
||||
JSONObject jSONObject = new JSONObject();
|
||||
try {
|
||||
jSONObject.put("cycle", 10);
|
||||
jSONObject.put("resourcearray", a());
|
||||
} catch (JSONException e) {
|
||||
c.a("Caught error while ResourceDatas asJSONObject: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
return jSONObject;
|
||||
}
|
||||
|
||||
public int e() {
|
||||
return this.b.size();
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONArray a() {
|
||||
List<f> f = f();
|
||||
JSONArray jSONArray = new JSONArray();
|
||||
Iterator<f> it = f.iterator();
|
||||
while (it.hasNext()) {
|
||||
jSONArray.put(it.next().b());
|
||||
}
|
||||
return jSONArray;
|
||||
}
|
||||
}
|
27
sources/com/baidu/uaq/agent/android/harvest/bean/h.java
Normal file
27
sources/com/baidu/uaq/agent/android/harvest/bean/h.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: Trace.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class h extends com.baidu.uaq.agent.android.harvest.type.d {
|
||||
private static final com.baidu.uaq.agent.android.logging.a c = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private String b;
|
||||
|
||||
public h(String str) {
|
||||
this.b = str;
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
/* renamed from: e, reason: merged with bridge method [inline-methods] */
|
||||
public JSONObject b() {
|
||||
try {
|
||||
return new JSONObject(this.b);
|
||||
} catch (JSONException e) {
|
||||
c.a("Caught error while Transmission asJSONObject: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
51
sources/com/baidu/uaq/agent/android/harvest/bean/i.java
Normal file
51
sources/com/baidu/uaq/agent/android/harvest/bean/i.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: Traces.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class i extends com.baidu.uaq.agent.android.harvest.type.d {
|
||||
private static final UAQ d;
|
||||
private final List<h> b = new ArrayList();
|
||||
private com.baidu.uaq.agent.android.trace.a c;
|
||||
|
||||
static {
|
||||
com.baidu.uaq.agent.android.logging.b.a();
|
||||
d = UAQ.getInstance();
|
||||
}
|
||||
|
||||
public i(com.baidu.uaq.agent.android.trace.a aVar) {
|
||||
this.c = aVar;
|
||||
}
|
||||
|
||||
public static void b(h hVar) {
|
||||
if (d.getConfig().isEnableTrace()) {
|
||||
com.baidu.uaq.agent.android.g.a(hVar);
|
||||
}
|
||||
}
|
||||
|
||||
private List<h> e() {
|
||||
synchronized (this) {
|
||||
if (this.b.size() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(this.b);
|
||||
this.b.clear();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(h hVar) {
|
||||
this.b.add(hVar);
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONObject d() {
|
||||
List<h> e = e();
|
||||
return e.size() != 0 ? this.c.a(e) : new JSONObject();
|
||||
}
|
||||
}
|
23
sources/com/baidu/uaq/agent/android/harvest/bean/j.java
Normal file
23
sources/com/baidu/uaq/agent/android/harvest/bean/j.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: Transmission.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class j extends com.baidu.uaq.agent.android.harvest.type.d {
|
||||
private static final com.baidu.uaq.agent.android.logging.a c = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private String b;
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
/* renamed from: e, reason: merged with bridge method [inline-methods] */
|
||||
public JSONObject b() {
|
||||
try {
|
||||
return new JSONObject(this.b);
|
||||
} catch (JSONException e) {
|
||||
c.a("Caught error while Transmission asJSONObject: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
40
sources/com/baidu/uaq/agent/android/harvest/bean/k.java
Normal file
40
sources/com/baidu/uaq/agent/android/harvest/bean/k.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.baidu.uaq.agent.android.harvest.bean;
|
||||
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
|
||||
/* compiled from: Transmissions.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class k extends com.baidu.uaq.agent.android.harvest.type.c {
|
||||
private final List<j> b = new ArrayList();
|
||||
private com.baidu.uaq.agent.android.transmission.a c;
|
||||
|
||||
static {
|
||||
com.baidu.uaq.agent.android.logging.b.a();
|
||||
UAQ.getInstance();
|
||||
}
|
||||
|
||||
public k(com.baidu.uaq.agent.android.transmission.a aVar) {
|
||||
this.c = aVar;
|
||||
}
|
||||
|
||||
private List<j> e() {
|
||||
synchronized (this) {
|
||||
if (this.b.size() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
ArrayList arrayList = new ArrayList(this.b);
|
||||
this.b.clear();
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.baidu.uaq.agent.android.harvest.type.a
|
||||
public JSONArray a() {
|
||||
List<j> e = e();
|
||||
return e.size() != 0 ? this.c.a(e) : new JSONArray();
|
||||
}
|
||||
}
|
40
sources/com/baidu/uaq/agent/android/harvest/health/a.java
Normal file
40
sources/com/baidu/uaq/agent/android/harvest/health/a.java
Normal 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;
|
||||
}
|
||||
}
|
89
sources/com/baidu/uaq/agent/android/harvest/health/b.java
Normal file
89
sources/com/baidu/uaq/agent/android/harvest/health/b.java
Normal 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;
|
||||
}
|
||||
}
|
54
sources/com/baidu/uaq/agent/android/harvest/health/c.java
Normal file
54
sources/com/baidu/uaq/agent/android/harvest/health/c.java
Normal 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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,93 @@
|
||||
package com.baidu.uaq.agent.android.harvest.multiharvest;
|
||||
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadConfigure;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* compiled from: MultiHarvest.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class a {
|
||||
private static final com.baidu.uaq.agent.android.logging.a e = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private static a f = new a();
|
||||
private Context a;
|
||||
private c b;
|
||||
private final ArrayList<c> c = new ArrayList<>();
|
||||
private int d = 0;
|
||||
|
||||
public static a c() {
|
||||
return f;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
if (this.b == null) {
|
||||
APMUploadConfigure aPMUploadConfigure = new APMUploadConfigure(APMUploadConfigure.APMUPLOADNAME, "", null);
|
||||
com.baidu.uaq.agent.android.customtransmission.b.a(aPMUploadConfigure);
|
||||
this.b = new c(this.a, aPMUploadConfigure);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(Context context) {
|
||||
this.a = b(context);
|
||||
this.d++;
|
||||
if (this.d == 1) {
|
||||
d();
|
||||
this.b.c();
|
||||
}
|
||||
e.d("MultiHarvest start one time, instanceNumber now is " + this.d);
|
||||
}
|
||||
|
||||
public synchronized void b() {
|
||||
this.d--;
|
||||
if (this.d == 0) {
|
||||
synchronized (this.c) {
|
||||
Iterator<c> it = this.c.iterator();
|
||||
while (it.hasNext()) {
|
||||
c next = it.next();
|
||||
next.d();
|
||||
next.a().a();
|
||||
next.a().b();
|
||||
}
|
||||
this.c.clear();
|
||||
}
|
||||
com.baidu.uaq.agent.android.a.h();
|
||||
com.baidu.uaq.agent.android.customtransmission.b.a().clear();
|
||||
com.baidu.uaq.agent.android.customtransmission.b.b().clear();
|
||||
if (this.b != null) {
|
||||
this.b.d();
|
||||
this.b.a().a();
|
||||
this.b.a().b();
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
e.d("MultiHarvest stop one time, instanceNumber now is " + this.d);
|
||||
}
|
||||
|
||||
public void a(APMUploadConfigure aPMUploadConfigure) {
|
||||
if (com.baidu.uaq.agent.android.customtransmission.b.a().containsKey(aPMUploadConfigure.getUploadName())) {
|
||||
e.d("addUploadCofigure already exists:" + aPMUploadConfigure.getUploadName() + " size:" + com.baidu.uaq.agent.android.customtransmission.b.a().size());
|
||||
com.baidu.uaq.agent.android.customtransmission.b.a(aPMUploadConfigure);
|
||||
return;
|
||||
}
|
||||
com.baidu.uaq.agent.android.customtransmission.b.a(aPMUploadConfigure);
|
||||
e.d("addUploadCofigure:" + aPMUploadConfigure.getUploadName());
|
||||
f.b(aPMUploadConfigure);
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
private void b(APMUploadConfigure aPMUploadConfigure) {
|
||||
c cVar = new c(this.a, aPMUploadConfigure);
|
||||
cVar.c();
|
||||
synchronized (this.c) {
|
||||
this.c.add(cVar);
|
||||
}
|
||||
}
|
||||
|
||||
private static Context b(Context context) {
|
||||
return !(context instanceof Application) ? context.getApplicationContext() : context;
|
||||
}
|
||||
}
|
229
sources/com/baidu/uaq/agent/android/harvest/multiharvest/b.java
Normal file
229
sources/com/baidu/uaq/agent/android/harvest/multiharvest/b.java
Normal file
@@ -0,0 +1,229 @@
|
||||
package com.baidu.uaq.agent.android.harvest.multiharvest;
|
||||
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadConfigure;
|
||||
import com.baidu.uaq.agent.android.util.e;
|
||||
import com.baidu.uaq.agent.android.util.h;
|
||||
import com.baidu.uaq.agent.android.util.l;
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||
import org.apache.http.conn.scheme.Scheme;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
|
||||
import org.apache.http.params.BasicHttpParams;
|
||||
import org.apache.http.params.HttpConnectionParams;
|
||||
|
||||
/* compiled from: MultiHarvestConnection.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class b {
|
||||
private static final com.baidu.uaq.agent.android.logging.a b = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private static final UAQ c = UAQ.getInstance();
|
||||
private HttpClient a;
|
||||
|
||||
private void a() {
|
||||
int convert = (int) TimeUnit.MILLISECONDS.convert(20L, TimeUnit.SECONDS);
|
||||
BasicHttpParams basicHttpParams = new BasicHttpParams();
|
||||
HttpConnectionParams.setConnectionTimeout(basicHttpParams, convert);
|
||||
HttpConnectionParams.setSoTimeout(basicHttpParams, convert);
|
||||
HttpConnectionParams.setTcpNoDelay(basicHttpParams, true);
|
||||
HttpConnectionParams.setSocketBufferSize(basicHttpParams, UnityActivity.BLOCKLY_TYPE_NONE);
|
||||
SchemeRegistry schemeRegistry = new SchemeRegistry();
|
||||
schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
|
||||
schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
|
||||
this.a = new DefaultHttpClient(new ThreadSafeClientConnManager(basicHttpParams, schemeRegistry), basicHttpParams);
|
||||
}
|
||||
|
||||
private HttpPost b(String str, APMUploadConfigure aPMUploadConfigure) {
|
||||
return a(str, "deflate", aPMUploadConfigure);
|
||||
}
|
||||
|
||||
private String c(String str) {
|
||||
return (c.getConfig().isUseSsl() ? "https://" : "http://") + c.getConfig().getCollectorHost() + (":" + c.getConfig().getCollectorPort()) + str;
|
||||
}
|
||||
|
||||
private HttpPost b(String str) {
|
||||
return a(b(), str, "gzip");
|
||||
}
|
||||
|
||||
private String b() {
|
||||
return c("/sdk_push_stat");
|
||||
}
|
||||
|
||||
public com.baidu.uaq.agent.android.harvest.b a(String str, APMUploadConfigure aPMUploadConfigure) {
|
||||
if (str != null) {
|
||||
l.a("MultiHarvest sendData = " + str);
|
||||
HttpPost b2 = b(str.replace("\\/", "/"), aPMUploadConfigure);
|
||||
if (b2 != null) {
|
||||
long contentLength = b2.getEntity().getContentLength();
|
||||
b.d("HarvestSize = " + contentLength + "bytes");
|
||||
com.baidu.uaq.agent.android.stats.a.b().b("Supportability/AgentHealth/Collector/HarvestSize", contentLength);
|
||||
}
|
||||
return a(b2);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public com.baidu.uaq.agent.android.harvest.b a(String str) {
|
||||
if (str != null) {
|
||||
l.a("MultiHarvest sendData = " + str);
|
||||
HttpPost b2 = b(str.replace("\\/", "/") + "\n");
|
||||
if (b2 != null) {
|
||||
long contentLength = b2.getEntity().getContentLength();
|
||||
b.d("HarvestSize = " + contentLength + "bytes");
|
||||
com.baidu.uaq.agent.android.stats.a.b().b("Supportability/AgentHealth/Collector/HarvestSize", contentLength);
|
||||
}
|
||||
return a(b2);
|
||||
}
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
private HttpPost a(String str, String str2, APMUploadConfigure aPMUploadConfigure) {
|
||||
String url = aPMUploadConfigure.getUrl();
|
||||
b.d("MultiHarvest POST <uri> = " + url);
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
HashMap<String, String> headerMap = aPMUploadConfigure.getHeaderMap();
|
||||
if (headerMap.size() <= 0) {
|
||||
b.a("Http header is null");
|
||||
}
|
||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||
httpPost.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
if (c.getConfig().getAPIKey() == null) {
|
||||
b.a("Cannot create POST without an Application Token.");
|
||||
return null;
|
||||
}
|
||||
if ("deflate".equals(str2)) {
|
||||
httpPost.setEntity(new ByteArrayEntity(com.baidu.uaq.agent.android.util.b.a(str)));
|
||||
} else {
|
||||
try {
|
||||
httpPost.setEntity(new StringEntity(str, "utf-8"));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
b.a("UTF-8 is unsupported");
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
return httpPost;
|
||||
}
|
||||
|
||||
private HttpPost a(String str, String str2, String str3) {
|
||||
String a;
|
||||
b.d("MultiHarvest POST <uri> = " + str);
|
||||
HttpPost httpPost = new HttpPost(str);
|
||||
httpPost.addHeader("Content-Type", "application/json");
|
||||
httpPost.addHeader("Content-Encoding", str3);
|
||||
if (System.getProperty("http.agent") != null) {
|
||||
httpPost.addHeader("User-Agent", System.getProperty("http.agent").trim());
|
||||
}
|
||||
httpPost.addHeader("X-UAQ-WanType", com.baidu.uaq.agent.android.a.c());
|
||||
try {
|
||||
String cuid = c.getConfig().getCuid();
|
||||
if (cuid.equals("null")) {
|
||||
com.baidu.uaq.agent.android.harvest.bean.c a2 = com.baidu.uaq.agent.android.a.a().a();
|
||||
if (a2.j()) {
|
||||
a = a2.l();
|
||||
} else {
|
||||
a = e.a(a2.l());
|
||||
}
|
||||
httpPost.addHeader("X-UAQ-UUID", a);
|
||||
} else {
|
||||
httpPost.addHeader("X-UAQ-UUID", e.a(cuid));
|
||||
}
|
||||
httpPost.addHeader("X-UAQ-Channel", e.a(c.getConfig().getChannel()));
|
||||
} catch (Exception e) {
|
||||
b.a("Caught error while createPost AES: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
if (c.getConfig().getAPIKey() == null) {
|
||||
b.a("Cannot create POST without an Application Token.");
|
||||
return null;
|
||||
}
|
||||
httpPost.addHeader("X-App-License-Key", c.getConfig().getAPIKey());
|
||||
if ("deflate".equals(str3)) {
|
||||
httpPost.setEntity(new ByteArrayEntity(com.baidu.uaq.agent.android.util.b.a(str2)));
|
||||
} else if ("gzip".equals(str3)) {
|
||||
httpPost.setEntity(new ByteArrayEntity(com.baidu.uaq.agent.android.util.b.a(str2, "utf-8")));
|
||||
} else {
|
||||
try {
|
||||
httpPost.setEntity(new StringEntity(str2, "utf-8"));
|
||||
} catch (UnsupportedEncodingException e2) {
|
||||
b.a("UTF-8 is unsupported");
|
||||
throw new IllegalArgumentException(e2);
|
||||
}
|
||||
}
|
||||
return httpPost;
|
||||
}
|
||||
|
||||
private com.baidu.uaq.agent.android.harvest.b a(HttpPost httpPost) {
|
||||
if (httpPost == null) {
|
||||
b.a("Failed to send POST to collector");
|
||||
return null;
|
||||
}
|
||||
com.baidu.uaq.agent.android.harvest.b bVar = new com.baidu.uaq.agent.android.harvest.b();
|
||||
try {
|
||||
com.baidu.uaq.agent.android.stats.b bVar2 = new com.baidu.uaq.agent.android.stats.b();
|
||||
bVar2.a();
|
||||
if (this.a == null) {
|
||||
a();
|
||||
}
|
||||
HttpResponse execute = this.a.execute(httpPost);
|
||||
bVar.a(bVar2.b());
|
||||
bVar.a(execute.getStatusLine().getStatusCode());
|
||||
try {
|
||||
bVar.a(a(execute));
|
||||
} catch (IOException e) {
|
||||
b.a("Failed to retrieve collector response: ", e);
|
||||
}
|
||||
return bVar;
|
||||
} catch (Exception e2) {
|
||||
b.a("Failed to send POST to collector: ", e2);
|
||||
a(e2);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r5v4, types: [java.io.InputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v5, types: [java.io.InputStream] */
|
||||
/* JADX WARN: Type inference failed for: r5v7, types: [java.lang.String] */
|
||||
private static String a(HttpResponse httpResponse) throws IOException {
|
||||
char[] cArr = new char[UnityActivity.BLOCKLY_TYPE_NONE];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (httpResponse == null || httpResponse.getEntity() == null) {
|
||||
return null;
|
||||
}
|
||||
?? content = httpResponse.getEntity().getContent();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(content));
|
||||
while (true) {
|
||||
try {
|
||||
int read = bufferedReader.read(cArr);
|
||||
if (read < 0) {
|
||||
content.close();
|
||||
content = sb.toString();
|
||||
return content;
|
||||
}
|
||||
sb.append(cArr, 0, read);
|
||||
} catch (Exception unused) {
|
||||
content.close();
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Exception exc) {
|
||||
com.baidu.uaq.agent.android.stats.a.b().a("Supportability/AgentHealth/Collector/ResponseErrorCodes/" + h.a(exc));
|
||||
}
|
||||
}
|
159
sources/com/baidu/uaq/agent/android/harvest/multiharvest/c.java
Normal file
159
sources/com/baidu/uaq/agent/android/harvest/multiharvest/c.java
Normal file
@@ -0,0 +1,159 @@
|
||||
package com.baidu.uaq.agent.android.harvest.multiharvest;
|
||||
|
||||
import android.content.Context;
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadConfigure;
|
||||
import com.baidu.uaq.agent.android.util.g;
|
||||
import com.baidu.uaq.agent.android.util.i;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* compiled from: MultiHarvestTimer.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class c implements Runnable {
|
||||
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 final d a;
|
||||
private ScheduledExecutorService b = Executors.newSingleThreadScheduledExecutor(new g("HarvestTimer"));
|
||||
private ScheduledFuture c;
|
||||
private long d;
|
||||
private long e;
|
||||
private Context f;
|
||||
private String g;
|
||||
private APMUploadConfigure h;
|
||||
|
||||
public c(Context context, APMUploadConfigure aPMUploadConfigure) {
|
||||
this.f = context;
|
||||
this.g = aPMUploadConfigure.getUploadName();
|
||||
this.h = aPMUploadConfigure;
|
||||
this.a = new d(context, aPMUploadConfigure);
|
||||
}
|
||||
|
||||
private void e() {
|
||||
long j2 = j();
|
||||
if (1000 + j2 < this.e && j2 != -1) {
|
||||
j.d("HarvestTimer: Tick is too soon (" + j2 + " delta) Last tick time: " + this.d + " . Skipping.");
|
||||
return;
|
||||
}
|
||||
j.d("================= Tick Begin for " + this.h.getUploadName() + " =====================");
|
||||
j.d("HarvestTimer: time since last tick: " + j2);
|
||||
long m = m();
|
||||
try {
|
||||
f();
|
||||
} catch (Exception e) {
|
||||
j.a("HarvestTimer: Exception in timer tick: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
this.d = m;
|
||||
j.d("================= Tick End for " + this.h.getUploadName() + " =====================");
|
||||
}
|
||||
|
||||
private void f() {
|
||||
com.baidu.uaq.agent.android.stats.b bVar = new com.baidu.uaq.agent.android.stats.b();
|
||||
bVar.a();
|
||||
try {
|
||||
this.a.a(this.h);
|
||||
} catch (Exception e) {
|
||||
j.a("HarvestTimer: Exception in harvest execute: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
long b = bVar.b();
|
||||
j.d("HarvestTimer tick took " + b + "ms");
|
||||
}
|
||||
|
||||
private long j() {
|
||||
if (this.d == 0) {
|
||||
return -1L;
|
||||
}
|
||||
return m() - this.d;
|
||||
}
|
||||
|
||||
private void k() {
|
||||
if (this.h == null) {
|
||||
this.e = -1L;
|
||||
return;
|
||||
}
|
||||
if (!i.d(this.f)) {
|
||||
if (i.c(this.f)) {
|
||||
this.e = this.h.getInterval4g();
|
||||
return;
|
||||
} else {
|
||||
this.e = i.getConfig().getDataReportPeriod();
|
||||
return;
|
||||
}
|
||||
}
|
||||
j.d("getPeriod for name:" + this.h.getUploadName());
|
||||
this.e = this.h.getIntervalWifi();
|
||||
}
|
||||
|
||||
private void l() {
|
||||
if (com.baidu.uaq.agent.android.customtransmission.b.a() != null) {
|
||||
this.h = com.baidu.uaq.agent.android.customtransmission.b.a().get(this.g);
|
||||
} else {
|
||||
this.h = null;
|
||||
}
|
||||
}
|
||||
|
||||
private long m() {
|
||||
return System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public d a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return this.c != null;
|
||||
}
|
||||
|
||||
public void c() {
|
||||
j.d("HarvestTimer: Start a harvestTimer, uploadName:" + this.h.getUploadName());
|
||||
if (b()) {
|
||||
j.b("HarvestTimer: Attempting to start while already running");
|
||||
return;
|
||||
}
|
||||
k();
|
||||
if (this.e <= 0) {
|
||||
j.a("HarvestTimer: Refusing to start with a period <= 0 ms");
|
||||
return;
|
||||
}
|
||||
j.d("HarvestTimer: Starting with a period of " + this.e + "ms");
|
||||
System.currentTimeMillis();
|
||||
this.c = this.b.scheduleAtFixedRate(this, 0L, this.e, TimeUnit.MILLISECONDS);
|
||||
if (this.h.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME)) {
|
||||
com.baidu.uaq.agent.android.g.a();
|
||||
}
|
||||
}
|
||||
|
||||
public void d() {
|
||||
if (b()) {
|
||||
j.d("HarvestTimer: Stop a harvestTimer when period is " + this.e + "ms");
|
||||
this.c.cancel(true);
|
||||
this.c = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
synchronized (this) {
|
||||
try {
|
||||
e();
|
||||
l();
|
||||
long j2 = this.e;
|
||||
k();
|
||||
j.d("period lasPeriod:" + j2 + " now:" + this.e);
|
||||
if (this.e <= 0) {
|
||||
d();
|
||||
} else if (j2 != this.e) {
|
||||
this.c.cancel(true);
|
||||
this.c = this.b.scheduleAtFixedRate(this, this.e, this.e, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
j.a("HarvestTimer: Exception in timer tick: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
542
sources/com/baidu/uaq/agent/android/harvest/multiharvest/d.java
Normal file
542
sources/com/baidu/uaq/agent/android/harvest/multiharvest/d.java
Normal file
@@ -0,0 +1,542 @@
|
||||
package com.baidu.uaq.agent.android.harvest.multiharvest;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import com.baidu.uaq.agent.android.AgentConfig;
|
||||
import com.baidu.uaq.agent.android.UAQ;
|
||||
import com.baidu.uaq.agent.android.customtransmission.APMUploadConfigure;
|
||||
import com.baidu.uaq.agent.android.g;
|
||||
import com.baidu.uaq.agent.android.harvest.bean.h;
|
||||
import com.baidu.uaq.agent.android.util.e;
|
||||
import com.baidu.uaq.agent.android.util.f;
|
||||
import com.baidu.uaq.agent.android.util.i;
|
||||
import com.tencent.open.SocialConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: MultiHarvester.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class d {
|
||||
private static final com.baidu.uaq.agent.android.logging.a k = com.baidu.uaq.agent.android.logging.b.a();
|
||||
private static final UAQ l = UAQ.getInstance();
|
||||
private static com.baidu.uaq.agent.android.harvest.a m;
|
||||
private APMUploadConfigure a;
|
||||
private b b;
|
||||
private final f c;
|
||||
private long d;
|
||||
private long e;
|
||||
private SharedPreferences f;
|
||||
private SharedPreferences.Editor g;
|
||||
private Context h;
|
||||
private ArrayList<String> i = new ArrayList<>();
|
||||
private a j;
|
||||
|
||||
/* compiled from: MultiHarvester.java */
|
||||
/* renamed from: com.baidu.uaq.agent.android.harvest.multiharvest.d$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[a.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[a.CONNECTEDWIFI.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[a.CONNECTEDNOTWIFI.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compiled from: MultiHarvester.java */
|
||||
private enum a {
|
||||
CONNECTEDWIFI,
|
||||
CONNECTEDNOTWIFI,
|
||||
DISCONNECTED
|
||||
}
|
||||
|
||||
public d(Context context, APMUploadConfigure aPMUploadConfigure) {
|
||||
this.h = context;
|
||||
this.a = aPMUploadConfigure;
|
||||
this.c = new f(context, aPMUploadConfigure.getUploadName());
|
||||
this.f = context.getSharedPreferences("com.baidu.uaq.android.agent.v2_customer_", 0);
|
||||
}
|
||||
|
||||
public static void a(com.baidu.uaq.agent.android.harvest.health.b bVar) {
|
||||
m.e().a(bVar);
|
||||
}
|
||||
|
||||
public static com.baidu.uaq.agent.android.harvest.a c() {
|
||||
return m;
|
||||
}
|
||||
|
||||
private void d() {
|
||||
if (this.a.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME) && m == null) {
|
||||
m = new com.baidu.uaq.agent.android.harvest.a();
|
||||
}
|
||||
if (this.b == null) {
|
||||
this.b = new b();
|
||||
}
|
||||
}
|
||||
|
||||
private void e() {
|
||||
if (this.j != a.CONNECTEDWIFI) {
|
||||
return;
|
||||
}
|
||||
ArrayList<String> a2 = this.c.a();
|
||||
if (a2.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
if (this.a.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME)) {
|
||||
a(a2, this.c);
|
||||
} else {
|
||||
b(a2, this.c);
|
||||
}
|
||||
}
|
||||
|
||||
private a f() {
|
||||
return i.d(this.h) ? a.CONNECTEDWIFI : i.c(this.h) ? a.CONNECTEDNOTWIFI : a.DISCONNECTED;
|
||||
}
|
||||
|
||||
private long g() {
|
||||
int i = AnonymousClass1.a[this.j.ordinal()];
|
||||
if (i == 1) {
|
||||
return this.a.getMaxBytesPeriodWifi();
|
||||
}
|
||||
if (i != 2) {
|
||||
return 0L;
|
||||
}
|
||||
return this.a.getMaxBytesPeriod4g();
|
||||
}
|
||||
|
||||
private long h() {
|
||||
int i = AnonymousClass1.a[this.j.ordinal()];
|
||||
if (i == 1) {
|
||||
return this.a.getMaxBytesWifi();
|
||||
}
|
||||
if (i != 2) {
|
||||
return 0L;
|
||||
}
|
||||
return this.a.getMaxBytes4g();
|
||||
}
|
||||
|
||||
private String i() {
|
||||
int i = AnonymousClass1.a[this.j.ordinal()];
|
||||
if (i == 1) {
|
||||
return this.a.getUploadName() + "_dataReportLimitWIFI";
|
||||
}
|
||||
if (i != 2) {
|
||||
return null;
|
||||
}
|
||||
return this.a.getUploadName() + "_dataReportLimitNOTWIFI";
|
||||
}
|
||||
|
||||
private void j() {
|
||||
this.g = this.f.edit();
|
||||
String i = i();
|
||||
if (i == null) {
|
||||
return;
|
||||
}
|
||||
k.d("saveMaxBytesState uploaded bytes:" + this.e + " key:" + i + " uploadStartTime:" + this.d);
|
||||
this.g.putLong(i, this.e);
|
||||
this.g.apply();
|
||||
}
|
||||
|
||||
private void k() {
|
||||
this.g = this.f.edit();
|
||||
String i = i();
|
||||
if (i == null) {
|
||||
return;
|
||||
}
|
||||
String l2 = l();
|
||||
k.d("saveIntervalState uploaded bytes:" + this.e + " key:" + i + " uploadStartTime:" + this.d + " dateKey:" + l2);
|
||||
this.g.putLong(i, this.e);
|
||||
this.g.putLong(l2, this.d);
|
||||
this.g.apply();
|
||||
}
|
||||
|
||||
private String l() {
|
||||
return this.a.getUploadName() + "apmUploadStartDate";
|
||||
}
|
||||
|
||||
private long m() {
|
||||
Context context = this.h;
|
||||
if (context == null) {
|
||||
k.a("getUploadedBytes failed, context is null");
|
||||
return -1L;
|
||||
}
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("com.baidu.uaq.android.agent.v2_customer_", 0);
|
||||
String i = i();
|
||||
if (sharedPreferences == null || i == null) {
|
||||
this.e = 0L;
|
||||
return 0L;
|
||||
}
|
||||
long j = sharedPreferences.getLong(i, 0L);
|
||||
this.e = j;
|
||||
return j;
|
||||
}
|
||||
|
||||
private long n() {
|
||||
Context context = this.h;
|
||||
if (context == null) {
|
||||
k.a("getUploadStartTime failed, context is null");
|
||||
return -1L;
|
||||
}
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences("com.baidu.uaq.android.agent.v2_customer_", 0);
|
||||
String l2 = l();
|
||||
if (sharedPreferences == null || l2 == null) {
|
||||
this.d = 0L;
|
||||
return 0L;
|
||||
}
|
||||
long j = sharedPreferences.getLong(l2, 0L);
|
||||
this.d = j;
|
||||
return j;
|
||||
}
|
||||
|
||||
private void o() {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
long j = this.d;
|
||||
Boolean bool = true;
|
||||
if (j != 0 && currentTimeMillis - j < g()) {
|
||||
bool = false;
|
||||
}
|
||||
if (bool.booleanValue()) {
|
||||
this.d = currentTimeMillis;
|
||||
this.e = 0L;
|
||||
k();
|
||||
}
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (this.a.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME)) {
|
||||
m.k();
|
||||
} else {
|
||||
this.i.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(h hVar) {
|
||||
m.f().a(hVar);
|
||||
}
|
||||
|
||||
private void c(String str) {
|
||||
com.baidu.uaq.agent.android.harvest.b a2 = this.b.a(a(str));
|
||||
if (com.baidu.uaq.agent.android.harvest.multiharvest.a.c().a() < 1) {
|
||||
k.a("Agent has shutdown during startUpload");
|
||||
} else {
|
||||
if (a(a2)) {
|
||||
return;
|
||||
}
|
||||
k.d("upload APM data failed!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void a(com.baidu.uaq.agent.android.harvest.bean.f fVar) {
|
||||
m.g().a(fVar);
|
||||
}
|
||||
|
||||
private void b(Long l2) {
|
||||
ArrayList<String> a2 = com.baidu.uaq.agent.android.customtransmission.b.a(this.a.getUploadName(), Boolean.valueOf(this.a.isEnableRetransmission()));
|
||||
if (!this.i.isEmpty()) {
|
||||
k.a("blockArray is not empty!");
|
||||
}
|
||||
if (a2 == null || a2.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
this.i.addAll(a2);
|
||||
String executeMerge = this.a.getMergeBlockCallBack().executeMerge(this.i);
|
||||
k.d("config name:" + this.a.getUploadName() + ", upload limit:" + l2 + ", curr uploads:" + this.e + ", length:" + executeMerge.length());
|
||||
if (l2.longValue() != 0 && this.e + executeMerge.length() > l2.longValue()) {
|
||||
if (this.j != a.CONNECTEDWIFI) {
|
||||
b(this.a.getUploadName());
|
||||
com.baidu.uaq.agent.android.customtransmission.b.b(this.a.getUploadName(), Boolean.valueOf(this.a.isEnableRetransmission()));
|
||||
return;
|
||||
} else {
|
||||
com.baidu.uaq.agent.android.customtransmission.b.b(this.a.getUploadName(), Boolean.valueOf(this.a.isEnableRetransmission()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
a(executeMerge, this.a);
|
||||
this.e += executeMerge.length();
|
||||
j();
|
||||
}
|
||||
|
||||
public void a(APMUploadConfigure aPMUploadConfigure) {
|
||||
this.a = aPMUploadConfigure;
|
||||
d();
|
||||
this.j = f();
|
||||
if (this.j != a.DISCONNECTED) {
|
||||
this.d = n();
|
||||
this.e = m();
|
||||
o();
|
||||
k.d("harvester exec for :" + aPMUploadConfigure.getUploadName() + ", uploadStartTime:" + this.d + ", intervalUploadedBytes:" + this.e);
|
||||
long h = h();
|
||||
if (aPMUploadConfigure.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME)) {
|
||||
a(Long.valueOf(h));
|
||||
} else {
|
||||
b(Long.valueOf(h));
|
||||
}
|
||||
if (h == 0 || this.e <= h) {
|
||||
e();
|
||||
}
|
||||
} else {
|
||||
a();
|
||||
}
|
||||
b();
|
||||
}
|
||||
|
||||
public void a() {
|
||||
if (this.a.getUploadName().equals(APMUploadConfigure.APMUPLOADNAME)) {
|
||||
com.baidu.uaq.agent.android.harvest.a aVar = m;
|
||||
a(aVar);
|
||||
String c = aVar.c();
|
||||
if (c != null) {
|
||||
k.d("harvester exec for :" + this.a.getUploadName() + ", network is not connected, choose to localize data");
|
||||
a(c, this.a.getUploadName());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
ArrayList<String> a2 = com.baidu.uaq.agent.android.customtransmission.b.a(this.a.getUploadName(), Boolean.valueOf(this.a.isEnableRetransmission()));
|
||||
if (a2 != null) {
|
||||
this.i.addAll(a2);
|
||||
k.d("harvester exec for :" + this.a.getUploadName() + ", network is not connected, choose to localize data");
|
||||
b(this.a.getUploadName());
|
||||
com.baidu.uaq.agent.android.customtransmission.b.b(this.a.getUploadName(), Boolean.valueOf(this.a.isEnableRetransmission()));
|
||||
}
|
||||
}
|
||||
|
||||
private void b(ArrayList<String> arrayList, f fVar) {
|
||||
long h = h();
|
||||
int size = arrayList.size();
|
||||
k.d("handle localized data for " + this.a.getUploadName() + ", Local fileLen: " + size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
String str = arrayList.get((size - i) - 1);
|
||||
ArrayList<String> c = fVar.c(str);
|
||||
if (c != null && c.size() != 0) {
|
||||
k.d("handle localized file :" + str);
|
||||
String executeMerge = this.a.getMergeBlockCallBack().executeMerge(c);
|
||||
if (h != 0 && this.e + executeMerge.length() > h) {
|
||||
k.d("upload data will exceeds upload limit");
|
||||
return;
|
||||
}
|
||||
com.baidu.uaq.agent.android.harvest.b a2 = this.b.a(executeMerge.substring(0, executeMerge.length()), this.a);
|
||||
if (a2 != null && a2.b()) {
|
||||
fVar.a(str);
|
||||
this.e += executeMerge.length();
|
||||
j();
|
||||
k.d("upload success, delete " + str + "; curr uploads:" + this.e + " length:" + executeMerge.length());
|
||||
} else {
|
||||
k.d("upload localized data for customer failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void a(Long l2) {
|
||||
com.baidu.uaq.agent.android.harvest.a aVar = m;
|
||||
a(aVar);
|
||||
String c = aVar.c();
|
||||
if (c.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
k.d("config name:" + this.a.getUploadName() + ", upload limit:" + l2 + ", curr uploads:" + this.e + ", length:" + c.length());
|
||||
if (l2.longValue() != 0 && this.e + c.length() > l2.longValue()) {
|
||||
if (this.j != a.CONNECTEDWIFI) {
|
||||
a(c, this.a.getUploadName());
|
||||
}
|
||||
} else {
|
||||
c(c);
|
||||
this.e += c.length();
|
||||
j();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(ArrayList<String> arrayList, f fVar) {
|
||||
long h = h();
|
||||
int size = arrayList.size();
|
||||
k.d("handle localized data for: " + this.a.getUploadName() + ", Local fileLen: " + size);
|
||||
for (int i = 0; i < size; i++) {
|
||||
String str = arrayList.get((size - i) - 1);
|
||||
String b = fVar.b(str);
|
||||
if (b != null && !b.isEmpty()) {
|
||||
k.d("handle localized file :" + str);
|
||||
if (h != 0 && this.e + b.length() > h) {
|
||||
k.d("upload data will exceeds upload limit");
|
||||
return;
|
||||
}
|
||||
com.baidu.uaq.agent.android.harvest.b a2 = this.b.a(a(b.substring(0, b.length() - 1)));
|
||||
if (a2 != null && a2.a()) {
|
||||
fVar.a(str);
|
||||
this.e += b.length();
|
||||
j();
|
||||
k.d("upload success, delete " + str + "; curr uploads:" + this.e + " length:" + b.length());
|
||||
}
|
||||
if (com.baidu.uaq.agent.android.harvest.multiharvest.a.c().a() < 1) {
|
||||
k.a("Agent has shutdown when handleLocalizedFile4APM");
|
||||
} else if (!a(a2)) {
|
||||
k.d("upload localized data failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void b(String str) {
|
||||
Iterator<String> it = this.i.iterator();
|
||||
while (it.hasNext()) {
|
||||
this.c.a(str, it.next());
|
||||
k.d("Log Persist, fileList: " + this.c.a().size());
|
||||
}
|
||||
}
|
||||
|
||||
private static void b(com.baidu.uaq.agent.android.harvest.b bVar) {
|
||||
com.baidu.uaq.agent.android.stats.a.b().a("Supportability/AgentHealth/Collector/HarvestTime", bVar.d());
|
||||
k.d("HarvestTime = " + bVar.d() + "ms");
|
||||
String c = bVar.c();
|
||||
if (c != null && !c.isEmpty() && !"".equals(c)) {
|
||||
try {
|
||||
JSONObject jSONObject = new JSONObject(c);
|
||||
if (!jSONObject.optString(SocialConstants.PARAM_SEND_MSG).isEmpty()) {
|
||||
k.a("Err msg from server: " + jSONObject.getString(SocialConstants.PARAM_SEND_MSG));
|
||||
return;
|
||||
}
|
||||
if (jSONObject.getBoolean("disableCollect")) {
|
||||
if (l.isDisableCollect()) {
|
||||
return;
|
||||
}
|
||||
k.c("disableCollect turn to true");
|
||||
l.setSavedConfig(l.getConfig().newBuilder().build());
|
||||
l.disableCollect();
|
||||
g.b();
|
||||
l.setDisableCollect(true);
|
||||
return;
|
||||
}
|
||||
if (!jSONObject.getBoolean("disableCollect") && l.isDisableCollect()) {
|
||||
k.c("disableCollect turn to false");
|
||||
l.enableCollect(l.getSavedConfig());
|
||||
g.a();
|
||||
l.setDisableCollect(false);
|
||||
}
|
||||
com.baidu.uaq.agent.android.harvest.bean.b bVar2 = new com.baidu.uaq.agent.android.harvest.bean.b(jSONObject.getLong("accountId"), jSONObject.getLong("agentId"));
|
||||
if (!bVar2.equals(m.j())) {
|
||||
m.a(bVar2);
|
||||
}
|
||||
if (jSONObject.length() > 4) {
|
||||
a(jSONObject);
|
||||
}
|
||||
l.setNeedBasicInfo(jSONObject.getBoolean("needBasicInfo"));
|
||||
return;
|
||||
} catch (JSONException e) {
|
||||
k.a("Caught error while parse responseBody: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
k.d("responseBody is Empty");
|
||||
}
|
||||
|
||||
private void a(String str, String str2) {
|
||||
this.c.a(str2, str);
|
||||
k.d("localizeData4APM, localized file size: " + this.c.a().size());
|
||||
}
|
||||
|
||||
private void a(String str, APMUploadConfigure aPMUploadConfigure) {
|
||||
com.baidu.uaq.agent.android.harvest.b a2 = this.b.a(str, aPMUploadConfigure);
|
||||
if (a2 != null && a2.b()) {
|
||||
k.d("upload success");
|
||||
com.baidu.uaq.agent.android.customtransmission.b.b(aPMUploadConfigure.getUploadName(), Boolean.valueOf(aPMUploadConfigure.isEnableRetransmission()));
|
||||
} else {
|
||||
k.d("upload customer data failed!");
|
||||
}
|
||||
}
|
||||
|
||||
private com.baidu.uaq.agent.android.harvest.a a(com.baidu.uaq.agent.android.harvest.a aVar) {
|
||||
if (aVar.h().j()) {
|
||||
return aVar;
|
||||
}
|
||||
try {
|
||||
String a2 = e.a(aVar.h().e());
|
||||
String a3 = e.a(aVar.h().n());
|
||||
String a4 = e.a(aVar.h().l());
|
||||
String a5 = e.a(aVar.h().m());
|
||||
String a6 = e.a(aVar.h().k());
|
||||
aVar.h().c(a2);
|
||||
aVar.h().e(a3);
|
||||
aVar.h().h(a4);
|
||||
aVar.h().d(a5);
|
||||
aVar.h().m(a6);
|
||||
aVar.h().a(true);
|
||||
return aVar;
|
||||
} catch (Exception e) {
|
||||
k.a("Caught error while data2AES: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
return aVar;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean a(com.baidu.uaq.agent.android.harvest.b bVar) {
|
||||
if (bVar == null) {
|
||||
return false;
|
||||
}
|
||||
k.d("Harvest response status code: " + bVar.e());
|
||||
if (bVar.f()) {
|
||||
k.a("Harvest response error body: " + bVar.c());
|
||||
m.k();
|
||||
return false;
|
||||
}
|
||||
k.d("Harvest response body: " + bVar.c());
|
||||
b(bVar);
|
||||
return true;
|
||||
}
|
||||
|
||||
private String a(String str) {
|
||||
return "{\"version\":1,\"value\":[" + str + "]}";
|
||||
}
|
||||
|
||||
private static void a(JSONObject jSONObject) {
|
||||
boolean z;
|
||||
AgentConfig.Builder newBuilder = l.getConfig().newBuilder();
|
||||
try {
|
||||
if (l.getConfig().isNativeControlDRP() || !jSONObject.has("dataReportPeriod") || l.getConfig().getDataReportPeriod() == jSONObject.getLong("dataReportPeriod")) {
|
||||
z = false;
|
||||
} else {
|
||||
newBuilder.dataReportPeriod(jSONObject.getLong("dataReportPeriod"));
|
||||
k.d("Update dataReportPeriod: " + jSONObject.getLong("dataReportPeriod"));
|
||||
z = true;
|
||||
}
|
||||
if (jSONObject.has("dataReportLimit") && l.getConfig().getDataReportLimit() != jSONObject.getLong("dataReportLimit")) {
|
||||
newBuilder.dataReportLimit(jSONObject.getLong("dataReportLimit"));
|
||||
k.d("Update dataReportLimit: " + jSONObject.getLong("dataReportLimit"));
|
||||
z = true;
|
||||
}
|
||||
if (jSONObject.has("responseBodyLimit") && l.getConfig().getResponseBodyLimit() != jSONObject.getLong("responseBodyLimit")) {
|
||||
newBuilder.responseBodyLimit(jSONObject.getLong("responseBodyLimit"));
|
||||
k.d("Update responseBodyLimit: " + jSONObject.getLong("responseBodyLimit"));
|
||||
z = true;
|
||||
}
|
||||
if (jSONObject.has("sampleRate") && l.getConfig().getSampleRate() != jSONObject.getDouble("sampleRate")) {
|
||||
newBuilder.sampleRate(jSONObject.getDouble("sampleRate"));
|
||||
k.d("Update sampleRate: " + jSONObject.getDouble("sampleRate"));
|
||||
z = true;
|
||||
}
|
||||
if (jSONObject.has("harvestableCacheLimit") && l.getConfig().getHarvestableCacheLimit() != jSONObject.getInt("harvestableCacheLimit")) {
|
||||
newBuilder.harvestableCacheLimit(jSONObject.getInt("harvestableCacheLimit"));
|
||||
k.d("Update harvestableCacheLimit: " + jSONObject.getInt("harvestableCacheLimit"));
|
||||
z = true;
|
||||
}
|
||||
if (jSONObject.has("samplerFreq") && l.getConfig().getSamplerFreq() != jSONObject.getLong("samplerFreq")) {
|
||||
newBuilder.samplerFreq(jSONObject.getLong("samplerFreq"));
|
||||
k.d("Update samplerFreq: " + jSONObject.getLong("samplerFreq"));
|
||||
z = true;
|
||||
}
|
||||
if (z) {
|
||||
l.reconfig(newBuilder.build());
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
k.a("Caught error while updateAgentConfig: ", e);
|
||||
com.baidu.uaq.agent.android.harvest.health.a.a(e);
|
||||
}
|
||||
}
|
||||
}
|
55
sources/com/baidu/uaq/agent/android/harvest/type/a.java
Normal file
55
sources/com/baidu/uaq/agent/android/harvest/type/a.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package com.baidu.uaq.agent.android.harvest.type;
|
||||
|
||||
import com.baidu.uaq.agent.android.harvest.type.b;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/* compiled from: BaseHarvestable.java */
|
||||
/* loaded from: classes.dex */
|
||||
public class a implements b {
|
||||
private final b.a a;
|
||||
|
||||
/* compiled from: BaseHarvestable.java */
|
||||
/* renamed from: com.baidu.uaq.agent.android.harvest.type.a$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[b.a.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[b.a.OBJECT.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[b.a.ARRAY.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public a(b.a aVar) {
|
||||
this.a = aVar;
|
||||
}
|
||||
|
||||
public JSONArray a() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void a(String str) {
|
||||
if (str == null || str.length() == 0) {
|
||||
throw new IllegalArgumentException("Missing Harvestable field.");
|
||||
}
|
||||
}
|
||||
|
||||
public Object b() {
|
||||
int i = AnonymousClass1.a[this.a.ordinal()];
|
||||
return i != 1 ? i != 2 ? "" : a() : d();
|
||||
}
|
||||
|
||||
public String c() {
|
||||
return b().toString();
|
||||
}
|
||||
|
||||
public JSONObject d() {
|
||||
return null;
|
||||
}
|
||||
}
|
12
sources/com/baidu/uaq/agent/android/harvest/type/b.java
Normal file
12
sources/com/baidu/uaq/agent/android/harvest/type/b.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.baidu.uaq.agent.android.harvest.type;
|
||||
|
||||
/* compiled from: Harvestable.java */
|
||||
/* loaded from: classes.dex */
|
||||
public interface b {
|
||||
|
||||
/* compiled from: Harvestable.java */
|
||||
public enum a {
|
||||
OBJECT,
|
||||
ARRAY
|
||||
}
|
||||
}
|
11
sources/com/baidu/uaq/agent/android/harvest/type/c.java
Normal file
11
sources/com/baidu/uaq/agent/android/harvest/type/c.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.baidu.uaq.agent.android.harvest.type;
|
||||
|
||||
import com.baidu.uaq.agent.android.harvest.type.b;
|
||||
|
||||
/* compiled from: HarvestableArray.java */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class c extends a {
|
||||
public c() {
|
||||
super(b.a.ARRAY);
|
||||
}
|
||||
}
|
11
sources/com/baidu/uaq/agent/android/harvest/type/d.java
Normal file
11
sources/com/baidu/uaq/agent/android/harvest/type/d.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.baidu.uaq.agent.android.harvest.type;
|
||||
|
||||
import com.baidu.uaq.agent.android.harvest.type.b;
|
||||
|
||||
/* compiled from: HarvestableObject.java */
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class d extends a {
|
||||
public d() {
|
||||
super(b.a.OBJECT);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user