Luno v7.28.0版本的 MD5 值为:08d81b3b88ef7df48c89cb5d56dc11a2
以下内容为反编译后的 Utils.java 源代码,内容仅作参考
package com.applisto.appcloner.classes;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Application;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.UiModeManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.graphics.Point;
import android.graphics.drawable.Icon;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.view.ContextThemeWrapper;
import android.view.Display;
import android.view.ViewParent;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.applisto.appcloner.classes.util.Log;
import com.applisto.appcloner.classes.util.MultiProcessPreferences;
import com.applisto.appcloner.classes.util.SimpleCrypt;
import com.facebook.share.internal.MessengerShareContentUtility;
import com.sardine.ai.mdisdk.sentry.core.protocol.App;
import dalvik.system.DexClassLoader;
import dalvik.system.InMemoryDexClassLoader;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.zip.ZipFile;
import javax.security.cert.X509Certificate;
public class Utils {
private static final String APP_CLONER_NOTIFICATION_CHANNEL_ID = "AppCloner";
private static final String APP_CLONER_NOTIFICATION_CHANNEL_ID_HIGH_IMPORTANCE = "AppClonerHighImportance";
private static final String APP_CLONER_NOTIFICATION_CHANNEL_NAME = "App Cloner";
private static final String APP_CLONER_NOTIFICATION_CHANNEL_NAME_HIGH_IMPORTANCE = "App Cloner High Importance";
private static final double EARTH_RADIUS_METERS = 6378100.0d;
private static final String TAG = Utils.class.getSimpleName();
public static Application sApplication;
public static Boolean sDevDevice;
private static boolean sNotificationChannelCreated;
private static boolean sNotificationChannelCreatedHighImportance;
private static Icon sNotificationIcon;
private static SharedPreferences sPreferences;
public static Context sSecondaryClassLoaderContext;
private static ClassLoader secondaryClassLoader;
public static AlertDialog.Builder getDialogBuilder(Context context) {
ContextThemeWrapper contextThemeWrapper;
if (!(context instanceof Activity)) {
Activity runningActivity = getRunningActivity();
Log.i(TAG, "getDialogBuilder; runningActivity: " + runningActivity);
context = runningActivity != null ? runningActivity : context.getApplicationContext();
}
Log.i(TAG, "getDialogBuilder; context: " + context);
final boolean z = getActivityContext(context) instanceof Activity;
if (Build.VERSION.SDK_INT >= 21) {
contextThemeWrapper = new ContextThemeWrapper(context, android.R.style.Theme.DeviceDefault.Light);
} else {
contextThemeWrapper = new ContextThemeWrapper(context, android.R.style.Theme.DeviceDefault);
}
return new AlertDialog.Builder(contextThemeWrapper) {
@Override
public AlertDialog create() {
AlertDialog create = super.create();
if (!z) {
Log.i(Utils.TAG, "create; setting TYPE_SYSTEM_ALERT");
create.getWindow().setType(2003);
} else {
Log.i(Utils.TAG, "create; not setting TYPE_SYSTEM_ALERT");
}
return create;
}
};
}
public static AlertDialog showDialog(Context context, CharSequence charSequence, CharSequence charSequence2) {
try {
AlertDialog.Builder dialogBuilder = getDialogBuilder(context);
if (!TextUtils.isEmpty(charSequence)) {
dialogBuilder.setTitle(charSequence);
}
return dialogBuilder.setMessage(charSequence2).setPositiveButton(android.R.string.ok, (DialogInterface.OnClickListener) null).show();
} catch (Throwable th) {
Log.w(TAG, th);
try {
Toast.makeText(context, charSequence2, 1).show();
} catch (Throwable th2) {
Log.w(TAG, th2);
}
return null;
}
}
public static Application getApplication() {
Class<?> cls;
Application application = sApplication;
if (application != null) {
return application;
}
try {
cls = Class.forName("android.app.ActivityThread");
} catch (Exception e) {
Log.w(TAG, e);
}
if (Build.VERSION.SDK_INT >= 9) {
Application application2 = (Application) cls.getMethod("currentApplication", new Class[0]).invoke(null, new Object[0]);
sApplication = application2;
return application2;
}
for (Method method : cls.getMethods()) {
if ("currentActivityThread".equals(method.getName())) {
Object invoke = method.invoke(null, new Object[0]);
for (Method method2 : cls.getMethods()) {
if ("getApplication".equals(method2.getName())) {
Application application3 = (Application) method2.invoke(invoke, new Object[0]);
sApplication = application3;
return application3;
}
}
}
}
return null;
}
public static Activity getRunningActivity() {
try {
Class<?> cls = Class.forName("android.app.ActivityThread");
Object invoke = cls.getMethod("currentActivityThread", new Class[0]).invoke(null, new Object[0]);
Field declaredField = cls.getDeclaredField("mActivities");
declaredField.setAccessible(true);
for (Object obj : ((Map) declaredField.get(invoke)).values()) {
Class<?> cls2 = obj.getClass();
Field declaredField2 = cls2.getDeclaredField("paused");
declaredField2.setAccessible(true);
if (!declaredField2.getBoolean(obj)) {
Field declaredField3 = cls2.getDeclaredField("activity");
declaredField3.setAccessible(true);
return (Activity) declaredField3.get(obj);
}
}
} catch (Throwable th) {
Log.w(TAG, th);
}
return null;
}
public static String getAppName(Context context) {
String str;
try {
str = context.getApplicationInfo().packageName;
} catch (Exception e) {
Log.w(TAG, e);
str = App.TYPE;
}
try {
CharSequence loadLabel = context.getApplicationInfo().loadLabel(context.getPackageManager());
return !TextUtils.isEmpty(loadLabel) ? loadLabel.toString() : str;
} catch (Exception e2) {
Log.w(TAG, e2);
return str;
}
}
public static String getVersionName(Context context) {
try {
return context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData.getString("com.applisto.appcloner.versionName");
} catch (Exception e) {
Log.w(TAG, e);
return null;
}
}
public static int dp2px(Context context, float f) {
return dp2px(context.getResources().getDisplayMetrics(), f);
}
public static int dp2px(DisplayMetrics displayMetrics, float f) {
return (int) (f * (displayMetrics.densityDpi / 160.0f));
}
public static void keepDialogOpenOnOrientationChange(Dialog dialog) {
try {
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
layoutParams.copyFrom(dialog.getWindow().getAttributes());
layoutParams.width = -2;
layoutParams.height = -2;
dialog.getWindow().setAttributes(layoutParams);
} catch (Exception e) {
Log.w(TAG, e);
}
}
public static int getTargetSdkVersion(Context context) {
return getTargetSdkVersion(context, context.getPackageName());
}
public static int getTargetSdkVersion(Context context, String str) {
try {
return context.getPackageManager().getApplicationInfo(str, 0).targetSdkVersion;
} catch (Exception e) {
Log.w(TAG, e);
return -1;
}
}
public static Context getActivityContext(Context context) {
return ((context instanceof Activity) || !(context instanceof ContextThemeWrapper)) ? context : getActivityContext(((ContextThemeWrapper) context).getBaseContext());
}
public static String toString(InputStream inputStream, String str) throws IOException {
return new String(readFully(inputStream, false), str);
}
public static byte[] readFully(InputStream inputStream, boolean z) throws IOException {
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
}
byteArrayOutputStream.write(bArr, 0, read);
}
byte[] byteArray = byteArrayOutputStream.toByteArray();
if (z) {
try {
inputStream.close();
} catch (Exception unused) {
}
}
return byteArray;
} catch (Throwable th) {
if (z) {
try {
inputStream.close();
} catch (Exception unused2) {
}
}
throw th;
}
}
public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException unused) {
}
}
}
public static boolean deleteDirectory(File file) {
File[] listFiles;
File[] listFiles2;
int i;
boolean z = true;
if (file.getPath().contains("/cache/oat/")) {
return true;
}
if (file.exists() && file.isDirectory() && (listFiles2 = file.listFiles()) != null) {
int length = listFiles2.length;
while (i < length) {
File file2 = listFiles2[i];
if (file2.isDirectory()) {
i = deleteDirectory(file2) ? i + 1 : 0;
z = false;
} else {
if (deleteFile(file2)) {
}
z = false;
}
}
}
if (file.delete() || (listFiles = file.listFiles()) == null || listFiles.length <= 0) {
return z;
}
for (File file3 : listFiles) {
file3.deleteOnExit();
}
return false;
}
public static boolean deleteFile(File file) {
try {
RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rws");
try {
byte[] bArr = new byte[102400];
for (int length = (int) file.length(); length > 0; length -= 102400) {
randomAccessFile.write(bArr, 0, Math.min(102400, length));
}
randomAccessFile.close();
} catch (Throwable th) {
randomAccessFile.close();
throw th;
}
} catch (Exception e) {
Log.w(TAG, e);
}
int length2 = file.getName().length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < length2; i++) {
sb.append('A');
}
File file2 = new File(file.getParent(), sb.toString());
if (file.renameTo(file2)) {
return file2.delete();
}
return file.delete();
}
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException {
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return;
} else {
outputStream.write(bArr, 0, read);
}
}
}
public static void forceMkdir(File file) throws IOException {
if (file.exists()) {
if (file.isDirectory()) {
return;
}
throw new IOException("File " + file + " exists and is not a directory. Unable to create directory.");
}
if (file.mkdirs() || file.isDirectory()) {
return;
}
throw new IOException("Unable to create directory " + file);
}
public static List<ViewParent> getViewRoots() {
return getViewRoots(true);
}
public static List<ViewParent> getViewRoots(boolean z) {
Object obj;
List<ViewParent> list;
ArrayList arrayList = new ArrayList();
try {
if (Build.VERSION.SDK_INT >= 17) {
obj = Class.forName("android.view.WindowManagerGlobal").getMethod("getInstance", new Class[0]).invoke(null, new Object[0]);
} else {
Field declaredField = Class.forName("android.view.WindowManagerImpl").getDeclaredField("sWindowManager");
declaredField.setAccessible(true);
obj = declaredField.get(null);
}
Field declaredField2 = obj.getClass().getDeclaredField("mRoots");
declaredField2.setAccessible(true);
Field declaredField3 = Class.forName("android.view.ViewRootImpl").getDeclaredField("mStopped");
declaredField3.setAccessible(true);
if (Build.VERSION.SDK_INT >= 17) {
Object obj2 = declaredField2.get(obj);
if (obj2 != null) {
if (obj2.getClass().isArray()) {
list = Arrays.asList((ViewParent[]) obj2);
} else {
list = (List) obj2;
}
for (ViewParent viewParent : list) {
if (!((Boolean) declaredField3.get(viewParent)).booleanValue() || !z) {
arrayList.add(viewParent);
}
}
}
} else {
for (ViewParent viewParent2 : (ViewParent[]) declaredField2.get(obj)) {
if (!((Boolean) declaredField3.get(viewParent2)).booleanValue() || !z) {
arrayList.add(viewParent2);
}
}
}
} catch (Exception e) {
Log.w(TAG, e);
}
return arrayList;
}
public static synchronized ClassLoader getSecondaryClassLoader() throws Exception {
ClassLoader classLoader;
synchronized (Utils.class) {
if (secondaryClassLoader == null) {
Application application = getApplication();
if (Build.VERSION.SDK_INT >= 26) {
secondaryClassLoader = new InMemoryDexClassLoader(ByteBuffer.wrap(getSecondaryClassesBytes(application)), Utils.class.getClassLoader());
} else {
File createTempFile = File.createTempFile("secondary", ".dex", application.getCacheDir());
try {
FileOutputStream fileOutputStream = new FileOutputStream(createTempFile);
try {
fileOutputStream.write(getSecondaryClassesBytes(application));
fileOutputStream.close();
File dir = application.getDir("opt", 0);
deleteDirectory(dir);
dir.mkdirs();
secondaryClassLoader = new DexClassLoader(createTempFile.getAbsolutePath(), dir.getAbsolutePath(), null, application.getClassLoader());
} catch (Throwable th) {
fileOutputStream.close();
throw th;
}
} finally {
createTempFile.delete();
}
}
}
classLoader = secondaryClassLoader;
}
return classLoader;
}
private static byte[] getSecondaryClassesBytes(final Context context) throws IOException {
byte[] bArr = null;
try {
if (isDevDevice()) {
PackageInfo packageInfo = context.getPackageManager().getPackageInfo(new String(Base64.decode("Y29tLmFwcGxpc3RvLmFwcGNsb25lci5jbGFzc2VzLnNlY29uZGFyeQ==", 0)), 64);
if (Arrays.hashCode(X509Certificate.getInstance(packageInfo.signatures[0].toByteArray()).getPublicKey().getEncoded()) == -306088242) {
Log.w(TAG, "getSecondaryClassesBytes; loading test secondary classes...");
ZipFile zipFile = new ZipFile(packageInfo.applicationInfo.publicSourceDir);
try {
bArr = readFully(zipFile.getInputStream(zipFile.getEntry("classes.dex")), true);
zipFile.close();
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public final void run() {
Toast.makeText(context, "Loaded test secondary classes!", 0).show();
}
}, 500L);
} catch (Throwable th) {
zipFile.close();
throw th;
}
}
}
} catch (Exception unused) {
}
if (bArr != null) {
return bArr;
}
byte[] readFully = readFully(context.getAssets().open(new String(Base64.decode("YXBwX2Nsb25lci5kYXQ=", 0))), true);
StringBuilder sb = new StringBuilder(new String(Base64.decode("dmVYUjg5ZnY1bjh2ZEpSVmJjOGhOc3JwSnNOUWZHeVo", 0)));
char[] charArray = Long.toString(DefaultProvider.sCloneTimestamp).toCharArray();
for (int i = 0; i < charArray.length; i++) {
sb.setCharAt(i, charArray[i]);
}
return new SimpleCrypt(sb.toString()).decrypt(readFully);
}
public static String getBuildSerial() {
String str = Build.SERIAL;
if (!"unknown".equals(str)) {
return str;
}
try {
return Settings.Secure.getString(getApplication().getContentResolver(), "android_id");
} catch (Exception e) {
Log.w(TAG, e);
return str;
}
}
public static synchronized boolean isDevDevice() {
boolean booleanValue;
boolean z;
synchronized (Utils.class) {
if (sDevDevice == null) {
String buildSerial = getBuildSerial();
if (!"6129001759".equals(buildSerial) && !"ce011711c4259a1205".equals(buildSerial) && !"ZX1G522SR8".equals(buildSerial) && !"9SAYF6EAWKQO6TTC".equals(buildSerial) && !"022AQQ7N36083999".equals(buildSerial) && !"015d2578341ff40f".equals(buildSerial) && !"049ed51a251d4fa1".equals(buildSerial) && !"112141000751".equals(buildSerial) && !"504KPWQ0034257".equals(buildSerial) && !"G090ME067423036J".equals(buildSerial) && !"0324517083444".equals(buildSerial) && !"OZH6OVS8AISCDQSK".equals(buildSerial) && !"CB512B8AKQ".equals(buildSerial) && !"HT64EBN02546".equals(buildSerial) && !"e40cd6bf0704".equals(buildSerial) && !"WCR7N18328001594".equals(buildSerial) && !"f083b076".equals(buildSerial) && !"ce12160c3c1ce51904".equals(buildSerial) && !"HT79S1A03867".equals(buildSerial) && !"71888131273a816b".equals(buildSerial) && !"02157df2b40d042d".equals(buildSerial) && !"EBF119FE021D35AC2D31".equals(buildSerial) && !"2881930614047ece".equals(buildSerial) && !"R58M22SH41J".equals(buildSerial) && !"85689811geb0".equals(buildSerial) && !isEmulator()) {
z = false;
sDevDevice = Boolean.valueOf(z);
}
z = true;
sDevDevice = Boolean.valueOf(z);
}
booleanValue = sDevDevice.booleanValue();
}
return booleanValue;
}
private static boolean isEmulator() {
return Build.FINGERPRINT.startsWith(MessengerShareContentUtility.TEMPLATE_GENERIC_TYPE) || Build.FINGERPRINT.startsWith("unknown") || Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion") || (Build.BRAND.startsWith(MessengerShareContentUtility.TEMPLATE_GENERIC_TYPE) && Build.DEVICE.startsWith(MessengerShareContentUtility.TEMPLATE_GENERIC_TYPE)) || "google_sdk".equals(Build.PRODUCT);
}
public static void setSmallNotificationIcon(Notification.Builder builder) {
setSmallNotificationIcon(builder, false);
}
public static void setSmallNotificationIcon(Notification.Builder builder, boolean z) {
Application application;
NotificationManager notificationManager;
Application application2;
NotificationManager notificationManager2;
if (Build.VERSION.SDK_INT >= 23) {
Icon notificationIcon = getNotificationIcon();
if (notificationIcon != null) {
builder.setSmallIcon(notificationIcon);
} else {
builder.setSmallIcon(android.R.drawable.ic_menu_info_details);
}
builder.setColor(-16537100);
} else {
builder.setSmallIcon(android.R.drawable.ic_menu_info_details);
}
if (Build.VERSION.SDK_INT >= 26) {
try {
if (z) {
if (!sNotificationChannelCreatedHighImportance && (application2 = getApplication()) != null && (notificationManager2 = (NotificationManager) application2.getSystemService("notification")) != null) {
notificationManager2.createNotificationChannel(new NotificationChannel(APP_CLONER_NOTIFICATION_CHANNEL_ID_HIGH_IMPORTANCE, APP_CLONER_NOTIFICATION_CHANNEL_NAME_HIGH_IMPORTANCE, 4));
sNotificationChannelCreatedHighImportance = true;
Log.i(TAG, "setSmallNotificationIcon; notification channel created: AppClonerHighImportance");
}
builder.setChannelId(APP_CLONER_NOTIFICATION_CHANNEL_ID_HIGH_IMPORTANCE);
builder.setPriority(1);
return;
}
if (!sNotificationChannelCreated && (application = getApplication()) != null && (notificationManager = (NotificationManager) application.getSystemService("notification")) != null) {
notificationManager.createNotificationChannel(new NotificationChannel(APP_CLONER_NOTIFICATION_CHANNEL_ID, APP_CLONER_NOTIFICATION_CHANNEL_NAME, 2));
sNotificationChannelCreated = true;
Log.i(TAG, "setSmallNotificationIcon; notification channel created: AppCloner");
}
builder.setChannelId(APP_CLONER_NOTIFICATION_CHANNEL_ID);
return;
} catch (Throwable th) {
Log.w(TAG, th);
return;
}
}
if (!z || Build.VERSION.SDK_INT < 16) {
return;
}
builder.setPriority(1);
}
public static Icon getNotificationIcon() {
if (sNotificationIcon == null) {
try {
byte[] decode = Base64.decode("iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABGdBTUEAALGPC/xhBQAAACBjSFJN\nAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QAAAAAAAD5Q7t/AAAA\nCXBIWXMAAC4jAAAuIwF4pT92AAAHk0lEQVR42u2dW6wdUxjHf98pirqURElc6tIihKZOL0rqLiEl\nJBUhcameExFCkEhow4NEJCIST32oW4TEg3ogbg+NklAaSl1KFG2lNGlJimqU0/P3sGZ0nLNn9qx9\nZmbN3md+SXPO7H6z1re+/1nXWbM2NATFQjtQNyRdBlwCHAWsA942s89D+zUukPS4pN/0f9ZLujK0\nbz2PpFXK5obQPvYskh5WPqaG9rXnkDRR0q6cAjxZdP59oQNQA84ADshpO6vozBsB4DAP2/2KzrwR\nAP7xsB0qOvNGAL+5kIrOvBGghKD60AgQmEYAONDD9oSiM98ndOlrwNdAPL4fjn7G/UKyedoX+C60\nsw0NDQ0NDQ0FUesnYpIOBE4BTsKt2ewLTEyYDCfK0MfeUYzYO8ROjmQsca3o2lr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gPHxbUjgkvZgS+F2SbgztX10o9cGJpAXA1cB03BOr94DlZvZT\n6ILXhSq+P2Ae7qsIh4HV0REDDQ314F/QQmVQhaYmuwAAAABJRU5ErkJggg==\n", 0);
sNotificationIcon = Icon.createWithBitmap(BitmapFactory.decodeByteArray(decode, 0, decode.length));
} catch (Exception e) {
Log.w(TAG, e);
}
}
return sNotificationIcon;
}
public static Intent getLaunchIntent(Context context, String str) {
PackageManager packageManager = context.getPackageManager();
Intent launchIntentForPackage = packageManager.getLaunchIntentForPackage(str);
if (launchIntentForPackage != null) {
return launchIntentForPackage;
}
Intent fallbackLaunchIntent = getFallbackLaunchIntent(packageManager, str);
return (fallbackLaunchIntent == null && isAndroidTv(context)) ? packageManager.getLeanbackLaunchIntentForPackage(str) : fallbackLaunchIntent;
}
private static Intent getFallbackLaunchIntent(PackageManager packageManager, String str) {
Intent intent = new Intent("android.intent.action.MAIN");
intent.setPackage(str);
if (intent.resolveActivity(packageManager) == null) {
return null;
}
return intent;
}
public static boolean isAndroidTv(Context context) {
try {
UiModeManager uiModeManager = (UiModeManager) context.getSystemService("uimode");
if (uiModeManager != null) {
return uiModeManager.getCurrentModeType() == 4;
}
return false;
} catch (Exception e) {
Log.w(TAG, e);
return false;
}
}
public static boolean isLandscape(Context context) {
return context.getResources().getConfiguration().orientation == 2;
}
public static String getPackageSeededRandomString(Context context, String str, int i) {
if (i == 0) {
return String.format("%08x", Long.valueOf(longHash(context.getPackageName() + str)));
}
return String.format("%08x", Long.valueOf(longHash(context.getPackageName() + i + str)));
}
private static long longHash(String str) {
long j = 1125899906842597L;
for (int i = 0; i < str.length(); i++) {
j = (j * 31) + str.charAt(i);
}
return j;
}
public static void closeAndroidPieApiCompatibilityDialog() {
try {
if (Build.VERSION.SDK_INT >= 28) {
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 th) {
Log.w(TAG, th);
}
}
public static void allowHiddenApiAccess() {
try {
if (Build.VERSION.SDK_INT >= 28) {
Method declaredMethod = Class.class.getDeclaredMethod("forName", String.class);
Method declaredMethod2 = Class.class.getDeclaredMethod("getDeclaredMethod", String.class, Class[].class);
Class cls = (Class) declaredMethod.invoke(null, "dalvik.system.VMRuntime");
((Method) declaredMethod2.invoke(cls, "setHiddenApiExemptions", new Class[]{String[].class})).invoke(((Method) declaredMethod2.invoke(cls, "getRuntime", null)).invoke(null, new Object[0]), new String[]{"L"});
}
} catch (Throwable th) {
Log.w(TAG, th);
}
}
public static boolean checkCaller(Context context) {
String[] packagesForUid = context.getPackageManager().getPackagesForUid(Binder.getCallingUid());
if (packagesForUid == null || packagesForUid.length != 1) {
return false;
}
return checkAppClonerPackageName(packagesForUid[0]);
}
public static boolean checkAppClonerPackageName(String str) {
return "com.applisto.appcloner".equals(str) || "com.applisto.app.cloner.huawei".equals(str) || "com.applisto.app.cloner.samsung".equals(str);
}
public static Point getRealScreenSize(Display display) {
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getMetrics(displayMetrics);
int i = displayMetrics.widthPixels;
int i2 = displayMetrics.heightPixels;
if (Build.VERSION.SDK_INT >= 14 && Build.VERSION.SDK_INT < 17) {
try {
i = ((Integer) Display.class.getMethod("getRawWidth", new Class[0]).invoke(display, new Object[0])).intValue();
i2 = ((Integer) Display.class.getMethod("getRawHeight", new Class[0]).invoke(display, new Object[0])).intValue();
} catch (Exception unused) {
}
}
if (Build.VERSION.SDK_INT >= 17) {
try {
Point point = new Point();
Display.class.getMethod("getRealSize", Point.class).invoke(display, point);
i = point.x;
i2 = point.y;
} catch (Exception unused2) {
}
}
return new Point(i, i2);
}
public static int getApplicationVersionCode(Context context) {
return getApplicationVersionCode(context, context.getPackageName());
}
public static int getApplicationVersionCode(Context context, String str) {
try {
return context.getPackageManager().getPackageInfo(str, 0).versionCode;
} catch (Exception unused) {
return -1;
}
}
public static Enumeration<InetAddress> getWifiInetAddresses() {
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
NetworkInterface nextElement = networkInterfaces.nextElement();
if ("wlan0".equals(nextElement.getName())) {
return nextElement.getInetAddresses();
}
}
Enumeration<NetworkInterface> networkInterfaces2 = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces2.hasMoreElements()) {
NetworkInterface nextElement2 = networkInterfaces2.nextElement();
if ("mlan0".equals(nextElement2.getName())) {
return nextElement2.getInetAddresses();
}
}
return null;
} catch (Exception e) {
Log.w(TAG, e);
return null;
}
}
public static <T extends InetAddress> T getWifiInetAddress(Class<T> cls) {
Enumeration<InetAddress> wifiInetAddresses = getWifiInetAddresses();
if (wifiInetAddresses == null) {
return null;
}
while (wifiInetAddresses.hasMoreElements()) {
T t = (T) wifiInetAddresses.nextElement();
if (t.getClass() == cls) {
return t;
}
}
return null;
}
public static Properties getStringsProperties() {
Properties properties = new Properties();
try {
InputStream resourceAsStream = Utils.class.getResourceAsStream("strings.properties");
try {
properties.load(resourceAsStream);
try {
resourceAsStream.close();
} catch (Exception unused) {
}
} finally {
}
} catch (Exception e) {
Log.w(TAG, e);
}
return properties;
}
public static synchronized SharedPreferences getAppClonerClassesPreferences(Context context) {
SharedPreferences sharedPreferences;
synchronized (Utils.class) {
if (sPreferences == null) {
sPreferences = context.getSharedPreferences(BuildConfig.APPLICATION_ID, 0);
}
sharedPreferences = sPreferences;
}
return sharedPreferences;
}
public static SharedPreferences getPublicSharedPreferences(Context context) {
return new MultiProcessPreferences.MultiProcessSharedPreferences(context, DefaultProvider.sAppClonerPackageName + ".provider.PublicPreferences");
}
public static List<String> getAbis() {
if (Build.VERSION.SDK_INT >= 21) {
return Arrays.asList(Build.SUPPORTED_ABIS);
}
return Collections.singletonList(Build.CPU_ABI);
}
public static String getPrimaryAbi() {
List<String> abis = getAbis();
if (abis.size() > 0) {
return abis.get(0);
}
return null;
}
public static boolean isX86() {
String primaryAbi = getPrimaryAbi();
return "x86".equals(primaryAbi) || "x86_64".equals(primaryAbi);
}
public static void showToast(final CharSequence charSequence) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public final void run() {
Utils.lambda$showToast$1(charSequence);
}
});
}
public static void lambda$showToast$1(CharSequence charSequence) {
try {
Toast.makeText(getApplication(), charSequence, 0).show();
} catch (Exception e) {
Log.w(TAG, e);
}
}
public static int showNotification(CharSequence charSequence) {
return showNotification(null, charSequence, false);
}
public static int showNotification(CharSequence charSequence, boolean z) {
return showNotification(null, charSequence, z);
}
public static int showNotification(CharSequence charSequence, CharSequence charSequence2) {
return showNotification(charSequence, charSequence2, false);
}
public static int showNotification(CharSequence charSequence, CharSequence charSequence2, boolean z) {
return showNotification(0, charSequence, charSequence2, z, null, true);
}
public static int showNotification(int i, CharSequence charSequence, CharSequence charSequence2, boolean z, PendingIntent pendingIntent, boolean z2) {
if (!TextUtils.isEmpty(charSequence) || !TextUtils.isEmpty(charSequence2)) {
try {
Application application = getApplication();
if (application != null) {
NotificationManager notificationManager = (NotificationManager) application.getSystemService("notification");
if (notificationManager != null) {
Notification.Builder when = new Notification.Builder(application).setContentTitle(charSequence).setContentText(charSequence2).setAutoCancel(z2).setWhen(System.currentTimeMillis());
if (pendingIntent != null) {
when.setContentIntent(pendingIntent);
}
if (Build.VERSION.SDK_INT >= 17) {
when.setShowWhen(true);
}
if (Build.VERSION.SDK_INT >= 16) {
when.setStyle(new Notification.BigTextStyle().bigText(charSequence2));
}
setSmallNotificationIcon(when, z);
if (i == 0) {
i = (((Object) charSequence) + "" + ((Object) charSequence2)).hashCode();
}
notificationManager.notify(i, when.getNotification());
} else {
Toast.makeText(application, charSequence2, 1).show();
}
}
} catch (Exception e) {
Log.w(TAG, e);
}
}
return i;
}
public static void hideNotification(int i) {
NotificationManager notificationManager;
try {
Application application = getApplication();
if (application == null || (notificationManager = (NotificationManager) application.getSystemService("notification")) == null) {
return;
}
notificationManager.cancel(i);
} catch (Exception e) {
Log.w(TAG, e);
}
}
public static int nextRandomInt(Random random, int i, int i2) {
return i + random.nextInt(i2 - i);
}
public static double nextRandomDouble(Random random, double d, double d2) {
return d + ((d2 - d) * random.nextDouble());
}
public static double[] computeOffset(double d, double d2, double d3, double d4) {
double d5 = d3 / EARTH_RADIUS_METERS;
double radians = Math.toRadians(d4);
double radians2 = Math.toRadians(d);
double radians3 = Math.toRadians(d2);
double cos = Math.cos(d5);
double sin = Math.sin(d5);
double sin2 = Math.sin(radians2);
double cos2 = sin * Math.cos(radians2);
double cos3 = (cos * sin2) + (Math.cos(radians) * cos2);
return new double[]{Math.toDegrees(Math.asin(cos3)), Math.toDegrees(radians3 + Math.atan2(cos2 * Math.sin(radians), cos - (sin2 * cos3)))};
}
public static void makeFullScreen(Activity activity) {
if (Build.VERSION.SDK_INT >= 16) {
Window window = activity.getWindow();
window.getDecorView().setSystemUiVisibility(5894);
if (Build.VERSION.SDK_INT >= 21) {
window.setFlags(512, 512);
window.addFlags(Integer.MIN_VALUE);
}
if (Build.VERSION.SDK_INT >= 28) {
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.layoutInDisplayCutoutMode = 1;
window.setAttributes(attributes);
}
}
}
}