Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22
以下内容为反编译后的 ab.java 源代码,内容仅作参考
package com.bytedance.sdk.openadsdk.utils;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
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.Looper;
import android.os.StatFs;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.accessibility.AccessibilityManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.appcompat.widget.ActivityChooserModel;
import com.bytedance.sdk.component.widget.SSWebView;
import com.mbridge.msdk.foundation.entity.CampaignEx;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Pattern;
import org.json.JSONException;
import org.json.JSONObject;
public class ab {
private static final ExecutorService f3199a = Executors.newSingleThreadExecutor();
private static volatile boolean f3200b = false;
private static final AtomicInteger c = new AtomicInteger(0);
private static volatile String d = "";
private static final ReentrantLock e = new ReentrantLock();
private static String f = null;
private static String g = null;
private static String h = null;
private static final HashSet<String> i = new HashSet<>(Arrays.asList("Asia/Shanghai", "Asia/Urumqi", "Asia/Chongqing", "Asia/Harbin", "Asia/Kashgar"));
private static final HashSet<String> j;
static class AnonymousClass1 implements Runnable {
AnonymousClass1() {
}
@Override
public void run() {
try {
if (TextUtils.isEmpty(ab.d)) {
SSWebView sSWebView = new SSWebView(com.bytedance.sdk.openadsdk.core.o.a());
sSWebView.setWebViewClient(new SSWebView.a());
String unused = ab.d = sSWebView.getUserAgentString();
}
} catch (Exception e) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "", e);
} catch (NoClassDefFoundError e2) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "", e2);
}
}
}
public static class a implements Callable<String> {
private final int f3202a;
a(int i) {
this.f3202a = i;
}
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"};
final CountDownLatch countDownLatch = new CountDownLatch(1);
z.a(new Runnable() {
@Override
public void run() {
strArr[0] = ab.u();
com.bytedance.sdk.component.utils.l.b("getUA", "webview ua:" + strArr[0]);
countDownLatch.countDown();
}
});
try {
countDownLatch.await(2L, TimeUnit.SECONDS);
} catch (InterruptedException e) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", e.getMessage());
}
return strArr[0];
}
@Override
public synchronized String call() throws Exception {
String str;
str = "unKnow";
int i = this.f3202a;
if (i == 1) {
str = c();
} else if (i == 2) {
str = b();
}
return str;
}
}
public static class b {
public final ComponentName f3205a;
public final int f3206b;
public b(ComponentName componentName, int i) {
this.f3205a = componentName;
this.f3206b = i;
}
}
static {
HashSet<String> hashSet = new HashSet<>();
j = hashSet;
hashSet.addAll(Arrays.asList("America/Eirunepe", "America/Rio_Branco", "America/Boa_Vista", "America/Campo_Grande", "America/Cuiaba", "America/Manaus", "America/Porto_Velho", "America/Araguaina", "America/Bahia", "America/Belem", "America/Fortaleza", "America/Maceio", "America/Recife", "America/Santarem", "America/Sao_Paulo", "America/Noronha"));
}
public static int a(String str) {
str.hashCode();
char c2 = 65535;
switch (str.hashCode()) {
case -1695837674:
if (str.equals("banner_ad")) {
c2 = 0;
break;
}
break;
case -1364000502:
if (str.equals("rewarded_video")) {
c2 = 1;
break;
}
break;
case -1263194568:
if (str.equals("open_ad")) {
c2 = 2;
break;
}
break;
case -764631662:
if (str.equals("fullscreen_interstitial_ad")) {
c2 = 3;
break;
}
break;
case 564365438:
if (str.equals("cache_splash_ad")) {
c2 = 4;
break;
}
break;
case 1844104722:
if (str.equals("interaction")) {
c2 = 5;
break;
}
break;
}
switch (c2) {
case 0:
return 2;
case 1:
return 7;
case 2:
case 4:
return 4;
case 3:
return 5;
case 5:
return 3;
default:
return 1;
}
}
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 b a(Context context, Intent intent) {
List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 65536);
if (queryIntentActivities == null || queryIntentActivities.isEmpty()) {
return new b(null, 0);
}
ActivityInfo activityInfo = queryIntentActivities.get(0).activityInfo;
return (activityInfo == null || TextUtils.isEmpty(activityInfo.packageName) || TextUtils.isEmpty(activityInfo.name)) ? new b(null, queryIntentActivities.size()) : new b(new ComponentName(activityInfo.packageName, activityInfo.name), queryIntentActivities.size());
}
public static String a(int i2) {
if (i2 != 1) {
if (i2 != 2) {
if (i2 != 3) {
if (i2 != 4) {
if (i2 != 5) {
if (i2 != 7) {
return null;
}
return "rewarded_video";
}
return "fullscreen_interstitial_ad";
}
return "open_ad";
}
return "interaction";
}
return "banner_ad";
}
return "embeded_ad";
}
public static String a(Context context) {
String b2 = com.bytedance.sdk.openadsdk.core.c.a(context).b("total_memory", (String) null);
if (b2 == null || b(b2) <= 0) {
b2 = c("MemTotal");
if (b(b2) <= 0) {
b2 = h();
}
com.bytedance.sdk.openadsdk.core.c.a(context).a("total_memory", b2);
}
return b2;
}
public static String a(com.bytedance.sdk.openadsdk.core.model.q qVar) {
if (qVar == null) {
return null;
}
try {
return c(qVar.aS());
} catch (Throwable unused) {
return null;
}
}
public static String a(String str, boolean z) {
String str2;
String G = com.bytedance.sdk.openadsdk.core.o.d().G();
if (!TextUtils.isEmpty(G)) {
String str3 = "https://" + G + str;
if (y.a() && !z) {
str3 = y.a(str3);
}
return z ? l(str3) : str3;
}
int p = p();
if (p == 1) {
str2 = "https://pangolin16.sgsnssdk.com" + str;
} else if (p == 2) {
str2 = "https://pangolin16.sgsnssdk.com" + str;
} else {
str2 = "https://pangolin16.isnssdk.com" + str;
}
return !z ? y.a(str2) : l(str2);
}
public static JSONObject a(com.bytedance.sdk.openadsdk.core.model.q qVar, long j2, com.bykv.vk.openvk.component.video.api.a aVar) {
if (qVar == null) {
return new JSONObject();
}
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("creative_id", qVar.Y());
jSONObject.put("buffers_time", j2);
com.bykv.vk.openvk.component.video.api.c.b K = qVar.K();
if (K != null) {
jSONObject.put(CampaignEx.JSON_KEY_VIDEO_SIZE, K.e());
jSONObject.put(CampaignEx.JSON_KEY_VIDEO_RESOLUTION, K.i());
}
a(jSONObject, aVar);
} catch (JSONException e2) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "getVideoAction json error", e2);
}
return jSONObject;
}
public static JSONObject a(boolean z, com.bytedance.sdk.openadsdk.core.model.q qVar, long j2, long j3, String str) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("creative_id", qVar.Y());
jSONObject.put("load_time", j2);
com.bykv.vk.openvk.component.video.api.c.b K = qVar.K();
if (K != null) {
jSONObject.put(CampaignEx.JSON_KEY_VIDEO_SIZE, K.e());
jSONObject.put(CampaignEx.JSON_KEY_VIDEO_RESOLUTION, K.i());
}
if (!z) {
jSONObject.put("error_code", j3);
if (TextUtils.isEmpty(str)) {
str = "unknown";
}
jSONObject.put("error_message", str);
}
} catch (JSONException e2) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "getVideoDownload json error", e2);
}
return jSONObject;
}
public static void a(com.bytedance.sdk.openadsdk.core.model.q qVar, View view) {
}
public static void a(com.bytedance.sdk.openadsdk.core.model.q qVar, String str) {
if (qVar != null) {
try {
String P = qVar.P();
if (TextUtils.isEmpty(P) && qVar.ab() != null && qVar.ab().c() == 1 && !TextUtils.isEmpty(qVar.ab().b())) {
P = qVar.ab().b();
}
String str2 = P;
if (TextUtils.isEmpty(str2)) {
return;
}
com.bytedance.sdk.openadsdk.core.z.a(com.bytedance.sdk.openadsdk.core.o.a(), str2, qVar, a(str), str, false);
} catch (Throwable unused) {
}
}
}
public static void a(String str, String str2, Context context) {
if (TextUtils.isEmpty(str2) || !j(context)) {
return;
}
int length = str2.length();
int i2 = 1;
int i3 = length % 3572 == 0 ? length / 3572 : (length / 3572) + 1;
int i4 = 3572;
int i5 = 0;
while (i2 <= i3) {
if (i4 >= length) {
Log.d(str, i3 + "-" + i2 + ":" + str2.substring(i5));
return;
}
Log.d(str, i3 + "-" + i2 + ":" + str2.substring(i5, i4));
i2++;
i5 = i4;
i4 += 3572;
}
}
public static void a(StringBuilder sb, String str, String str2) {
int indexOf;
if (sb == null || TextUtils.isEmpty(str) || (indexOf = sb.indexOf(str)) <= 0) {
return;
}
sb.replace(indexOf, str.length() + indexOf, str2);
}
private static void a(JSONObject jSONObject, com.bykv.vk.openvk.component.video.api.a aVar) {
if (jSONObject.has(CampaignEx.JSON_KEY_VIDEO_RESOLUTION) || aVar == null) {
return;
}
try {
jSONObject.put(CampaignEx.JSON_KEY_VIDEO_RESOLUTION, String.format(Locale.getDefault(), "%d×%d", Integer.valueOf(aVar.d()), Integer.valueOf(aVar.e())));
} catch (Throwable unused) {
}
}
public static boolean a() {
return (com.bytedance.sdk.openadsdk.core.m.a() == null || com.bytedance.sdk.openadsdk.core.m.a().f()) ? false : true;
}
public static int b(Context context, Intent intent) {
if (intent == null) {
return 0;
}
try {
return context.getPackageManager().queryIntentActivities(intent, 65536).size();
} catch (Throwable unused) {
return 0;
}
}
public static long b(String str) {
try {
return Long.parseLong(str);
} catch (Throwable unused) {
return 0L;
}
}
public static String b() {
String b2;
String str = "unKnow";
com.bytedance.sdk.openadsdk.multipro.c.a(com.bytedance.sdk.openadsdk.core.o.a());
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));
f3199a.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 b(int i2) {
if (i2 != 1) {
if (i2 != 2) {
if (i2 != 3) {
if (i2 != 4) {
if (i2 != 5) {
if (i2 != 7) {
return null;
}
return "rewarded_video_landingpage";
}
return "fullscreen_interstitial_ad";
}
return "splash_ad_landingpage";
}
return "interaction_landingpage";
}
return "banner_ad_landingpage";
}
return "embeded_ad_landingpage";
}
public static String b(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_memory", "0");
}
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.model.q qVar) {
if (qVar == null) {
return true;
}
int b2 = com.bytedance.sdk.openadsdk.core.o.d().b(qVar.aZ());
int c2 = com.bytedance.sdk.component.utils.o.c(com.bytedance.sdk.openadsdk.core.o.a());
if (b2 != 1) {
if (b2 == 2) {
return e(c2) || d(c2) || f(c2);
} else if (b2 != 3) {
return b2 != 5 || d(c2) || f(c2);
} else {
return false;
}
}
return d(c2);
}
public static long c(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_internal_storage", 0L).longValue();
}
public static String c() {
if (TextUtils.isEmpty(d)) {
com.bytedance.sdk.openadsdk.multipro.c.a(com.bytedance.sdk.openadsdk.core.o.a());
d = com.bytedance.sdk.openadsdk.core.h.a("sdk_local_web_ua", (long) b.a.h.d.c);
if (TextUtils.isEmpty(d)) {
ReentrantLock reentrantLock = e;
try {
if (reentrantLock.tryLock()) {
try {
if (TextUtils.isEmpty(d)) {
d = WebSettings.getDefaultUserAgent(com.bytedance.sdk.openadsdk.core.o.a());
}
com.bytedance.sdk.openadsdk.core.h.a("sdk_local_web_ua", d);
reentrantLock.unlock();
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "", e2);
return d;
} catch (NoClassDefFoundError e3) {
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", "", e3);
return d;
}
}
} finally {
e.unlock();
}
}
return d;
}
return d;
}
public static String c(int i2) {
return i2 != 1 ? i2 != 2 ? (i2 == 3 || i2 == 4) ? "open_ad" : i2 != 7 ? i2 != 8 ? "embeded_ad" : "fullscreen_interstitial_ad" : "rewarded_video" : "interaction" : "banner_ad";
}
public static String c(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 {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", th.getMessage());
if (fileReader != null) {
try {
fileReader.close();
} catch (Exception unused) {
}
}
return null;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception unused2) {
}
}
if (fileReader != null) {
try {
fileReader.close();
} catch (Exception unused3) {
}
}
}
}
} while (!readLine.contains(str));
if (readLine == null) {
try {
bufferedReader.close();
} catch (Exception unused4) {
}
try {
fileReader.close();
} catch (Exception unused5) {
}
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 unused6) {
}
try {
fileReader.close();
} catch (Exception unused7) {
}
return str2;
} catch (Throwable th2) {
th = th2;
bufferedReader = null;
}
} catch (Throwable th3) {
th = th3;
fileReader = null;
bufferedReader = null;
}
}
public static boolean c(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 long d(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("free_internal_storage", 0L).longValue();
}
public static String d() {
return r.a();
}
public static String d(String str) {
return a(str, false);
}
public static boolean d(int i2) {
return i2 == 4;
}
public static long e(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("total_sdcard_storage", 0L).longValue();
}
public static synchronized String e() {
String str;
Context a2;
synchronized (ab.class) {
if (TextUtils.isEmpty(f) && (a2 = com.bytedance.sdk.openadsdk.core.o.a()) != null) {
f = a2.getPackageName();
}
str = f;
}
return str;
}
public static String e(String str) {
if (TextUtils.isEmpty(str)) {
str = com.bytedance.sdk.openadsdk.core.o.d().H();
}
if (TextUtils.isEmpty(str)) {
return p() == 2 ? "https://log.sgsnssdk.com/service/2/app_log/" : "https://log-mva.isnssdk.com/service/2/app_log/";
} else if (str.startsWith("http")) {
return str;
} else {
return "https://" + str;
}
}
public static boolean e(int i2) {
return i2 == 5;
}
public static int f(Context context) {
return com.bytedance.sdk.openadsdk.core.c.a(context).b("is_root", -1);
}
public static synchronized String f() {
String str;
synchronized (ab.class) {
if (TextUtils.isEmpty(g) && com.bytedance.sdk.openadsdk.core.o.a() != null) {
PackageInfo packageInfo = com.bytedance.sdk.openadsdk.core.o.a().getPackageManager().getPackageInfo(e(), 0);
g = String.valueOf(packageInfo.versionCode);
h = packageInfo.versionName;
}
str = g;
}
return str;
}
public static boolean f(int i2) {
return i2 == 6;
}
public static boolean f(String str) {
try {
return Pattern.compile("[一-龥]").matcher(str).find();
} catch (Throwable unused) {
return false;
}
}
public static int g(int i2) {
if (i2 != 1) {
if (i2 != 4) {
if (i2 != 5) {
if (i2 != 6) {
return i2;
}
return 5;
}
return 4;
}
return 1;
}
return 0;
}
public static synchronized String g() {
String str;
synchronized (ab.class) {
if (TextUtils.isEmpty(h) && com.bytedance.sdk.openadsdk.core.o.a() != null) {
PackageInfo packageInfo = com.bytedance.sdk.openadsdk.core.o.a().getPackageManager().getPackageInfo(e(), 0);
g = String.valueOf(packageInfo.versionCode);
h = packageInfo.versionName;
}
str = h;
}
return str;
}
public static String g(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("TTAD.ToolUtils", e2.toString());
return "";
}
}
public static String g(String str) {
return TextUtils.isEmpty(str) ? "" : str.contains("KLLK") ? str.replace("KLLK", "OPPO") : str.contains("kllk") ? str.replace("kllk", "oppo") : "";
}
public static String h() {
try {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
((ActivityManager) com.bytedance.sdk.openadsdk.core.o.a().getSystemService(ActivityChooserModel.ATTRIBUTE_ACTIVITY)).getMemoryInfo(memoryInfo);
if (memoryInfo.totalMem > 0) {
return String.valueOf(memoryInfo.totalMem / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID);
}
return null;
} catch (Throwable unused) {
return null;
}
}
public static String h(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("TTAD.ToolUtils", e2.toString());
return "";
}
}
public static void h(final String str) {
com.bytedance.sdk.openadsdk.j.b.a();
com.bytedance.sdk.openadsdk.j.b.a("reportMultiLog", false, new com.bytedance.sdk.openadsdk.j.a() {
@Override
public com.bytedance.sdk.openadsdk.j.a.a getLogStats() throws Exception {
if (ab.f3200b || !com.bytedance.sdk.openadsdk.core.o.d().W()) {
return null;
}
boolean unused = ab.f3200b = true;
JSONObject jSONObject = new JSONObject();
jSONObject.put("error", str);
return com.bytedance.sdk.openadsdk.j.a.b.b().a("reportMultiLog").b(jSONObject.toString());
}
});
}
public static boolean h(int i2) {
if (i2 <= 0) {
return false;
}
if (i2 >= 100) {
return true;
}
int nextInt = new Random(System.currentTimeMillis()).nextInt(100) + 1;
com.bytedance.sdk.component.utils.l.b("TTAD.ToolUtils", "isMatchProbability: " + nextInt + "/" + i2);
return nextInt <= i2;
}
public static String i() {
return c("MemTotal");
}
public static void i(String str) {
if (com.bytedance.sdk.openadsdk.core.l.e()) {
return;
}
com.bytedance.sdk.component.utils.l.d("You must use method '" + str + "' after initialization, please check.");
}
public static boolean i(Context context) {
if (context != null) {
boolean z = context.getApplicationInfo().targetSdkVersion >= 30 && Build.VERSION.SDK_INT >= 30 && context.checkSelfPermission("android.permission.QUERY_ALL_PACKAGES") != 0;
StringBuilder sb = new StringBuilder("can query all package = ");
sb.append(!z);
com.bytedance.sdk.component.utils.l.c("TTAD.ToolUtils", sb.toString());
return !z;
}
throw new IllegalArgumentException("params context is null");
}
public static long j() {
try {
StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
return statFs.getBlockCountLong() * statFs.getBlockSizeLong();
} catch (Throwable unused) {
return 0L;
}
}
public static void j(String str) {
if (Looper.myLooper() != Looper.getMainLooper()) {
return;
}
com.bytedance.sdk.component.utils.l.d("You should use method '" + str + "' on the asynchronous thread,it may cause anr, please check.");
}
public static boolean j(Context context) {
if (context == null) {
return false;
}
try {
return (context.getApplicationInfo().flags & 2) != 0;
} catch (Exception unused) {
return false;
}
}
public static long k() {
try {
if (x()) {
StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
return statFs.getBlockCount() * statFs.getBlockSize();
}
return 0L;
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", th.getMessage());
return 0L;
}
}
public static long k(Context context) {
int i2 = -1;
try {
i2 = context.getApplicationInfo().targetSdkVersion;
com.bytedance.sdk.component.utils.l.b("TTAD.ToolUtils", "targetSdkVersion = ", Integer.valueOf(i2));
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", th.getMessage());
}
return i2;
}
public static long l(Context context) {
int i2 = -1;
try {
if (Build.VERSION.SDK_INT >= 24) {
i2 = context.getApplicationInfo().minSdkVersion;
com.bytedance.sdk.component.utils.l.b("TTAD.ToolUtils", "minSdkVersion = ", Integer.valueOf(i2));
}
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", th.getMessage());
}
return i2;
}
private static String l(String str) {
try {
return Uri.parse(str).buildUpon().appendQueryParameter("aid", "1371").appendQueryParameter("device_platform", "android").appendQueryParameter("version_code", f()).toString();
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", e2.getMessage());
return str;
}
}
public static boolean l() {
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 int m(Context context) {
return g(com.bytedance.sdk.component.utils.v.a(context, 0L));
}
public static String m() {
return String.format("https://%s", "log.byteoversea.com/service/2/app_log_test/");
}
public static String n() {
int p = p();
return (p == 1 || p == 2) ? "https://sf16-static.i18n-pglstatp.com/obj/ad-pattern-sg/renderer/package_sg.json" : "https://sf16-static.i18n-pglstatp.com/obj/ad-pattern-va/renderer/package_va.json";
}
public static void n(Context context) {
try {
AtomicInteger atomicInteger = c;
if (atomicInteger.get() != 0) {
return;
}
AccessibilityManager accessibilityManager = (AccessibilityManager) context.getSystemService("accessibility");
boolean isEnabled = accessibilityManager.isEnabled();
boolean isTouchExplorationEnabled = accessibilityManager.isTouchExplorationEnabled();
if (isEnabled && isTouchExplorationEnabled) {
atomicInteger.set(1);
com.bytedance.sdk.openadsdk.j.b.a().b();
} else {
atomicInteger.set(2);
}
} catch (Exception unused) {
c.set(2);
}
}
public static String o() {
try {
return TimeZone.getDefault().getID();
} catch (Exception e2) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", e2.toString());
return "";
}
}
public static int p() {
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 && id.startsWith("America/")) {
if (!j.contains(id)) {
return 5;
}
}
return 3;
}
return 4;
}
return 2;
} catch (Throwable th) {
com.bytedance.sdk.component.utils.l.e("TTAD.ToolUtils", th.toString());
return 0;
}
}
public static int q() {
int rawOffset = TimeZone.getDefault().getRawOffset() / 3600000;
if (rawOffset < -12) {
rawOffset = -12;
}
if (rawOffset > 12) {
return 12;
}
return rawOffset;
}
public static String r() {
int i2 = -q();
if (i2 >= 0) {
return "Etc/GMT+" + i2;
}
return "Etc/GMT" + i2;
}
public static boolean s() {
return c.get() == 1;
}
static String u() {
return w();
}
private static String w() {
try {
WebView webView = new WebView(com.bytedance.sdk.openadsdk.core.o.a());
webView.setWebViewClient(new SSWebView.a());
String userAgentString = webView.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 x() {
try {
return "mounted".equals(Environment.getExternalStorageState());
} catch (Throwable unused) {
return false;
}
}
}