atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9
以下内容为反编译后的 r.java 源代码,内容仅作参考
package com.bytedance.sdk.openadsdk.l;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.StatFs;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.amazon.device.ads.DtbDeviceDataRetriever;
import com.bytedance.sdk.component.widget.SSWebView;
import com.bytedance.sdk.openadsdk.core.ab;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
public class r {
private static ExecutorService a = Executors.newSingleThreadExecutor();
private static p b = new p();
private static volatile boolean c = false;
private static String d = null;
private static volatile String e = "";
private static String f = null;
private static String g = null;
private static String h = null;
private static HashSet<String> i = new HashSet<>(Arrays.asList("Asia/Shanghai", "Asia/Urumqi", "Asia/Chongqing", "Asia/Harbin", "Asia/Kashgar"));
public static int a(String str) {
char c2;
switch (str.hashCode()) {
case -1695837674:
if (str.equals("banner_ad")) {
c2 = 2;
break;
}
c2 = 65535;
break;
case -1364000502:
if (str.equals("rewarded_video")) {
c2 = 7;
break;
}
c2 = 65535;
break;
case -764631662:
if (str.equals("fullscreen_interstitial_ad")) {
c2 = 6;
break;
}
c2 = 65535;
break;
case -712491894:
if (str.equals("embeded_ad")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case 174971131:
if (str.equals("splash_ad")) {
c2 = 4;
break;
}
c2 = 65535;
break;
case 564365438:
if (str.equals("cache_splash_ad")) {
c2 = 5;
break;
}
c2 = 65535;
break;
case 1844104722:
if (str.equals("interaction")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case 1912999166:
if (str.equals("draw_ad")) {
c2 = 1;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
switch (c2) {
case 1:
return 6;
case 2:
return 2;
case 3:
return 3;
case 4:
case 5:
return 4;
case 6:
return 5;
case 7:
return 7;
default:
return 1;
}
}
public static long a(long j) {
return (j + TimeZone.getDefault().getOffset(j)) / 86400000;
}
public static Intent a(Context context, String str) {
Intent launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage(str);
if (launchIntentForPackage == null) {
return null;
}
if (!launchIntentForPackage.hasCategory("android.intent.category.LAUNCHER")) {
launchIntentForPackage.addCategory("android.intent.category.LAUNCHER");
}
launchIntentForPackage.setPackage(null);
launchIntentForPackage.addFlags(2097152);
launchIntentForPackage.addFlags(268435456);
return launchIntentForPackage;
}
public static String a() {
String b2;
String str = "unKnow";
try {
b2 = com.bytedance.sdk.openadsdk.multipro.b.c() ? com.bytedance.sdk.openadsdk.multipro.d.a.b("sp_multi_ua_data", "android_system_ua", "unKnow") : com.bytedance.sdk.openadsdk.core.c.a(com.bytedance.sdk.openadsdk.core.o.a()).b("android_system_ua", "unKnow");
} catch (Exception unused) {
}
if (b2 == null || "unKnow".equals(b2)) {
FutureTask futureTask = new FutureTask(new a(2));
a.execute(futureTask);
str = (String) futureTask.get(500L, TimeUnit.MILLISECONDS);
com.bytedance.sdk.component.utils.l.e("getUA", " getAndroidSystemUA userAgent" + str);
return str;
}
return b2;
}
public static String a(int i2) {
switch (i2) {
case 1:
return "embeded_ad_landingpage";
case 2:
return "banner_ad_landingpage";
case 3:
return "interaction_landingpage";
case 4:
return "splash_ad_landingpage";
case 5:
return "fullscreen_interstitial_ad";
case 6:
return "draw_ad_landingpage";
case 7:
return "rewarded_video_landingpage";
default:
return null;
}
}
public static String a(Context context) {
String b2 = com.bytedance.sdk.openadsdk.core.c.a(context).b("total_memory", (String) null);
if (b2 == null) {
String e2 = e(context, "MemTotal");
com.bytedance.sdk.openadsdk.core.c.a(context).a("total_memory", e2);
return e2;
}
return b2;
}
public static String a(com.bytedance.sdk.openadsdk.core.f.l lVar) {
if (lVar == null) {
return null;
}
try {
return b(c(lVar.Y()));
} catch (Throwable unused) {
return null;
}
}
public static Map<String, Object> a(com.bytedance.sdk.openadsdk.core.f.l lVar, long j, com.bykv.vk.openvk.component.video.api.a aVar) {
if (lVar == null) {
return new HashMap();
}
HashMap hashMap = new HashMap();
hashMap.put("creative_id", lVar.V());
hashMap.put("buffers_time", Long.valueOf(j));
com.bykv.vk.openvk.component.video.api.c.b G = lVar.G();
if (G != null) {
hashMap.put("video_size", Long.valueOf(G.d()));
hashMap.put("video_resolution", G.f());
}
a(hashMap, aVar);
return hashMap;
}
public static Map<String, Object> a(boolean z, com.bytedance.sdk.openadsdk.core.f.l lVar, long j, long j2, String str) {
HashMap hashMap = new HashMap();
hashMap.put("creative_id", lVar.V());
hashMap.put("load_time", Long.valueOf(j));
com.bykv.vk.openvk.component.video.api.c.b G = lVar.G();
if (G != null) {
hashMap.put("video_size", Long.valueOf(G.d()));
hashMap.put("video_resolution", G.f());
}
if (!z) {
hashMap.put("error_code", Long.valueOf(j2));
if (TextUtils.isEmpty(str)) {
str = DtbDeviceDataRetriever.ORIENTATION_UNKNOWN;
}
hashMap.put("error_message", str);
}
return hashMap;
}
public static void a(com.bytedance.sdk.openadsdk.core.f.l lVar, View view) {
}
public static void a(com.bytedance.sdk.openadsdk.core.f.l lVar, String str) {
if (lVar != null) {
try {
String L = lVar.L();
if (TextUtils.isEmpty(L) && lVar.X() != null && lVar.X().c() == 1 && !TextUtils.isEmpty(lVar.X().b())) {
L = lVar.X().b();
}
String str2 = L;
if (TextUtils.isEmpty(str2)) {
return;
}
ab.a(com.bytedance.sdk.openadsdk.core.o.a(), str2, lVar, a(str), str, false);
} catch (Throwable unused) {
}
}
}
public static void a(String str, String str2, Context context) {
if (TextUtils.isEmpty(str2) || context == null || !m(context)) {
return;
}
int length = str2.length();
int i2 = length % 3572 == 0 ? length / 3572 : (length / 3572) + 1;
int i3 = 3572;
int i4 = 0;
int i5 = 1;
while (i5 <= i2) {
if (i3 >= length) {
Log.d(str, i2 + "-" + i5 + ":" + str2.substring(i4));
return;
}
Log.d(str, i2 + "-" + i5 + ":" + str2.substring(i4, i3));
i5++;
i4 = i3;
i3 += 3572;
}
}
private static void a(Map<String, Object> map, com.bykv.vk.openvk.component.video.api.a aVar) {
if (map.containsKey("video_resolution") || aVar == null) {
return;
}
try {
map.put("video_resolution", String.format(Locale.getDefault(), "%d×%d", Integer.valueOf(aVar.j()), Integer.valueOf(aVar.k())));
} catch (Throwable unused) {
}
}
public static void a(JSONObject jSONObject, Float f2, Float f3) {
if (jSONObject == null) {
return;
}
try {
jSONObject.put(com.bytedance.sdk.component.c.a.a("w0yrwBEUr1ini9hm/p022A==", com.bytedance.sdk.openadsdk.core.a.a()), f3);
jSONObject.put(com.bytedance.sdk.component.c.a.a("LeHrqxcsm457V3n1/LcJVw==", com.bytedance.sdk.openadsdk.core.a.a()), f2);
} catch (JSONException e2) {
e2.printStackTrace();
}
}
public static void a(JSONObject jSONObject, boolean z) {
String a2;
if (!p.a() || (a2 = p.a("testGps.txt")) == null) {
return;
}
try {
String[] split = a2.split(",");
if (split.length >= 2 && k(split[1]) && k(split[0])) {
if (z) {
a(jSONObject, Float.valueOf(Float.parseFloat(split[0])), Float.valueOf(Float.parseFloat(split[1])));
} else {
JSONObject jSONObject2 = new JSONObject();
a(jSONObject2, Float.valueOf(Float.parseFloat(split[0])), Float.valueOf(Float.parseFloat(split[1])));
jSONObject.put("geo", jSONObject2);
}
}
} catch (JSONException unused) {
}
}
public static boolean a(long j, long j2) {
long j3 = j2 - j;
return j3 < 86400000 && j3 > -86400000 && a(j) == a(j2);
}
public static boolean a(Context context, Intent intent) {
if (intent == null) {
return false;
}
try {
List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 65536);
if (queryIntentActivities != null) {
return queryIntentActivities.size() > 0;
}
return false;
} catch (Throwable unused) {
return false;
}
}
public static String b() {
String defaultUserAgent;
if (TextUtils.isEmpty(e)) {
try {
e = com.bytedance.sdk.openadsdk.core.h.a("sdk_local_web_ua", 86400000L);
} catch (Exception unused) {
}
if (TextUtils.isEmpty(e)) {
if (Build.VERSION.SDK_INT < 17) {
if (Looper.myLooper() != Looper.getMainLooper()) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
try {
if (TextUtils.isEmpty(r.e)) {
String unused2 = r.e = new SSWebView(com.bytedance.sdk.openadsdk.core.o.a()).getUserAgentString();
}
} catch (Exception unused3) {
}
}
});
} else if (TextUtils.isEmpty(e)) {
defaultUserAgent = new SSWebView(com.bytedance.sdk.openadsdk.core.o.a()).getUserAgentString();
e = defaultUserAgent;
}
com.bytedance.sdk.openadsdk.core.h.a("sdk_local_web_ua", e);
} else {
if (TextUtils.isEmpty(e)) {
defaultUserAgent = WebSettings.getDefaultUserAgent(com.bytedance.sdk.openadsdk.core.o.a());
e = defaultUserAgent;
}
com.bytedance.sdk.openadsdk.core.h.a("sdk_local_web_ua", e);
}
}
return e;
}
return e;
}
public static String b(int i2) {
return i2 != 1 ? i2 != 2 ? (i2 == 3 || i2 == 4) ? "splash_ad" : i2 != 7 ? i2 != 8 ? i2 != 9 ? "embeded_ad" : "draw_ad" : "fullscreen_interstitial_ad" : "rewarded_video" : "interaction" : "banner_ad";
}
public static String b(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_memory", "0");
}
public static JSONObject b(String str) {
if (!TextUtils.isEmpty(str)) {
try {
return new JSONObject(str);
} catch (JSONException e2) {
e2.printStackTrace();
}
}
return null;
}
public static boolean b(Context context, String str) {
if (context == null || TextUtils.isEmpty(str)) {
return false;
}
try {
return context.getPackageManager().getPackageInfo(str, 0) != null;
} catch (Throwable unused) {
return false;
}
}
public static boolean b(com.bytedance.sdk.openadsdk.core.f.l lVar) {
return lVar != null && c(lVar.Y()) == 9;
}
public static int c(int i2) {
BufferedReader bufferedReader;
Throwable th;
int parseInt;
FileReader fileReader = null;
BufferedReader bufferedReader2 = null;
int i3 = 0;
while (true) {
i2--;
if (i2 < 0) {
return i3;
}
try {
FileReader fileReader2 = new FileReader("/sys/devices/system/cpu/cpu" + i2 + "/cpufreq/cpuinfo_max_freq");
try {
BufferedReader bufferedReader3 = new BufferedReader(fileReader2);
try {
String readLine = bufferedReader3.readLine();
if (!TextUtils.isEmpty(readLine) && (parseInt = Integer.parseInt(readLine)) > i3) {
i3 = parseInt;
}
try {
bufferedReader3.close();
fileReader2.close();
} catch (Exception unused) {
}
bufferedReader2 = bufferedReader3;
fileReader = fileReader2;
} catch (Throwable th2) {
th = th2;
bufferedReader = bufferedReader3;
fileReader = fileReader2;
try {
com.bytedance.sdk.component.utils.l.e("ToolUtils", th.getMessage());
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused2) {
bufferedReader2 = bufferedReader;
}
}
bufferedReader2 = bufferedReader;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused3) {
}
}
if (fileReader != null) {
fileReader.close();
}
}
}
} catch (Throwable th3) {
BufferedReader bufferedReader4 = bufferedReader2;
th = th3;
fileReader = fileReader2;
bufferedReader = bufferedReader4;
}
} catch (Throwable th4) {
bufferedReader = bufferedReader2;
th = th4;
}
}
}
public static int c(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("cpu_count", 0);
}
public static int c(String str) {
JSONObject b2 = b(str);
if (b2 != null) {
return b2.optInt("ad_slot_type", 0);
}
return 0;
}
public static String c() {
return UUID.randomUUID().toString();
}
public static boolean c(Context context, String str) {
return (com.bytedance.sdk.openadsdk.core.h.d() == null || com.bytedance.sdk.openadsdk.core.h.d().a()) ? false : true;
}
public static boolean c(com.bytedance.sdk.openadsdk.core.f.l lVar) {
if (lVar != null) {
return c(lVar.Y()) == 3 || c(lVar.Y()) == 4;
}
return false;
}
public static int d(int i2) {
BufferedReader bufferedReader;
Throwable th;
int parseInt;
FileReader fileReader = null;
BufferedReader bufferedReader2 = null;
int i3 = 0;
while (true) {
i2--;
if (i2 < 0) {
return i3;
}
try {
FileReader fileReader2 = new FileReader("/sys/devices/system/cpu/cpu" + i2 + "/cpufreq/cpuinfo_min_freq");
try {
BufferedReader bufferedReader3 = new BufferedReader(fileReader2);
try {
String readLine = bufferedReader3.readLine();
if (!TextUtils.isEmpty(readLine) && ((parseInt = Integer.parseInt(readLine)) < i3 || i3 == 0)) {
i3 = parseInt;
}
try {
bufferedReader3.close();
fileReader2.close();
} catch (Exception unused) {
}
bufferedReader2 = bufferedReader3;
fileReader = fileReader2;
} catch (Throwable th2) {
th = th2;
bufferedReader = bufferedReader3;
fileReader = fileReader2;
try {
com.bytedance.sdk.component.utils.l.e("ToolUtils", th.getMessage());
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused2) {
bufferedReader2 = bufferedReader;
}
}
bufferedReader2 = bufferedReader;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused3) {
}
}
if (fileReader != null) {
fileReader.close();
}
}
}
} catch (Throwable th3) {
BufferedReader bufferedReader4 = bufferedReader2;
th = th3;
fileReader = fileReader2;
bufferedReader = bufferedReader4;
}
} catch (Throwable th4) {
bufferedReader = bufferedReader2;
th = th4;
}
}
}
public static int d(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("cpu_max_frequency", 0);
}
public static int d(String str) {
JSONObject b2 = b(str);
if (b2 != null) {
return b2.optInt("rit", 0);
}
return 0;
}
public static synchronized String d() {
String str;
synchronized (r.class) {
if (TextUtils.isEmpty(f) && com.bytedance.sdk.openadsdk.core.o.a() != null) {
f = com.bytedance.sdk.openadsdk.core.o.a().getPackageName();
}
str = f;
}
return str;
}
public static boolean d(Context context, String str) {
if (context != null && !TextUtils.isEmpty(str)) {
try {
Intent intent = new Intent("android.intent.action.DIAL", Uri.parse("tel:" + Uri.encode(str)));
if (!(context instanceof Activity)) {
intent.setFlags(268435456);
}
com.bytedance.sdk.component.utils.b.a(context, intent, null);
return true;
} catch (Exception unused) {
}
}
return false;
}
public static boolean d(com.bytedance.sdk.openadsdk.core.f.l lVar) {
return lVar != null && c(lVar.Y()) == 7;
}
public static int e(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("cpu_min_frequency", 0);
}
public static long e(String str) {
JSONObject b2 = b(str);
if (b2 != null) {
return b2.optLong("uid", 0L);
}
return 0L;
}
public static synchronized String e() {
String str;
synchronized (r.class) {
if (TextUtils.isEmpty(g) && com.bytedance.sdk.openadsdk.core.o.a() != null) {
PackageInfo packageInfo = com.bytedance.sdk.openadsdk.core.o.a().getPackageManager().getPackageInfo(d(), 0);
g = String.valueOf(packageInfo.versionCode);
h = packageInfo.versionName;
}
str = g;
}
return str;
}
public static String e(Context context, String str) {
FileReader fileReader;
BufferedReader bufferedReader;
String readLine;
try {
fileReader = new FileReader("/proc/meminfo");
try {
bufferedReader = new BufferedReader(fileReader, 4096);
do {
try {
readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
} catch (Throwable th) {
th = th;
try {
th.printStackTrace();
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused) {
}
}
if (fileReader != null) {
try {
fileReader.close();
} catch (Exception unused2) {
}
}
return null;
} catch (Throwable th2) {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused3) {
}
}
if (fileReader != null) {
try {
fileReader.close();
} catch (Exception unused4) {
}
}
throw th2;
}
}
} while (!readLine.contains(str));
if (readLine == null) {
try {
bufferedReader.close();
} catch (Exception unused5) {
}
try {
fileReader.close();
} catch (Exception unused6) {
}
return null;
}
String[] split = readLine.split("\\s+");
com.bytedance.sdk.component.utils.l.b("ToolUtils", "getTotalMemory = " + split[1]);
String str2 = split[1];
try {
bufferedReader.close();
} catch (Exception unused7) {
}
try {
fileReader.close();
} catch (Exception unused8) {
}
return str2;
} catch (Throwable th3) {
th = th3;
bufferedReader = null;
}
} catch (Throwable th4) {
th = th4;
fileReader = null;
bufferedReader = null;
}
}
public static boolean e(com.bytedance.sdk.openadsdk.core.f.l lVar) {
return lVar != null && c(lVar.Y()) == 8;
}
public static int f(String str) {
JSONObject b2 = b(str);
if (b2 != null) {
return b2.optInt("ut", 0);
}
return 0;
}
public static long f(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_internal_storage", 0L).longValue();
}
public static synchronized String f() {
String str;
synchronized (r.class) {
if (TextUtils.isEmpty(h) && com.bytedance.sdk.openadsdk.core.o.a() != null) {
PackageInfo packageInfo = com.bytedance.sdk.openadsdk.core.o.a().getPackageManager().getPackageInfo(d(), 0);
g = String.valueOf(packageInfo.versionCode);
h = packageInfo.versionName;
}
str = h;
}
return str;
}
public static String f(com.bytedance.sdk.openadsdk.core.f.l lVar) {
if (lVar == null || lVar.W() == null || TextUtils.isEmpty(lVar.W().a())) {
return null;
}
return lVar.W().a();
}
public static double g(String str) {
JSONObject b2 = b(str);
if (b2 != null) {
return b2.optDouble("pack_time", 0.0d);
}
return 0.0d;
}
public static int g() {
File[] listFiles;
if (Build.VERSION.SDK_INT >= 17) {
return Math.max(Runtime.getRuntime().availableProcessors(), 0);
}
try {
File file = new File("/sys/devices/system/cpu/");
if (!file.exists() || (listFiles = file.listFiles(new FilenameFilter() {
private Pattern a = Pattern.compile("^cpu[0-9]+$");
@Override
public boolean accept(File file2, String str) {
return this.a.matcher(str).matches();
}
})) == null) {
return 0;
}
return Math.max(listFiles.length, 0);
} catch (Throwable unused) {
return 0;
}
}
public static long g(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("free_internal_storage", 0L).longValue();
}
public static boolean g(com.bytedance.sdk.openadsdk.core.f.l lVar) {
if (lVar == null) {
return true;
}
int c2 = com.bytedance.sdk.openadsdk.core.o.h().c(d(lVar.Y()));
if (c2 != 1) {
if (c2 == 2) {
return com.bytedance.sdk.component.utils.o.e(com.bytedance.sdk.openadsdk.core.o.a()) || com.bytedance.sdk.component.utils.o.d(com.bytedance.sdk.openadsdk.core.o.a()) || com.bytedance.sdk.component.utils.o.f(com.bytedance.sdk.openadsdk.core.o.a());
} else if (c2 != 3) {
return c2 != 5 || com.bytedance.sdk.component.utils.o.d(com.bytedance.sdk.openadsdk.core.o.a()) || com.bytedance.sdk.component.utils.o.f(com.bytedance.sdk.openadsdk.core.o.a());
} else {
return false;
}
}
return com.bytedance.sdk.component.utils.o.d(com.bytedance.sdk.openadsdk.core.o.a());
}
public static long h() {
long blockSize;
long blockCount;
try {
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
if (Build.VERSION.SDK_INT >= 18) {
blockSize = statFs.getBlockSizeLong();
blockCount = statFs.getBlockCountLong();
} else {
blockSize = statFs.getBlockSize();
blockCount = statFs.getBlockCount();
}
return blockCount * blockSize;
} catch (Throwable unused) {
return 0L;
}
}
public static long h(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_sdcard_storage", 0L).longValue();
}
public static String h(String str) {
JSONObject b2 = b(str);
return b2 != null ? b2.optString("req_id", "") : "";
}
public static int i(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("is_root", -1);
}
public static long i() {
try {
if (v()) {
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
return statFs.getBlockCount() * statFs.getBlockSize();
}
return 0L;
} catch (Throwable unused) {
return 0L;
}
}
public static String i(String str) {
StringBuilder sb;
String n = com.bytedance.sdk.openadsdk.core.o.h().n();
if (!TextUtils.isEmpty(n)) {
String str2 = "https://" + n + str;
return p.a() ? p.b(str2) : str2;
}
int o = o();
if (o == 1) {
sb = new StringBuilder();
} else if (o != 2) {
sb = new StringBuilder();
sb.append("https://");
sb.append("pangolin16.isnssdk.com");
sb.append(str);
return p.b(sb.toString());
} else {
sb = new StringBuilder();
}
sb.append("https://");
sb.append("pangolin16.sgsnssdk.com");
sb.append(str);
return p.b(sb.toString());
}
public static String j(Context context) {
try {
Locale locale = Build.VERSION.SDK_INT >= 24 ? context.getResources().getConfiguration().getLocales().get(0) : Locale.getDefault();
String language = locale.getLanguage();
String country = locale.getCountry();
return language + "_" + country;
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.e("ToolUtils", e2.toString());
return "";
}
}
public static boolean j() {
try {
if (!new File("/system/bin/su").exists()) {
if (!new File("/system/xbin/su").exists()) {
return false;
}
}
return true;
} catch (Throwable unused) {
return false;
}
}
public static boolean j(String str) {
try {
return Pattern.compile("[一-龥]").matcher(str).find();
} catch (Throwable unused) {
return false;
}
}
public static String k() {
String o = com.bytedance.sdk.openadsdk.core.o.h().o();
if (TextUtils.isEmpty(o)) {
return o() == 2 ? "https://log.sgsnssdk.com/service/2/app_log/" : "https://log-mva.isnssdk.com/service/2/app_log/";
} else if (o.startsWith("http")) {
return o;
} else {
return "https://" + o;
}
}
public static String k(Context context) {
try {
return (Build.VERSION.SDK_INT >= 24 ? context.getResources().getConfiguration().getLocales().get(0) : Locale.getDefault()).getLanguage();
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.e("ToolUtils", e2.toString());
return "";
}
}
public static boolean k(String str) {
String str2 = str;
if (TextUtils.isEmpty(str2)) {
return false;
}
return Pattern.compile("^[+-]?([0-9]|([1-9][0-9]*))(\\.[0-9]+)?").matcher(str2).matches();
}
public static String l() {
return String.format("https://%s", "log.byteoversea.com/service/2/app_log_test/");
}
public static String l(String str) {
CharSequence charSequence;
String str2;
if (TextUtils.isEmpty(str)) {
return "";
}
if (str.contains("KLLK")) {
str2 = "OPPO";
} else if (!str.contains("kllk")) {
return "";
} else {
str2 = "oppo";
}
return str.replace(charSequence, str2);
}
public static boolean l(Context context) {
if (context != null) {
boolean z = context.getApplicationInfo().targetSdkVersion >= 30 && Build.VERSION.SDK_INT >= 30;
StringBuilder sb = new StringBuilder();
sb.append("can query all package = ");
sb.append(!z);
com.bytedance.sdk.component.utils.l.c("ToolUtils", sb.toString());
return !z;
}
throw new IllegalArgumentException("params context is null");
}
public static String m() {
int o = o();
return (o == 1 || o == 2) ? "https://sf-tb-sg.ibytedtos.com/obj/ad-pattern-sg/renderer/package_sg.json" : "https://sf16-muse-va.ibytedtos.com/obj/ad-pattern-va/renderer/package_va.json";
}
public static void m(final String str) {
com.bytedance.sdk.component.f.e.a(new com.bytedance.sdk.component.f.g("reportMultiLog") {
@Override
public void run() {
if (r.c || !com.bytedance.sdk.openadsdk.core.o.h().C()) {
return;
}
try {
boolean unused = r.c = true;
JSONObject jSONObject = new JSONObject();
jSONObject.put("error", str);
com.bytedance.sdk.openadsdk.h.b.a().a("reportMultiLog", jSONObject);
} catch (JSONException e2) {
e2.printStackTrace();
}
}
});
}
public static boolean m(Context context) {
if (context == null) {
return false;
}
try {
return (context.getApplicationInfo().flags & 2) != 0;
} catch (Exception unused) {
return false;
}
}
public static long n(Context context) {
int i2 = -1;
try {
i2 = context.getApplicationInfo().targetSdkVersion;
com.bytedance.sdk.component.utils.l.a("ToolUtils", "targetSdkVersion = ", Integer.valueOf(i2));
} catch (Throwable unused) {
}
return i2;
}
public static String n() {
try {
return TimeZone.getDefault().getID();
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.e("ToolUtils", e2.toString());
return "";
}
}
public static int o() {
try {
String id = TimeZone.getDefault().getID();
if (i.contains(id)) {
return 2;
}
if (id == null || !id.startsWith("Asia/")) {
if (id == null || !id.startsWith("Europe/")) {
if (id != null) {
if (id.startsWith("America/")) {
return 5;
}
}
return 3;
}
return 4;
}
return 2;
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("ToolUtils", th.toString());
return 0;
}
}
public static long o(Context context) {
int i2 = -1;
try {
if (Build.VERSION.SDK_INT >= 24) {
i2 = context.getApplicationInfo().minSdkVersion;
com.bytedance.sdk.component.utils.l.a("ToolUtils", "minSdkVersion = ", Integer.valueOf(i2));
}
} catch (Throwable unused) {
}
return i2;
}
public static int p() {
int rawOffset = TimeZone.getDefault().getRawOffset() / 3600000;
if (rawOffset < -12) {
rawOffset = -12;
}
if (rawOffset > 12) {
return 12;
}
return rawOffset;
}
public static String q() {
StringBuilder sb;
String str;
int i2 = -p();
if (i2 >= 0) {
sb = new StringBuilder();
str = "Etc/GMT+";
} else {
sb = new StringBuilder();
str = "Etc/GMT";
}
sb.append(str);
sb.append(i2);
return sb.toString();
}
public static String r1645007836605dc(String str) {
while (true) {
char c2 = 'I';
char c3 = '`';
while (true) {
switch (c2) {
case 'H':
c2 = 'J';
c3 = '7';
case 'I':
switch (c3) {
case '_':
case '`':
c2 = 'J';
c3 = '7';
}
break;
case 'J':
break;
default:
c2 = 'H';
}
switch (c3) {
case '7':
char[] charArray = str.toCharArray();
for (int i2 = 0; i2 < charArray.length; i2++) {
charArray[i2] = (char) (charArray[i2] ^ i2);
}
return new String(charArray);
}
}
}
}
static String s() {
return u();
}
private static String u() {
try {
String userAgentString = new WebView(com.bytedance.sdk.openadsdk.core.o.a()).getSettings().getUserAgentString();
if (userAgentString != null && !"unKnow".equals(userAgentString)) {
if (com.bytedance.sdk.openadsdk.multipro.b.c()) {
com.bytedance.sdk.openadsdk.multipro.d.a.a("sp_multi_ua_data", "webview_ua", userAgentString);
} else {
com.bytedance.sdk.openadsdk.core.c.a(com.bytedance.sdk.openadsdk.core.o.a()).a("webview_ua", userAgentString);
}
}
return userAgentString;
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("getUA", "e:" + th.getMessage());
return "unKnow";
}
}
private static boolean v() {
try {
return "mounted".equals(Environment.getExternalStorageState());
} catch (Throwable unused) {
return false;
}
}
public static class a implements Callable<String> {
int a;
a(int i) {
this.a = 1;
this.a = i;
}
@Override
public synchronized String call() throws Exception {
String c;
c = this.a == 1 ? c() : "unKnow";
if (this.a == 2) {
c = b();
}
return c;
}
private String b() {
String str;
Throwable th;
try {
str = System.getProperty("http.agent");
if (str != null) {
try {
if (!"unKnow".equals(str)) {
if (com.bytedance.sdk.openadsdk.multipro.b.c()) {
com.bytedance.sdk.openadsdk.multipro.d.a.a("sp_multi_ua_data", "android_system_ua", str);
} else {
com.bytedance.sdk.openadsdk.core.c.a(com.bytedance.sdk.openadsdk.core.o.a()).a("android_system_ua", str);
}
}
} catch (Throwable th2) {
th = th2;
com.bytedance.sdk.component.utils.l.e("getUA", "e:" + th.getMessage());
return str;
}
}
} catch (Throwable th3) {
str = "unKnow";
th = th3;
}
return str;
}
private synchronized String c() {
final String[] strArr;
strArr = new String[]{"unKnow"};
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
strArr[0] = r.s();
com.bytedance.sdk.component.utils.l.b("getUA", "webview ua:" + strArr[0]);
}
});
while ("unKnow".equals(strArr[0])) {
}
return strArr[0];
}
}
}