同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8
以下内容为反编译后的 af.java 源代码,内容仅作参考
package com.bonree.sdk.bz;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.SystemClock;
import android.text.TextUtils;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import androidx.exifinterface.media.ExifInterface;
import anet.channel.util.HttpConstant;
import com.bonree.sdk.bq.a;
import com.bonree.sdk.bw.v;
import com.bonree.sdk.bx.a;
import com.bonree.sdk.common.gson.Gson;
import com.huawei.agconnect.exception.AGCServerException;
import com.huawei.hms.framework.common.ContainerUtils;
import com.moture.lib.core.utils.immersion.RomUtils;
import com.moture.lib.core.utils.string.HanziToPinyin;
import com.xiaomi.mipush.sdk.Constants;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import ohos.agp.components.webengine.ResourceError;
import ohos.agp.components.webengine.ResourceRequest;
import org.android.agoo.huawei.HuaWeiRegister;
import org.json.JSONException;
import org.json.JSONObject;
public final class af {
private static String f5611a = "Utils";
private static int f5612b = 53;
private static String f5613c = ";";
private static String f5614d = "@";
private static String f5615e = "\\.";
private static String f5616f = "/";
private static String f5617g = "_";
private static String f5618h = "&";
private static String f5619i = "####";
private static String f5620j = "\r\n";
private static final int f5621k = 10000;
private static final Pattern f5622l = Pattern.compile("/");
private static final Pattern f5623m = Pattern.compile("^[:0-9a-zA-Z_-]{1,}$");
private static final Pattern f5624n = Pattern.compile("[0-9]*");
private static final Pattern f5625o = Pattern.compile("^(\\-|\\+)?\\d+(\\.\\d+)?$");
private static String f5626p = " ";
private static String A() {
String d9 = d("ro.build.version.incremental", "");
if (b(d9) || d9.startsWith(RomUtils.ROM_MIUI)) {
return d9;
}
if (d9.startsWith(ExifInterface.GPS_MEASUREMENT_INTERRUPTED) || d9.startsWith("v")) {
d9 = d9.substring(1);
}
int lastIndexOf = d9.lastIndexOf(".");
if (lastIndexOf != -1) {
String substring = d9.substring(lastIndexOf + 1);
if (!b(substring)) {
if (!(b(substring) ? false : f5624n.matcher(substring).matches())) {
d9 = d9.substring(0, lastIndexOf) + "(" + substring + ")";
}
}
}
return "MIUI " + d9;
}
private static String B() {
String d9 = d(HuaWeiRegister.EMUI_PROPERTY, "");
if (b(d9)) {
return "";
}
if (d9.startsWith(RomUtils.ROM_EMUI)) {
return d9;
}
String[] split = d9.split("_");
String str = split[split.length - 1];
return "EMUI " + str;
}
private static String C() {
String d9 = d("ro.build.version.opporom", "");
if (b(d9)) {
return "";
}
if (d9.startsWith("ColorOs")) {
return d9;
}
return "ColorOs " + d9;
}
private static String D() {
return d("ro.vivo.os.build.display.id", "");
}
private static String E() {
String d9 = d("ro.smartisan.version", "");
if (b(d9)) {
return "";
}
String str = d9.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)[0];
if (str.startsWith("smartisan os")) {
return str;
}
if (!str.startsWith("v")) {
str = "v" + str;
}
return "smartisan os " + str;
}
private static String F() {
String d9 = d("ro.build.rom.id", "");
if (b(d9)) {
return "";
}
if (d9.startsWith("nubia UI")) {
return d9;
}
return "nubia UI " + d9;
}
private static String G() {
String d9 = d("ro.rom.version", "");
if (b(d9)) {
return "";
}
if (d9.startsWith("H2OS")) {
return d9;
}
return "H2OS " + d9;
}
private static String H() {
String d9 = d("ro.build.sense.version", "");
if (b(d9)) {
return "";
}
if (d9.startsWith("HTC Sense")) {
return d9;
}
return "HTC Sense " + d9;
}
private static String I() {
return d("ro.build.display.id", "");
}
private static ArrayList<String> J() {
ArrayList<String> arrayList = new ArrayList<>();
for (int i9 = 1; i9 <= 4; i9++) {
String d9 = d("net.dns" + i9, "");
if (!".0.0.0".equals(d9) && ((d9.matches("^\\d+(\\.\\d+){3}$") || d9.matches("^[0-9a-f]+(:[0-9a-f]*)+:[0-9a-f]+$")) && !arrayList.contains(d9))) {
arrayList.add(d9);
}
}
return arrayList;
}
public static long a(long j9) {
return j9 * 1000;
}
public static boolean a(String str) {
return !TextUtils.isEmpty(str) && Pattern.compile("[一-龥]").matcher(str).find();
}
private static boolean b(List list) {
return list == null || list.size() <= 0;
}
public static boolean c(String str) {
return str == null || str.length() == 0;
}
public static boolean d(String str) {
return !b(str);
}
public static boolean e(String str) {
try {
if (TextUtils.isEmpty(str)) {
return false;
}
boolean matches = f5623m.matcher(str).matches();
if (!matches) {
com.bonree.sdk.bl.f fVar = com.bonree.sdk.c.a.f5744a;
fVar.d("don`t matches: " + str, new Object[0]);
}
return matches;
} catch (Throwable unused) {
return true;
}
}
public static void f(String str) {
g(str);
}
public static void g(String str) {
try {
if (com.bonree.sdk.c.a.f().o()) {
a.a(str);
}
} catch (Throwable unused) {
}
}
public static String h(String str) {
StringBuffer stringBuffer = new StringBuffer();
int length = str.length();
int i9 = 0;
for (int i10 = 0; i10 < length; i10++) {
char charAt = str.charAt(i10);
if (charAt == '[' || charAt == '{') {
int i11 = i10 - 1;
if (i11 > 0 && str.charAt(i11) == ':') {
stringBuffer.append('\n');
stringBuffer.append(b(i9));
}
stringBuffer.append(charAt);
stringBuffer.append('\n');
i9++;
stringBuffer.append(b(i9));
} else if (charAt == ']' || charAt == '}') {
stringBuffer.append('\n');
i9--;
stringBuffer.append(b(i9));
stringBuffer.append(charAt);
int i12 = i10 + 1;
if (i12 < length && str.charAt(i12) != ',') {
stringBuffer.append('\n');
}
} else if (charAt == ',') {
stringBuffer.append(charAt);
stringBuffer.append('\n');
stringBuffer.append(b(i9));
} else {
stringBuffer.append(charAt);
}
}
return stringBuffer.toString();
}
public static Class<?> i(String str) {
try {
return Class.forName(str);
} catch (Throwable unused) {
return null;
}
}
public static String j() {
String str;
if (l()) {
try {
Class<?> cls = Class.forName("android.os.SystemProperties");
Method declaredMethod = cls.getDeclaredMethod("get", String.class, String.class);
str = (String) declaredMethod.invoke(cls, "ro.product.marketname", "");
try {
if (TextUtils.isEmpty(str)) {
str = (String) declaredMethod.invoke(cls, "ro.product.model", "");
}
} catch (Exception unused) {
}
} catch (Exception unused2) {
str = "";
}
} else {
str = Build.MODEL;
}
return str == null ? "" : str;
}
public static String j(String str) {
return str == null ? "" : str;
}
public static boolean k(String str) {
return f5625o.matcher(str).matches();
}
private static boolean l() {
return !b(d("ro.miui.ui.version.name", ""));
}
private static boolean m() {
return !b(d("ro.build.version.opporom", ""));
}
private static boolean n() {
return !b(d("ro.vivo.os.version", ""));
}
private static boolean o() {
return d("ro.build.display.id", "").toUpperCase().contains(RomUtils.ROM_FLYME);
}
private static boolean p() {
return !b(d("ro.lenovo.series", ""));
}
private static boolean q() {
return !b(d("ro.smartisan.version", ""));
}
private static boolean r() {
return !b(d("ro.build.nubia.rom.name", ""));
}
private static boolean s() {
return d("ro.build.display.id", "").toUpperCase().contains("ONEPLUS");
}
private static boolean t() {
return !b(d("htc.build.stage", "")) || d("ro.product.manufacturer", "").toUpperCase().contains("HTC");
}
private static boolean u() {
String d9 = d("ro.build.display.id", "");
return d9.contains(RomUtils.ROM_QIKU) || d9.contains("360");
}
private static boolean v() {
return d("ro.product.manufacturer", "").contains("samsung");
}
private static boolean w() {
return d("ro.product.manufacturer", "").toUpperCase().contains("ZTE");
}
private static boolean x() {
return !b(d("ro.yulong.version.release", ""));
}
private static boolean y() {
return d("ro.product.manufacturer", "").contains("Gree");
}
private static boolean z() {
return !b(d("ro.sony.irremote.protocol_type", "")) || d("ro.product.manufacturer", "").contains("Sony");
}
public static boolean b(String str) {
return TextUtils.isEmpty(str) || str.toLowerCase().equals("null");
}
private static void c(Context context, String str) {
File file = new File(context.getFilesDir().getAbsolutePath() + "/" + str);
if (file.exists()) {
file.delete();
}
}
public static boolean d() {
return !b(d(HuaWeiRegister.EMUI_PROPERTY, ""));
}
public static String f() {
return d("ro.huawei.build.display.id", "");
}
public static String i() {
if (Build.VERSION.SDK_INT >= 21) {
return TextUtils.join(Constants.ACCEPT_TIME_SEPARATOR_SP, Build.SUPPORTED_ABIS);
}
String str = Build.CPU_ABI;
String str2 = Build.CPU_ABI2;
if (TextUtils.isEmpty(str2)) {
return str;
}
return str + Constants.ACCEPT_TIME_SEPARATOR_SP + str2;
}
public static String l(String str) {
int i9;
if (b(str)) {
return "";
}
String str2 = str + "/";
try {
int indexOf = str2.indexOf("/");
Matcher matcher = f5622l.matcher(str2);
int i10 = 0;
int i11 = 0;
while (matcher.find() && (i11 = i11 + 1) != 3) {
}
if (i11 != 0) {
i10 = matcher.start();
}
if (i10 > 0 && i10 >= (i9 = indexOf + 2) && i10 < str2.length()) {
return str2.substring(i9, i10);
}
} catch (Throwable unused) {
}
return "";
}
public static boolean m(String str) {
Context a9;
PackageManager packageManager;
try {
a9 = a.a();
} catch (Throwable unused) {
}
if (a9 == null || (packageManager = a9.getPackageManager()) == null) {
return false;
}
return packageManager.checkPermission(str, a9.getPackageName()) != -1;
}
public static List<String> n(String str) {
try {
ArrayList arrayList = new ArrayList();
arrayList.addAll(a(str, m.b()));
return arrayList;
} catch (Exception unused) {
return null;
}
}
public static String o(String str) {
try {
try {
return URLDecoder.decode(str, "UTF-8");
} catch (Throwable unused) {
return Uri.decode(str);
}
} catch (Throwable unused2) {
return str;
}
}
public static String p(String str) {
try {
try {
return URLEncoder.encode(str, "UTF-8");
} catch (Throwable unused) {
return Uri.encode(str);
}
} catch (Throwable unused2) {
return str;
}
}
public static String q(String str) {
return TextUtils.isEmpty(str) ? "" : str.contains(".") ? str.substring(str.lastIndexOf(".") + 1) : str;
}
private static boolean r(String str) {
if (b(str)) {
return false;
}
return f5624n.matcher(str).matches();
}
public static boolean b(String str, String str2) {
return Pattern.compile(str).matcher(str2).matches();
}
public static String d(String str, String str2) {
if (b(str)) {
return str2;
}
try {
Class<?> cls = Class.forName("android.os.SystemProperties");
Method method = cls.getMethod("get", String.class, String.class);
method.setAccessible(true);
return (String) method.invoke(cls, str, str2);
} catch (Throwable th) {
com.bonree.sdk.bl.a.a().a("get system property exception", th);
return str2;
}
}
public static String g() {
String d9;
if (d()) {
d9 = d(HuaWeiRegister.EMUI_PROPERTY, "");
if (!b(d9)) {
if (!d9.startsWith(RomUtils.ROM_EMUI)) {
String[] split = d9.split("_");
d9 = "EMUI " + split[split.length - 1];
}
}
d9 = "";
} else if (l()) {
d9 = d("ro.build.version.incremental", "");
if (!b(d9) && !d9.startsWith(RomUtils.ROM_MIUI)) {
if (d9.startsWith(ExifInterface.GPS_MEASUREMENT_INTERRUPTED) || d9.startsWith("v")) {
d9 = d9.substring(1);
}
int lastIndexOf = d9.lastIndexOf(".");
if (lastIndexOf != -1) {
String substring = d9.substring(lastIndexOf + 1);
if (!b(substring)) {
if (!(b(substring) ? false : f5624n.matcher(substring).matches())) {
d9 = d9.substring(0, lastIndexOf) + "(" + substring + ")";
}
}
}
d9 = "MIUI " + d9;
}
} else if (!b(d("ro.build.version.opporom", ""))) {
d9 = d("ro.build.version.opporom", "");
if (!b(d9)) {
if (!d9.startsWith("ColorOs")) {
d9 = "ColorOs " + d9;
}
}
d9 = "";
} else if (!b(d("ro.vivo.os.version", ""))) {
d9 = d("ro.vivo.os.build.display.id", "");
} else if (!b(d("ro.smartisan.version", ""))) {
String d10 = d("ro.smartisan.version", "");
if (!b(d10)) {
d9 = d10.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)[0];
if (!d9.startsWith("smartisan os")) {
if (!d9.startsWith("v")) {
d9 = "v" + d9;
}
d9 = "smartisan os " + d9;
}
}
d9 = "";
} else if (!b(d("ro.build.nubia.rom.name", ""))) {
d9 = d("ro.build.rom.id", "");
if (!b(d9)) {
if (!d9.startsWith("nubia UI")) {
d9 = "nubia UI " + d9;
}
}
d9 = "";
} else if (d("ro.build.display.id", "").toUpperCase().contains("ONEPLUS")) {
d9 = d("ro.rom.version", "");
if (!b(d9)) {
if (!d9.startsWith("H2OS")) {
d9 = "H2OS " + d9;
}
}
d9 = "";
} else {
if (!b(d("htc.build.stage", "")) || d("ro.product.manufacturer", "").toUpperCase().contains("HTC")) {
d9 = d("ro.build.sense.version", "");
if (!b(d9)) {
if (!d9.startsWith("HTC Sense")) {
d9 = "HTC Sense " + d9;
}
}
d9 = "";
} else {
if (!d("ro.build.display.id", "").toUpperCase().contains(RomUtils.ROM_FLYME) && !(!b(d("ro.lenovo.series", "")))) {
String d11 = d("ro.build.display.id", "");
if (!(d11.contains(RomUtils.ROM_QIKU) || d11.contains("360")) && !d("ro.product.manufacturer", "").contains("samsung") && !d("ro.product.manufacturer", "").toUpperCase().contains("ZTE") && !(!b(d("ro.yulong.version.release", ""))) && !d("ro.product.manufacturer", "").contains("Gree")) {
}
}
d9 = d("ro.build.display.id", "");
}
}
if (b(d9)) {
String d12 = d("ro.build.display.id", "");
com.bonree.sdk.bl.a.a().d("get manufacturer os version from ro.build.display.id:" + d12, new Object[0]);
if (b(d12)) {
String str = Build.DISPLAY;
com.bonree.sdk.bl.a.a().d("get manufacturer os version from Build.DISPLAY:%s", str);
return str;
}
return d12;
}
return d9;
}
public static boolean k() {
try {
Class<?> cls = Class.forName("com.huawei.system.BuildEx");
return "harmony".equals(cls.getMethod("getOsBrand", new Class[0]).invoke(cls, new Object[0]));
} catch (Throwable unused) {
return false;
}
}
private static String s(String str) {
return TextUtils.isEmpty(str) ? "" : (str.contains("::") && str.contains(".") && str.startsWith("::ffff:")) ? str.replace("::ffff:", "") : str;
}
private static String t(String str) {
if (str == null) {
return null;
}
try {
URL url = new URL(str);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(url.getProtocol());
stringBuffer.append(HttpConstant.SCHEME_SPLIT);
stringBuffer.append(url.getHost());
if (url.getPort() != -1) {
stringBuffer.append(Constants.COLON_SEPARATOR);
stringBuffer.append(url.getPort());
}
stringBuffer.append(url.getPath());
return stringBuffer.toString();
} catch (MalformedURLException unused) {
return null;
}
}
public static String e() {
return d(HuaWeiRegister.HARMONYOS_PROPERTY, "");
}
public static String a(String str, String str2) {
String str3 = null;
if (str != null) {
try {
str3 = "(" + str;
} catch (Exception unused) {
}
}
if (str != null && str2 != null) {
return str3 + Constants.ACCEPT_TIME_SEPARATOR_SP + str2 + ")";
}
if (str == null && str2 != null) {
str3 = "(" + str2 + ")";
}
return str3;
}
private static Field e(Class<?> cls, Class<?> cls2) {
Field[] fields;
if (cls == null || cls2 == null || (fields = cls.getFields()) == null || fields.length == 0) {
return null;
}
for (Field field : fields) {
if (field.getType().equals(cls2)) {
return field;
}
}
return null;
}
private static void b(InputStream inputStream) {
new Thread(new h(inputStream)).start();
}
public static String c() {
return String.valueOf(System.currentTimeMillis());
}
public static String a() {
return String.format(" [Thread name: %s, id: %s] ", Thread.currentThread().getName(), Long.valueOf(Thread.currentThread().getId()));
}
public static String b() {
try {
if ("mounted".equals(Environment.getExternalStorageState())) {
return Environment.getExternalStorageDirectory().getCanonicalPath();
}
return null;
} catch (Throwable unused) {
return null;
}
}
public static String c(String str, String str2) {
return b(str, str2, null);
}
public static boolean a(CharSequence charSequence, CharSequence charSequence2) {
int length;
if (charSequence == charSequence2) {
return true;
}
if (charSequence == null || (length = charSequence.length()) != charSequence2.length()) {
return false;
}
if (charSequence instanceof String) {
return charSequence.equals(charSequence2);
}
for (int i9 = 0; i9 < length; i9++) {
if (charSequence.charAt(i9) != charSequence2.charAt(i9)) {
return false;
}
}
return true;
}
public static String c(Map<String, String> map) {
if (map == null) {
return "";
}
try {
StringBuilder sb = new StringBuilder();
int size = map.size();
int i9 = 0;
for (Map.Entry<String, String> entry : map.entrySet()) {
i9++;
sb.append(entry.getKey());
sb.append(ContainerUtils.KEY_VALUE_DELIMITER);
sb.append(entry.getValue());
if (i9 != size) {
sb.append("&");
}
}
return sb.toString();
} catch (Exception unused) {
return "";
}
}
private static Field d(Class<?> cls, Class<?> cls2) {
Field[] declaredFields;
if (cls == null || cls2 == null || (declaredFields = cls.getDeclaredFields()) == null || declaredFields.length == 0) {
return null;
}
for (Field field : declaredFields) {
if (field.getType().equals(cls2)) {
return field;
}
}
return null;
}
private static byte[] b(Object obj) {
return new Gson().toJson(obj).getBytes();
}
private static String b(int i9) {
StringBuffer stringBuffer = new StringBuffer();
for (int i10 = 0; i10 < i9; i10++) {
stringBuffer.append(f5626p);
}
return stringBuffer.toString();
}
public static String a(int i9) {
try {
c cVar = new c(AGCServerException.AUTHENTICATION_INVALID, new g());
cVar.a();
Object obj = cVar.f5629a;
return obj != null ? (String) obj : "";
} catch (Throwable th) {
com.bonree.sdk.bl.a.a().a(f5611a, th);
return "";
}
}
public static String d(Map<String, Object> map) {
if (map == null) {
return null;
}
StringBuilder sb = new StringBuilder();
JSONObject jSONObject = new JSONObject();
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (key != null && value != null && !(value instanceof String) && !(value instanceof Number)) {
value = value instanceof Object[] ? Arrays.toString((Object[]) value) : value.toString();
}
try {
jSONObject.put(key, value);
} catch (JSONException unused) {
}
}
sb.append(jSONObject.toString());
return sb.toString();
}
private static boolean b(CharSequence charSequence, CharSequence charSequence2) {
int length;
if (charSequence == charSequence2) {
return true;
}
if (charSequence == null || charSequence2 == null || (length = charSequence.length()) != charSequence2.length()) {
return false;
}
if ((charSequence instanceof String) && (charSequence2 instanceof String)) {
return charSequence.equals(charSequence2);
}
for (int i9 = 0; i9 < length; i9++) {
if (charSequence.charAt(i9) != charSequence2.charAt(i9)) {
return false;
}
}
return true;
}
public static String c(Throwable th) {
if (th != null) {
try {
return "Caused by: " + th.toString();
} catch (Throwable unused) {
return "";
}
}
return "";
}
private static String a(String str, int i9) {
try {
c cVar = new c(i9, new q(str));
cVar.a();
Object obj = cVar.f5629a;
return obj != null ? (String) obj : "";
} catch (Throwable th) {
com.bonree.sdk.bl.a.a().a(f5611a, th);
return "";
}
}
private static List<String> b(Context context, String str) {
FileInputStream fileInputStream;
InputStreamReader inputStreamReader;
?? r52;
try {
fileInputStream = context.openFileInput(str);
try {
inputStreamReader = new InputStreamReader(fileInputStream);
try {
r52 = new BufferedReader(inputStreamReader);
} catch (Throwable unused) {
r52 = 0;
}
} catch (Throwable unused2) {
inputStreamReader = null;
r52 = inputStreamReader;
a((Closeable[]) new Closeable[]{fileInputStream, inputStreamReader, r52});
return null;
}
} catch (Throwable unused3) {
fileInputStream = null;
inputStreamReader = null;
}
try {
ArrayList arrayList = new ArrayList();
for (String readLine = r52.readLine(); readLine != null; readLine = r52.readLine()) {
arrayList.add(readLine);
}
a((Closeable[]) new Closeable[]{fileInputStream, inputStreamReader, r52});
return arrayList;
} catch (Throwable unused4) {
a((Closeable[]) new Closeable[]{fileInputStream, inputStreamReader, r52});
return null;
}
}
public static Field c(Class<?> cls, Class<?> cls2) {
Field field;
Field[] fields;
Field[] declaredFields;
if (cls != null && cls2 != null && (declaredFields = cls.getDeclaredFields()) != null && declaredFields.length != 0) {
int length = declaredFields.length;
for (int i9 = 0; i9 < length; i9++) {
field = declaredFields[i9];
if (field.getType().equals(cls2)) {
break;
}
}
}
field = null;
if (field == null) {
if (cls == null || cls2 == null || (fields = cls.getFields()) == null || fields.length == 0) {
return null;
}
for (Field field2 : fields) {
if (field2.getType().equals(cls2)) {
return field2;
}
}
return null;
}
return field;
}
@SuppressLint({"SoonBlockedPrivateApi"})
public static void h() {
if (Build.VERSION.SDK_INT < 28) {
return;
}
try {
Class<?> cls = Class.forName("android.app.ActivityThread");
Method declaredMethod = cls.getDeclaredMethod("currentActivityThread", new Class[0]);
declaredMethod.setAccessible(true);
Object invoke = declaredMethod.invoke(null, new Object[0]);
Field declaredField = cls.getDeclaredField("mHiddenApiWarningShown");
declaredField.setAccessible(true);
declaredField.setBoolean(invoke, true);
} catch (Throwable unused) {
}
}
private static Object a(byte[] bArr, Class<?> cls) {
return a(new String(bArr), cls);
}
public static Object a(String str, Class<?> cls) {
return new Gson().fromJson(str, (Class<Object>) cls);
}
public static <T> T a(Properties properties, String str, T t9) {
if (properties.containsKey(str)) {
String property = properties.getProperty(str);
if (b(property) || t9 == null) {
return t9;
}
?? r12 = (T) property.trim();
Class<?> cls = t9.getClass();
if (cls == String.class) {
return r12;
}
if (cls == Boolean.class) {
return (T) new Boolean((String) r12);
}
if (cls == Integer.class) {
return (T) new Integer((String) r12);
}
if (cls == Float.class) {
return (T) new Float((String) r12);
}
if (cls == Long.class) {
return (T) new Long((String) r12);
}
return cls == Double.class ? (T) new Double((String) r12) : t9;
}
return t9;
}
private static String b(String str, String str2, String str3) {
if (str2 == null) {
return null;
}
if (str2.startsWith("http:") || str2.startsWith("https:")) {
return str2;
}
if (str2.contains(HttpConstant.SCHEME_SPLIT) && !str2.startsWith(HttpConstant.SCHEME_SPLIT) && str2.contains("?")) {
String[] split = str2.split("\\?");
if (split.length > 0 && split[0].contains(HttpConstant.SCHEME_SPLIT) && !split[0].startsWith(HttpConstant.SCHEME_SPLIT)) {
return str2;
}
}
if (str == null) {
return null;
}
try {
URL url = new URL(str);
StringBuilder sb = new StringBuilder();
sb.append(url.getProtocol());
sb.append(HttpConstant.SCHEME_SPLIT);
sb.append(url.getHost());
int port = url.getPort();
if (port != -1) {
sb.append(Constants.COLON_SEPARATOR);
sb.append(String.valueOf(port));
}
if (str2.startsWith("/")) {
if (str2.startsWith("//")) {
while (str2.startsWith("/")) {
str2 = str2.replaceFirst("/", "");
}
return url.getProtocol() + HttpConstant.SCHEME_SPLIT + str2;
}
sb.append(str2);
return sb.toString();
}
String replaceFirst = url.getPath().replaceFirst("/", "");
if (replaceFirst.endsWith("/")) {
replaceFirst = replaceFirst + "*";
}
LinkedList linkedList = new LinkedList();
String[] split2 = replaceFirst.split("/");
if (split2.length > 0) {
Collections.addAll(linkedList, split2);
}
if (!TextUtils.isEmpty(str2) && !str2.startsWith("?") && !str2.contains(".html") && !TextUtils.isEmpty((CharSequence) linkedList.getLast()) && ((String) linkedList.getLast()).contains(".html")) {
linkedList.removeLast();
}
while (true) {
if (!str2.startsWith("../") && !str2.startsWith("./") && !str2.startsWith("/")) {
break;
}
if (str2.startsWith("../")) {
try {
linkedList.pollLast();
} catch (Throwable unused) {
}
str2 = str2.replaceFirst("../", "");
if (linkedList.size() > 0) {
linkedList.removeLast();
}
}
if (str2.startsWith("./")) {
str2 = str2.replaceFirst("./", "");
if (linkedList.size() > 0) {
linkedList.removeLast();
}
}
if (str2.startsWith("/")) {
str2 = str2.replaceFirst("/", "");
if (linkedList.size() > 0) {
linkedList.removeLast();
}
}
}
sb.append("/");
for (int i9 = 0; i9 < linkedList.size(); i9++) {
sb.append((String) linkedList.get(i9));
sb.append("/");
}
if (!TextUtils.isEmpty(str2) && str2.startsWith("?")) {
sb.deleteCharAt(sb.length() - 1);
}
sb.append(str2);
return sb.toString();
} catch (Throwable unused2) {
return null;
}
}
private static boolean a(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence) || charSequence.toString().trim().length() == 0;
}
private static boolean a(String[] strArr, String[] strArr2, String[] strArr3) {
if (strArr != null && strArr.length != 0 && strArr2 != null && strArr2.length != 0) {
for (String str : strArr) {
if (!b(str) && !a(str, (String[]) null) && a(str, strArr2)) {
return true;
}
}
}
return false;
}
private static boolean a(String str, String[] strArr) {
if (!b(str) && strArr != null && strArr.length != 0) {
for (String str2 : strArr) {
if (str.equals(str2)) {
return true;
}
}
}
return false;
}
private static String a(String str, String str2, String str3) {
if (!b(str) && str2 != null && str3 != null) {
int length = str.length();
int length2 = str2.length();
int length3 = str3.length();
if (length > length2 && length > length3) {
int i9 = 0;
if (length2 == 0 || (i9 = str.indexOf(str2)) != -1) {
if (length3 == 0 || (length = str.indexOf(str3, i9 + length2)) != -1) {
return str.substring(i9 + length2, length);
}
return null;
}
return null;
}
}
return null;
}
public static void a(Closeable... closeableArr) {
for (int i9 = 0; i9 < 3; i9++) {
a(closeableArr[i9]);
}
}
public static void a(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (Throwable unused) {
}
}
}
public static Class<?> a(Class<?> cls, Class<?> cls2) {
if (cls2 == null) {
return null;
}
Class<?> cls3 = cls2;
while (!cls.equals(cls2)) {
Class<? super Object> superclass = cls2.getSuperclass();
if (Object.class.equals(superclass)) {
return cls2;
}
cls3 = cls2;
cls2 = superclass;
}
return cls3;
}
public static long a(double d9, double d10) {
return new BigDecimal(d9).setScale(20, 4).multiply(new BigDecimal(1.0d)).longValue();
}
public static ArrayList<String> a(boolean z8) {
ArrayList<String> arrayList = new ArrayList<>();
try {
if (Build.VERSION.SDK_INT >= 25 && z8) {
arrayList.addAll(a(a.a()));
}
if (arrayList.isEmpty()) {
arrayList.addAll(J());
}
} catch (Throwable unused) {
}
return arrayList;
}
private static ArrayList<String> a(Context context) {
Network[] allNetworks;
List<InetAddress> dnsServers;
ArrayList<String> arrayList = new ArrayList<>();
try {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (Build.VERSION.SDK_INT >= 21) {
for (Network network : connectivityManager.getAllNetworks()) {
if (connectivityManager.getNetworkInfo(network).isConnected() && (dnsServers = connectivityManager.getLinkProperties(network).getDnsServers()) != null) {
for (InetAddress inetAddress : dnsServers) {
arrayList.add(inetAddress.getHostAddress());
}
}
}
}
} catch (Throwable unused) {
}
return arrayList;
}
public static boolean b(Class<?> cls, Class<?> cls2) {
if (cls != null && cls2 != null && !cls.equals(cls2) && !cls.isInterface() && !cls2.isInterface()) {
Class<? super Object> superclass = cls2.getSuperclass();
if (cls.equals(superclass) || Object.class.equals(cls)) {
return true;
}
while (superclass != null && !Object.class.equals(superclass)) {
if (cls.equals(superclass)) {
return true;
}
superclass = superclass.getSuperclass();
}
}
return false;
}
private static long b(long j9) {
return (j9 - System.currentTimeMillis()) + SystemClock.uptimeMillis();
}
public static boolean a(Context context, String str) {
if (context != null) {
try {
try {
if (!b(str)) {
return context.getPackageManager().checkPermission(str, context.getPackageName()) == 0;
}
} catch (Throwable unused) {
}
} catch (Throwable unused2) {
com.bonree.sdk.bl.a.a().e("check permission is error: %s", str);
}
}
return false;
}
public static String b(Map<String, String> map) {
StringBuilder sb = new StringBuilder();
JSONObject jSONObject = new JSONObject();
for (Map.Entry<String, String> entry : map.entrySet()) {
try {
jSONObject.put(entry.getKey(), entry.getValue());
} catch (JSONException unused) {
}
}
sb.append(jSONObject.toString());
return sb.toString();
}
@SuppressLint({"NewApi"})
public static String a(WebResourceError webResourceError, WebResourceRequest webResourceRequest) {
if (webResourceError == null && webResourceRequest == null) {
return "";
}
try {
StringBuilder sb = new StringBuilder();
Objects.toString(webResourceError == null ? "" : Integer.valueOf(webResourceError.getErrorCode()));
sb.append(webResourceError == null ? "" : webResourceError.getDescription());
if (webResourceRequest != null) {
a(webResourceRequest.getRequestHeaders());
}
} catch (Throwable unused) {
}
return "";
}
public static String b(Throwable th) {
if (th != null) {
try {
return th.getClass().getSimpleName();
} catch (Throwable unused) {
return "";
}
}
return "";
}
public static String a(Map<String, String> map) {
if (map == null) {
return "";
}
try {
StringBuilder sb = new StringBuilder();
for (String str : map.keySet()) {
sb.append(str);
sb.append(Constants.COLON_SEPARATOR);
sb.append(map.get(str));
sb.append("\r\n");
}
sb.append("\r\n\r\n");
return sb.toString();
} catch (Throwable unused) {
return "";
}
}
public static int b(double d9) {
try {
return Double.valueOf(d9).intValue();
} catch (Exception unused) {
return 0;
}
}
private static boolean b(CharSequence charSequence) {
return !(TextUtils.isEmpty(charSequence) || charSequence.toString().trim().length() == 0);
}
@SuppressLint({"NewApi"})
public static String a(WebResourceResponse webResourceResponse) {
if (webResourceResponse == null) {
return "";
}
try {
AtomicReference atomicReference = new AtomicReference(new StringBuilder());
StringBuilder sb = (StringBuilder) atomicReference.get();
sb.append(webResourceResponse.getStatusCode());
sb.append(HanziToPinyin.Token.SEPARATOR);
sb.append(webResourceResponse.getReasonPhrase());
sb.append("\r\n");
sb.append(a(webResourceResponse.getResponseHeaders()));
return atomicReference.toString();
} catch (Throwable unused) {
return "";
}
}
private static List<String> a(String str, Set<String> set) {
com.bonree.sdk.bl.f a9 = com.bonree.sdk.bl.a.a();
a9.c("javaDNS: domain -> " + str + ", ns:" + set, new Object[0]);
ArrayList arrayList = new ArrayList();
arrayList.add(str);
if (str != null && set != null) {
if (set.isEmpty()) {
set.add("114.114.114.114");
}
com.bonree.sdk.bx.c cVar = new com.bonree.sdk.bx.c();
cVar.a(a.EnumC0064a.udpTcp);
for (String str2 : set) {
com.bonree.sdk.bl.f a10 = com.bonree.sdk.bl.a.a();
a10.c("javaDNS: use " + str2 + " to resolver", new Object[0]);
a.C0061a a11 = com.bonree.sdk.bq.a.f().a(new com.bonree.sdk.bq.c(str, v.b.A)).a(new Random().nextInt()).c(true).b(true).a(a.b.QUERY);
a.c cVar2 = a.c.NO_ERROR;
try {
com.bonree.sdk.bs.d a12 = cVar.a(a11.a(cVar2).a(false).b(), InetAddress.getByName(str2), f5612b);
if (a12 != null) {
com.bonree.sdk.bq.a aVar = a12.f5348a;
if (aVar.f5269c == cVar2) {
for (com.bonree.sdk.bw.v<? extends com.bonree.sdk.bw.h> vVar : aVar.f5278l) {
if (vVar.f5485b == v.b.CNAME) {
String obj = vVar.f5489f.toString();
if (!obj.isEmpty()) {
if (obj.endsWith(".")) {
obj = obj.substring(0, obj.length() - 1);
}
arrayList.add(obj);
}
}
}
com.bonree.sdk.bl.f a13 = com.bonree.sdk.bl.a.a();
a13.c("javaDNS: resolver ok, cnameList:" + arrayList, new Object[0]);
return arrayList;
}
continue;
} else {
continue;
}
} catch (Exception unused) {
}
}
com.bonree.sdk.bl.a.a().c("javaDNS: miss", new Object[0]);
}
return arrayList;
}
private static com.bonree.sdk.bq.a a(com.bonree.sdk.bq.c cVar) {
return com.bonree.sdk.bq.a.f().a(cVar).a(new Random().nextInt()).c(true).b(true).a(a.b.QUERY).a(a.c.NO_ERROR).a(false).b();
}
public static String a(Object obj) {
if (obj == null) {
return "";
}
try {
if (obj instanceof List) {
List list = (List) obj;
if (list.size() == 1) {
return o(list.get(0).toString());
}
return o(Arrays.toString(list.toArray()));
}
return o(obj.toString());
} catch (Throwable unused) {
return "";
}
}
public static String a(Throwable th) {
if (th != null) {
try {
StackTraceElement[] stackTrace = th.getStackTrace();
StringBuffer stringBuffer = new StringBuffer();
for (StackTraceElement stackTraceElement : stackTrace) {
String valueOf = String.valueOf(stackTraceElement);
if (stringBuffer.length() + valueOf.length() >= 10000) {
break;
}
stringBuffer.append("at ");
stringBuffer.append(valueOf);
stringBuffer.append("\r\n");
}
return stringBuffer.toString();
} catch (Throwable unused) {
return "";
}
}
return "";
}
public static long a(double d9) {
try {
return Double.valueOf(d9).longValue();
} catch (Exception unused) {
return 0L;
}
}
private static double a(long j9, long j10, int i9) {
if (i9 >= 0) {
return new BigDecimal(Long.toString(j9)).divide(new BigDecimal(Long.toString(j10)), i9, 7).doubleValue();
}
throw new IllegalArgumentException("The scale must be a positive integer or zero");
}
public static String a(ResourceError resourceError, ResourceRequest resourceRequest) {
if (resourceError == null && resourceRequest == null) {
return "";
}
try {
StringBuilder sb = new StringBuilder();
Objects.toString(resourceError == null ? "" : Integer.valueOf(resourceError.getErrorCode()));
sb.append(resourceError == null ? "" : resourceError.getInfo());
if (resourceRequest != null) {
a((Map<String, String>) resourceRequest.getHeaders());
}
} catch (Throwable unused) {
}
return "";
}
public static String a(List<String> list) {
StringBuffer stringBuffer = new StringBuffer();
BufferedReader bufferedReader = null;
try {
try {
list = Runtime.getRuntime().exec((String[]) list.toArray(new String[list.size()]));
try {
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(list.getInputStream()));
try {
if (list.getErrorStream() != null) {
BufferedReader bufferedReader3 = new BufferedReader(new InputStreamReader(list.getErrorStream()));
StringBuffer stringBuffer2 = new StringBuffer();
while (true) {
try {
String readLine = bufferedReader3.readLine();
if (readLine == null) {
break;
}
stringBuffer2.append(readLine);
stringBuffer2.append("\n");
} catch (Throwable unused) {
}
}
bufferedReader3.close();
}
while (true) {
String readLine2 = bufferedReader2.readLine();
if (readLine2 == null) {
break;
}
stringBuffer.append("\n" + readLine2);
}
if (stringBuffer.length() > 0) {
stringBuffer.delete(0, 1);
}
bufferedReader2.close();
} catch (IOException unused2) {
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (Throwable th) {
th = th;
bufferedReader = bufferedReader2;
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Throwable unused3) {
list.destroy();
throw th;
}
}
if (list != 0) {
list.exitValue();
}
throw th;
}
} catch (IOException unused4) {
} catch (Throwable th2) {
th = th2;
}
} catch (Throwable unused5) {
list.destroy();
}
} catch (IOException unused6) {
list = 0;
} catch (Throwable th3) {
th = th3;
list = 0;
}
list.exitValue();
return stringBuffer.toString();
}
private static boolean a(String[] strArr, String[] strArr2) {
if (strArr != null && strArr.length != 0 && strArr2 != null && strArr2.length != 0) {
for (String str : strArr) {
if (!b(str) && !a(str, (String[]) null) && a(str, strArr2)) {
return true;
}
}
}
return false;
}
}