533 lines
19 KiB
Java
533 lines
19 KiB
Java
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;
|
|
}
|
|
}
|
|
}
|