Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,392 @@
package com.tencent.bugly.crashreport.common.info;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import com.ijm.dataencryption.de.DataDecryptTool;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.base.util.FileUtil;
import com.ubt.jimu.diy.model.CategoryModel;
import com.ubtrobot.jimu.robotapi.PeripheralType;
import java.io.ByteArrayInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.Principal;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class AppInfo {
private static ActivityManager a;
static {
"@buglyAllChannel@".split(",");
"@buglyAllChannelPriority@".split(",");
}
public static String a(Context context) {
if (context == null) {
return null;
}
try {
return context.getPackageName();
} catch (Throwable th) {
if (x.a(th)) {
return "fail";
}
th.printStackTrace();
return "fail";
}
}
public static PackageInfo b(Context context) {
try {
return context.getPackageManager().getPackageInfo(a(context), 0);
} catch (Throwable th) {
if (x.a(th)) {
return null;
}
th.printStackTrace();
return null;
}
}
public static String c(Context context) {
CharSequence applicationLabel;
if (context == null) {
return null;
}
try {
PackageManager packageManager = context.getPackageManager();
ApplicationInfo applicationInfo = context.getApplicationInfo();
if (packageManager != null && applicationInfo != null && (applicationLabel = packageManager.getApplicationLabel(applicationInfo)) != null) {
return applicationLabel.toString();
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
return null;
}
public static Map<String, String> d(Context context) {
if (context == null) {
return null;
}
try {
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO);
if (applicationInfo.metaData == null) {
return null;
}
HashMap hashMap = new HashMap();
Object obj = applicationInfo.metaData.get("BUGLY_DISABLE");
if (obj != null) {
hashMap.put("BUGLY_DISABLE", obj.toString());
}
Object obj2 = applicationInfo.metaData.get("BUGLY_APPID");
if (obj2 != null) {
hashMap.put("BUGLY_APPID", obj2.toString());
}
Object obj3 = applicationInfo.metaData.get("BUGLY_APP_CHANNEL");
if (obj3 != null) {
hashMap.put("BUGLY_APP_CHANNEL", obj3.toString());
}
Object obj4 = applicationInfo.metaData.get("BUGLY_APP_VERSION");
if (obj4 != null) {
hashMap.put("BUGLY_APP_VERSION", obj4.toString());
}
Object obj5 = applicationInfo.metaData.get("BUGLY_ENABLE_DEBUG");
if (obj5 != null) {
hashMap.put("BUGLY_ENABLE_DEBUG", obj5.toString());
}
Object obj6 = applicationInfo.metaData.get("com.tencent.rdm.uuid");
if (obj6 != null) {
hashMap.put("com.tencent.rdm.uuid", obj6.toString());
}
return hashMap;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
public static String e(Context context) {
Signature[] signatureArr;
String a2 = a(context);
if (a2 == null) {
return null;
}
try {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(a2, 64);
if (packageInfo != null && (signatureArr = packageInfo.signatures) != null && signatureArr.length != 0) {
return a(signatureArr[0].toByteArray());
}
} catch (PackageManager.NameNotFoundException unused) {
}
return null;
}
public static boolean f(Context context) {
if (context == null) {
return false;
}
if (a == null) {
a = (ActivityManager) context.getSystemService("activity");
}
try {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
a.getMemoryInfo(memoryInfo);
if (!memoryInfo.lowMemory) {
return false;
}
x.c("Memory is low.", new Object[0]);
return true;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return false;
}
}
public static String g(Context context) {
if (context == null) {
return "";
}
String h = h(context);
return !z.a(h) ? h : i(context);
}
private static String h(Context context) {
String str = "";
InputStream inputStream = null;
try {
} catch (IOException e) {
x.a(e);
}
try {
try {
String string = z.a("DENGTA_META", context).getString("key_channelpath", "");
if (z.a(string)) {
string = "channel.ini";
}
x.a("[AppInfo] Beacon channel file path: " + string, new Object[0]);
if (!string.equals("")) {
inputStream = context.getAssets().open(string);
Properties properties = new Properties();
properties.load(inputStream);
str = properties.getProperty("CHANNEL", "");
x.a("[AppInfo] Beacon channel read from assert: " + str, new Object[0]);
if (!z.a(str)) {
return str;
}
}
} catch (Exception unused) {
x.d("[AppInfo] Failed to get get beacon channel", new Object[0]);
if (inputStream != null) {
inputStream.close();
}
}
if (inputStream != null) {
inputStream.close();
}
return str;
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e2) {
x.a(e2);
}
}
}
}
private static String i(Context context) {
try {
Object obj = context.getPackageManager().getApplicationInfo(context.getPackageName(), PeripheralType.SERVO).metaData.get("CHANNEL_DENGTA");
return obj != null ? obj.toString() : "";
} catch (Throwable th) {
x.d("[AppInfo] Failed to read beacon channel from manifest.", new Object[0]);
x.a(th);
return "";
}
}
public static boolean a(Context context, String str) {
if (context != null && str != null && str.trim().length() > 0) {
try {
String[] strArr = context.getPackageManager().getPackageInfo(context.getPackageName(), FileUtil.ZIP_BUFFER_SIZE).requestedPermissions;
if (strArr != null) {
for (String str2 : strArr) {
if (str.equals(str2)) {
return true;
}
}
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return false;
}
public static String a(int i) {
FileReader fileReader;
FileReader fileReader2 = null;
try {
fileReader = new FileReader("/proc/" + i + "/cmdline");
} catch (Throwable th) {
th = th;
}
try {
char[] cArr = new char[DataDecryptTool.DECRYPT_DB_FILE];
fileReader.read(cArr);
int i2 = 0;
while (i2 < cArr.length && cArr[i2] != 0) {
i2++;
}
String substring = new String(cArr).substring(0, i2);
try {
fileReader.close();
} catch (Throwable unused) {
}
return substring;
} catch (Throwable th2) {
th = th2;
fileReader2 = fileReader;
try {
if (!x.a(th)) {
th.printStackTrace();
}
String valueOf = String.valueOf(i);
if (fileReader2 != null) {
try {
fileReader2.close();
} catch (Throwable unused2) {
}
}
return valueOf;
} catch (Throwable th3) {
if (fileReader2 != null) {
try {
fileReader2.close();
} catch (Throwable unused3) {
}
}
throw th3;
}
}
}
public static List<String> a(Map<String, String> map) {
if (map == null) {
return null;
}
try {
String str = map.get("BUGLY_DISABLE");
if (str != null && str.length() != 0) {
String[] split = str.split(",");
for (int i = 0; i < split.length; i++) {
split[i] = split[i].trim();
}
return Arrays.asList(split);
}
return null;
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
return null;
}
}
private static String a(byte[] bArr) {
X509Certificate x509Certificate;
StringBuilder sb = new StringBuilder();
if (bArr != null && bArr.length > 0) {
try {
CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
if (certificateFactory == null || (x509Certificate = (X509Certificate) certificateFactory.generateCertificate(new ByteArrayInputStream(bArr))) == null) {
return null;
}
sb.append("Issuer|");
Principal issuerDN = x509Certificate.getIssuerDN();
if (issuerDN != null) {
sb.append(issuerDN.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("SerialNumber|");
BigInteger serialNumber = x509Certificate.getSerialNumber();
if (issuerDN != null) {
sb.append(serialNumber.toString(16));
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("NotBefore|");
Date notBefore = x509Certificate.getNotBefore();
if (issuerDN != null) {
sb.append(notBefore.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("NotAfter|");
Date notAfter = x509Certificate.getNotAfter();
if (issuerDN != null) {
sb.append(notAfter.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("SHA1|");
String a2 = z.a(MessageDigest.getInstance("SHA1").digest(x509Certificate.getEncoded()));
if (a2 != null && a2.length() > 0) {
sb.append(a2.toString());
} else {
sb.append(CategoryModel.unknown);
}
sb.append("\n");
sb.append("MD5|");
String a3 = z.a(MessageDigest.getInstance("MD5").digest(x509Certificate.getEncoded()));
if (a3 != null && a3.length() > 0) {
sb.append(a3.toString());
} else {
sb.append(CategoryModel.unknown);
}
} catch (CertificateException e) {
if (!x.a(e)) {
e.printStackTrace();
}
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
return sb.length() == 0 ? CategoryModel.unknown : sb.toString();
}
}

View File

@@ -0,0 +1,51 @@
package com.tencent.bugly.crashreport.common.info;
import android.os.Parcel;
import android.os.Parcelable;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public class PlugInBean implements Parcelable {
public static final Parcelable.Creator<PlugInBean> CREATOR = new Parcelable.Creator<PlugInBean>() { // from class: com.tencent.bugly.crashreport.common.info.PlugInBean.1
@Override // android.os.Parcelable.Creator
public final /* synthetic */ PlugInBean createFromParcel(Parcel parcel) {
return new PlugInBean(parcel);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ PlugInBean[] newArray(int i) {
return new PlugInBean[i];
}
};
public final String a;
public final String b;
public final String c;
public PlugInBean(String str, String str2, String str3) {
this.a = str;
this.b = str2;
this.c = str3;
}
@Override // android.os.Parcelable
public int describeContents() {
return 0;
}
public String toString() {
return "plid:" + this.a + " plV:" + this.b + " plUUID:" + this.c;
}
@Override // android.os.Parcelable
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(this.a);
parcel.writeString(this.b);
parcel.writeString(this.c);
}
public PlugInBean(Parcel parcel) {
this.a = parcel.readString();
this.b = parcel.readString();
this.c = parcel.readString();
}
}

View File

@@ -0,0 +1,652 @@
package com.tencent.bugly.crashreport.common.info;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Process;
import com.tencent.bugly.proguard.x;
import com.tencent.bugly.proguard.z;
import com.ubt.jimu.diy.model.CategoryModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/* compiled from: BUGLY */
/* loaded from: classes.dex */
public final class a {
private static a af;
public SharedPreferences E;
private final Context F;
private String G;
private String H;
private String I;
private String Y;
public String c;
public final String d;
public final String f;
public final String g;
public final String h;
public long i;
public String j;
public String k;
public String l;
public List<String> o;
public boolean u;
public String v;
public String w;
public String x;
public boolean z;
public boolean e = true;
private String J = CategoryModel.unknown;
private String K = CategoryModel.unknown;
private String L = "";
private String M = null;
private String N = null;
private String O = null;
private String P = null;
private long Q = -1;
private long R = -1;
private long S = -1;
private String T = null;
private String U = null;
private Map<String, PlugInBean> V = null;
private boolean W = true;
private String X = null;
private Boolean Z = null;
private String aa = null;
private String ab = null;
private String ac = null;
public String m = null;
public String n = null;
private Map<String, PlugInBean> ad = null;
private Map<String, PlugInBean> ae = null;
private int ag = -1;
private int ah = -1;
private Map<String, String> ai = new HashMap();
private Map<String, String> aj = new HashMap();
private Map<String, String> ak = new HashMap();
private boolean al = true;
public String p = CategoryModel.unknown;
public long q = 0;
public long r = 0;
public long s = 0;
public long t = 0;
public boolean y = false;
private Boolean am = null;
private Boolean an = null;
public HashMap<String, String> A = new HashMap<>();
private String ao = null;
private String ap = null;
private String aq = null;
private String ar = null;
private String as = null;
public boolean B = true;
public List<String> C = new ArrayList();
public com.tencent.bugly.crashreport.a D = null;
/* renamed from: at, reason: collision with root package name */
private final Object f1at = new Object();
private final Object au = new Object();
private final Object av = new Object();
private final Object aw = new Object();
private final Object ax = new Object();
private final Object ay = new Object();
private final Object az = new Object();
public final long a = System.currentTimeMillis();
public final byte b = 1;
private a(Context context) {
this.j = null;
this.k = null;
this.Y = null;
this.l = null;
this.o = null;
this.u = false;
this.v = null;
this.w = null;
this.x = null;
this.z = false;
this.F = z.a(context);
PackageInfo b = AppInfo.b(context);
if (b != null) {
try {
this.j = b.versionName;
this.v = this.j;
this.w = Integer.toString(b.versionCode);
} catch (Throwable th) {
if (!x.a(th)) {
th.printStackTrace();
}
}
}
this.c = AppInfo.a(context);
this.d = AppInfo.a(Process.myPid());
this.f = b.o();
this.g = b.a();
this.k = AppInfo.c(context);
this.h = "Android " + b.b() + ",level " + b.c();
String str = this.g + ";" + this.h;
Map<String, String> d = AppInfo.d(context);
if (d != null) {
try {
this.o = AppInfo.a(d);
String str2 = d.get("BUGLY_APPID");
if (str2 != null) {
this.Y = str2;
c("APP_ID", this.Y);
}
String str3 = d.get("BUGLY_APP_VERSION");
if (str3 != null) {
this.j = str3;
}
String str4 = d.get("BUGLY_APP_CHANNEL");
if (str4 != null) {
this.l = str4;
}
String str5 = d.get("BUGLY_ENABLE_DEBUG");
if (str5 != null) {
this.u = str5.equalsIgnoreCase("true");
}
String str6 = d.get("com.tencent.rdm.uuid");
if (str6 != null) {
this.x = str6;
}
} catch (Throwable th2) {
if (!x.a(th2)) {
th2.printStackTrace();
}
}
}
try {
if (!context.getDatabasePath("bugly_db_").exists()) {
this.z = true;
x.c("App is first time to be installed on the device.", new Object[0]);
}
} catch (Throwable th3) {
if (com.tencent.bugly.b.c) {
th3.printStackTrace();
}
}
this.E = z.a("BUGLY_COMMON_VALUES", context);
x.c("com info create end", new Object[0]);
}
public static int K() {
return b.c();
}
public static synchronized a b() {
a aVar;
synchronized (a.class) {
aVar = af;
}
return aVar;
}
public static String c() {
return "3.1.0";
}
public final String A() {
if (this.ac == null) {
this.ac = b.g();
x.a("Hardware serial number: %s", this.ac);
}
return this.ac;
}
public final Map<String, String> B() {
synchronized (this.av) {
if (this.ai.size() <= 0) {
return null;
}
return new HashMap(this.ai);
}
}
public final void C() {
synchronized (this.av) {
this.ai.clear();
}
}
public final int D() {
int size;
synchronized (this.av) {
size = this.ai.size();
}
return size;
}
public final Set<String> E() {
Set<String> keySet;
synchronized (this.av) {
keySet = this.ai.keySet();
}
return keySet;
}
public final Map<String, String> F() {
synchronized (this.az) {
if (this.aj.size() <= 0) {
return null;
}
return new HashMap(this.aj);
}
}
public final Map<String, String> G() {
synchronized (this.aw) {
if (this.ak.size() <= 0) {
return null;
}
return new HashMap(this.ak);
}
}
public final int H() {
int i;
synchronized (this.ax) {
i = this.ag;
}
return i;
}
public final int I() {
return this.ah;
}
public final synchronized Map<String, PlugInBean> J() {
return null;
}
public final String L() {
if (this.ao == null) {
this.ao = b.q();
}
return this.ao;
}
public final String M() {
if (this.ap == null) {
this.ap = b.f(this.F);
}
return this.ap;
}
public final String N() {
if (this.aq == null) {
this.aq = b.g(this.F);
}
return this.aq;
}
public final String O() {
return b.r();
}
public final String P() {
if (this.ar == null) {
this.ar = b.h(this.F);
}
return this.ar;
}
public final long Q() {
return b.s();
}
public final boolean R() {
if (this.am == null) {
this.am = Boolean.valueOf(b.i(this.F));
x.a("Is it a virtual machine? " + this.am, new Object[0]);
}
return this.am.booleanValue();
}
public final boolean S() {
if (this.an == null) {
this.an = Boolean.valueOf(b.j(this.F));
x.a("Does it has hook frame? " + this.an, new Object[0]);
}
return this.an.booleanValue();
}
public final String T() {
if (this.H == null) {
this.H = AppInfo.g(this.F);
x.a("Beacon channel " + this.H, new Object[0]);
}
return this.H;
}
public final boolean a() {
return this.al;
}
public final void c(String str) {
this.I = str;
synchronized (this.az) {
this.aj.put("E8", str);
}
}
public final void d() {
synchronized (this.f1at) {
this.G = UUID.randomUUID().toString();
}
}
public final String e() {
String str;
synchronized (this.f1at) {
if (this.G == null) {
synchronized (this.f1at) {
this.G = UUID.randomUUID().toString();
}
}
str = this.G;
}
return str;
}
public final String f() {
if (z.a((String) null)) {
return this.Y;
}
return null;
}
public final String g() {
String str;
synchronized (this.ay) {
str = this.J;
}
return str;
}
public final String h() {
String str = this.I;
if (str != null) {
return str;
}
this.I = k() + "|" + m() + "|" + n();
return this.I;
}
public final synchronized String i() {
return this.K;
}
public final synchronized String j() {
return this.L;
}
public final String k() {
if (!this.W) {
return "";
}
if (this.M == null) {
this.M = b.d();
}
return this.M;
}
public final String l() {
if (!this.W) {
return "";
}
String str = this.N;
if (str == null || !str.contains(":")) {
this.N = b.f();
}
return this.N;
}
public final String m() {
if (!this.W) {
return "";
}
if (this.O == null) {
this.O = b.e();
}
return this.O;
}
public final String n() {
if (!this.W) {
return "";
}
if (this.P == null) {
this.P = b.a(this.F);
}
return this.P;
}
public final long o() {
if (this.Q <= 0) {
this.Q = b.h();
}
return this.Q;
}
public final long p() {
if (this.R <= 0) {
this.R = b.j();
}
return this.R;
}
public final long q() {
if (this.S <= 0) {
this.S = b.l();
}
return this.S;
}
public final String r() {
if (this.T == null) {
this.T = b.a(this.F, true);
}
return this.T;
}
public final String s() {
if (this.U == null) {
this.U = b.e(this.F);
}
return this.U;
}
public final String t() {
try {
Map<String, ?> all = this.F.getSharedPreferences("BuglySdkInfos", 0).getAll();
if (!all.isEmpty()) {
synchronized (this.au) {
for (Map.Entry<String, ?> entry : all.entrySet()) {
try {
this.A.put(entry.getKey(), entry.getValue().toString());
} catch (Throwable th) {
x.a(th);
}
}
}
}
} catch (Throwable th2) {
x.a(th2);
}
if (this.A.isEmpty()) {
return null;
}
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry2 : this.A.entrySet()) {
sb.append("[");
sb.append(entry2.getKey());
sb.append(",");
sb.append(entry2.getValue());
sb.append("] ");
}
c("SDK_INFO", sb.toString());
return sb.toString();
}
public final String u() {
if (this.as == null) {
this.as = AppInfo.e(this.F);
}
return this.as;
}
public final synchronized Map<String, PlugInBean> v() {
return null;
}
public final String w() {
if (this.X == null) {
this.X = b.n();
}
return this.X;
}
public final Boolean x() {
if (this.Z == null) {
this.Z = Boolean.valueOf(b.p());
}
return this.Z;
}
public final String y() {
if (this.aa == null) {
this.aa = b.d(this.F);
x.a("ROM ID: %s", this.aa);
}
return this.aa;
}
public final String z() {
if (this.ab == null) {
this.ab = b.b(this.F);
x.a("SIM serial number: %s", this.ab);
}
return this.ab;
}
public final void a(boolean z) {
this.al = z;
com.tencent.bugly.crashreport.a aVar = this.D;
if (aVar != null) {
aVar.setNativeIsAppForeground(z);
}
}
public final void b(String str) {
synchronized (this.ay) {
if (str == null) {
str = "10000";
}
this.J = str;
}
}
public final String f(String str) {
String remove;
if (z.a(str)) {
x.d("key should not be empty %s", str);
return null;
}
synchronized (this.av) {
remove = this.ai.remove(str);
}
return remove;
}
public final synchronized void d(String str) {
this.K = str;
}
public final String g(String str) {
String str2;
if (z.a(str)) {
x.d("key should not be empty %s", str);
return null;
}
synchronized (this.av) {
str2 = this.ai.get(str);
}
return str2;
}
public static synchronized a a(Context context) {
a aVar;
synchronized (a.class) {
if (af == null) {
af = new a(context);
}
aVar = af;
}
return aVar;
}
public final void b(boolean z) {
this.W = z;
}
public final void c(String str, String str2) {
if (!z.a(str) && !z.a(str2)) {
synchronized (this.aw) {
this.ak.put(str, str2);
}
} else {
x.d("server key&value should not be empty %s %s", str, str2);
}
}
public final void b(String str, String str2) {
if (!z.a(str) && !z.a(str2)) {
synchronized (this.av) {
this.ai.put(str, str2);
}
} else {
x.d("key&value should not be empty %s %s", str, str2);
}
}
public final synchronized void e(String str) {
this.L = str;
}
public final void a(String str) {
this.Y = str;
c("APP_ID", str);
}
public final void a(String str, String str2) {
if (str == null || str2 == null) {
return;
}
synchronized (this.au) {
this.A.put(str, str2);
}
}
public final void b(int i) {
int i2 = this.ah;
if (i2 != 24096) {
this.ah = 24096;
x.a("server scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ah));
}
}
public final void a(int i) {
synchronized (this.ax) {
int i2 = this.ag;
if (i2 != i) {
this.ag = i;
x.a("user scene tag %d changed to tag %d", Integer.valueOf(i2), Integer.valueOf(this.ag));
}
}
}
}

File diff suppressed because it is too large Load Diff