Files
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

1067 lines
37 KiB
Java

package com.mbridge.msdk.foundation.tools;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.content.Context;
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.support.v4.media.session.PlaybackStateCompat;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.format.Formatter;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.mbridge.msdk.MBridgeConstans;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import com.mbridge.msdk.foundation.tools.ah;
import com.unity3d.ads.core.data.datasource.AndroidDynamicDeviceInfoDataSource;
import com.unity3d.services.ads.gmascar.bridges.mobileads.MobileAdsBridge;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Locale;
import java.util.TimeZone;
import org.json.JSONObject;
@SuppressLint({"NewApi"})
/* loaded from: classes4.dex */
public final class ab extends k {
private static String A = "";
private static Object B = null;
private static int C = 0;
private static int D = 0;
private static String E = "";
private static String e = "";
private static String f = "";
private static int g = -1;
private static String h = "";
private static int i = -1;
private static int j = 0;
private static String k = "";
private static int l = -1;
private static String m = "";
private static String n = "";
private static volatile int o = -1;
private static String p = "";
private static String q = "";
private static int r = -1;
private static int s = -1;
private static int t = 0;
private static String u = "";
private static String v = null;
private static int w = 0;
private static String x = "";
private static int y = -1;
private static int z;
public static int b(int i2) {
switch (i2) {
case 1:
case 2:
case 4:
case 7:
case 11:
case 16:
return 2;
case 3:
case 5:
case 6:
case 8:
case 9:
case 10:
case 12:
case 14:
case 15:
case 17:
return 3;
case 13:
case 18:
case 19:
return 4;
case 20:
return 5;
default:
return 0;
}
}
public static void c(int i2) {
l = i2;
}
public static int t() {
return y;
}
public static int v() {
return l;
}
public static void e(final Context context) {
if (context == null) {
return;
}
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
f.b(context);
} else {
new Handler(context.getMainLooper()).post(new Runnable() { // from class: com.mbridge.msdk.foundation.tools.ab.1
@Override // java.lang.Runnable
public final void run() {
f.b(context);
}
});
}
} catch (Exception e2) {
af.b("SameDiTool", "", e2);
}
}
public static String f(Context context) {
if (context == null) {
return q;
}
try {
if (!TextUtils.isEmpty(q)) {
return q;
}
String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).packageName;
q = str;
return str;
} catch (Exception e2) {
e2.printStackTrace();
return "";
}
}
public static int f() {
try {
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
}
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return 0;
}
Context c = com.mbridge.msdk.foundation.controller.c.m().c();
long j2 = 0;
long longValue = ((Long) an.a(c, "FreeRamSize", 0L)).longValue();
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - longValue <= 1800000) {
if (r == -1) {
}
return r;
}
Context c2 = com.mbridge.msdk.foundation.controller.c.m().c();
if (c2 != null) {
ActivityManager activityManager = (ActivityManager) c2.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
j2 = memoryInfo.availMem;
}
r = Long.valueOf((j2 / 1000) / 1000).intValue();
an.b(c, "FreeRamSize", Long.valueOf(currentTimeMillis));
return r;
}
public static String g() {
if (TextUtils.isEmpty(x)) {
g(com.mbridge.msdk.foundation.controller.c.m().c());
}
return x;
}
public static String g(Context context) {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return null;
}
if (TextUtils.isEmpty(x)) {
try {
x = an.a(context, "mbridge_ua", "").toString();
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
}
}
try {
if (Looper.myLooper() == Looper.getMainLooper() && !MBridgeConstans.DNT_GUA_ON_UI) {
if (TextUtils.isEmpty(x)) {
try {
x = WebSettings.getDefaultUserAgent(context);
} catch (Throwable unused) {
}
if (TextUtils.isEmpty(x)) {
try {
Constructor declaredConstructor = WebSettings.class.getDeclaredConstructor(Context.class, WebView.class);
declaredConstructor.setAccessible(true);
x = ((WebSettings) declaredConstructor.newInstance(context, null)).getUserAgentString();
declaredConstructor.setAccessible(false);
} catch (Throwable th2) {
th2.printStackTrace();
}
if (TextUtils.isEmpty(x)) {
try {
x = new WebView(context).getSettings().getUserAgentString();
} catch (Throwable th3) {
th3.printStackTrace();
}
}
if (TextUtils.isEmpty(x)) {
B();
}
}
} else {
y(context);
}
} else {
if (TextUtils.isEmpty(x)) {
B();
}
y(context);
}
} catch (Throwable th4) {
af.b("SameDiTool", th4.getMessage(), th4);
}
z(context);
return x;
}
private static void B() {
String str = Build.VERSION.RELEASE;
String h2 = h();
String str2 = Build.DISPLAY;
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(h2)) {
x = "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19";
return;
}
StringBuilder sb = new StringBuilder();
sb.append("Mozilla/5.0 (Linux; Android ");
sb.append(str);
sb.append("; ");
sb.append(h2);
sb.append(" Build/");
if (TextUtils.isEmpty(str2)) {
str2 = "";
}
sb.append(str2);
sb.append(") AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19");
x = sb.toString();
}
private static void y(final Context context) {
try {
new Thread(new Runnable() { // from class: com.mbridge.msdk.foundation.tools.ab.2
@Override // java.lang.Runnable
public final void run() {
String str;
try {
str = WebSettings.getDefaultUserAgent(context);
} catch (Throwable unused) {
str = null;
}
try {
if (TextUtils.isEmpty(str) || str.equals(ab.x)) {
return;
}
String unused2 = ab.x = str;
ab.z(context);
} catch (Throwable th) {
th.printStackTrace();
}
}
}).start();
} catch (Exception e2) {
e2.printStackTrace();
}
}
/* JADX INFO: Access modifiers changed from: private */
public static void z(Context context) {
try {
an.b(context, "mbridge_ua", x);
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
}
}
public static String h() {
return !com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) ? "" : Build.MODEL;
}
public static String i() {
com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA);
return "";
}
public static int h(Context context) {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) || context == null) {
return 0;
}
try {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
HashMap i2 = i(context);
return i2.get("height") == null ? displayMetrics.heightPixels : ((Integer) i2.get("height")).intValue();
} catch (Exception e2) {
e2.printStackTrace();
return 0;
}
}
public static HashMap i(Context context) {
HashMap hashMap = new HashMap();
if (context == null) {
return hashMap;
}
try {
Display defaultDisplay = ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
defaultDisplay.getRealMetrics(displayMetrics);
hashMap.put("height", Integer.valueOf(displayMetrics.heightPixels));
hashMap.put("width", Integer.valueOf(displayMetrics.widthPixels));
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage(), e2);
}
return hashMap;
}
public static int j(Context context) {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) || context == null) {
return 0;
}
try {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
HashMap i2 = i(context);
return i2.get("width") == null ? displayMetrics.widthPixels : ((Integer) i2.get("width")).intValue();
} catch (Exception e2) {
e2.printStackTrace();
return 0;
}
}
public static void j() {
try {
Object a = an.a(com.mbridge.msdk.foundation.controller.c.m().c(), MBridgeConstans.SP_GA_ID, "");
Object a2 = an.a(com.mbridge.msdk.foundation.controller.c.m().c(), MBridgeConstans.SP_GA_ID_LIMIT, 0);
if (a instanceof String) {
String str = (String) a;
if (!TextUtils.isEmpty(str)) {
f.a(str);
}
if (a2 instanceof Integer) {
f.d = ((Integer) a2).intValue();
}
}
} catch (Exception e2) {
if (MBridgeConstans.DEBUG) {
af.b("SameDiTool", e2.getMessage());
}
}
}
public static int k() {
if (com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return Build.VERSION.SDK_INT;
}
return -1;
}
public static String k(Context context) {
try {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
m = "";
} else if (TextUtils.isEmpty(m)) {
if (context == null) {
m = "";
return "";
}
String simOperator = ((TelephonyManager) context.getSystemService("phone")).getSimOperator();
if (ak.j(simOperator)) {
m = simOperator.substring(0, Math.min(3, simOperator.length()));
}
}
} catch (Exception e2) {
e2.printStackTrace();
m = "";
}
return m;
}
public static String l(Context context) {
try {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
n = "";
} else if (TextUtils.isEmpty(n)) {
if (context == null) {
n = "";
return m;
}
String simOperator = ((TelephonyManager) context.getSystemService("phone")).getSimOperator();
if (ak.j(simOperator)) {
n = simOperator.substring(Math.min(3, simOperator.length()));
}
}
} catch (Exception e2) {
e2.printStackTrace();
n = "";
}
return n;
}
public static String a(Context context, int i2) {
TelephonyManager telephonyManager;
if (i2 == 0 || i2 == 9) {
return "";
}
try {
return (!com.mbridge.msdk.foundation.same.a.z || (telephonyManager = (TelephonyManager) context.getSystemService("phone")) == null) ? "" : String.valueOf(telephonyManager.getNetworkType());
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
return "";
}
}
public static String l() {
return !com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) ? "" : Build.MANUFACTURER;
}
@SuppressLint({"MissingPermission"})
public static int m(Context context) {
try {
final Context c = com.mbridge.msdk.foundation.controller.c.m().c();
if (com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) && c != null) {
if (o == -1) {
o = 0;
return o;
}
try {
Runnable runnable = new Runnable() { // from class: com.mbridge.msdk.foundation.tools.ab.3
@Override // java.lang.Runnable
@SuppressLint({"MissingPermission"})
public final void run() {
try {
ConnectivityManager connectivityManager = (ConnectivityManager) c.getSystemService("connectivity");
if (connectivityManager != null && com.mbridge.msdk.foundation.same.a.z) {
NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
if (activeNetworkInfo == null) {
int unused = ab.o = 0;
return;
}
if (activeNetworkInfo.getType() == 1) {
int unused2 = ab.o = 9;
return;
}
TelephonyManager telephonyManager = (TelephonyManager) c.getSystemService("phone");
if (telephonyManager == null) {
int unused3 = ab.o = 0;
} else {
int unused4 = ab.o = ab.b(telephonyManager.getNetworkType());
}
}
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage(), e2);
int unused5 = ab.o = 0;
}
}
};
if (com.mbridge.msdk.foundation.same.f.a.d().getActiveCount() < 1) {
com.mbridge.msdk.foundation.same.f.a.d().execute(runnable);
}
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage());
}
return o;
}
return o;
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage(), e2);
o = 0;
return o;
}
}
public static String a(String str, Context context) {
try {
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage(), e2);
}
if (!TextUtils.isEmpty(e)) {
return e;
}
if (!TextUtils.isEmpty(str) && context != null) {
e = context.getPackageManager().getInstallerPackageName(str);
af.a("SameDiTool", "PKGSource:" + e);
}
return e;
}
public static String m() {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return "";
}
return Build.MANUFACTURER + " " + Build.MODEL;
}
public static String n() {
Context c;
long a;
long C2;
String A2;
String str;
String str2;
String str3 = "";
try {
c = com.mbridge.msdk.foundation.controller.c.m().c();
a = aa.a();
C2 = C();
A2 = A(c);
str = "app_tki_" + a + "_" + C2 + "_" + A2;
str2 = (String) an.a(c, str, "");
try {
} catch (Exception e2) {
e = e2;
str3 = str2;
e.printStackTrace();
return str3;
}
} catch (Exception e3) {
e = e3;
}
if (!TextUtils.isEmpty(str2)) {
return str2;
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("1", A2);
jSONObject.put("2", String.valueOf(C2));
jSONObject.put("3", String.valueOf(a));
jSONObject.put("4", "");
jSONObject.put(CampaignEx.CLICKMODE_ON, "");
} catch (Exception e4) {
e4.printStackTrace();
}
str3 = a.a(jSONObject.toString());
an.b(c, str, str3);
return str3;
}
private static long C() {
Context c = com.mbridge.msdk.foundation.controller.c.m().c();
if (c == null) {
return 0L;
}
ActivityManager activityManager = (ActivityManager) c.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return memoryInfo.totalMem;
}
private static String A(Context context) {
try {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
f = "";
} else if (TextUtils.isEmpty(f)) {
f = ((TelephonyManager) context.getSystemService("phone")).getSimOperatorName();
}
} catch (Exception e2) {
e2.printStackTrace();
f = "";
}
return f;
}
public static int o() {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return 0;
}
if (s < 1) {
try {
Context c = com.mbridge.msdk.foundation.controller.c.m().c();
long longValue = ((Long) an.a(c, "TotalRamSize", 0L)).longValue();
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - longValue <= 1800000) {
if (s == -1) {
}
}
s = Long.valueOf((C() / 1000) / 1000).intValue();
an.b(c, "TotalRamSize", Long.valueOf(currentTimeMillis));
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
}
}
return s;
}
public static String n(Context context) {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) || context == null) {
return "";
}
try {
return Settings.System.getString(context.getContentResolver(), "time_12_24");
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage(), e2);
return "";
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
return "";
}
}
public static String o(Context context) {
FileReader fileReader;
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) || context == null) {
return "";
}
if (!TextUtils.isEmpty(v)) {
return v;
}
BufferedReader bufferedReader = null;
try {
try {
try {
fileReader = new FileReader(AndroidDynamicDeviceInfoDataSource.DIRECTORY_MEM_INFO);
try {
BufferedReader bufferedReader2 = new BufferedReader(fileReader, 8192);
try {
String formatFileSize = Formatter.formatFileSize(context, Long.valueOf(bufferedReader2.readLine().split("\\s+")[1]).longValue() * PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID);
v = formatFileSize;
try {
bufferedReader2.close();
} catch (IOException e2) {
af.b("SameDiTool", e2.getMessage(), e2);
}
try {
fileReader.close();
} catch (IOException e3) {
af.b("SameDiTool", e3.getMessage(), e3);
}
return formatFileSize;
} catch (IOException e4) {
e = e4;
bufferedReader = bufferedReader2;
af.b("SameDiTool", e.getMessage(), e);
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e5) {
af.b("SameDiTool", e5.getMessage(), e5);
}
}
if (fileReader != null) {
fileReader.close();
}
return "";
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
af.b("SameDiTool", th.getMessage(), th);
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException e6) {
af.b("SameDiTool", e6.getMessage(), e6);
}
}
if (fileReader != null) {
fileReader.close();
}
return "";
}
} catch (IOException e7) {
e = e7;
} catch (Throwable th2) {
th = th2;
}
} catch (IOException e8) {
af.b("SameDiTool", e8.getMessage(), e8);
return "";
}
} catch (IOException e9) {
e = e9;
fileReader = null;
} catch (Throwable th3) {
th = th3;
fileReader = null;
}
} finally {
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v10, types: [java.io.BufferedReader] */
/* JADX WARN: Type inference failed for: r1v11, types: [java.io.BufferedReader] */
/* JADX WARN: Type inference failed for: r1v13 */
/* JADX WARN: Type inference failed for: r1v14 */
/* JADX WARN: Type inference failed for: r1v16 */
/* JADX WARN: Type inference failed for: r1v18 */
/* JADX WARN: Type inference failed for: r1v19, types: [java.io.BufferedReader] */
/* JADX WARN: Type inference failed for: r1v21 */
/* JADX WARN: Type inference failed for: r1v22 */
/* JADX WARN: Type inference failed for: r1v23 */
/* JADX WARN: Type inference failed for: r1v3, types: [java.lang.String] */
/* JADX WARN: Type inference failed for: r1v4, types: [java.io.BufferedReader] */
/* JADX WARN: Type inference failed for: r1v7 */
/* JADX WARN: Type inference failed for: r1v9 */
public static String p() {
FileReader fileReader;
Throwable th;
Exception e2;
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return "";
}
if (w > 0) {
return w + "GB";
}
?? r1 = AndroidDynamicDeviceInfoDataSource.DIRECTORY_MEM_INFO;
w = 0;
try {
try {
try {
fileReader = new FileReader(AndroidDynamicDeviceInfoDataSource.DIRECTORY_MEM_INFO);
try {
r1 = new BufferedReader(fileReader, 8192);
try {
String str = r1.readLine().split("\\s+")[1];
r1.close();
if (str != null) {
w = (int) Math.ceil(new Float(Float.valueOf(str).floatValue() / 1048576.0f).doubleValue());
}
try {
fileReader.close();
} catch (IOException unused) {
}
r1.close();
r1 = r1;
} catch (Exception e3) {
e2 = e3;
af.b("SameDiTool", e2.getMessage(), e2);
if (fileReader != null) {
try {
fileReader.close();
} catch (IOException unused2) {
}
}
if (r1 != 0) {
r1.close();
r1 = r1;
}
return w + "GB";
} catch (Throwable th2) {
th = th2;
af.b("SameDiTool", th.getMessage(), th);
if (fileReader != null) {
try {
fileReader.close();
} catch (IOException unused3) {
}
}
if (r1 != 0) {
r1.close();
r1 = r1;
}
return w + "GB";
}
} catch (Exception e4) {
e2 = e4;
r1 = 0;
} catch (Throwable th3) {
th = th3;
r1 = 0;
}
} catch (IOException e5) {
e5.printStackTrace();
}
} catch (Exception e6) {
fileReader = null;
e2 = e6;
r1 = 0;
} catch (Throwable th4) {
fileReader = null;
th = th4;
r1 = 0;
}
return w + "GB";
} finally {
}
}
public static int r() {
try {
if (ak.h()) {
return 1;
}
return ak.i() ? 2 : 0;
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage());
return 0;
}
}
public static int s() {
try {
return Build.VERSION.SDK_INT;
} catch (Exception e2) {
e2.printStackTrace();
return 0;
}
}
public static Object b(String str) {
if (B == null) {
B = ak.g(str);
}
return B;
}
public static int u() {
if (C == 0) {
C = ak.e();
}
return C;
}
public static int c(String str) {
if (D == 0) {
D = ak.f(str);
}
return D;
}
public static String w() {
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return "";
}
if (TextUtils.isEmpty(p)) {
p = s() + "";
}
return p;
}
public static String q(Context context) {
if (context == null) {
return A;
}
try {
if (!TextUtils.isEmpty(A)) {
return A;
}
String str = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
A = str;
return str;
} catch (Exception e2) {
e2.printStackTrace();
return "";
}
}
public static int r(Context context) {
if (context == null) {
return z;
}
int i2 = z;
if (i2 != 0) {
return i2;
}
try {
int i3 = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode;
z = i3;
return i3;
} catch (Exception e2) {
e2.printStackTrace();
return -1;
}
}
public static int s(Context context) {
Configuration configuration;
return (context == null || context.getResources() == null || (configuration = context.getResources().getConfiguration()) == null || configuration.orientation != 2) ? 1 : 2;
}
public static String x() {
return !com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA) ? "" : Build.BRAND;
}
public static String t(Context context) {
Locale locale;
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_GENERAL_DATA)) {
return "";
}
if (TextUtils.isEmpty(k)) {
if (context == null) {
return "en-US";
}
try {
if (context.getResources() == null || context.getResources().getConfiguration() == null || (locale = context.getResources().getConfiguration().locale) == null) {
return "en-US";
}
String languageTag = locale.toLanguageTag();
k = languageTag;
return languageTag;
} catch (Throwable th) {
af.a("SameDiTool", th.getMessage());
k = "en-US";
}
}
return k;
}
public static String y() {
try {
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage(), th);
}
if (!com.mbridge.msdk.foundation.controller.authoritycontroller.c.j().c(MBridgeConstans.AUTHORITY_OTHER)) {
return "";
}
if (TextUtils.isEmpty(u)) {
new Thread(new Runnable() { // from class: com.mbridge.msdk.foundation.tools.ab.4
@Override // java.lang.Runnable
public final void run() {
try {
String unused = ab.u = TimeZone.getDefault().getDisplayName(false, 0, Locale.ENGLISH);
} catch (Throwable th2) {
th2.printStackTrace();
}
}
}).start();
return u;
}
return u;
}
public static int u(Context context) {
if (context == null) {
return t;
}
if (t == 0) {
try {
t = context.getApplicationInfo().targetSdkVersion;
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage());
}
}
return t;
}
private static String D() {
String str;
if (!TextUtils.isEmpty(h)) {
return h;
}
JSONObject jSONObject = new JSONObject();
try {
Class<?> cls = Class.forName("com.huawei.system.BuildEx");
str = (String) cls.getMethod("getOsBrand", new Class[0]).invoke(cls, new Object[0]);
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage());
str = null;
}
try {
if (TextUtils.isEmpty(str) || !str.equals("harmony")) {
h = "android";
} else {
jSONObject.put("osType", str);
try {
Class<?> cls2 = Class.forName("ohos.system.version.SystemVersion");
jSONObject.put("version", (String) cls2.getMethod(MobileAdsBridge.versionMethodName, new Class[0]).invoke(cls2, new Object[0]));
} catch (Throwable th2) {
af.b("SameDiTool", th2.getMessage());
}
try {
jSONObject.put("pure_state", Settings.Secure.getInt(com.mbridge.msdk.foundation.controller.c.m().c().getContentResolver(), "pure_mode_state", -1));
} catch (Throwable th3) {
af.b("SameDiTool", th3.getMessage());
}
String jSONObject2 = jSONObject.toString();
if (!TextUtils.isEmpty(jSONObject2)) {
jSONObject2 = z.b(jSONObject2);
}
h = jSONObject2;
}
} catch (Throwable th4) {
af.b("SameDiTool", th4.getMessage());
}
return h;
}
public static int v(Context context) {
if (g == -1) {
g = ak.c(context, "com.tencent.mm") ? 1 : 0;
}
return g;
}
public static int z() {
if (i == -1) {
i = ak.f() ? 1 : 0;
}
return i;
}
public static boolean w(Context context) {
return (context.getResources().getConfiguration().screenLayout & 15) >= 3;
}
public static int q() {
try {
} catch (Exception e2) {
j = 0;
af.b("SameDiTool", e2.getMessage());
}
if (!ah.a.a.a("v_a_d_p", false)) {
return 0;
}
if (ak.h()) {
j = 1;
} else if (ak.i()) {
j = 2;
} else {
j = 0;
}
return j;
}
public static void p(Context context) {
try {
f.a(context);
w();
f(context);
q(context);
r(context);
s(context);
h();
x();
t(context);
y();
com.mbridge.msdk.foundation.same.a.B = false;
com.mbridge.msdk.foundation.same.a.z = ak.a("android.permission.ACCESS_NETWORK_STATE", context);
u(context);
D();
f.e();
try {
com.mbridge.msdk.foundation.same.f.a.e().execute(new Runnable() { // from class: com.mbridge.msdk.foundation.tools.ab.5
@Override // java.lang.Runnable
public final void run() {
try {
com.mbridge.msdk.e.c.a();
} catch (Exception e2) {
af.b("SameDiTool", e2.getMessage());
}
}
});
} catch (Throwable th) {
af.b("SameDiTool", th.getMessage());
}
} catch (Throwable th2) {
af.b("SameDiTool", th2.getMessage());
}
}
}