package com.tencent.smtt.utils; import android.annotation.TargetApi; import android.content.Context; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.StatFs; import android.text.TextUtils; import android.util.Log; import androidx.core.view.InputDeviceCompat; import androidx.core.view.PointerIconCompat; import cn.jpush.android.service.WakedResultReceiver; import com.tencent.smtt.sdk.QbSdk; import com.tencent.smtt.sdk.TbsConfig; import com.tencent.smtt.sdk.TbsDownloader; import com.tencent.smtt.sdk.TbsPrivacyAccess; import com.tencent.smtt.sdk.TbsShareManager; import com.tencent.smtt.sdk.c; import com.tencent.smtt.sdk.stat.b; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.util.Properties; public class r { private static File a = null; private static String b = ""; private static String c = ""; private static int d = -1; private static String e = ""; private static String f = null; private static int g = 0; private static String h = null; private static boolean i = false; private static boolean j = false; private static String k = "unknown"; private static int l = -1; private static int m = -1; private static int n = -1; private static int o = -1; private static int p = -1; private static String q = ""; private static String r = ""; private static int a(Context context, String str, int i2, int i3) { File file = new File(FileUtil.a(context, str, i2, true), TbsDownloader.getBackupFileName(false, i3)); if (!file.exists() || !file.canRead()) { return -1; } int b2 = a.b(file); return b2 <= 0 ? a.a(context, file) : b2; } public static long a() { StatFs statFs = new StatFs(Environment.getDataDirectory().getPath()); return ((long) statFs.getBlockSize()) * ((long) statFs.getAvailableBlocks()); } public static void a(int i2) { d = i2; } public static void a(Context context, Bundle bundle) { try { SharedPreferences.Editor edit = context.getSharedPreferences("sai", 0).edit(); if (bundle.containsKey(QbSdk.KEY_THIRD_PARTY_TURING)) { boolean z = bundle.getBoolean(QbSdk.KEY_THIRD_PARTY_TURING); edit.putBoolean("itge", z); TbsLog.e("TbsUtils", "setEnableForThirdParty key is " + "itge" + " value is " + z); } edit.commit(); } catch (Throwable unused) { } } public static void a(Context context, String str, String str2) { String str3; try { if (TbsShareManager.isThirdPartyApp(context) && k(context)) { String str4 = "thirdapp_" + str; if (TextUtils.isEmpty(str2)) { str3 = ""; } else { str3 = str2 + "_"; } StringBuilder sb = new StringBuilder(); sb.append(str3); sb.append("mycpuis"); sb.append(b.b() ? 64 : 32); String str5 = (sb.toString() + "_" + "64scoreis" + TbsShareManager.getTbsStableCoreVersion(context, 64)) + "_" + "32scoreis" + TbsShareManager.getTbsStableCoreVersion(context, 32); b.a(context, str4, str5); TbsLog.i("uploadThirdAppCoreUpdate", "action is " + str4 + " p1 is " + str5); } } catch (Throwable th) { TbsLog.i("uploadThirdAppCoreUpdate", "stack is " + Log.getStackTraceString(th)); } } public static void a(String str) { if (!TextUtils.isEmpty(str)) { if (!TextUtils.isEmpty(b)) { str = b + "&" + str; } b = str; } } public static void a(String str, String str2) { q = str; r = str2; } @TargetApi(9) public static boolean a(Context context) { File tbsFolderDir; if (context == null) { return false; } if (a != null) { return true; } try { if (context.getApplicationInfo().processName.contains(TbsConfig.APP_WX) && (tbsFolderDir = QbSdk.getTbsFolderDir(context)) != null) { if (tbsFolderDir.isDirectory()) { File file = new File(tbsFolderDir, "share"); if (!file.isDirectory() && !file.mkdir()) { return false; } a = file; file.setExecutable(true, false); return true; } } return false; } catch (Exception e2) { e2.printStackTrace(); return false; } } public static String b() { if (QbSdk.getIsSysWebViewForcedByOuter()) { return "SysWebViewForcedByOuter"; } String str = (QbSdk.getIsInitX5Environment() ? "pre" : "nopre") + "&" + b; if (QbSdk.getCoreMinVersion() <= 0) { return str; } return "coremin_" + QbSdk.getCoreMinVersion() + "&" + str; } public static void b(Context context, String str, String str2) { } public static void b(String str) { e = str; } public static boolean b(Context context) { try { if (TbsShareManager.isThirdPartyApp(context)) { TbsLog.i("TbsUtils", "isStableCoreForHostEnable app is thirdapp return is false "); return false; } } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); } boolean z = true; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("scfh", true); TbsLog.i("TbsUtils", "isStableCoreForHostEnable is " + z); c a2 = c.a(); a2.a(context, (Integer) 1003, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass1 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("scfh", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1003](" + str + ")"); } }); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_VERTICAL_TEXT), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass10 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("scfh", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1009](" + str + ")"); } }); return z; } catch (Throwable th2) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th2)); return z; } } public static void c() { b = ""; } public static boolean c(Context context) { boolean z = true; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("ucup", true); TbsLog.i("TbsUtils", "isUploadCoreUpdateEnable is " + z); c.a().a(context, (Integer) 1005, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass12 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("ucup", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1005](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static String d() { return e; } public static String d(Context context) { if (!TextUtils.isEmpty(c)) { return c; } try { SharedPreferences sharedPreferences = context.getSharedPreferences("sai", 0); c = sharedPreferences.getString("bmo", ""); if (!TextUtils.isEmpty(c)) { return c; } c = TbsPrivacyAccess.getConfigurePrivacy(context, TbsPrivacyAccess.ConfigurablePrivacy.MODEL, ""); TbsLog.i("TbsUtils", "getBuildModel from sp is " + c); if (!TextUtils.isEmpty(c)) { return c; } if (TextUtils.isEmpty(c) && !context.getApplicationInfo().packageName.contains(TbsConfig.APP_QQ)) { c = Build.MODEL; } TbsLog.i("TbsUtils", "getBuildModel is " + c); if (!TextUtils.isEmpty(c)) { TbsPrivacyAccess.configurePrivacy(context, TbsPrivacyAccess.ConfigurablePrivacy.MODEL, c); SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putString("bmo", c); edit.commit(); } return c; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); } } public static boolean e(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("rrff", false); TbsLog.i("TbsUtils", "isReadResponseFromFileEnable is " + z); c.a().a(context, (Integer) 1006, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass13 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("rrff", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1006](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static boolean f(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("fwdn", false); TbsLog.i("TbsUtils", "isReadResponseFromFileEnable is " + z); c a2 = c.a(); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_CROSSHAIR), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass14 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("fwdn", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command 1007(" + str + ")"); } }); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_TEXT), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass15 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("fwdn", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command 1008(" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static boolean g(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("cbau", false); TbsLog.i("TbsUtils", "isClearBackupEnable is " + z); c a2 = c.a(); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_ALL_SCROLL), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass16 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("cbau", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1013](" + str + ")"); } }); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_HORIZONTAL_DOUBLE_ARROW), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass17 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("cbau", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1014](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static boolean h(Context context) { if (QbSdk.getTbsVersion(context) == d) { TbsLog.i("TbsUtils", "isUploadCoreSourceEnable core source version " + d + " already uploaded and return "); return false; } boolean z = true; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("ucst", true); TbsLog.i("TbsUtils", "isUploadCoreSourceEnable is " + z); c a2 = c.a(); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass18 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("ucst", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1016](" + str + ")"); } }); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_VERTICAL_DOUBLE_ARROW), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass2 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("ucst", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1015](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static boolean i(Context context) { boolean z; try { z = context.getApplicationInfo().packageName.contains("com.tencent.qqmusic"); } catch (Throwable unused) { z = false; } TbsLog.i("TbsUtils", "shouldUploadDestroyCode is " + z); return z; } public static String j(Context context) { l = a(context, TbsConfig.APP_WX, 3, 32); m = a(context, TbsConfig.APP_WX, 3, 64); n = a(context, TbsConfig.APP_QQ, 3, 32); o = a(context, TbsConfig.APP_WX, 4, 32); p = a(context, TbsConfig.APP_WX, 4, 64); q(context); String str = "coretype" + "=ctis=" + k; int sharedTbsCoreVersion = TbsShareManager.getSharedTbsCoreVersion(context, TbsConfig.APP_WX); int sharedTbsCoreVersion2 = TbsShareManager.getSharedTbsCoreVersion(context, TbsConfig.APP_QQ); return str + "=split=" + ("wx" + "=ceis=" + sharedTbsCoreVersion + "_" + "wxd" + "=ceis=" + TbsShareManager.getCoreShareDecoupleCoreVersion(context, TbsConfig.APP_WX) + "_" + "qq" + "=ceis=" + sharedTbsCoreVersion2 + "_" + "qqd" + "=ceis=" + TbsShareManager.getCoreShareDecoupleCoreVersion(context, TbsConfig.APP_QQ) + "_" + "wxb32" + "=ceis=" + l + "_" + "wxb64" + "=ceis=" + m + "_" + "qqb" + "=ceis=" + n + "_" + "s32" + "=ceis=" + o + "_" + "s64" + "=ceis=" + p); } public static boolean k(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("utcu", false); TbsLog.i("TbsUtils", "isUploadThirdAppCoreUpdateEnable is " + z); c a2 = c.a(); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_ZOOM_OUT), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass3 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("utcu", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1019](" + str + ")"); } }); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_GRAB), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass4 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("utcu", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1020](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static boolean l(Context context) { boolean z = true; try { final Context applicationContext = context.getApplicationContext(); z = applicationContext.getSharedPreferences("sai", 0).getBoolean("itge", true); TbsLog.i("TbsUtils", "isTuringEnable is " + z); c a2 = c.a(); a2.a(context, Integer.valueOf((int) PointerIconCompat.TYPE_GRABBING), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass5 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("itge", true); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1021](" + str + ")"); } }); a2.a(context, (Integer) 1022, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass6 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("itge", false); edit.commit(); TbsLog.e("TbsUtils", "Execute command [1022](" + str + ")"); } }); return z; } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); return z; } } public static void m(Context context) { String[] split; try { if (context.getApplicationInfo().packageName.contains(TbsConfig.APP_WX)) { TbsLog.i("TbsUtils", "deleteStableCoreIfNeed #00 "); final Context applicationContext = context.getApplicationContext(); String string = applicationContext.getSharedPreferences("sai", 0).getString("dscin", ""); TbsLog.i("TbsUtils", "deleteStableCoreIfNeed is " + string); c.a().a(context, (Integer) 1023, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass7 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { String[] split; TbsLog.i("TbsUtils", "Execute command [1023](" + str + ")"); if (!TextUtils.isEmpty(str) && (split = str.split("cl")) != null && split.length >= 1) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putString("dscin", str); edit.commit(); } } }); if (TextUtils.isEmpty(string) || (split = string.split("cl")) == null) { return; } if (split.length >= 1) { int tbsStableCoreVersion = TbsShareManager.getTbsStableCoreVersion(applicationContext, 32); int tbsStableCoreVersion2 = TbsShareManager.getTbsStableCoreVersion(applicationContext, 64); for (int i2 = 0; i2 < split.length; i2++) { try { int parseInt = Integer.parseInt(split[i2]); if (parseInt == tbsStableCoreVersion || parseInt == tbsStableCoreVersion2) { QbSdk.deleteStableCore(applicationContext, parseInt); split[i2] = ""; } } catch (Throwable unused) { } } String str = ""; boolean z = true; for (int i3 = 0; i3 < split.length; i3++) { try { if (!TextUtils.isEmpty(split[i3])) { if (z) { str = split[i3]; z = false; } else { str = str + "cl" + split[i3]; } } } catch (Throwable unused2) { } } if (!TextUtils.isEmpty(str)) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putString("dscin", str); edit.commit(); } } } } catch (Throwable th) { TbsLog.i("TbsUtils", "stack is " + Log.getStackTraceString(th)); } } public static boolean n(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = context.getSharedPreferences("sai", 0).getBoolean("ex5i", false); c.a().a(context, (Integer) 1024, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass8 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("ex5i", WakedResultReceiver.CONTEXT_KEY.equals(str)); edit.commit(); } }); return z; } catch (Throwable unused) { TbsLog.e("TbsUtils", "isX5InitIgnoreSystemCore failed ctx = " + context); return z; } } public static boolean o(Context context) { boolean z = false; try { final Context applicationContext = context.getApplicationContext(); z = context.getSharedPreferences("sai", 0).getBoolean("eitr", false); c.a().a(context, Integer.valueOf((int) InputDeviceCompat.SOURCE_GAMEPAD), new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass9 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("eitr", WakedResultReceiver.CONTEXT_KEY.equals(str)); edit.commit(); } }); return z; } catch (Throwable unused) { TbsLog.e("TbsUtils", "isInitTimeNeedReport failed ctx = " + context); return z; } } public static boolean p(Context context) { boolean z = true; try { final Context applicationContext = context.getApplicationContext(); z = context.getSharedPreferences("sai", 0).getBoolean("easmcv", true); c.a().a(context, (Integer) 1026, (c.a) new c.a() { /* class com.tencent.smtt.utils.r.AnonymousClass11 */ @Override // com.tencent.smtt.sdk.c.a public void a(String str) { SharedPreferences.Editor edit = applicationContext.getSharedPreferences("sai", 0).edit(); edit.putBoolean("easmcv", WakedResultReceiver.CONTEXT_KEY.equals(str)); edit.commit(); } }); return z; } catch (Throwable unused) { TbsLog.e("TbsUtils", "isEnableAppSetMinCoreVersion failed ctx = " + context); return z; } } /* JADX WARNING: Removed duplicated region for block: B:22:0x0084 A[Catch:{ Throwable -> 0x00c1 }] */ private static void q(Context context) { String str; String str2; try { File tbsShareFile = TbsShareManager.getTbsShareFile(context, "core_info"); if (tbsShareFile != null) { BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(tbsShareFile)); Properties properties = new Properties(); properties.load(bufferedInputStream); String property = properties.getProperty("core_version", ""); if (!"".equals(property)) { g = Math.max(Integer.parseInt(property), 0); } String property2 = properties.getProperty("core_packagename", ""); if (!"".equals(property2)) { h = property2; } String property3 = properties.getProperty("core_path", ""); if (!"".equals(property3)) { f = property3; if (f.contains(TbsConfig.APP_WX)) { str2 = "shareFromWX"; } else { if (f.contains(TbsConfig.APP_QQ)) { str2 = "shareFromQQ"; } if (f.contains(context.getApplicationInfo().packageName)) { k = "downloadOWN"; if (g != o) { if (g != p) { if (g != l) { if (g != m) { if (g == n) { str = "copyBackupFromQQ"; k = str; } } } str = "copyBackupFromWX"; k = str; } } str = "copyFromStable"; k = str; } } k = str2; if (f.contains(context.getApplicationInfo().packageName)) { } } i = Boolean.parseBoolean(properties.getProperty("core_disabled", "false")); } } catch (Throwable unused) { } } }