正在查看: CallApp v2.226 应用的 Header.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CallApp v2.226 应用的 Header.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.apm.insight.entity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import androidx.annotation.Keep;
import androidx.annotation.Nullable;
import com.amazon.aps.shared.APSAnalytics;
import com.amazon.aps.shared.metrics.model.ApsMetricsDataMap;
import com.amazonaws.services.s3.model.InstructionFileId;
import com.apm.insight.e;
import com.apm.insight.l.k;
import com.apm.insight.l.l;
import com.apm.insight.runtime.o;
import java.util.Iterator;
import java.util.Map;
import java.util.TimeZone;
import org.json.JSONException;
import org.json.JSONObject;
public final class Header {
private static final String[] f7916a = {"version_code", "manifest_version_code", "aid", "update_version_code"};
private static String f7917d = null;
private static int f7918e = -1;
private static int f7919f = -1;
private Context f7920b;
private JSONObject f7921c = new JSONObject();
public Header(Context context) {
this.f7920b = context;
}
public static Header a(Context context) {
Header header = new Header(context);
JSONObject jSONObject = header.f7921c;
try {
jSONObject.put("sdk_version", 200000390);
jSONObject.put("sdk_version_name", "2.0.0.3");
} catch (Exception unused) {
}
return header;
}
@Keep
public static void addOtherHeader(JSONObject jSONObject) {
if (jSONObject == null) {
return;
}
StringBuilder sb = new StringBuilder();
try {
if (com.apm.insight.l.d.b()) {
sb.append("MIUI-");
} else if (com.apm.insight.l.d.c()) {
sb.append("FLYME-");
} else {
String a8 = com.apm.insight.l.d.a();
if (com.apm.insight.l.d.a(a8)) {
sb.append("EMUI-");
}
if (!TextUtils.isEmpty(a8)) {
sb.append(a8);
sb.append("-");
}
}
sb.append(Build.VERSION.INCREMENTAL);
if (sb.length() > 0) {
jSONObject.put("rom", sb.toString());
}
jSONObject.put("rom_version", l.a());
} catch (Throwable unused) {
}
try {
DisplayMetrics displayMetrics = e.g().getResources().getDisplayMetrics();
int i8 = displayMetrics.densityDpi;
String str = i8 != 120 ? i8 != 240 ? i8 != 320 ? "mdpi" : "xhdpi" : "hdpi" : "ldpi";
jSONObject.put("density_dpi", i8);
jSONObject.put("display_density", str);
jSONObject.put("resolution", displayMetrics.heightPixels + "x" + displayMetrics.widthPixels);
} catch (Exception unused2) {
}
try {
String language = e.g().getResources().getConfiguration().locale.getLanguage();
if (!TextUtils.isEmpty(language)) {
jSONObject.put("language", language);
}
int rawOffset = TimeZone.getDefault().getRawOffset() / 3600000;
if (rawOffset < -12) {
rawOffset = -12;
}
if (rawOffset > 12) {
rawOffset = 12;
}
jSONObject.put("timezone", rawOffset);
} catch (Exception unused3) {
}
try {
jSONObject.put(ApsMetricsDataMap.APSMETRICS_FIELD_OS, APSAnalytics.OS_NAME);
jSONObject.put("device_id", e.c().a());
String str2 = Build.VERSION.RELEASE;
if (!str2.contains(InstructionFileId.DOT)) {
str2 = str2.concat(".0");
}
jSONObject.put("os_version", str2);
jSONObject.put("os_api", Build.VERSION.SDK_INT);
String str3 = Build.MODEL;
String str4 = Build.BRAND;
if (str3 == null) {
str3 = str4;
} else if (str4 != null && !str3.contains(str4)) {
str3 = str4 + ' ' + str3;
}
jSONObject.put("device_model", str3);
jSONObject.put("device_brand", str4);
jSONObject.put("device_manufacturer", Build.MANUFACTURER);
jSONObject.put("cpu_abi", g());
Context g9 = e.g();
String packageName = g9.getPackageName();
jSONObject.put("package", packageName);
PackageInfo packageInfo = g9.getPackageManager().getPackageInfo(packageName, 0);
ApplicationInfo applicationInfo = packageInfo.applicationInfo;
if (applicationInfo != null) {
int i9 = applicationInfo.labelRes;
if (i9 > 0) {
jSONObject.put("display_name", g9.getString(i9));
} else {
jSONObject.put("display_name", g9.getPackageManager().getApplicationLabel(packageInfo.applicationInfo));
}
}
} catch (Throwable th) {
th.printStackTrace();
}
d.a(jSONObject);
}
public static void addRuntimeHeader(JSONObject jSONObject) {
try {
jSONObject.put("access", k.a(e.g()));
} catch (JSONException e6) {
e6.printStackTrace();
}
try {
TelephonyManager telephonyManager = (TelephonyManager) e.g().getSystemService("phone");
if (telephonyManager != null) {
String networkOperatorName = telephonyManager.getNetworkOperatorName();
if (!TextUtils.isEmpty(networkOperatorName)) {
jSONObject.put("carrier", networkOperatorName);
}
String networkOperator = telephonyManager.getNetworkOperator();
if (TextUtils.isEmpty(networkOperator)) {
return;
}
jSONObject.put("mcc_mnc", networkOperator);
}
} catch (Exception e9) {
e9.printStackTrace();
}
}
public static Header b(Context context) {
Header a8 = a(context);
a(a8);
b(a8);
a8.c();
a8.d();
a8.e();
return a8;
}
private static String g() {
if (f7917d == null) {
try {
StringBuilder sb = new StringBuilder();
if (Build.SUPPORTED_ABIS.length > 0) {
int i8 = 0;
while (true) {
String[] strArr = Build.SUPPORTED_ABIS;
if (i8 >= strArr.length) {
break;
}
sb.append(strArr[i8]);
if (i8 != strArr.length - 1) {
sb.append(", ");
}
i8++;
}
} else {
sb = new StringBuilder(Build.CPU_ABI);
}
if (TextUtils.isEmpty(sb.toString())) {
f7917d = "unknown";
}
f7917d = sb.toString();
} catch (Exception e6) {
com.apm.insight.a.b((Throwable) e6);
f7917d = "unknown";
}
}
return f7917d;
}
public final JSONObject c() {
return a(e.a().a());
}
public final JSONObject d() {
try {
this.f7921c.put("device_id", e.c().a());
} catch (JSONException e6) {
e6.printStackTrace();
}
return this.f7921c;
}
public final JSONObject e() {
try {
long f6 = e.a().f();
if (f6 > 0) {
this.f7921c.put("user_id", f6);
}
} catch (JSONException e6) {
e6.printStackTrace();
}
return this.f7921c;
}
public final JSONObject f() {
return this.f7921c;
}
public static boolean c(JSONObject jSONObject) {
if (jSONObject == null || jSONObject.length() == 0) {
return true;
}
return (jSONObject.opt("app_version") == null && jSONObject.opt("version_name") == null) || jSONObject.opt("version_code") == null || jSONObject.opt("update_version_code") == null;
}
public static boolean d(JSONObject jSONObject) {
if (jSONObject != null && jSONObject.length() != 0) {
String optString = jSONObject.optString("aid");
if (TextUtils.isEmpty(optString)) {
return true;
}
try {
return Integer.parseInt(optString) <= 0;
} catch (Throwable unused) {
}
}
return true;
}
public static Header a(long j8) {
Header a8;
o a9 = o.a();
if (j8 == 0) {
j8 = System.currentTimeMillis();
}
JSONObject a10 = a9.a(j8);
if (a10 != null && a10.length() != 0) {
a8 = new Header(e.g());
} else {
a8 = a(e.g());
a8.c();
try {
a8.f7921c.put("errHeader", 1);
} catch (Throwable unused) {
}
}
b(a8);
a8.a(a10);
return a8;
}
public static boolean b() {
if (f7919f == -1) {
f7919f = g().contains("86") ? 1 : 0;
}
return f7919f == 1;
}
public static boolean b(JSONObject jSONObject) {
return jSONObject.optInt("unauthentic_version", 0) == 1;
}
public static void b(Header header) {
if (header == null) {
return;
}
addOtherHeader(header.f7921c);
}
public static boolean a() {
if (f7918e == -1) {
f7918e = g().contains("64") ? 1 : 0;
}
return f7918e == 1;
}
public final JSONObject a(JSONObject jSONObject) {
if (jSONObject == null) {
return this.f7921c;
}
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
try {
this.f7921c.put(next, jSONObject.opt(next));
} catch (JSONException e6) {
e6.printStackTrace();
}
}
return this.f7921c;
}
public final JSONObject a(@Nullable Map<String, Object> map) {
if (map == null) {
return this.f7921c;
}
for (Map.Entry<String, Object> entry : map.entrySet()) {
if (!this.f7921c.has(entry.getKey())) {
this.f7921c.put(entry.getKey(), entry.getValue());
}
}
String[] strArr = f7916a;
for (int i8 = 0; i8 < 4; i8++) {
String str = strArr[i8];
if (map.containsKey(str)) {
try {
this.f7921c.put(str, Integer.parseInt(String.valueOf(map.get(str))));
} catch (Throwable unused) {
this.f7921c.put(str, map.get(str));
}
}
}
if (map.containsKey("version_code") && !map.containsKey("manifest_version_code")) {
try {
this.f7921c.put("manifest_version_code", Integer.parseInt(String.valueOf(map.get("version_code"))));
} catch (Throwable unused2) {
}
}
if (map.containsKey("iid")) {
this.f7921c.put("udid", map.get("iid"));
this.f7921c.remove("iid");
}
if (map.containsKey("version_name")) {
this.f7921c.put("app_version", map.get("version_name"));
this.f7921c.remove("version_name");
}
return this.f7921c;
}
public static Header a(Header header) {
addRuntimeHeader(header.f7921c);
return header;
}
}