MD5 校验值:27cf44ec6e0720408f5ef017a90a3331
b.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.jb.gokeyboard.theme.template.util; import android.app.ActivityManager; import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; import android.os.Process; import android.provider.Settings; import android.telephony.TelephonyManager; import android.text.TextUtils; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodManager; import com.google.android.gms.ads.identifier.AdvertisingIdClient; import com.jb.gokeyboard.theme.emojiztfors9.getjar.R; import com.jb.gokeyboard.theme.template.MainActivity; import com.jb.gokeyboard.theme.template.ThemeApplication; import com.jiubang.commerce.ad.AdSdkApi; import com.mopub.mobileads.VastExtensionXmlManager; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Random; public class b { public static final String[] a = {"com.jb.emoji.gokeyboard", "com.jb.gokeyboardpro", "com.jb.gokeyboard", "com.jb.lab.gokeyboard"}; public static void a(Context context) { f(context, "https://m.facebook.com/ads/ad_choices"); } public static boolean a(Context context, String str) { if (context == null || str == null) { return false; } try { context.getPackageManager().getPackageInfo(str, 1024); return true; } catch (PackageManager.NameNotFoundException e) { return false; } catch (Exception e2) { return false; } } public static String b(Context context) { try { int myPid = Process.myPid(); for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses()) { if (runningAppProcessInfo.pid == myPid) { return runningAppProcessInfo.processName; } } } catch (Exception e) { } return null; } public static boolean b(Context context, String str) { if (context == null || str == null || str.equals(context.getPackageName())) { return true; } return false; } public static String c(Context context) { InputStream openRawResource = context.getResources().openRawResource(R.raw.uid); byte[] bArr = new byte[1024]; try { try { try { try { int read = openRawResource.read(bArr); if (read <= 0) { if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e) { e.printStackTrace(); } } return "200"; } byte[] bArr2 = new byte[read]; for (int i = 0; i < read; i++) { bArr2[i] = bArr[i]; } String trim = new String(bArr2).trim(); if (bArr2 != null && trim.contains("\n")) { trim = trim.replaceAll("\n", ""); } if (openRawResource == null) { return trim; } try { openRawResource.close(); return trim; } catch (IOException e2) { e2.printStackTrace(); return trim; } } catch (IOException e3) { e3.printStackTrace(); if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e4) { e4.printStackTrace(); } } return "200"; } } catch (Exception e5) { e5.printStackTrace(); if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e6) { e6.printStackTrace(); } } return "200"; } } catch (Error e7) { e7.printStackTrace(); if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e8) { e8.printStackTrace(); } } return "200"; } } catch (Throwable th) { if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e9) { e9.printStackTrace(); } } throw th; } } public static String d(Context context) { AdvertisingIdClient.Info info = null; try { info = AdvertisingIdClient.getAdvertisingIdInfo(context); } catch (Throwable th) { th.printStackTrace(); } if (info != null) { return info.getId(); } return AdSdkApi.UNABLE_TO_RETRIEVE; } public static int e(Context context) { try { return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return 0; } } public static String f(Context context) { try { return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return null; } } public static boolean g(Context context) { return c(context, "com.jb.gokeyboard") || c(context, "com.jb.emoji.gokeyboard") || c(context, "com.jb.lab.gokeyboard") || c(context, "com.jb.gokeyboardpro"); } public static boolean c(Context context, String str) { if (context == null) { return false; } try { context.getPackageManager().getPackageInfo(str, 0); return true; } catch (Exception e) { return false; } } public static String h(Context context) { String str; InputStream inputStream; Throwable th; InputStream openRawResource; String str2 = "1"; InputStream inputStream2 = null; try { try { openRawResource = context.getResources().openRawResource(R.raw.svn); } catch (Throwable th2) { th = th2; if (inputStream2 != null) { try { inputStream2.close(); } catch (IOException e) { e.printStackTrace(); } } throw th; } } catch (Throwable th3) { str = "1"; inputStream = null; th = th3; } try { str2 = new BufferedReader(new InputStreamReader(openRawResource)).readLine(); if (str2 != null) { str = str2.trim(); } else { str = "1"; } if (openRawResource != null) { try { openRawResource.close(); } catch (IOException e2) { e2.printStackTrace(); } } } catch (Throwable th4) { str = str2; inputStream = openRawResource; th = th4; try { th.printStackTrace(); if (inputStream != null) { try { inputStream.close(); } catch (IOException e3) { e3.printStackTrace(); } } return str; } catch (Throwable th5) { th = th5; inputStream2 = inputStream; if (inputStream2 != null) { } throw th; } } return str; } public static String i(Context context) { try { return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.loadLabel(context.getPackageManager()).toString(); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); return ""; } } public static boolean j(Context context) { boolean v; if (k(context) || (v = v(context))) { return true; } w(context); return v; } public static Uri a(String str) { if (TextUtils.isEmpty(str)) { return null; } if ("com.jb.emoji.gokeyboard".equals(str)) { return Uri.parse("content://com.jb.emoji.gokeyboard.gokeyboardprovider/curtheme"); } if ("com.jb.gokeyboard".equals(str)) { return Uri.parse("content://com.jb.gokeyboard.gokeyboardprovider/curtheme"); } if ("com.jb.lab.gokeyboard".equals(str)) { return Uri.parse("content://com.jb.gokeyboard.lab.gokeyboardprovider/curtheme"); } if ("com.jb.gokeyboardpro".equals(str)) { return Uri.parse("content://com.jb.gokeyboardpro.gokeyboardprovider/curtheme"); } return Uri.parse("content://" + str + ".gokeyboardprovider/curtheme"); } public static boolean k(Context context) { boolean z; Uri uri; String string = Settings.Secure.getString(context.getContentResolver(), "default_input_method"); if (string == null) { string = ""; } if (string.startsWith("com.jb.gokeyboardpro")) { uri = Uri.parse("content://com.jb.gokeyboardpro.gokeyboardprovider/curtheme"); z = true; } else if (string.startsWith("com.jb.gokeyboard")) { uri = Uri.parse("content://com.jb.gokeyboard.gokeyboardprovider/curtheme"); z = true; } else if (string.startsWith("com.jb.lab.gokeyboard")) { uri = Uri.parse("content://com.jb.gokeyboard.lab.gokeyboardprovider/curtheme"); z = true; } else if (!string.startsWith("com.jb.emoji.gokeyboard")) { z = false; uri = null; } else { uri = Uri.parse("content://com.jb.emoji.gokeyboard.gokeyboardprovider/curtheme"); z = true; } if (z) { return a(uri, context); } return false; } private static boolean v(Context context) { boolean a2; boolean a3; boolean a4; boolean z = false; if (a(context, "com.jb.gokeyboard")) { z = a(Uri.parse("content://com.jb.gokeyboard.gokeyboardprovider/curtheme"), context); } if (a(context, "com.jb.emoji.gokeyboard") && (a4 = a(Uri.parse("content://com.jb.emoji.gokeyboard.gokeyboardprovider/curtheme"), context))) { z = a4; } if (a(context, "com.jb.lab.gokeyboard") && (a3 = a(Uri.parse("content://com.jb.gokeyboard.lab.gokeyboardprovider/curtheme"), context))) { z = a3; } return (a(context, "com.jb.gokeyboardpro") && (a2 = a(Uri.parse("content://com.jb.gokeyboardpro.gokeyboardprovider/curtheme"), context))) ? a2 : z; } private static void w(Context context) { if (a(context, "com.jb.emoji.gokeyboard")) { p(context, "com.jb.emoji.gokeyboard"); return; } if (a(context, "com.jb.gokeyboard")) { p(context, "com.jb.gokeyboard"); } else if (a(context, "com.jb.lab.gokeyboard")) { p(context, "com.jb.lab.gokeyboard"); } else if (a(context, "com.jb.gokeyboardpro")) { p(context, "com.jb.gokeyboardpro"); } } private static void p(Context context, String str) { d(context, str); } public static void d(Context context, String str) { try { Intent intent = new Intent(); intent.setClassName(str, "com.jb.gokeyboard.gostore.GoStroeFragmentActivity"); intent.putExtra("theme_install_page", true); context.startActivity(intent); } catch (Exception e) { try { Intent intent2 = new Intent(); intent2.setClassName(str, "com.jb.gokeyboard.MainActivity"); intent2.addFlags(268435456); context.startActivity(intent2); } catch (Exception e2) { e2.printStackTrace(); } } } private static boolean a(Uri uri, Context context) { ContentResolver contentResolver = context.getContentResolver(); ContentValues contentValues = new ContentValues(); contentValues.put("SkinPackName", context.getPackageName()); try { contentResolver.insert(uri, contentValues); return true; } catch (Exception e) { e.printStackTrace(); return false; } } public static String l(Context context) { String string = Settings.Secure.getString(context.getContentResolver(), "default_input_method"); if (string == null) { string = ""; } for (String str : a) { if (string.startsWith(str) && i(context, str)) { return str; } } for (String str2 : a) { if (a(context, str2) && i(context, str2)) { return str2; } } return ""; } public static void a(String str, MainActivity mainActivity, int i) { Intent intent = new Intent(); intent.setClassName(str, "com.jb.gokeyboard.gostore.LocalAppDetailActivity"); intent.putExtra("shoptype", i); intent.putExtra(VastExtensionXmlManager.TYPE, 1); intent.putExtra("title", mainActivity.getString(R.string.displayName)); intent.putExtra("from_theme", true); intent.putExtra("packageName", mainActivity.getPackageName()); ArrayList<String> arrayList = new ArrayList<>(); arrayList.add("default_pic1"); arrayList.add("default_pic2"); arrayList.add("default_pic3"); intent.putStringArrayListExtra("pics", arrayList); intent.putExtra("detail_type", 2); try { mainActivity.startActivity(intent); } catch (Exception e) { } } public static boolean e(Context context, String str) { Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str)); intent.setPackage("com.android.vending"); intent.setFlags(268435456); try { context.startActivity(intent); return true; } catch (ActivityNotFoundException e) { e.printStackTrace(); return false; } catch (Exception e2) { e2.printStackTrace(); return false; } } public static boolean f(Context context, String str) { Uri parse = Uri.parse(str); if (parse == null) { return false; } Intent intent = new Intent("android.intent.action.VIEW", parse); intent.setFlags(268435456); try { context.startActivity(intent); return true; } catch (ActivityNotFoundException e) { e.printStackTrace(); return false; } catch (Exception e2) { e2.printStackTrace(); return false; } } public static boolean m(Context context) { return a(context, "com.android.vending"); } public static void n(Context context) { String str; String str2 = context.getApplicationInfo().packageName.split("\\.")[4]; String str3 = "com.jb.emoji.gokeyboard"; if (t(ThemeApplication.a())) { String a2 = com.jb.gokeyboard.theme.a.b.a(context).a(13L, "scheme"); if (TextUtils.isEmpty(a2)) { boolean nextBoolean = new Random().nextBoolean(); if (j.c()) { nextBoolean = j.d(); } if (nextBoolean) { str3 = "com.jb.gokeyboardpro"; } } else if (TextUtils.equals(a2, "f_oldga")) { str3 = "com.jb.gokeyboard"; } else if (TextUtils.equals(a2, "f_labga")) { str3 = "com.jb.lab.gokeyboard"; } else if (TextUtils.equals(a2, "f_proga")) { str3 = "com.jb.gokeyboardpro"; } } if (u(context)) { str3 = "com.jb.emoji.gokeyboard"; } if (u(context) || "com.jb.emoji.gokeyboard".equals(str3)) { str = str2 + f(context); } else { str = "themeZT" + str2; } StringBuilder sb = new StringBuilder(); sb.append("id=").append(str3).append("&referrer=utm_source%3D").append(str).append("%26utm_medium%3DHyperlink%26utm_campaign%3D").append("ztthemes"); String sb2 = sb.toString(); if (c(context, "com.android.vending")) { e(context, "market://details?" + sb2); } else { f(context, "https://play.google.com/store/apps/details?" + sb2); } } public static String g(Context context, String str) { String str2 = null; Cursor query = context.getContentResolver().query(Uri.parse(str), new String[]{"themename"}, null, null, null); if (query != null) { try { if (query.moveToFirst()) { str2 = query.getString(query.getColumnIndex("themename")); } } catch (Exception e) { if (query != null) { query.close(); } } catch (Throwable th) { if (query != null) { query.close(); } throw th; } } if (query != null) { query.close(); } return str2; } public static boolean b(String str) { boolean z = true; if (TextUtils.isEmpty(str)) { return false; } Context a2 = ThemeApplication.a(); String packageName = a2.getPackageName(); if (!str.startsWith("com.jb.gokeyboardpro") ? !str.startsWith("com.jb.gokeyboard") ? !str.startsWith("com.jb.lab.gokeyboard") ? !str.startsWith("com.jb.emoji.gokeyboard") || !TextUtils.equals(packageName, g(a2, "content://com.jb.emoji.gokeyboard.gokeyboardprovider/curtheme")) : !TextUtils.equals(packageName, g(a2, "content://com.jb.gokeyboard.lab.gokeyboardprovider/curtheme")) : !TextUtils.equals(packageName, g(a2, "content://com.jb.gokeyboard.gokeyboardprovider/curtheme")) : !TextUtils.equals(packageName, g(a2, "content://com.jb.gokeyboardpro.gokeyboardprovider/curtheme"))) { z = false; } return z; } public static boolean c(String str) { return "com.jb.lab.gokeyboard".equals(str) || "com.jb.emoji.gokeyboard".equals(str) || "com.jb.gokeyboard".equals(str) || "com.jb.gokeyboardpro".equals(str); } public static String o(Context context) { return l(context); } public static List<String> p(Context context) { ArrayList arrayList = new ArrayList(); for (String str : a) { if (a(context, str)) { arrayList.add(str); } } return arrayList; } public static String h(Context context, String str) { ArrayList<String> arrayList = new ArrayList<>(); if (TextUtils.isEmpty(str)) { for (String str2 : a) { if (a(context, str2)) { arrayList.add(str2); } } } else { arrayList = j(context, str); } if (arrayList.size() == 1) { return arrayList.get(0); } String q = q(context); if (!TextUtils.isEmpty(q) && arrayList.contains(q)) { return q; } if (arrayList.contains("com.jb.gokeyboardpro")) { return "com.jb.gokeyboardpro"; } if (arrayList.contains("com.jb.emoji.gokeyboard")) { return "com.jb.emoji.gokeyboard"; } if (arrayList.contains("com.jb.gokeyboard")) { return "com.jb.gokeyboard"; } if (arrayList.contains("com.jb.lab.gokeyboard")) { return "com.jb.lab.gokeyboard"; } return ""; } public static boolean i(Context context, String str) { int i; Resources resources; int identifier; int i2 = -1; try { Context createPackageContext = context.createPackageContext(str, 2); resources = createPackageContext.getResources(); identifier = resources != null ? resources.getIdentifier("keyboard_version", "integer", createPackageContext.getPackageName()) : 0; } catch (Exception e) { e.printStackTrace(); i = 0; } if (identifier == 0) { return false; } i2 = resources.getInteger(identifier); i = context.getResources().getInteger(R.integer.theme_version); return i2 >= i; } public static String q(Context context) { String string = Settings.Secure.getString(context.getContentResolver(), "default_input_method"); if (string == null) { string = ""; } for (String str : a) { if (string.startsWith(str)) { return str; } } return string; } public static ArrayList<String> j(Context context, String str) { ArrayList<String> arrayList = new ArrayList<>(); if (context == null || TextUtils.isEmpty(str)) { return arrayList; } Iterator<ResolveInfo> it = context.getPackageManager().queryIntentServices(new Intent(str), 65536).iterator(); while (it.hasNext()) { arrayList.add(it.next().serviceInfo.packageName); } return arrayList; } public static boolean k(Context context, String str) { List<InputMethodInfo> enabledInputMethodList = ((InputMethodManager) context.getSystemService("input_method")).getEnabledInputMethodList(); if (enabledInputMethodList == null || enabledInputMethodList.size() <= 0) { return false; } for (int i = 0; i < enabledInputMethodList.size(); i++) { InputMethodInfo inputMethodInfo = enabledInputMethodList.get(i); if (inputMethodInfo != null && inputMethodInfo.getPackageName().equals(str)) { return true; } } return false; } public static boolean l(Context context, String str) { String string = Settings.Secure.getString(context.getContentResolver(), "default_input_method"); if (string == null) { string = ""; } return string.startsWith(str); } public static List<String> r(Context context) { ArrayList arrayList = new ArrayList(); for (String str : a) { if (k(context, str)) { arrayList.add(str); } } return arrayList; } public static Context m(Context context, String str) { try { return context.createPackageContext(str, 2); } catch (Exception e) { return null; } } public static boolean n(Context context, String str) { Resources resources; int identifier; if (context == null || (resources = context.getResources()) == null || (identifier = resources.getIdentifier(str, "bool", context.getPackageName())) == 0) { return false; } return resources.getBoolean(identifier); } public static String s(Context context) { return context.getResources().getConfiguration().locale.getCountry(); } public static boolean o(Context context, String str) { Uri parse; if (context == null || TextUtils.isEmpty(str) || (parse = Uri.parse(str)) == null) { return false; } Intent intent = new Intent("android.intent.action.VIEW", parse); intent.setFlags(268435456); try { context.startActivity(intent); return true; } catch (ActivityNotFoundException e) { e.printStackTrace(); return false; } catch (Exception e2) { e2.printStackTrace(); return false; } } public static boolean t(Context context) { if (context == null) { return false; } String simOperator = ((TelephonyManager) context.getSystemService("phone")).getSimOperator(); if (!TextUtils.isEmpty(simOperator)) { return simOperator.startsWith("310"); } String country = Locale.getDefault().getCountry(); return country != null && country.contains("US"); } public static boolean u(Context context) { return context.getResources().getIdentifier("gif_keyboard_background", "raw", context.getPackageName()) != 0; } }