同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.uc.crashsdk.a;
import android.os.Build;
import android.os.Process;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.SparseArray;
import com.google.android.material.timepicker.TimeModel;
import com.huawei.hms.framework.common.ContainerUtils;
import com.moture.lib.cache.wrapper.CacheNameFactory;
import com.taobao.accs.common.Constants;
import com.uc.crashsdk.JNIBridge;
import com.umeng.analytics.pro.at;
import com.umeng.analytics.pro.bh;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
public class h {
static final boolean f14122a = true;
private static final Object f14123b = new Object();
private static final Map<String, String> f14124c = new HashMap();
private static int f14125d = 0;
private static final Map<String, a> f14126e = new HashMap();
private static final Object f14127f = new Object();
private static final Object f14128g = new Object();
private static final SparseArray<String> f14129h = new SparseArray<>();
private static boolean f14130i = false;
private static boolean f14131j = false;
private static final Object f14132k = new Object();
private static String f14133l = null;
public static class a {
long f14134a = 0;
int f14135b = 0;
Map<String, String> f14136c = new HashMap();
private String f14137d;
private boolean f14138e;
private boolean f14139f;
a(String str, boolean z8, boolean z9) {
this.f14138e = false;
this.f14139f = false;
this.f14137d = str;
this.f14138e = z8;
this.f14139f = z9;
}
private long d(String str) {
return g.c(a(str));
}
final void a(String str, String str2) {
this.f14136c.put(str, str2);
}
final String b(String str) {
String a9 = a(str);
return a9 == null ? "" : a9;
}
final boolean c(String str) {
if (g.a(str)) {
return false;
}
String str2 = null;
long j9 = 0;
HashMap hashMap = new HashMap();
Map c9 = h.c(str);
int i9 = 0;
for (String str3 : c9.keySet()) {
String str4 = (String) c9.get(str3);
if (str3.equals("lt")) {
str2 = str4;
} else if (this.f14138e && str3.equals("up")) {
j9 = g.c(str4);
} else if (this.f14138e && str3.equals("pid")) {
i9 = (int) g.c(str4);
} else {
hashMap.put(str3, str4);
}
}
String str5 = this.f14137d;
if (str5 == null || str5.equals(str2)) {
this.f14134a = j9;
this.f14135b = i9;
this.f14137d = str2;
this.f14136c = hashMap;
return true;
}
return false;
}
final void a(String str, long j9) {
long d9 = d(str) + j9;
if (d9 <= 100) {
j9 = d9 < 0 ? 0L : d9;
}
a(str, String.valueOf(j9));
}
final boolean a(a aVar) {
if (!this.f14139f) {
com.uc.crashsdk.a.a.a("crashsdk", String.format(Locale.US, "WaItem '%s' is not mergable!", this.f14137d), null);
return false;
}
for (String str : aVar.f14136c.keySet()) {
if (str.startsWith("c_")) {
a(str, aVar.a(str));
} else {
long d9 = aVar.d(str);
if (d9 == 0) {
a(str, aVar.a(str));
} else if (d9 < 100) {
a(str, d9);
}
}
}
return true;
}
final String a(String str) {
return this.f14136c.get(str);
}
final String a(boolean z8, boolean z9, boolean z10) {
if (this.f14137d == null) {
return null;
}
StringBuilder sb = new StringBuilder();
if (z8) {
h.b(sb, "lt", "uc");
h.b(sb, "pre", com.uc.crashsdk.g.e());
h.b(sb, "pkg", com.uc.crashsdk.a.f14060a);
h.b(sb, "rom", Build.VERSION.RELEASE);
h.b(sb, "brd", Build.BRAND);
h.b(sb, Constants.KEY_MODEL, Build.MODEL);
h.a(sb, com.umeng.ccg.a.f15010r, Build.VERSION.SDK_INT);
h.b(sb, bh.f14448w, com.uc.crashsdk.e.e());
h.b(sb, "hdw", com.uc.crashsdk.e.f());
long l9 = h.l();
h.a(sb, "ram", l9);
h.b(sb, "aram", h.a(l9));
h.b(sb, "cver", "3.3.2.2");
h.b(sb, "cseq", "211215141717");
h.b(sb, "ctag", "release");
h.b(sb, "aver", com.uc.crashsdk.a.a());
h.b(sb, "ver", com.uc.crashsdk.g.T());
h.b(sb, "sver", com.uc.crashsdk.g.U());
h.b(sb, "seq", com.uc.crashsdk.g.V());
h.b(sb, "grd", com.uc.crashsdk.b.A() ? "fg" : "bg");
h.b(sb, "os", "android");
h.b(sb, "dn", com.uc.crashsdk.e.q());
String ab = com.uc.crashsdk.g.ab();
if (TextUtils.isEmpty(ab)) {
ab = com.uc.crashsdk.e.q();
}
h.b(sb, "k_uid", ab);
String ac = com.uc.crashsdk.g.ac();
if (!TextUtils.isEmpty(ac)) {
h.b(sb, "k_channel", ac);
}
sb.append("\n");
}
h.b(sb, "lt", this.f14137d);
h.a(sb, this.f14136c);
if (this.f14138e && !z9) {
long j9 = this.f14134a;
if (j9 != 0) {
h.b(sb, "up", String.valueOf(j9));
}
if (z10) {
h.b(sb, "pid", String.format(Locale.US, TimeModel.NUMBER_FORMAT, Integer.valueOf(Process.myPid())));
} else {
int i9 = this.f14135b;
if (i9 != 0) {
h.b(sb, "pid", String.format(Locale.US, TimeModel.NUMBER_FORMAT, Integer.valueOf(i9)));
}
}
}
sb.append("\n");
return sb.toString();
}
}
static String a(long j9) {
return j9 < PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED ? "512M" : String.format(Locale.US, "%dG", Long.valueOf(((j9 / 1024) + 512) / 1024));
}
public static void b(StringBuilder sb, String str, String str2) {
sb.append(str);
sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
sb.append(str2);
sb.append("`");
}
static Map c(String str) {
String[] split;
HashMap hashMap = new HashMap();
for (String str2 : str.split("`")) {
if (str2.length() > 1) {
String[] split2 = str2.split(ContainerUtils.KEY_VALUE_DELIMITER, 3);
if (split2.length == 2) {
hashMap.put(split2[0], split2[1]);
}
}
}
return hashMap;
}
public static void d() {
b(2, 2000L);
a(1, 70000L);
}
public static boolean e() {
return f14131j;
}
public static void f() {
b(1, 2000L);
}
public static void g() {
b(3, 0L);
}
public static void h() {
b(4, 0L);
}
public static void i() {
if (com.uc.crashsdk.g.Q()) {
f.a(1, new e(303));
}
}
public static byte[] j() {
return new byte[]{Byte.MAX_VALUE, 100, 110, 31};
}
public static void k() {
synchronized (f14132k) {
f14133l = null;
}
}
static long l() {
return o();
}
private static String m() {
return com.uc.crashsdk.g.W() + "pv.wa";
}
private static String n() {
return com.uc.crashsdk.g.W() + "cdt.wa";
}
private static long o() {
Iterator<String> it = g.a(new File("/proc/meminfo"), 2).iterator();
while (true) {
if (!it.hasNext()) {
break;
}
String next = it.next();
if (next.contains("MemTotal:")) {
try {
return Long.parseLong(next.replaceAll("\\D+", ""));
} catch (NumberFormatException e9) {
g.a(e9);
}
}
}
return 0L;
}
static void a(StringBuilder sb, String str, long j9) {
b(sb, str, String.valueOf(j9));
}
public static void b() {
a(2, 0L);
}
public static void c() {
a(3, 0L);
}
private static void b(int i9, long j9) {
if (com.uc.crashsdk.g.Q()) {
f.a(1, new e(301, new Object[]{Integer.valueOf(i9)}), j9);
}
}
private static boolean c(String str, String str2) {
boolean z8;
String d9;
String sb;
byte[] a9;
byte[] a10;
if (g.a(str2)) {
return true;
}
byte[] bytes = str2.getBytes();
try {
byte[] bArr = new byte[16];
c.a(bArr, 0, c.a());
c.a(bArr, 4, j());
c.a(bArr, 8, com.uc.crashsdk.a.f());
c.a(bArr, 12, d.d());
a10 = c.a(bytes, bArr);
} catch (Throwable th) {
g.a(th);
}
if (a10 != null) {
bytes = a10;
z8 = true;
if (str == null) {
str = "unknown";
}
String str3 = !com.uc.crashsdk.g.R() ? "4ea4e41a3993" : "28ef1713347d";
String valueOf = String.valueOf(System.currentTimeMillis());
d9 = g.d(str3 + str + valueOf + "AppChk#2014");
if (d9 != null) {
sb = null;
} else {
StringBuilder sb2 = new StringBuilder();
sb2.append(com.uc.crashsdk.g.z());
sb2.append("?chk=");
sb2.append(d9.substring(d9.length() - 8, d9.length()));
sb2.append("&vno=");
sb2.append(valueOf);
sb2.append("&uuid=");
sb2.append(str);
sb2.append("&app=");
sb2.append(str3);
if (z8) {
sb2.append("&enc=aes");
}
sb = sb2.toString();
}
return sb == null && (a9 = c.a(sb, bytes)) != null && new String(a9).contains("retcode=0");
}
z8 = false;
if (str == null) {
}
if (!com.uc.crashsdk.g.R()) {
}
String valueOf2 = String.valueOf(System.currentTimeMillis());
d9 = g.d(str3 + str + valueOf2 + "AppChk#2014");
if (d9 != null) {
}
if (sb == null) {
return false;
}
}
private static boolean d(String str) {
boolean c9;
File file = new File(str);
Iterator<a> it = a(file, "cst", 30).iterator();
while (it.hasNext()) {
a next = it.next();
String a9 = next.a("prc");
if (!g.a(a9)) {
Map<String, a> map = f14126e;
a aVar = map.get(a9);
if (aVar != null) {
aVar.a(next);
} else {
map.put(a9, next);
}
}
}
Map<String, a> map2 = f14126e;
StringBuilder a10 = a((Iterable<a>) map2.values(), true, false);
if (com.uc.crashsdk.g.aa()) {
c9 = b(com.uc.crashsdk.e.q(), a10.toString());
} else {
c9 = c(com.uc.crashsdk.e.q(), a10.toString());
}
g.b(file);
if (c9 || g.a(file, a((Iterable<a>) map2.values(), false, true).toString())) {
map2.clear();
}
return true;
}
static void a(StringBuilder sb, Map map) {
for (String str : map.keySet()) {
b(sb, str, (String) map.get(str));
}
}
public static void a(String str) {
synchronized (f14123b) {
File file = new File(m());
a aVar = new a("pv", true, true);
String c9 = g.c(file);
if (!g.a(c9)) {
aVar.c(c9);
}
aVar.a(str, 1L);
aVar.a("aujv", 1L);
g.a(file, aVar.a(false, false, false));
}
}
public static boolean b(int i9, Object[] objArr) {
switch (i9) {
case 351:
if (f14122a || objArr != null) {
String str = (String) objArr[0];
int intValue = ((Integer) objArr[1]).intValue();
if (intValue == 1) {
if (f14131j) {
return false;
}
f14131j = true;
}
if (com.uc.crashsdk.g.Z()) {
File file = new File(str);
ArrayList<a> a9 = a(file, "crp", 100);
if (intValue != 4) {
a aVar = new a("crp", false, false);
if (intValue == 1) {
aVar.a("et", String.valueOf(com.uc.crashsdk.b.I()));
aVar.a("ete", String.valueOf(com.uc.crashsdk.b.J()));
} else if (intValue == 3) {
aVar.a("et", "1");
aVar.a("ete", "1");
} else if (intValue == 2) {
aVar.a("hpv", "1");
}
aVar.a("prc", com.uc.crashsdk.e.h());
aVar.a(at.f14366c, com.uc.crashsdk.b.F() ? "1" : "0");
a(aVar);
a9.add(0, aVar);
}
if (!a9.isEmpty()) {
boolean c9 = c(com.uc.crashsdk.e.q(), a((Iterable<a>) a9, true, false).toString());
g.b(file);
if (!c9) {
g.a(file, a((Iterable<a>) a9, false, true).toString());
}
}
return true;
}
return false;
}
throw new AssertionError();
case 352:
if (f14122a || objArr != null) {
return d((String) objArr[0]);
}
throw new AssertionError();
case 353:
if (f14122a || objArr != null) {
return b((String) objArr[0], (String) objArr[1], ((Boolean) objArr[2]).booleanValue(), ((Boolean) objArr[3]).booleanValue());
}
throw new AssertionError();
case 354:
if (f14122a || objArr != null) {
File file2 = new File((String) objArr[0]);
boolean c10 = c(com.uc.crashsdk.e.q(), a((Iterable<a>) a(file2, "cst", 30), true, false).toString());
if (c10) {
g.b(file2);
}
return c10;
}
throw new AssertionError();
default:
return false;
}
}
public static void a() {
a(0, com.uc.crashsdk.b.H() ? 700000L : 70000L);
}
private static void a(int i9, long j9) {
if (com.uc.crashsdk.b.F()) {
f.a(0, new e(302, new Object[]{Integer.valueOf(i9)}), j9);
}
}
public static boolean a(String str, String str2) {
try {
String str3 = "c_" + str.replaceAll("[^0-9a-zA-Z-_]", com.xiaomi.mipush.sdk.Constants.ACCEPT_TIME_SEPARATOR_SERVER);
String replaceAll = g.a(str2) ? "" : str2.replaceAll("[`=]", com.xiaomi.mipush.sdk.Constants.ACCEPT_TIME_SEPARATOR_SERVER);
Map<String, String> map = f14124c;
synchronized (map) {
if (map.get(str3) == null) {
int i9 = f14125d;
if (i9 >= 20) {
return false;
}
f14125d = i9 + 1;
}
map.put(str3, replaceAll);
return true;
}
} catch (Throwable th) {
g.a(th);
return false;
}
}
public static void b(boolean z8) {
if (a(z8, "crash detail upload")) {
return;
}
String str = com.uc.crashsdk.g.W() + "dt.wa";
com.uc.crashsdk.b.a(f14127f, str, new e(352, new Object[]{str}));
String n9 = n();
com.uc.crashsdk.b.a(f14128g, n9, new e(354, new Object[]{n9}));
}
private static boolean b(String str, String str2) {
boolean z8;
byte[] a9;
byte[] a10;
if (g.a(str2)) {
return true;
}
byte[] bytes = str2.getBytes();
long currentTimeMillis = System.currentTimeMillis();
String d9 = g.d(com.uc.crashsdk.g.e() + str + currentTimeMillis + "AppChk#2014");
try {
a10 = c.a(bytes, d9.substring(d9.length() - 16, d9.length()).getBytes());
} catch (Throwable th) {
g.a(th);
}
if (a10 != null) {
bytes = a10;
z8 = true;
String substring = d9.substring(d9.length() - 8, d9.length());
StringBuilder sb = new StringBuilder();
sb.append(com.uc.crashsdk.g.z());
sb.append("/api/v1/crashtrack/upload?chk=");
sb.append(substring);
sb.append("&vno=");
sb.append(currentTimeMillis);
sb.append("&uuid=");
sb.append(str);
sb.append("&app=");
sb.append(com.uc.crashsdk.g.e());
if (z8) {
sb.append("&enc=aes");
}
String sb2 = sb.toString();
return sb2 == null && (a9 = c.a(sb2, bytes)) != null && new String(a9).contains("retcode=0");
}
z8 = false;
String substring2 = d9.substring(d9.length() - 8, d9.length());
StringBuilder sb3 = new StringBuilder();
sb3.append(com.uc.crashsdk.g.z());
sb3.append("/api/v1/crashtrack/upload?chk=");
sb3.append(substring2);
sb3.append("&vno=");
sb3.append(currentTimeMillis);
sb3.append("&uuid=");
sb3.append(str);
sb3.append("&app=");
sb3.append(com.uc.crashsdk.g.e());
if (z8) {
}
String sb22 = sb3.toString();
if (sb22 == null) {
return false;
}
}
private static void a(a aVar) {
Map<String, String> map = f14124c;
synchronized (map) {
for (String str : map.keySet()) {
aVar.a(str, f14124c.get(str));
}
}
}
public static void a(boolean z8) {
a(1, z8);
}
public static boolean a(boolean z8, String str) {
if (com.uc.crashsdk.b.f14143d && !z8 && JNIBridge.nativeIsCrashing()) {
com.uc.crashsdk.a.a.b("crashsdk", "Native is crashing, skip stat for " + str);
return true;
}
return false;
}
private static boolean b(String str, String str2, boolean z8, boolean z9) {
a aVar;
File file = new File(n());
ArrayList<a> a9 = a(file, "cst", 30);
String str3 = str + str2;
Iterator<a> it = a9.iterator();
while (true) {
if (!it.hasNext()) {
aVar = null;
break;
}
aVar = it.next();
if (str3.equals(aVar.b("prc") + aVar.b("typ"))) {
break;
}
}
if (aVar == null) {
aVar = new a("cst", false, true);
aVar.a("prc", str);
aVar.a("typ", str2);
a(aVar);
a9.add(aVar);
}
aVar.a("cnt", 1L);
if (z8) {
aVar.a(CacheNameFactory.PREFIX_LIMIT, 1L);
}
if (z9) {
aVar.a("syu", 1L);
}
return g.a(file, a((Iterable<a>) a9, false, false).toString());
}
private static void a(int i9, boolean z8) {
if (a(z8, "crash rate")) {
return;
}
String str = com.uc.crashsdk.g.W() + "cr.wa";
com.uc.crashsdk.b.a(f14123b, str, new e(351, new Object[]{str, Integer.valueOf(i9)}));
}
public static void a(int i9, Object[] objArr) {
String str;
String q9;
long j9;
boolean z8;
switch (i9) {
case 301:
if (!f14122a && objArr == null) {
throw new AssertionError();
}
a(((Integer) objArr[0]).intValue(), false);
return;
case 302:
if (!f14122a && objArr == null) {
throw new AssertionError();
}
synchronized (f14123b) {
int intValue = ((Integer) objArr[0]).intValue();
if (intValue == 0) {
if (!f14130i) {
f14130i = true;
}
}
if (!com.uc.crashsdk.a.f14061b.equals("2.0") || !com.uc.crashsdk.b.c(268435456)) {
File file = new File(m());
String c9 = g.c(file);
a aVar = new a("pv", true, true);
if (!g.a(c9)) {
aVar.c(c9);
}
if (intValue == 0) {
if (aVar.f14135b != Process.myPid()) {
z8 = false;
break;
} else {
z8 = true;
break;
}
}
if (intValue == 0) {
aVar.a("pv", 1L);
str = "fjv";
} else if (intValue == 1) {
str = "hpv";
} else {
if (intValue == 2) {
aVar.a("pv", 1L);
str = "npv";
}
q9 = com.uc.crashsdk.e.q();
j9 = aVar.f14134a;
if ((j9 != 0 || System.currentTimeMillis() - j9 >= 28800000) ? c(q9, aVar.a(true, true, false)) : false) {
aVar.f14136c = new HashMap();
aVar.f14134a = System.currentTimeMillis();
aVar.f14135b = Process.myPid();
}
g.a(file, aVar.a(false, false, true));
}
aVar.a(str, 1L);
q9 = com.uc.crashsdk.e.q();
j9 = aVar.f14134a;
if ((j9 != 0 || System.currentTimeMillis() - j9 >= 28800000) ? c(q9, aVar.a(true, true, false)) : false) {
}
g.a(file, aVar.a(false, false, true));
}
}
return;
case 303:
b(false);
return;
default:
if (!f14122a) {
throw new AssertionError();
}
return;
}
}
public static void b(String str) {
synchronized (f14132k) {
f14133l = str;
String k9 = com.uc.crashsdk.b.k();
b.a(k9, str + "\n");
}
}
private static StringBuilder a(Iterable<a> iterable, boolean z8, boolean z9) {
StringBuilder sb = new StringBuilder();
boolean z10 = true;
for (a aVar : iterable) {
if (z10) {
sb.append(aVar.a(z8, z8, z9));
z10 = false;
} else {
sb.append(aVar.a(false, z8, z9));
}
}
return sb;
}
public static void a(String str, int i9, int i10) {
if (com.uc.crashsdk.g.Q()) {
synchronized (f14127f) {
Map<String, a> map = f14126e;
a aVar = map.get(str);
if (aVar == null) {
aVar = new a("cst", false, true);
map.put(str, aVar);
a(aVar);
}
SparseArray<String> sparseArray = f14129h;
synchronized (sparseArray) {
if (sparseArray.size() == 0) {
a(100, "pv");
a(102, "hpv");
a(1, "all");
a(2, "afg");
a(101, "abg");
a(3, "jfg");
a(4, "jbg");
a(7, "nfg");
a(8, "nbg");
a(27, "nafg");
a(28, "nabg");
a(9, "nho");
a(10, "uar");
a(29, "ulm");
a(30, "ukt");
a(31, "uet");
a(32, "urs");
a(11, "ufg");
a(12, "ubg");
a(40, "anf");
a(41, "anb");
a(42, "ancf");
a(43, "ancb");
a(13, "lup");
a(14, "luf");
a(15, "lef");
a(200, "ltf");
a(16, "laf");
a(22, "lac");
a(23, "lau");
a(17, "llf");
a(18, "lul");
a(19, "lub");
a(20, "luc");
a(21, "luu");
a(24, "lzc");
a(201, "lec");
a(25, "lrc");
a(26, "lss");
}
}
String str2 = sparseArray.get(i9);
if (str2 == null) {
com.uc.crashsdk.a.a.a("crashsdk", "map key is not set with: " + i9, null);
}
aVar.a("prc", str);
if (str2 != null) {
aVar.a(str2, String.valueOf(i10));
}
}
}
}
public static boolean a(String str, String str2, boolean z8, boolean z9) {
if (com.uc.crashsdk.g.Q()) {
return com.uc.crashsdk.b.a(f14128g, n(), new e(353, new Object[]{str, str2, Boolean.valueOf(z8), Boolean.valueOf(z9)}));
}
return false;
}
private static void a(int i9, String str) {
f14129h.put(i9, str);
}
private static ArrayList<a> a(File file, String str, int i9) {
ArrayList<String> a9 = g.a(file, i9);
ArrayList<a> arrayList = new ArrayList<>();
Iterator<String> it = a9.iterator();
while (it.hasNext()) {
a aVar = new a(str, false, false);
if (aVar.c(it.next())) {
arrayList.add(aVar);
}
}
return arrayList;
}
}