导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - Utils.java 源代码

正在查看: Minits v4.9.3.32 应用的 Utils.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.xone.android.utils;

import B0.h;
import O8.c;
import U9.AbstractC0298d1;
import U9.AbstractC0313i1;
import U9.CallableC0294c0;
import W1.E;
import W1.i;
import a8.C0394a;
import a8.C0395b;
import android.R;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.Dialog;
import android.app.KeyguardManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.database.DatabaseUtils;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.Icon;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Looper;
import android.os.PowerManager;
import android.provider.Settings;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
import android.text.TextPaint;
import android.text.TextUtils;
import android.text.format.DateFormat;
import android.util.Base64;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Keep;
import androidx.core.content.FileProvider;
import com.microsoft.intune.mam.client.app.MAMComponents;
import com.microsoft.intune.mam.client.identity.MAMPolicyManager;
import com.microsoft.intune.mam.policy.MAMUserInfo;
import com.xone.android.framework.xoneApp;
import com.xone.android.utils.Utils;
import fa.j;
import fb.AbstractC0698k;
import fb.AbstractC0699l;
import fb.C0694g;
import fb.q;
import fb.t;
import ha.AbstractC0750e;
import ha.AbstractC0751f;
import ha.AbstractC0752g;
import ha.EnumC0749d;
import ha.M;
import ha.N;
import ha.r;
import ha.s;
import ha.u;
import ha.v;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Character;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.nio.channels.FileChannel;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.Formatter;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ExecutionException;
import java.util.zip.Adler32;
import java.util.zip.CRC32;
import java.util.zip.CheckedInputStream;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import java.util.zip.InflaterInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.json.JSONArray;
import org.json.JSONObject;
import q3.e;
import q3.f;
import q3.i;
import w7.d;
import z0.r;

public final class Utils {
    public static String a = "com.xone.mobbsign.XOneMobbSignViewFactory";
    public static String b;
    public static String c;
    public static Class d;
    public static Method e;
    public static Context f;
    public static Class g;
    public static final String[] h = {"##FILESPATH##", "./icons", "##APP##", "./fonts"};
    public static final char[] i = "0123456789ABCDEF".toCharArray();
    public static File j;

    public static class a extends Throwable {
    }

    public static class b {
        public final String a;
        public final String b;

        public b(String str, String str2) {
            this.a = str;
            this.b = str2;
        }

        public String a() {
            return this.b;
        }

        public String b() {
            return this.a;
        }
    }

    public static Object A(Object[] objArr, int i2, Object obj) {
        if (objArr != null && objArr.length != 0 && i2 >= 0 && objArr.length > i2) {
            try {
                return objArr[i2];
            } catch (ClassCastException unused) {
            }
        }
        return obj;
    }

    public static String A0(Context context, String str, String str2, String str3, boolean z, int i2) {
        if (TextUtils.isEmpty(str3)) {
            return null;
        }
        String lowerCase = str3.toLowerCase();
        if (lowerCase.startsWith("http://") || lowerCase.startsWith("https://")) {
            return str3;
        }
        String v0 = v0(str3, z);
        String str4 = z ? "##app##" : "##APP##";
        String str5 = z ? "##filespath##" : "##FILESPATH##";
        if (v0.startsWith("/" + str4)) {
            v0 = v0.replace("/" + str4, str4);
        }
        if (v0.startsWith("/rw/xone/iconos")) {
            v0 = v0.replace("/rw/xone/iconos", str4 + "/icons");
        } else if (v0.startsWith("/rw/xone")) {
            v0 = v0.replace("/rw/xone", str4);
        }
        String str6 = File.separator;
        if (!str2.endsWith(str6)) {
            str2 = str2 + str6;
        }
        if (v0.startsWith(str4)) {
            return AbstractC0752g.g(str2, v0.replace(str4, "."));
        }
        if (v0.startsWith(str5)) {
            return AbstractC0752g.f(context, str, v0.replace(str5, "."));
        }
        if (v0.startsWith("./") || v0.startsWith("/") || v0.startsWith("../")) {
            return AbstractC0752g.g(str2, v0);
        }
        if (i2 == 2) {
            if (v0.startsWith("icons/")) {
                return AbstractC0752g.g(str2, v0);
            }
            return AbstractC0752g.g(str2, "icons/" + v0);
        }
        if (i2 == 1) {
            return AbstractC0752g.f(context, str, v0);
        }
        if (i2 == 3) {
            return AbstractC0752g.g(str2, "fonts/" + v0);
        }
        if (i2 == 4) {
            return AbstractC0752g.g(str2, "bd/" + v0);
        }
        if (i2 != 5) {
            return AbstractC0752g.f(context, str, v0);
        }
        return AbstractC0752g.g(str2, "certificates/" + v0);
    }

    public static File A1(Object... objArr) {
        File k2 = k2(objArr);
        if (k2 == null || k2.isFile()) {
            return k2;
        }
        return null;
    }

    public static Bitmap A2(Context context, File file) {
        Bitmap b0;
        if (file.exists() && file.isFile()) {
            b0 = BitmapFactory.decodeFile(file.getAbsolutePath());
        } else {
            Drawable W0 = W0(context);
            if (W0 == null) {
                W0 = F2(context);
            }
            if (W0 == null || (b0 = r.b0(W0)) == null) {
                return null;
            }
        }
        WindowManager windowManager = (WindowManager) y2(context, "window");
        DisplayMetrics displayMetrics = new DisplayMetrics();
        windowManager.getDefaultDisplay().getMetrics(displayMetrics);
        b0.setDensity(displayMetrics.densityDpi);
        int i2 = displayMetrics.densityDpi;
        Bitmap createScaledBitmap = i2 <= 120 ? Bitmap.createScaledBitmap(b0, 36, 36, true) : i2 <= 160 ? Bitmap.createScaledBitmap(b0, 48, 48, true) : i2 <= 240 ? Bitmap.createScaledBitmap(b0, 72, 72, true) : i2 <= 320 ? Bitmap.createScaledBitmap(b0, 96, 96, true) : i2 <= 480 ? Bitmap.createScaledBitmap(b0, 144, 144, true) : Bitmap.createScaledBitmap(b0, 144, 144, true);
        if (!createScaledBitmap.sameAs(b0)) {
            b0.recycle();
        }
        return createScaledBitmap;
    }

    public static StringBuilder A3(InputStream inputStream, String str) {
        InputStreamReader inputStreamReader;
        BufferedReader bufferedReader;
        StringBuilder sb2 = new StringBuilder();
        BufferedReader bufferedReader2 = null;
        try {
            inputStreamReader = new InputStreamReader(inputStream, str);
            try {
                bufferedReader = new BufferedReader(inputStreamReader);
            } catch (Throwable th) {
                th = th;
            }
            try {
                for (String readLine = bufferedReader.readLine(); readLine != null; readLine = bufferedReader.readLine()) {
                    sb2.append(readLine);
                    sb2.append('\n');
                }
                P(bufferedReader, inputStreamReader, inputStream);
                return sb2;
            } catch (Throwable th2) {
                th = th2;
                bufferedReader2 = bufferedReader;
                P(bufferedReader2, inputStreamReader, inputStream);
                throw th;
            }
        } catch (Throwable th3) {
            th = th3;
            inputStreamReader = null;
        }
    }

    public static float A4(DisplayMetrics displayMetrics, float f2) {
        return TypedValue.applyDimension(1, f2, displayMetrics);
    }

    public static boolean B(Object[] objArr, int i2, boolean z) {
        return (objArr == null || objArr.length == 0 || i2 < 0 || objArr.length <= i2) ? z : t.k(objArr[i2], z);
    }

    public static String B0(String str, String str2, String str3) {
        return E0(str, str2, str3, true, 1);
    }

    public static Uri B1(Context context, File file) {
        Context applicationContext = context.getApplicationContext();
        try {
            String canonicalPath = file.getCanonicalPath();
            if (canonicalPath.startsWith(applicationContext.getFilesDir().getParentFile().getCanonicalPath())) {
                return FileProvider.h(applicationContext, applicationContext.getPackageName() + ".provider", file);
            }
            if (H2(applicationContext) < 24) {
                return Uri.fromFile(file);
            }
            File externalStorageDirectory = Environment.getExternalStorageDirectory();
            if (externalStorageDirectory == null) {
                return Uri.fromFile(file);
            }
            if (!canonicalPath.startsWith(externalStorageDirectory.getCanonicalPath())) {
                return Uri.fromFile(file);
            }
            return FileProvider.h(applicationContext, applicationContext.getPackageName() + ".provider", file);
        } catch (IOException e2) {
            throw AbstractC0751f.e(e2);
        }
    }

    public static String B2(Context context) {
        try {
            return ((TelephonyManager) y2(context.getApplicationContext(), "phone")).getSimSerialNumber();
        } catch (SecurityException unused) {
            return "";
        }
    }

    public static byte[] B3(File file) {
        return C3(file, false);
    }

    public static void B4(File file) {
        C4(file, null);
    }

    public static void C(ZipOutputStream zipOutputStream, String str, String str2) {
        File file = new File(str);
        if (!file.exists()) {
            return;
        }
        if (file.isDirectory()) {
            if (!str.equalsIgnoreCase(str2)) {
                zipOutputStream.putNextEntry(new ZipEntry(str.substring(str2.length() + 1) + File.separatorChar));
            }
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File file2 : listFiles) {
                    C(zipOutputStream, file2.getAbsolutePath(), str2);
                }
                return;
            }
            return;
        }
        zipOutputStream.putNextEntry(new ZipEntry(str.substring(str2.length() + 1)));
        FileInputStream fileInputStream = new FileInputStream(str);
        try {
            byte[] bArr = new byte[8192];
            while (true) {
                int read = fileInputStream.read(bArr);
                if (read <= 0) {
                    N(fileInputStream);
                    zipOutputStream.closeEntry();
                    return;
                }
                zipOutputStream.write(bArr, 0, read);
            }
        } catch (Throwable th) {
            N(fileInputStream);
            throw th;
        }
    }

    public static String C0(String str, String str2, String str3, int i2) {
        return E0(str, str2, str3, true, i2);
    }

    public static File C1() {
        return j;
    }

    public static int C2(Window window) {
        Rect rect = new Rect();
        window.getDecorView().getWindowVisibleDisplayFrame(rect);
        return rect.top;
    }

    public static byte[] C3(File file, boolean z) {
        byte[] bArr;
        Path path;
        if (Build.VERSION.SDK_INT >= 26) {
            path = file.toPath();
            bArr = Files.readAllBytes(path);
        } else {
            byte[] bArr2 = new byte[(int) file.length()];
            FileInputStream fileInputStream = null;
            try {
                FileInputStream fileInputStream2 = new FileInputStream(file);
                try {
                    if (fileInputStream2.read(bArr2) == -1) {
                        throw new IOException("EOF reached while trying to read the whole file");
                    }
                    N(fileInputStream2);
                    bArr = bArr2;
                } catch (Throwable th) {
                    th = th;
                    fileInputStream = fileInputStream2;
                    N(fileInputStream);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        }
        if (!z) {
            return bArr;
        }
        int i2 = 0;
        int i3 = 0;
        while (true) {
            if (i3 >= bArr.length) {
                i3 = 0;
                break;
            }
            if (bArr[i3] != 0) {
                break;
            }
            i3++;
        }
        int length = bArr.length - 1;
        while (true) {
            if (length <= 0) {
                break;
            }
            if (bArr[length] != 0) {
                i2 = length;
                break;
            }
            length--;
        }
        return X(bArr, i3, i2 + 1);
    }

    public static void C4(java.io.File r10, java.io.File r11) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.utils.Utils.C4(java.io.File, java.io.File):void");
    }

    public static String D(Context context, String str) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        NotificationManager notificationManager = (NotificationManager) y2(context, "notification");
        if (Build.VERSION.SDK_INT < 26) {
            return null;
        }
        if (str.compareTo("XOneAndroidFrameworkHighPriority") == 0) {
            if (e.a(notificationManager, "XOneAndroidFrameworkHighPriority") == null) {
                NotificationChannel a2 = i.a("XOneAndroidFrameworkHighPriority", "XOneAndroidFramework high priority channel", 4);
                a2.enableLights(true);
                a2.enableVibration(true);
                a2.setLightColor(-16711936);
                f.a(notificationManager, a2);
                return str;
            }
        } else {
            if (str.compareTo("XOneAndroidFrameworkLowPriority") != 0) {
                l("XOneAndroidFramework", "Cannot add notification channel " + str + ", it is not defined, ignoring.");
                return null;
            }
            if (e.a(notificationManager, "XOneAndroidFrameworkLowPriority") == null) {
                NotificationChannel a3 = i.a("XOneAndroidFrameworkLowPriority", "XOneAndroidFramework low priority channel", 2);
                a3.enableLights(true);
                a3.enableVibration(true);
                a3.setLightColor(-16711936);
                a3.setSound(null, null);
                f.a(notificationManager, a3);
            }
        }
        return str;
    }

    public static String D0(String str, String str2, String str3, boolean z) {
        return E0(str, str2, str3, z, 1);
    }

    public static CharSequence D1(Context context, CharSequence charSequence, String str) {
        if (!TextUtils.isEmpty(charSequence)) {
            charSequence = I(DatabaseUtils.sqlEscapeString(charSequence.toString()));
        }
        if (!str.contains("##F")) {
            return charSequence;
        }
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(DateFormat.getDateFormat(context).parse(charSequence.toString()));
        if (str.equals("##FFVAL##")) {
            calendar.set(9, 0);
            charSequence = ((Object) charSequence) + " 00:00:00";
            calendar.set(10, 0);
            calendar.set(12, 0);
            calendar.set(13, 0);
        } else if (str.equals("##FTVAL##")) {
            charSequence = ((Object) charSequence) + " 23:59:59";
            calendar.set(9, 1);
            calendar.set(11, 23);
            calendar.set(12, 59);
            calendar.set(13, 59);
        }
        return "'" + new SimpleDateFormat(U0(charSequence.toString().replace("/", "-"))).format(calendar.getTime()) + "'";
    }

    public static String D2(String str, String str2, boolean z) {
        return L0(str.getBytes(StandardCharsets.UTF_8), str2, z);
    }

    public static byte[] D3(InputStream inputStream) {
        byte[] bArr = new byte[inputStream.available()];
        if (inputStream.read(bArr) != -1) {
            return bArr;
        }
        throw new IOException("EOF reached while trying to read the whole input stream");
    }

    public static int D4(File file, File file2) {
        FileOutputStream fileOutputStream;
        ZipOutputStream zipOutputStream;
        ZipOutputStream zipOutputStream2 = null;
        try {
            fileOutputStream = new FileOutputStream(file2);
            try {
                try {
                    zipOutputStream = new ZipOutputStream(fileOutputStream);
                } catch (Exception e2) {
                    e = e2;
                }
            } catch (Throwable th) {
                th = th;
            }
        } catch (Exception e3) {
            e = e3;
            fileOutputStream = null;
        } catch (Throwable th2) {
            th = th2;
            fileOutputStream = null;
        }
        try {
            zipOutputStream.setLevel(9);
            C(zipOutputStream, file.getAbsolutePath(), file.getAbsolutePath());
            P(zipOutputStream, fileOutputStream);
            return 0;
        } catch (Exception e4) {
            e = e4;
            zipOutputStream2 = zipOutputStream;
            e.printStackTrace();
            P(zipOutputStream2, fileOutputStream);
            return -1;
        } catch (Throwable th3) {
            th = th3;
            zipOutputStream2 = zipOutputStream;
            P(zipOutputStream2, fileOutputStream);
            throw th;
        }
    }

    public static void E(Toast toast, int i2, int i3, File file, int i4, boolean z) {
        View view = toast.getView();
        if (view == null) {
            return;
        }
        View findViewById = view.findViewById(R.id.message);
        if (findViewById instanceof TextView) {
            TextView textView = (TextView) findViewById;
            if (i3 != 0) {
                textView.setTextColor(i3);
            }
            if (file != null) {
                textView.setTypeface(Typeface.createFromFile(file));
            }
            if (i4 != 0) {
                textView.setTextSize(i4);
            }
        }
        if (i2 != 0 || z) {
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setShape(0);
            gradientDrawable.setColor(i2);
            gradientDrawable.setStroke(0, -16777216);
            if (z) {
                gradientDrawable.setCornerRadius(60.0f);
            }
            view.setBackgroundDrawable(gradientDrawable);
        }
    }

    public static String E0(String str, String str2, String str3, boolean z, int i2) {
        return A0(J0(), str, str2, str3, z, i2);
    }

    public static View E1(ViewGroup viewGroup, Object obj) {
        if (viewGroup == null) {
            return null;
        }
        for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
            if (obj.equals(viewGroup.getChildAt(i2).getTag())) {
                return viewGroup.getChildAt(i2);
            }
        }
        return null;
    }

    public static String E2(Context context, Object obj, String str) {
        StringBuilder sb2 = null;
        if (obj == null) {
            return null;
        }
        if (obj instanceof Date) {
            if (str.equals("DT")) {
                Date date = (Date) obj;
                sb2 = new StringBuilder(p4(context, date));
                StringBuilder sb3 = new StringBuilder(DateFormat.getTimeFormat(context).format(date));
                sb2.append(" ");
                sb2.append((CharSequence) sb3);
            } else {
                sb2 = new StringBuilder(p4(context, (Date) obj));
            }
        } else if (!(obj instanceof GregorianCalendar)) {
            String str2 = (String) obj;
            if (str2.length() > 0) {
                Date parse = new SimpleDateFormat(U0(str2)).parse(str2);
                if (str.equals("DT")) {
                    sb2 = new StringBuilder(p4(context, parse));
                    sb2.append(" ");
                    sb2.append(DateFormat.getTimeFormat(context).format(parse));
                } else {
                    sb2 = new StringBuilder(p4(context, parse));
                }
            }
        } else if (str.equals("DT")) {
            sb2 = new StringBuilder(o4(context, (GregorianCalendar) obj));
            StringBuilder sb4 = new StringBuilder(DateFormat.getTimeFormat(context).format(obj));
            sb2.append(" ");
            sb2.append((CharSequence) sb4);
        } else {
            sb2 = new StringBuilder(o4(context, (GregorianCalendar) obj));
        }
        return sb2 != null ? sb2.toString() : "";
    }

    public static byte[] E3(InputStream inputStream) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            byte[] bArr = new byte[16384];
            while (true) {
                int read = inputStream.read(bArr, 0, 16384);
                if (read == -1) {
                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                    N(byteArrayOutputStream);
                    return byteArray;
                }
                byteArrayOutputStream.write(bArr, 0, read);
            }
        } catch (Throwable th) {
            N(byteArrayOutputStream);
            throw th;
        }
    }

    public static void E4(File file, List list) {
        F4(file, list, null);
    }

    public static String F(String str, int i2) {
        StringBuilder sb2 = new StringBuilder();
        Formatter formatter = new Formatter(sb2);
        formatter.format("%" + i2 + "s", str);
        formatter.close();
        return sb2.toString().replace(" ", "0");
    }

    public static ActivityManager F0(Context context) {
        ActivityManager activityManager = (ActivityManager) context.getApplicationContext().getSystemService("activity");
        if (activityManager != null) {
            return activityManager;
        }
        throw new NullPointerException("Cannot obtain ActivityManager service");
    }

    public static String F1(Context context) {
        return context.getApplicationInfo().dataDir;
    }

    public static Drawable F2(Context context) {
        try {
            return context.getResources().getDrawable(R.drawable.sym_def_app_icon);
        } catch (Exception unused) {
            return null;
        }
    }

    public static String F3(InputStream inputStream, String str) {
        try {
            byte[] bArr = new byte[inputStream.available()];
            if (inputStream.read(bArr) != -1) {
                return new String(bArr, str);
            }
            throw new IOException("EOF reached while trying to read the whole input stream");
        } finally {
            N(inputStream);
        }
    }

    public static void F4(File file, List list, List list2) {
        FileOutputStream fileOutputStream;
        if (list == null || list.isEmpty()) {
            throw new IllegalArgumentException("zipFiles(): No files to compress");
        }
        byte[] bArr = new byte[3145728];
        ZipOutputStream zipOutputStream = null;
        try {
            fileOutputStream = new FileOutputStream(file);
            try {
                ZipOutputStream zipOutputStream2 = new ZipOutputStream(fileOutputStream);
                try {
                    Iterator it = list.iterator();
                    while (it.hasNext()) {
                        File file2 = (File) it.next();
                        if (!file2.exists()) {
                            throw new FileNotFoundException("File " + file2.getAbsolutePath() + " not found");
                        }
                        if (!file2.isFile()) {
                            throw new FileNotFoundException("Path " + file2.getAbsolutePath() + " is not a file");
                        }
                        ZipEntry zipEntry = new ZipEntry(file2.getName());
                        zipOutputStream2.setLevel(9);
                        zipOutputStream2.putNextEntry(zipEntry);
                        FileInputStream fileInputStream = new FileInputStream(file2.getAbsolutePath());
                        while (true) {
                            try {
                                int read = fileInputStream.read(bArr);
                                if (read > 0) {
                                    zipOutputStream2.write(bArr, 0, read);
                                }
                            } catch (Throwable th) {
                                N(fileInputStream);
                                throw th;
                            }
                        }
                        N(fileInputStream);
                    }
                    if (list2 != null) {
                        Iterator it2 = list2.iterator();
                        while (it2.hasNext()) {
                            b bVar = (b) it2.next();
                            String b2 = bVar.b();
                            String a2 = bVar.a();
                            ZipEntry zipEntry2 = new ZipEntry(b2);
                            zipOutputStream2.setLevel(9);
                            zipOutputStream2.putNextEntry(zipEntry2);
                            zipOutputStream2.write(t.S(a2));
                        }
                    }
                    T(zipOutputStream2);
                    P(zipOutputStream2, fileOutputStream);
                } catch (Throwable th2) {
                    th = th2;
                    zipOutputStream = zipOutputStream2;
                    T(zipOutputStream);
                    P(zipOutputStream, fileOutputStream);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
            }
        } catch (Throwable th4) {
            th = th4;
            fileOutputStream = null;
        }
    }

    public static boolean G(String str, int i2) {
        return !t.h(str) && (Integer.parseInt(str) & i2) > 0;
    }

    public static String G0(Context context) {
        String a1 = a1(context);
        return !TextUtils.isEmpty(a1) ? a1 : Settings.Secure.getString(context.getContentResolver(), "android_id");
    }

    public static String G1(Context context, String str, String str2, int i2) {
        ActivityInfo[] activityInfoArr = context.getApplicationContext().getPackageManager().getPackageInfo(str, i2).activities;
        for (ActivityInfo activityInfo : activityInfoArr) {
            if (activityInfo.name.endsWith(str2)) {
                return activityInfo.name;
            }
        }
        throw new NullPointerException("Cannot find framework entry point class");
    }

    public static String G2(String str, String str2) {
        return str + str2;
    }

    public static String G3(InputStream inputStream, String str) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            byte[] bArr = new byte[16384];
            while (true) {
                int read = inputStream.read(bArr, 0, 16384);
                if (read == -1) {
                    String byteArrayOutputStream2 = byteArrayOutputStream.toString(str);
                    N(byteArrayOutputStream);
                    return byteArrayOutputStream2;
                }
                byteArrayOutputStream.write(bArr, 0, read);
            }
        } catch (Throwable th) {
            N(byteArrayOutputStream);
            throw th;
        }
    }

    public static boolean H(int i2, int i3) {
        return (i2 & i3) > 0;
    }

    public static Uri H0(Context context, File file) {
        return Build.VERSION.SDK_INT <= 23 ? Uri.fromFile(file) : B1(context, file);
    }

    public static Intent H1(Context context, String str, String str2) {
        Intent intent = new Intent();
        if (TextUtils.isEmpty(str)) {
            str = I1(context);
        }
        String G1 = G1(context, str, "mainEntry", 1);
        if (TextUtils.isEmpty(G1)) {
            throw new NullPointerException("Cannot get framework entry point class");
        }
        intent.setComponent(new ComponentName(str, G1));
        intent.setAction("android.intent.action.MAIN");
        intent.addCategory("android.intent.category.LAUNCHER");
        intent.putExtra("appname", str2);
        return intent;
    }

    public static int H2(Context context) {
        if (context == null) {
            throw new IllegalArgumentException("Context argument cannot be null");
        }
        Context applicationContext = context.getApplicationContext();
        if (applicationContext == null) {
            throw new NullPointerException("Cannot obtain application context");
        }
        ApplicationInfo applicationInfo = applicationContext.getApplicationInfo();
        if (applicationInfo != null) {
            return applicationInfo.targetSdkVersion;
        }
        throw new NullPointerException("Cannot obtain application info");
    }

    public static JSONArray H3(File file, String str) {
        return new JSONArray(z3(file, str).toString());
    }

    public static String I(String str) {
        if (TextUtils.isEmpty(str)) {
            return str;
        }
        if (str.startsWith("'") || str.startsWith("\"")) {
            str = str.substring(1);
        }
        return (str.endsWith("'") || str.endsWith("\"")) ? str.substring(0, str.length() - 1) : str;
    }

    public static File I0(Context context) {
        return new File(context.getFilesDir(), "app_scheme_id.txt");
    }

    public static String I1(Context context) {
        return context.getApplicationContext().getPackageName();
    }

    public static TelephonyManager I2(Context context) {
        TelephonyManager telephonyManager = (TelephonyManager) context.getApplicationContext().getSystemService("phone");
        if (telephonyManager != null) {
            return telephonyManager;
        }
        throw new NullPointerException("Cannot obtain TelephonyManager service");
    }

    public static JSONObject I3(File file) {
        return J3(file, "UTF-8");
    }

    public static void J(Cursor cursor) {
        if (cursor == null) {
            return;
        }
        try {
            cursor.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static Context J0() {
        Context context = f;
        if (context != null) {
            return context;
        }
        try {
            Method method = e;
            if (method != null) {
                return (Context) method.invoke(null, null);
            }
            if (d == null) {
                xoneApp xoneapp = xoneApp.K0;
                d = xoneApp.class;
            }
            Method declaredMethod = d.getDeclaredMethod("getContext", null);
            e = declaredMethod;
            Context context2 = (Context) declaredMethod.invoke(null, null);
            f = context2;
            return context2;
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static InputMethodManager J1(Context context) {
        Object y2 = y2(context, "input_method");
        if (y2 instanceof InputMethodManager) {
            return (InputMethodManager) y2;
        }
        throw new NullPointerException("Cannot obtain InputMethodManager service");
    }

    public static float J2(Paint.Align align, float f2, Typeface typeface) {
        TextPaint textPaint = new TextPaint();
        textPaint.setARGB(255, 255, 255, 255);
        textPaint.setTextAlign(align);
        textPaint.setTextSize(f2);
        textPaint.setTypeface(typeface);
        return textPaint.getFontSpacing();
    }

    public static JSONObject J3(File file, String str) {
        return new JSONObject(z3(file, str).toString());
    }

    public static void K(Process process) {
        if (process == null) {
            return;
        }
        try {
            process.destroy();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static int K0(boolean r3, int... r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.utils.Utils.K0(boolean, int[]):int");
    }

    public static String K1(InputStream inputStream) {
        return L1(inputStream, "adler32");
    }

    public static Rect K2(String str, Paint.Align align, float f2, Typeface typeface) {
        TextPaint textPaint = new TextPaint();
        textPaint.setARGB(255, 255, 255, 255);
        textPaint.setTextAlign(align);
        textPaint.setTextSize(f2);
        textPaint.setTypeface(typeface);
        Rect rect = new Rect();
        textPaint.getTextBounds(str, 0, str.length(), rect);
        return rect;
    }

    public static JSONObject K3(InputStream inputStream, String str) {
        return new JSONObject(A3(inputStream, str).toString());
    }

    public static void L(SQLiteDatabase sQLiteDatabase) {
        if (sQLiteDatabase == null) {
            return;
        }
        try {
            sQLiteDatabase.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static String L0(byte[] bArr, String str, boolean z) {
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bArr);
        try {
            return M1(byteArrayInputStream, str, z);
        } finally {
            N(byteArrayInputStream);
        }
    }

    public static String L1(InputStream inputStream, String str) {
        CheckedInputStream checkedInputStream;
        CheckedInputStream checkedInputStream2 = null;
        try {
            try {
                checkedInputStream = new CheckedInputStream(inputStream, str.compareTo("adler32") == 0 ? new Adler32() : str.compareTo("crc32") == 0 ? new CRC32() : new CRC32());
            } catch (IOException e2) {
                e = e2;
            }
        } catch (Throwable th) {
            th = th;
        }
        try {
            while (checkedInputStream.read(new byte[128]) >= 0) {
            }
            String valueOf = String.valueOf(checkedInputStream.getChecksum().getValue());
            N(checkedInputStream);
            return valueOf;
        } catch (IOException e3) {
            e = e3;
            checkedInputStream2 = checkedInputStream;
            throw AbstractC0751f.e(e);
        } catch (Throwable th2) {
            th = th2;
            checkedInputStream2 = checkedInputStream;
            N(checkedInputStream2);
            throw th;
        }
    }

    public static String L2(Throwable th) {
        if (th == null) {
            return "";
        }
        StringWriter stringWriter = new StringWriter();
        stringWriter.write(10);
        StackTraceElement[] stackTrace = th.getStackTrace();
        if (stackTrace != null && stackTrace.length > 0) {
            stringWriter.write(th.getClass() + ": " + th.getMessage());
            stringWriter.write(10);
            for (StackTraceElement stackTraceElement : stackTrace) {
                stringWriter.write("    at " + stackTraceElement.getClassName() + '.' + stackTraceElement.getMethodName() + '(' + stackTraceElement.getFileName() + ':' + stackTraceElement.getLineNumber() + ')');
                stringWriter.write(10);
            }
        }
        for (Throwable cause = th.getCause(); cause != null; cause = cause.getCause()) {
            StackTraceElement[] stackTrace2 = cause.getStackTrace();
            if (stackTrace2 != null && stackTrace2.length > 0) {
                stringWriter.write("Caused by:");
                stringWriter.write(10);
                stringWriter.write(cause.getClass() + ": " + cause.getMessage());
                stringWriter.write(10);
                for (StackTraceElement stackTraceElement2 : stackTrace2) {
                    stringWriter.write("    at " + stackTraceElement2.getClassName() + '.' + stackTraceElement2.getMethodName() + '(' + stackTraceElement2.getFileName() + ':' + stackTraceElement2.getLineNumber() + ')');
                    stringWriter.write(10);
                }
            }
        }
        return stringWriter.toString();
    }

    public static void L3(Bitmap bitmap) {
        if (bitmap == null) {
            return;
        }
        try {
            if (bitmap.isRecycled()) {
                return;
            }
            bitmap.recycle();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static void M(AssetFileDescriptor assetFileDescriptor) {
        if (assetFileDescriptor == null) {
            return;
        }
        try {
            assetFileDescriptor.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static String M0() {
        return TextUtils.isEmpty(c) ? "" : c;
    }

    public static String M1(InputStream inputStream, String str, boolean z) {
        char c2;
        if (TextUtils.isEmpty(str)) {
            str = "crc32";
        }
        str.getClass();
        switch (str.hashCode()) {
            case -903629273:
                if (str.equals("sha256")) {
                    c2 = 0;
                    break;
                }
                c2 = 65535;
                break;
            case -903626518:
                if (str.equals("sha512")) {
                    c2 = 1;
                    break;
                }
                c2 = 65535;
                break;
            case 3528965:
                if (str.equals("sha1")) {
                    c2 = 2;
                    break;
                }
                c2 = 65535;
                break;
            case 3528966:
                if (str.equals("sha2")) {
                    c2 = 3;
                    break;
                }
                c2 = 65535;
                break;
            default:
                c2 = 65535;
                break;
        }
        switch (c2) {
            case 0:
            case 1:
            case 2:
            case 3:
                try {
                    MessageDigest messageDigest = MessageDigest.getInstance(str.toUpperCase(Locale.US));
                    byte[] bArr = new byte[8192];
                    while (true) {
                        int read = inputStream.read(bArr);
                        if (read == -1) {
                            return Base64.encodeToString(messageDigest.digest(), z ? 10 : 2);
                        }
                        messageDigest.update(bArr, 0, read);
                    }
                } catch (IOException | NoSuchAlgorithmException e2) {
                    throw AbstractC0751f.e(e2);
                }
            default:
                return L1(inputStream, str);
        }
    }

    public static String M2(Throwable th) {
        if (th == null) {
            return "";
        }
        String simpleName = th.getClass().getSimpleName();
        String message = th.getMessage();
        if (TextUtils.isEmpty(message)) {
            return simpleName;
        }
        return simpleName + "(): " + message;
    }

    public static void M3(Bitmap... bitmapArr) {
        if (bitmapArr == null) {
            return;
        }
        for (Bitmap bitmap : bitmapArr) {
            if (bitmap != null) {
                L3(bitmap);
            }
        }
    }

    public static void N(Closeable closeable) {
        if (closeable == null) {
            return;
        }
        try {
            closeable.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static Calendar N0(Context context, String str) {
        Date V0 = V0(context, str);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(V0);
        return calendar;
    }

    public static int N1(CharSequence charSequence, int i2) {
        if (!TextUtils.isEmpty(charSequence)) {
            try {
                return Integer.decode(charSequence.toString()).intValue();
            } catch (Exception unused) {
            }
        }
        return i2;
    }

    public static String N2(Throwable th) {
        StringWriter stringWriter;
        PrintWriter printWriter;
        PrintWriter printWriter2 = null;
        try {
            stringWriter = new StringWriter();
            try {
                printWriter = new PrintWriter(stringWriter);
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            th = th3;
            stringWriter = null;
        }
        try {
            th.printStackTrace(printWriter);
            String stringWriter2 = stringWriter.toString();
            P(printWriter, stringWriter);
            return stringWriter2;
        } catch (Throwable th4) {
            th = th4;
            printWriter2 = printWriter;
            P(printWriter2, stringWriter);
            throw th;
        }
    }

    public static void N3(TypedArray typedArray) {
        if (typedArray == null) {
            return;
        }
        typedArray.recycle();
    }

    public static void O(ZipFile zipFile) {
        if (zipFile == null) {
            return;
        }
        try {
            zipFile.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static StringBuilder O0(Process process) {
        InputStream errorStream = process.getErrorStream();
        try {
            return Q0(errorStream);
        } finally {
            N(errorStream);
        }
    }

    public static KeyguardManager O1(Context context) {
        Object systemService = context.getSystemService("keyguard");
        if (systemService == null) {
            throw new NullPointerException("Cannot obtain KeyguardManager service instance");
        }
        if (systemService instanceof KeyguardManager) {
            return (KeyguardManager) systemService;
        }
        throw new NullPointerException("Returned service is not an instance of KeyguardManager");
    }

    public static int O2(String str, int i2) {
        if (TextUtils.isEmpty(str)) {
            return -1;
        }
        String replace = str.replace((char) 160, ' ');
        boolean contains = replace.contains(" a. m.");
        boolean contains2 = replace.contains(" p. m.");
        String[] j4 = j4(replace);
        if (i2 != 0) {
            if (i2 != 1) {
                if (i2 != 2) {
                    if (i2 == 3) {
                        if (j4.length > 3) {
                            String str2 = j4[3];
                            if (contains || contains2) {
                                str2 = str2.replace(" a. m.", "").replace(" p. m.", "");
                            }
                            return Integer.parseInt(str2);
                        }
                        if (j4.length > 2) {
                            String str3 = j4[2];
                            if (contains || contains2) {
                                str3 = str3.replace(" a. m.", "").replace(" p. m.", "");
                            }
                            String[] split = str3.split(".");
                            if (split.length >= 1) {
                                return Integer.parseInt(split[1]);
                            }
                        }
                    }
                } else if (j4.length > 2) {
                    String str4 = j4[2];
                    if (contains || contains2) {
                        str4 = str4.replace(" a. m.", "").replace(" p. m.", "");
                    }
                    String[] split2 = str4.split(".");
                    return split2.length == 1 ? Integer.parseInt(str4) : Integer.parseInt(split2[0]);
                }
            } else if (j4.length > 1) {
                String str5 = j4[1];
                if (contains || contains2) {
                    str5 = str5.replace(" a. m.", "").replace(" p. m.", "");
                }
                return Integer.parseInt(str5);
            }
        } else if (j4.length > 0) {
            int parseInt = Integer.parseInt(j4[0]);
            return contains2 ? parseInt + 12 : parseInt;
        }
        return -1;
    }

    public static void O3(File file, File file2) {
        if (file == null) {
            throw new IllegalArgumentException("Error, empty source file parameter");
        }
        if (file2 == null) {
            throw new IllegalArgumentException("Error, empty target path parameter");
        }
        if (!file.exists()) {
            throw new FileNotFoundException("Error, file " + file.getAbsolutePath() + " does not exist");
        }
        if (file.renameTo(file2)) {
            return;
        }
        throw new IOException("Cannot rename file " + file.getAbsolutePath() + " to " + file2.getAbsolutePath());
    }

    public static void P(Closeable... closeableArr) {
        Closeable closeable;
        if (closeableArr == null || closeableArr.length == 0) {
            return;
        }
        for (int i2 = 0; i2 < closeableArr.length; i2++) {
            try {
                closeable = closeableArr[i2];
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            if (closeable != null) {
                closeable.close();
                closeableArr[i2] = null;
            }
        }
    }

    public static StringBuilder P0(Process process) {
        InputStream inputStream = process.getInputStream();
        try {
            return Q0(inputStream);
        } finally {
            N(inputStream);
        }
    }

    public static String P1(Context context, String str, String str2) {
        File file = new File(context.getApplicationContext().getFilesDir(), "lastexecuted.ini");
        if (file.exists()) {
            String f2 = new C0694g(file).f(str);
            if (!TextUtils.isEmpty(f2)) {
                return f2;
            }
        }
        return str2;
    }

    public static String P2(String str) {
        String replaceAll = str.replaceAll("[0-9]", "");
        return TextUtils.isEmpty(replaceAll) ? ":" : String.valueOf(replaceAll.charAt(0));
    }

    public static StringBuilder P3(CharSequence charSequence) {
        Process exec = Runtime.getRuntime().exec(charSequence.toString());
        int waitFor = exec.waitFor();
        if (waitFor == 0) {
            return P0(exec);
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append("Command execution failed.\nCommand line: ");
        sb2.append(charSequence);
        sb2.append("\nExit code: ");
        sb2.append(waitFor);
        if (!TextUtils.isEmpty(O0(exec))) {
            sb2.append("\nError message: ");
            sb2.append((CharSequence) sb2);
        }
        throw new RuntimeException(sb2.toString());
    }

    public static void Q(Scanner scanner) {
        if (scanner == null) {
            return;
        }
        try {
            scanner.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static StringBuilder Q0(InputStream inputStream) {
        BufferedReader bufferedReader;
        Throwable th;
        InputStreamReader inputStreamReader;
        if (inputStream == null) {
            return new StringBuilder();
        }
        try {
            inputStreamReader = new InputStreamReader(inputStream);
            try {
                bufferedReader = new BufferedReader(inputStreamReader);
            } catch (Throwable th2) {
                bufferedReader = null;
                th = th2;
            }
            try {
                StringBuilder sb2 = new StringBuilder();
                while (true) {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        P(bufferedReader, inputStreamReader, inputStream);
                        return sb2;
                    }
                    sb2.append(readLine);
                }
            } catch (Throwable th3) {
                th = th3;
                P(bufferedReader, inputStreamReader, inputStream);
                throw th;
            }
        } catch (Throwable th4) {
            bufferedReader = null;
            th = th4;
            inputStreamReader = null;
        }
    }

    public static String Q1(Context context) {
        return P1(context, "appname", "");
    }

    public static String Q2(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return str2;
        }
        int indexOf = str2.indexOf(str);
        return indexOf >= 0 ? str2.substring(indexOf + str.length()) : str2;
    }

    public static boolean Q3(Context context, Class cls, boolean z, String str) {
        ComponentName startForegroundService;
        Context applicationContext = context.getApplicationContext();
        if (m3(applicationContext, cls)) {
            return false;
        }
        Intent intent = new Intent(applicationContext, (Class<?>) cls);
        intent.putExtra("source", str);
        intent.putExtra("manual_launch", z);
        try {
            return applicationContext.startService(intent) != null;
        } catch (IllegalStateException e2) {
            if (H2(applicationContext) < 26 || Build.VERSION.SDK_INT < 26) {
                throw e2;
            }
            l("XOneAndroidFramework", "runLiveService(): Catched an IllegalStateException while starting live cyle, targetSdkVersion >= 26 and Android >= 8.X, retrying as a foreground service");
            intent.putExtra("isForegroundService", true);
            startForegroundService = applicationContext.startForegroundService(intent);
            return startForegroundService != null;
        }
    }

    public static void R(ServerSocket serverSocket) {
        if (serverSocket == null) {
            return;
        }
        try {
            serverSocket.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static String R0() {
        return TextUtils.isEmpty(b) ? "" : b;
    }

    public static int R1(Context context, Double d2, Integer num) {
        return (int) (d2.doubleValue() == 0.0d ? y4(context, num.intValue()) : y4(context, (float) (d2.doubleValue() * 10.0d)));
    }

    public static CharSequence R2(View view) {
        if (view instanceof TextView) {
            return ((TextView) view).getText();
        }
        return null;
    }

    public static boolean R3(Context context, String str, String str2, boolean z, String str3) {
        ComponentName startForegroundService;
        Context applicationContext = context.getApplicationContext();
        if (n3(applicationContext, str2)) {
            return false;
        }
        Intent intent = new Intent();
        intent.setClassName(str, str2);
        intent.putExtra("source", str3);
        intent.putExtra("manual_launch", z);
        try {
            return applicationContext.startService(intent) != null;
        } catch (IllegalStateException e2) {
            if (H2(applicationContext) < 26 || Build.VERSION.SDK_INT < 26) {
                throw e2;
            }
            l("XOneAndroidFramework", "runLiveService(): Catched an IllegalStateException while starting live cyle, targetSdkVersion >= 26 and Android >= 8.X, retrying as a foreground service");
            intent.putExtra("isForegroundService", true);
            startForegroundService = applicationContext.startForegroundService(intent);
            return startForegroundService != null;
        }
    }

    public static void S(Socket socket) {
        if (socket == null) {
            return;
        }
        try {
            if (socket.isClosed()) {
                return;
            }
            socket.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static EnumC0749d S0(Context context) {
        NetworkInfo activeNetworkInfo = T0(context.getApplicationContext()).getActiveNetworkInfo();
        if (activeNetworkInfo == null) {
            return EnumC0749d.SLOW;
        }
        if (!activeNetworkInfo.isConnected()) {
            return EnumC0749d.SLOW;
        }
        int type = activeNetworkInfo.getType();
        int subtype = activeNetworkInfo.getSubtype();
        if (type == 1) {
            return EnumC0749d.VERY_FAST;
        }
        if (type == 9) {
            return EnumC0749d.VERY_FAST;
        }
        if (type == 6) {
            return EnumC0749d.VERY_FAST;
        }
        if (type == 7) {
            return EnumC0749d.SLOW;
        }
        if (type == 17) {
            return EnumC0749d.FAST;
        }
        if (type != 0) {
            return EnumC0749d.SLOW;
        }
        switch (subtype) {
        }
        return EnumC0749d.SLOW;
    }

    public static int S1(Context context, String str, int i2) {
        return U1(context.getResources(), str, i2);
    }

    public static View S2(View view, int i2) {
        View findViewById;
        if (view == null) {
            return null;
        }
        if (view.getId() == i2) {
            return view;
        }
        if ((view instanceof ViewGroup) && (findViewById = view.findViewById(i2)) != null) {
            return findViewById;
        }
        Object parent = view.getParent();
        if (parent instanceof View) {
            return S2((View) parent, i2);
        }
        return null;
    }

    public static void S3(File file, boolean z, byte[] bArr) {
        FileOutputStream fileOutputStream;
        FileOutputStream fileOutputStream2 = null;
        try {
            fileOutputStream = new FileOutputStream(file, z);
        } catch (Throwable th) {
            th = th;
        }
        try {
            fileOutputStream.write(bArr);
            N(fileOutputStream);
        } catch (Throwable th2) {
            th = th2;
            fileOutputStream2 = fileOutputStream;
            N(fileOutputStream2);
            throw th;
        }
    }

    public static void T(ZipOutputStream zipOutputStream) {
        if (zipOutputStream == null) {
            return;
        }
        try {
            zipOutputStream.closeEntry();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static ConnectivityManager T0(Context context) {
        Object systemService = context.getSystemService("connectivity");
        if (systemService instanceof ConnectivityManager) {
            return (ConnectivityManager) systemService;
        }
        throw new NullPointerException("Cannot obtain ConnectivityManager instance");
    }

    public static int T1(Context context, String str, int i2, int i3, int i4) {
        return V1(context.getResources(), str, i2, i3, i4);
    }

    public static View T2(View view, String str) {
        View findViewWithTag;
        if (view == null) {
            return null;
        }
        Object tag = view.getTag();
        if ((tag instanceof String) && t.E((String) tag, str)) {
            return view;
        }
        if ((view instanceof ViewGroup) && (findViewWithTag = view.findViewWithTag(str)) != null) {
            return findViewWithTag;
        }
        Object parent = view.getParent();
        if (parent instanceof View) {
            return T2((View) parent, str);
        }
        return null;
    }

    public static void T3(File file, boolean z, String str, CharSequence charSequence) {
        OutputStreamWriter outputStreamWriter;
        FileOutputStream fileOutputStream;
        BufferedWriter bufferedWriter;
        BufferedWriter bufferedWriter2 = null;
        try {
            fileOutputStream = new FileOutputStream(file, z);
            try {
                outputStreamWriter = new OutputStreamWriter(fileOutputStream, str);
                try {
                    bufferedWriter = new BufferedWriter(outputStreamWriter);
                } catch (Throwable th) {
                    th = th;
                }
            } catch (Throwable th2) {
                th = th2;
                outputStreamWriter = null;
            }
        } catch (Throwable th3) {
            th = th3;
            outputStreamWriter = null;
            fileOutputStream = null;
        }
        try {
            if (charSequence == null) {
                bufferedWriter.write((String) null);
            } else {
                bufferedWriter.write(charSequence.toString());
            }
            P(bufferedWriter, outputStreamWriter, fileOutputStream);
        } catch (Throwable th4) {
            th = th4;
            bufferedWriter2 = bufferedWriter;
            P(bufferedWriter2, outputStreamWriter, fileOutputStream);
            throw th;
        }
    }

    public static int U(Context context, float f2) {
        return (int) A4(context.getApplicationContext().getResources().getDisplayMetrics(), f2);
    }

    public static String U0(String str) {
        String trim = str.trim();
        StringBuilder sb2 = new StringBuilder();
        String str2 = str.indexOf("/") <= 0 ? "-" : "/";
        sb2.append("yyyy");
        sb2.append(str2);
        sb2.append("MM");
        sb2.append(str2);
        sb2.append("dd");
        int indexOf = trim.indexOf(" ");
        int indexOf2 = trim.indexOf(84);
        if (indexOf == -1 && indexOf2 == -1) {
            return sb2.toString();
        }
        int indexOf3 = trim.indexOf(":");
        if (indexOf3 >= 0) {
            if (indexOf != -1) {
                sb2.append(' ');
            } else {
                sb2.append("'T'");
            }
            if (trim.indexOf(58, indexOf3 + 1) >= 0) {
                sb2.append("HH:mm:ss");
            } else {
                sb2.append("HH:mm");
            }
        }
        return sb2.toString();
    }

    public static int U1(Resources resources, String str, int i2) {
        if (TextUtils.isEmpty(str)) {
            return 0;
        }
        if (str.indexOf("dp") >= 0) {
            return V(resources, Integer.parseInt(str.substring(0, r0)));
        }
        int indexOf = str.indexOf("p");
        if (indexOf >= 0) {
            return Integer.parseInt(str.substring(0, indexOf));
        }
        int indexOf2 = str.indexOf("%");
        if (indexOf2 < 0) {
            return (int) (Double.parseDouble(str) * 10);
        }
        if (i2 >= 0) {
            return (i2 * Integer.parseInt(str.substring(0, indexOf2))) / 100;
        }
        return -2;
    }

    public static String U2(String str) {
        return str.replace(" ", "_").replace("?", "$").replace("=", "$$").replace("&", "$_");
    }

    public static void U3(final Context context, final Exception exc) {
        final File file = new File(context.getFilesDir(), "dpc_bug.txt");
        if (file.exists()) {
            return;
        }
        new Thread(new Runnable() {
            @Override
            public final void run() {
                Utils.b(context, exc, file);
            }
        }).start();
    }

    public static int V(Resources resources, float f2) {
        return (int) A4(resources.getDisplayMetrics(), f2);
    }

    public static Date V0(Context context, String str) {
        String str2;
        SimpleDateFormat simpleDateFormat = (SimpleDateFormat) DateFormat.getDateFormat(context);
        String pattern = simpleDateFormat.toPattern();
        if (!b3(str)) {
            pattern = pattern.replaceAll("\u200f", "");
        }
        String trim = str.trim();
        if (trim.indexOf(":") > 0) {
            if (trim.indexOf(":", trim.indexOf(":") + 1) > 0) {
                str2 = pattern + " HH:mm:ss";
            } else {
                str2 = pattern + " HH:mm";
            }
        } else if (trim.indexOf(".") <= 0) {
            str2 = null;
        } else if (trim.indexOf(".", trim.indexOf(".") + 1) > 0) {
            str2 = pattern + " HH.mm.ss";
        } else {
            str2 = pattern + " HH.mm";
        }
        if (!TextUtils.isEmpty(str2)) {
            simpleDateFormat = new SimpleDateFormat(str2);
        }
        return simpleDateFormat.parse(trim);
    }

    public static int V1(Resources resources, String str, int i2, int i3, int i4) {
        if (TextUtils.isEmpty(str)) {
            return 0;
        }
        if (str.indexOf("dp") >= 0) {
            return V(resources, s2(Integer.parseInt(str.substring(0, r0)), i2, i4));
        }
        int indexOf = str.indexOf("p");
        if (indexOf >= 0) {
            return s2(Integer.parseInt(str.substring(0, indexOf)), i2, i4);
        }
        int indexOf2 = str.indexOf("%");
        if (indexOf2 < 0) {
            int parseDouble = (int) (Double.parseDouble(str) * 10);
            return parseDouble >= 0 ? i2 > 0 ? s2(parseDouble, i2, i4) : V(resources, s2(parseDouble, i2, i4)) : parseDouble;
        }
        if (i4 >= 0) {
            return (int) ((i3 * Double.parseDouble(str.substring(0, indexOf2))) / 100.0d);
        }
        return -2;
    }

    public static String V2(Context context) {
        WifiInfo connectionInfo;
        WifiManager wifiManager = (WifiManager) y2(context, "wifi");
        if (wifiManager == null || !C9.e.p(context, "android.permission.ACCESS_WIFI_STATE") || (connectionInfo = wifiManager.getConnectionInfo()) == null) {
            return "";
        }
        String macAddress = connectionInfo.getMacAddress();
        return TextUtils.isEmpty(macAddress) ? "" : macAddress;
    }

    public static void V3(String str) {
        c = str;
    }

    public static long W(InputStream inputStream, OutputStream outputStream) {
        long b0 = b0(inputStream, outputStream);
        if (b0 > 2147483647L) {
            return -1L;
        }
        return b0;
    }

    public static Drawable W0(Context context) {
        try {
            return context.getPackageManager().getApplicationIcon(context.getApplicationInfo());
        } catch (Exception unused) {
            return null;
        }
    }

    public static String W1(int i2) {
        return i2 != 5 ? i2 != 10 ? i2 != 15 ? i2 != 20 ? i2 != 40 ? i2 != 60 ? i2 != 80 ? "unknown" : "complete" : "moderate" : "background" : "ui_hidden" : "running_critical" : "running_low" : "running_moderate";
    }

    public static int W2(int i2, int i3) {
        return i2 <= 0 ? i2 : (int) (i2 * (i3 / 100.0f));
    }

    public static void W3(String str) {
        b = str;
    }

    public static byte[] X(byte[] bArr, int i2, int i3) {
        int i4 = i3 - i2;
        if (i4 >= 0) {
            byte[] bArr2 = new byte[i4];
            System.arraycopy(bArr, i2, bArr2, 0, Math.min(bArr.length - i2, i4));
            return bArr2;
        }
        throw new IllegalArgumentException(i2 + " > " + i3);
    }

    public static Typeface X0(Context context) {
        return h.g(context.getApplicationContext(), u.a);
    }

    public static SmsMessage[] X1(Intent intent) {
        Object[] objArr = (Object[]) AbstractC0698k.p(intent, "pdus", null);
        if (objArr == null) {
            return new SmsMessage[0];
        }
        if (objArr.length == 0) {
            return new SmsMessage[0];
        }
        int length = objArr.length;
        byte[][] bArr = new byte[length][];
        for (int i2 = 0; i2 < objArr.length; i2++) {
            bArr[i2] = (byte[]) objArr[i2];
        }
        byte[][] bArr2 = new byte[length][];
        SmsMessage[] smsMessageArr = new SmsMessage[length];
        for (int i3 = 0; i3 < length; i3++) {
            byte[] bArr3 = bArr[i3];
            bArr2[i3] = bArr3;
            smsMessageArr[i3] = SmsMessage.createFromPdu(bArr3);
        }
        return smsMessageArr;
    }

    public static boolean X2(int i2, int i3) {
        return (i2 & i3) == i3;
    }

    public static void X3(File file) {
        j = file;
    }

    public static void Y(final c cVar, File file, File file2, boolean z) {
        if (file == null) {
            throw new IllegalArgumentException("Error, empty source directory parameter");
        }
        if (file2 == null) {
            throw new IllegalArgumentException("Error, empty target directory parameter");
        }
        if (!file.exists()) {
            throw AbstractC0751f.b("Error, source directory " + file.getAbsolutePath() + " does not exist");
        }
        if (!file.isDirectory()) {
            throw AbstractC0751f.b("Error, source path " + file.getAbsolutePath() + " is not a directory");
        }
        if (file2.exists()) {
            if (!z) {
                throw AbstractC0751f.c("Error, target path " + file2.getAbsolutePath() + " already exists");
            }
            n0(file2);
        }
        if (!file2.mkdirs()) {
            throw AbstractC0751f.c("Cannot create directory " + file2.getAbsolutePath());
        }
        File[] listFiles = file.listFiles();
        if (listFiles == null) {
            return;
        }
        for (File file3 : listFiles) {
            if (file3.isFile()) {
                Z(file3, new File(file2, file3.getName()));
            } else if (file3.isDirectory()) {
                Y(cVar, file3, new File(file2, file3.getName()), z);
            }
            if (cVar != null) {
                j.p(new Runnable() {
                    @Override
                    public final void run() {
                        O8.c.this.a();
                    }
                });
            }
        }
    }

    public static String Y0(Context context) {
        Context applicationContext = context.getApplicationContext();
        String e2 = e2(applicationContext);
        if (!TextUtils.isEmpty(e2)) {
            return e2;
        }
        String a1 = a1(applicationContext);
        if (!TextUtils.isEmpty(a1)) {
            return a1;
        }
        if (N.e(applicationContext)) {
            a1 = b1(applicationContext);
            if (!TextUtils.isEmpty(a1)) {
                Z3(applicationContext, a1);
                return a1;
            }
        }
        TelephonyManager I2 = I2(applicationContext);
        try {
            if (Build.VERSION.SDK_INT >= 26) {
                a1 = I2.getImei();
                if (TextUtils.isEmpty(a1)) {
                    a1 = I2.getMeid();
                }
            } else {
                a1 = I2.getDeviceId();
            }
        } catch (SecurityException unused) {
        }
        if (Build.VERSION.SDK_INT < 23 && (TextUtils.isEmpty(a1) || TextUtils.equals(a1, "000000000000000"))) {
            a1 = V2(applicationContext);
        }
        if (TextUtils.isEmpty(a1) || TextUtils.equals(a1, "000000000000000")) {
            a1 = G0(applicationContext);
        }
        return !TextUtils.isEmpty(a1) ? a1 : ((TextUtils.isEmpty(a1) || TextUtils.equals(a1, "000000000000000")) && (applicationContext.getApplicationInfo().flags & 2) != 0) ? "1234567890" : "";
    }

    public static Set Y1(Context context) {
        String meid;
        Context applicationContext = context.getApplicationContext();
        TelephonyManager I2 = I2(applicationContext);
        LinkedHashSet linkedHashSet = new LinkedHashSet();
        String e2 = e2(applicationContext);
        if (!TextUtils.isEmpty(e2)) {
            linkedHashSet.add(e2);
            return linkedHashSet;
        }
        String a1 = a1(applicationContext);
        if (!TextUtils.isEmpty(a1)) {
            linkedHashSet.add(a1);
            return linkedHashSet;
        }
        linkedHashSet.add(G0(applicationContext));
        if (N.e(applicationContext)) {
            Set Z1 = Z1(applicationContext);
            if (!Z1.isEmpty()) {
                linkedHashSet.addAll(Z1);
            }
        }
        if (Build.VERSION.SDK_INT >= 23) {
            int a2 = d.a(I2);
            try {
                if (a2 > 0) {
                    for (int i2 = 0; i2 < a2; i2++) {
                        linkedHashSet.add(w7.e.a(I2, i2));
                    }
                } else {
                    linkedHashSet.add(I2.getDeviceId());
                }
            } catch (SecurityException unused) {
            }
        } else {
            linkedHashSet.add(I2.getDeviceId());
        }
        int i3 = Build.VERSION.SDK_INT;
        if (i3 < 23) {
            String V2 = V2(applicationContext);
            if (!TextUtils.equals(V2, "02:00:00:00:00:00")) {
                linkedHashSet.add(V2);
            }
        }
        if (i3 >= 26) {
            try {
                meid = I2.getMeid();
                linkedHashSet.add(meid);
            } catch (SecurityException unused2) {
            }
        }
        linkedHashSet.remove("");
        linkedHashSet.remove(null);
        return linkedHashSet;
    }

    public static void Y2(Context context) {
        ((NotificationManager) y2(context, "notification")).cancel(155555);
    }

    public static void Y3(Context context, String str, String str2) {
        C0694g c0694g = new C0694g(new File(context.getApplicationContext().getFilesDir(), "lastexecuted.ini"), true);
        c0694g.B0(str2, str);
        c0694g.n();
    }

    public static File Z(File file, File file2) {
        Throwable th;
        FileOutputStream fileOutputStream;
        FileChannel fileChannel;
        FileChannel fileChannel2;
        IOException iOException;
        FileChannel fileChannel3;
        FileChannel fileChannel4;
        FileInputStream fileInputStream;
        if (file == null) {
            throw new IllegalArgumentException("Error, empty source file parameter");
        }
        if (file2 == null) {
            throw new IllegalArgumentException("Error, empty target path parameter");
        }
        File parentFile = file2.getParentFile();
        if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs()) {
            throw AbstractC0751f.e(new IOException("Cannot create target file parent folder " + parentFile.getAbsolutePath()));
        }
        if (!file.exists()) {
            throw AbstractC0751f.e(new FileNotFoundException("Error, file " + file.getAbsolutePath() + " does not exist"));
        }
        if (!file.isFile()) {
            throw AbstractC0751f.e(new FileNotFoundException("Error, path " + file.getAbsolutePath() + " is not a file"));
        }
        if (file.getAbsolutePath().equals(file2.getAbsolutePath())) {
            return file2;
        }
        FileChannel fileChannel5 = null;
        try {
            fileInputStream = new FileInputStream(file);
            try {
                fileOutputStream = new FileOutputStream(file2);
            } catch (IOException e2) {
                iOException = e2;
                fileOutputStream = null;
                fileChannel2 = null;
            } catch (Throwable th2) {
                th = th2;
                fileOutputStream = null;
                fileChannel2 = null;
                fileChannel = fileInputStream;
            }
        } catch (IOException e3) {
            iOException = e3;
            fileOutputStream = null;
            fileChannel2 = null;
            fileChannel3 = null;
        } catch (Throwable th3) {
            th = th3;
            fileOutputStream = null;
            fileChannel = null;
            fileChannel2 = null;
        }
        try {
            fileChannel3 = fileInputStream.getChannel();
            try {
                fileChannel2 = fileOutputStream.getChannel();
            } catch (IOException e4) {
                iOException = e4;
                fileChannel2 = null;
            } catch (Throwable th4) {
                th = th4;
                fileChannel2 = null;
                fileChannel4 = fileInputStream;
            }
            try {
                File parentFile2 = file2.getParentFile();
                if (parentFile2 != null && !parentFile2.exists() && !parentFile2.mkdirs()) {
                    throw new IOException("Error, cannot create parent directory " + parentFile2.getAbsolutePath());
                }
                if (fileChannel3.size() > 0) {
                    fileChannel2.transferFrom(fileChannel3, 0L, fileChannel3.size());
                }
                P(fileChannel3, fileChannel2, fileInputStream, fileOutputStream);
                return file2;
            } catch (IOException e5) {
                iOException = e5;
                fileChannel5 = fileInputStream;
                try {
                    throw AbstractC0751f.e(iOException);
                } catch (Throwable th5) {
                    th = th5;
                    fileChannel4 = fileChannel5;
                    fileChannel5 = fileChannel3;
                    fileChannel = fileChannel4;
                    P(fileChannel5, fileChannel2, fileChannel, fileOutputStream);
                    throw th;
                }
            } catch (Throwable th6) {
                th = th6;
                fileChannel4 = fileInputStream;
                fileChannel5 = fileChannel3;
                fileChannel = fileChannel4;
                P(fileChannel5, fileChannel2, fileChannel, fileOutputStream);
                throw th;
            }
        } catch (IOException e6) {
            iOException = e6;
            fileChannel2 = null;
            fileChannel3 = fileChannel2;
            fileChannel5 = fileInputStream;
            throw AbstractC0751f.e(iOException);
        } catch (Throwable th7) {
            th = th7;
            fileChannel2 = null;
            fileChannel = fileInputStream;
            P(fileChannel5, fileChannel2, fileChannel, fileOutputStream);
            throw th;
        }
    }

    public static String Z0(Context context) {
        return Y0(context).replace(":", "_").replace("/", "_").replace("\\", "_");
    }

    public static Set Z1(Context context) {
        try {
            Context applicationContext = context.getApplicationContext();
            Uri parse = Uri.parse("content://com.xone.dpc.dataprovider");
            ContentResolver contentResolver = applicationContext.getContentResolver();
            if (contentResolver == null) {
                throw new C0395b();
            }
            Cursor query = contentResolver.query(parse, new String[]{"DEVICE_IDS"}, null, null, null);
            if (query == null) {
                throw new C0395b();
            }
            if (!query.moveToFirst()) {
                throw new C0395b();
            }
            int i2 = query.getInt(query.getColumnIndex("IMEI_COUNT"));
            if (i2 <= 0) {
                throw new C0395b();
            }
            LinkedHashSet linkedHashSet = new LinkedHashSet(i2);
            for (int i3 = 0; i3 < i2; i3++) {
                linkedHashSet.add(query.getString(query.getColumnIndex("IMEI" + i3)));
            }
            J(query);
            return linkedHashSet;
        } catch (Throwable th) {
            J(null);
            throw th;
        }
    }

    public static byte[] Z2(byte[] bArr) {
        byte b2;
        ByteArrayInputStream byteArrayInputStream;
        Throwable th;
        InflaterInputStream inflaterInputStream;
        if (bArr == null) {
            throw new IllegalArgumentException("Input buffer must not be null");
        }
        if (bArr.length < 2 || bArr[0] != 120 || ((b2 = bArr[1]) != 1 && b2 != 94 && b2 != -100 && b2 != -38)) {
            return bArr;
        }
        try {
            byteArrayInputStream = new ByteArrayInputStream(bArr);
            try {
                inflaterInputStream = new InflaterInputStream(byteArrayInputStream);
                try {
                    byte[] E3 = E3(inflaterInputStream);
                    P(inflaterInputStream, byteArrayInputStream);
                    return E3;
                } catch (Throwable th2) {
                    th = th2;
                    P(inflaterInputStream, byteArrayInputStream);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inflaterInputStream = null;
            }
        } catch (Throwable th4) {
            byteArrayInputStream = null;
            th = th4;
            inflaterInputStream = null;
        }
    }

    public static void Z3(Context context, String str) {
        SharedPreferences.Editor edit = context.getApplicationContext().getSharedPreferences("OverridenBuildValues", 0).edit();
        edit.putString("DeviceId", str);
        edit.commit();
    }

    public static boolean a0(File file, File file2) {
        try {
            Z(file, file2);
            return true;
        } catch (Exception e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public static String a1(Context context) {
        JSONObject u;
        Context applicationContext = context.getApplicationContext();
        String string = applicationContext.getString(v.a);
        if (TextUtils.isEmpty(string) || (u = AbstractC0699l.u(string)) == null) {
            return "";
        }
        String r = AbstractC0699l.r(u, "method", "");
        if (TextUtils.isEmpty(r) || !TextUtils.equals(r, "content_provider")) {
            return "";
        }
        String r2 = AbstractC0699l.r(u, "uri", "");
        if (TextUtils.isEmpty(r2)) {
            return "";
        }
        String r3 = AbstractC0699l.r(u, "deviceIdKey", "");
        if (TextUtils.isEmpty(r3)) {
            return "";
        }
        Uri parse = Uri.parse(r2);
        String w2 = w2(applicationContext);
        if (!TextUtils.isEmpty(w2)) {
            return w2;
        }
        try {
            Cursor query = applicationContext.getContentResolver().query(parse, new String[]{r3}, null, null, null);
            if (query == null) {
                String n1 = n1(u);
                J(query);
                return n1;
            }
            if (!query.moveToFirst()) {
                String n12 = n1(u);
                J(query);
                return n12;
            }
            String string2 = query.getString(query.getColumnIndex(r3));
            if (TextUtils.isEmpty(string2)) {
                String n13 = n1(u);
                J(query);
                return n13;
            }
            a4(applicationContext, string2);
            J(query);
            return string2;
        } catch (Throwable th) {
            J(null);
            throw th;
        }
    }

    public static BluetoothAdapter a2() {
        BluetoothAdapter bluetoothAdapter = (BluetoothAdapter) j.o(new CallableC0294c0());
        if (bluetoothAdapter != null) {
            return bluetoothAdapter;
        }
        throw new UnsupportedOperationException("Bluetooth adapter not found");
    }

    public static byte[] a3(byte[] bArr) {
        ByteArrayInputStream byteArrayInputStream;
        ByteArrayOutputStream byteArrayOutputStream;
        Throwable th;
        ByteArrayOutputStream byteArrayOutputStream2;
        try {
            byteArrayInputStream = new ByteArrayInputStream(bArr);
            try {
                ?? gZIPInputStream = new GZIPInputStream(byteArrayInputStream);
                try {
                    byteArrayOutputStream = new ByteArrayOutputStream();
                    try {
                        byte[] bArr2 = new byte[8192];
                        while (true) {
                            int read = gZIPInputStream.read(bArr2);
                            if (read == -1) {
                                byte[] byteArray = byteArrayOutputStream.toByteArray();
                                P(new Closeable[]{gZIPInputStream, byteArrayInputStream, byteArrayOutputStream});
                                return byteArray;
                            }
                            byteArrayOutputStream.write(bArr2, 0, read);
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        byteArrayOutputStream2 = gZIPInputStream;
                        P(byteArrayOutputStream2, byteArrayInputStream, byteArrayOutputStream);
                        throw th;
                    }
                } catch (Throwable th3) {
                    byteArrayOutputStream = null;
                    th = th3;
                    byteArrayOutputStream2 = gZIPInputStream;
                }
            } catch (Throwable th4) {
                th = th4;
                byteArrayOutputStream = null;
                th = th;
                byteArrayOutputStream2 = byteArrayOutputStream;
                P(byteArrayOutputStream2, byteArrayInputStream, byteArrayOutputStream);
                throw th;
            }
        } catch (Throwable th5) {
            th = th5;
            byteArrayInputStream = null;
            byteArrayOutputStream = null;
        }
    }

    public static void a4(Context context, String str) {
        try {
            File I0 = I0(context);
            k0(I0);
            T3(I0, false, "UTF-8", str);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static void b(Context context, Exception exc, File file) {
        HttpURLConnection httpURLConnection;
        InputStream inputStream;
        File file2;
        InputStream inputStream2;
        File file3;
        HttpURLConnection httpURLConnection2;
        Closeable closeable = null;
        try {
            String q2 = q2(10);
            file2 = new File(context.getFilesDir(), "tempLogs/" + q2);
            try {
                if (!file2.exists() && !file2.mkdirs()) {
                    throw new IOException("Cannot create temporary directory" + file2.getAbsolutePath());
                }
                URL url = new URL("https://xoneisp.com/XoneLogRec/reclog.aspx");
                File file4 = new File(file2, "log.txt");
                file3 = new File(file2, "framework_" + G0(context) + '_' + System.currentTimeMillis() + "_NODPCBUG.zip");
                String M2 = M2(exc);
                String N2 = N2(exc);
                StringBuilder sb2 = new StringBuilder();
                sb2.append("----------- EXCEPTION MESSAGE -----------");
                sb2.append("\r\n");
                if (TextUtils.isEmpty(M2)) {
                    M2 = "[empty exception message]";
                }
                sb2.append(M2);
                sb2.append("\r\n");
                sb2.append("\r\n");
                sb2.append("----------- FULL STACK TRACE -----------");
                sb2.append("\r\n");
                if (TextUtils.isEmpty(N2)) {
                    N2 = "[empty stack trace]";
                }
                sb2.append(N2);
                sb2.append("\r\n");
                sb2.append("\r\n");
                InputStream inputStream3 = Runtime.getRuntime().exec(new String[]{"logcat", "-d", "-v", "time"}).getInputStream();
                try {
                    byte[] bArr = new byte[65536];
                    while (inputStream3.read(bArr) != -1) {
                        sb2.append(t.U(bArr));
                    }
                    N(inputStream3);
                    String sb3 = sb2.toString();
                    FileWriter fileWriter = new FileWriter(file4);
                    try {
                        fileWriter.write(sb3);
                        fileWriter.flush();
                        N(fileWriter);
                        ArrayList arrayList = new ArrayList();
                        if (file4.exists()) {
                            arrayList.add(file4);
                        }
                        E4(file3, arrayList);
                        httpURLConnection2 = (HttpURLConnection) url.openConnection();
                    } catch (Throwable th) {
                        N(fileWriter);
                        throw th;
                    }
                } catch (Throwable th2) {
                    N(inputStream3);
                    throw th2;
                }
            } catch (Exception e2) {
                e = e2;
                httpURLConnection = null;
                inputStream = null;
            } catch (Throwable th3) {
                th = th3;
                httpURLConnection = null;
                inputStream = null;
            }
        } catch (Exception e3) {
            e = e3;
            httpURLConnection = null;
            inputStream = null;
            file2 = null;
            inputStream2 = null;
        } catch (Throwable th4) {
            th = th4;
            httpURLConnection = null;
            inputStream = null;
            file2 = null;
            inputStream2 = null;
        }
        try {
            httpURLConnection2.setDoInput(true);
            httpURLConnection2.setDoOutput(true);
            httpURLConnection2.setUseCaches(false);
            httpURLConnection2.setRequestMethod("POST");
            httpURLConnection2.setRequestProperty("Connection", "Keep-Alive");
            httpURLConnection2.setRequestProperty("Accept-Encoding", "");
            httpURLConnection2.setRequestProperty("Content-Type", "multipart/form-data;boundary=*****");
            httpURLConnection2.setConnectTimeout(60000);
            httpURLConnection2.setReadTimeout(60000);
            DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection2.getOutputStream());
            try {
                dataOutputStream.writeBytes("--*****\r\n");
                dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"/" + file3.getName() + "\"\r\n");
                dataOutputStream.writeBytes("\r\n");
                inputStream = new FileInputStream(file3);
                try {
                    inputStream2 = new BufferedInputStream(inputStream);
                    while (true) {
                        try {
                            byte[] bArr2 = new byte[131072];
                            int read = inputStream2.read(bArr2);
                            if (read <= 0) {
                                break;
                            } else {
                                dataOutputStream.write(bArr2, 0, read);
                            }
                        } catch (Exception e4) {
                            e = e4;
                            closeable = dataOutputStream;
                            httpURLConnection = httpURLConnection2;
                            e = e;
                            try {
                                e.printStackTrace();
                                P(closeable, inputStream2, inputStream);
                                r0(httpURLConnection);
                                p0(file2);
                            } catch (Throwable th5) {
                                th = th5;
                                P(closeable, inputStream2, inputStream);
                                r0(httpURLConnection);
                                p0(file2);
                                throw th;
                            }
                        } catch (Throwable th6) {
                            th = th6;
                            closeable = dataOutputStream;
                            httpURLConnection = httpURLConnection2;
                            th = th;
                            P(closeable, inputStream2, inputStream);
                            r0(httpURLConnection);
                            p0(file2);
                            throw th;
                        }
                    }
                    Thread.sleep(100L);
                    dataOutputStream.writeBytes("\r\n");
                    dataOutputStream.writeBytes("--*****--\r\n");
                    dataOutputStream.flush();
                    int responseCode = httpURLConnection2.getResponseCode();
                    httpURLConnection2.getResponseMessage();
                    if (responseCode != 200) {
                        P(dataOutputStream, inputStream2, inputStream);
                    } else {
                        InputStream inputStream4 = httpURLConnection2.getInputStream();
                        try {
                            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                            byte[] bArr3 = new byte[8192];
                            while (true) {
                                int read2 = inputStream4.read(bArr3);
                                if (-1 == read2) {
                                    break;
                                } else {
                                    byteArrayOutputStream.write(bArr3, 0, read2);
                                }
                            }
                            String byteArrayOutputStream2 = byteArrayOutputStream.toString("UTF-8");
                            if (!TextUtils.isEmpty(byteArrayOutputStream2)) {
                                l("XOneAndroidFramework", "Response: " + byteArrayOutputStream2);
                            }
                            N(inputStream4);
                            file.createNewFile();
                            P(dataOutputStream, inputStream2, inputStream);
                        } catch (Throwable th7) {
                            N(inputStream4);
                            throw th7;
                        }
                    }
                    r0(httpURLConnection2);
                } catch (Exception e5) {
                    e = e5;
                    inputStream2 = null;
                } catch (Throwable th8) {
                    th = th8;
                    inputStream2 = null;
                }
            } catch (Exception e6) {
                e = e6;
                inputStream = null;
                inputStream2 = null;
            } catch (Throwable th9) {
                th = th9;
                inputStream = null;
                inputStream2 = null;
            }
        } catch (Exception e7) {
            httpURLConnection = httpURLConnection2;
            e = e7;
            inputStream = null;
            inputStream2 = inputStream;
            e.printStackTrace();
            P(closeable, inputStream2, inputStream);
            r0(httpURLConnection);
            p0(file2);
        } catch (Throwable th10) {
            httpURLConnection = httpURLConnection2;
            th = th10;
            inputStream = null;
            inputStream2 = inputStream;
            P(closeable, inputStream2, inputStream);
            r0(httpURLConnection);
            p0(file2);
            throw th;
        }
        p0(file2);
    }

    public static long b0(InputStream inputStream, OutputStream outputStream) {
        byte[] bArr = new byte[4096];
        long j2 = 0;
        while (true) {
            int read = inputStream.read(bArr);
            if (-1 == read) {
                return j2;
            }
            outputStream.write(bArr, 0, read);
            j2 += read;
        }
    }

    public static String b1(Context context) {
        try {
            try {
                Context applicationContext = context.getApplicationContext();
                Uri parse = Uri.parse("content://com.xone.dpc.dataprovider");
                ContentResolver contentResolver = applicationContext.getContentResolver();
                if (contentResolver == null) {
                    throw new C0395b();
                }
                Cursor query = contentResolver.query(parse, new String[]{"DEVICE_IDS"}, null, null, null);
                if (query == null) {
                    throw new C0395b();
                }
                if (!query.moveToFirst()) {
                    throw new C0395b();
                }
                String string = query.getString(query.getColumnIndex("PRIMARY_DEVICE_ID"));
                if (TextUtils.isEmpty(string)) {
                    throw new C0395b();
                }
                J(query);
                return string;
            } catch (Exception e2) {
                e2.printStackTrace();
                U3(context, e2);
                throw new C0395b();
            }
        } catch (Throwable th) {
            J(null);
            throw th;
        }
    }

    public static BluetoothAdapter b2(Context context) {
        try {
            if (context.getApplicationContext().getPackageManager().hasSystemFeature("android.hardware.bluetooth_le")) {
                return a2();
            }
            return null;
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static boolean b3(String str) {
        for (char c2 : str.toCharArray()) {
            if (Character.UnicodeBlock.of(c2) == Character.UnicodeBlock.ARABIC) {
                return true;
            }
        }
        return false;
    }

    public static void b4(WeakReference weakReference, CharSequence charSequence) {
        TextView textView = (TextView) weakReference.get();
        if (textView == null) {
            return;
        }
        textView.setText(charSequence);
    }

    public static void c0(InputStream inputStream, File file) {
        Throwable th;
        FileOutputStream fileOutputStream;
        FileChannel fileChannel;
        if (inputStream == null) {
            throw new IllegalArgumentException("Source input stream argument cannot be null");
        }
        if (file == null) {
            throw new IllegalArgumentException("Destination file argument cannot be null");
        }
        File parentFile = file.getParentFile();
        if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs()) {
            throw new IOException("Cannot create parent directory " + parentFile.getAbsolutePath());
        }
        if (inputStream instanceof FileInputStream) {
            FileChannel fileChannel2 = null;
            try {
                fileOutputStream = new FileOutputStream(file);
                try {
                    FileChannel channel = ((FileInputStream) inputStream).getChannel();
                    try {
                        fileChannel = fileOutputStream.getChannel();
                        try {
                            if (channel.size() > 0) {
                                fileChannel.transferFrom(channel, 0L, channel.size());
                            }
                            P(channel, fileChannel, fileOutputStream);
                        } catch (Throwable th2) {
                            th = th2;
                            fileChannel2 = channel;
                            P(fileChannel2, fileChannel, fileOutputStream);
                            throw th;
                        }
                    } catch (Throwable th3) {
                        th = th3;
                        fileChannel = null;
                    }
                } catch (Throwable th4) {
                    th = th4;
                    fileChannel = null;
                }
            } catch (Throwable th5) {
                th = th5;
                fileOutputStream = null;
                fileChannel = null;
            }
        } else {
            FileOutputStream fileOutputStream2 = new FileOutputStream(file);
            try {
                byte[] bArr = new byte[1000000];
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        return;
                    } else {
                        fileOutputStream2.write(bArr, 0, read);
                    }
                }
            } finally {
                N(fileOutputStream2);
            }
        }
    }

    public static String c1(Context context) {
        return q4(context, Calendar.getInstance().getTime());
    }

    public static String c2(String str) {
        return d2(str, ";");
    }

    public static boolean c3() {
        if (M0().equals("debug")) {
            return true;
        }
        String R0 = R0();
        if (TextUtils.isEmpty(R0)) {
            return false;
        }
        return R0.equals("playStoreDeveloper");
    }

    public static void c4(Context context, String str, int i2, CharSequence charSequence, CharSequence charSequence2, int i3) {
        Context applicationContext = context.getApplicationContext();
        NotificationManager notificationManager = (NotificationManager) y2(applicationContext, "notification");
        String D = D(applicationContext, str);
        r.e eVar = TextUtils.isEmpty(D) ? new r.e(applicationContext) : new r.e(applicationContext, D);
        eVar.y(i3);
        eVar.l(charSequence2);
        eVar.m(charSequence);
        eVar.f(true);
        eVar.w(2);
        eVar.s(-1, 1000, 1000);
        eVar.A(new r.c().h(charSequence2));
        eVar.k(PendingIntent.getBroadcast(applicationContext, i2, new Intent(), l2(true, 268435456)));
        notificationManager.notify(i2, eVar.c());
    }

    public static void d0(Context context, int i2, File file) {
        if (context == null) {
            throw new IllegalArgumentException("Null context object");
        }
        e0(context.getApplicationContext().getResources(), i2, file);
    }

    public static int d1(Context context, String str, int i2) {
        return g1(context.getResources(), str, -1, i2, i2, -1);
    }

    public static String d2(String str, String str2) {
        try {
            if (TextUtils.isEmpty(str)) {
                return "";
            }
            if (TextUtils.isEmpty(str2)) {
                str2 = ";";
            }
            String[] split = str.split(str2);
            return split.length == 0 ? "" : split[0];
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    public static boolean d3(Context context) {
        ApplicationInfo applicationInfo = context.getApplicationInfo();
        int i2 = applicationInfo.flags & 2;
        applicationInfo.flags = i2;
        if (i2 != 0) {
            return true;
        }
        String R0 = R0();
        if (TextUtils.isEmpty(R0)) {
            return false;
        }
        return R0.equals("playStoreDeveloper");
    }

    public static void d4(final Context context, final int i2) {
        if (s3()) {
            Toast.makeText(context, i2, 1).show();
        } else {
            j.m(new Runnable() {
                @Override
                public final void run() {
                    Toast.makeText(context, i2, 1).show();
                }
            });
        }
    }

    public static void e0(Resources resources, int i2, File file) {
        InputStream inputStream;
        FileOutputStream fileOutputStream;
        if (resources == null) {
            throw new IllegalArgumentException("Null resources object");
        }
        if (file == null) {
            throw new IllegalArgumentException("Empty target parameter");
        }
        FileOutputStream fileOutputStream2 = null;
        try {
            inputStream = resources.openRawResource(i2);
            try {
                fileOutputStream = new FileOutputStream(file);
            } catch (Throwable th) {
                th = th;
            }
        } catch (Throwable th2) {
            th = th2;
            inputStream = null;
        }
        try {
            b0(inputStream, fileOutputStream);
            P(fileOutputStream, inputStream);
        } catch (Throwable th3) {
            th = th3;
            fileOutputStream2 = fileOutputStream;
            P(fileOutputStream2, inputStream);
            throw th;
        }
    }

    public static int e1(Context context, String str, int i2, int i3, int i4) {
        return g1(context.getResources(), str, i2, i3, i4, -1);
    }

    public static String e2(Context context) {
        try {
            String string = context.getApplicationContext().getSharedPreferences("OverridenBuildValues", 0).getString("DeviceId", "");
            return TextUtils.isEmpty(string) ? "" : string;
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    public static boolean e3(Context context) {
        boolean isDeviceLocked;
        KeyguardManager O1 = O1(context);
        if (Build.VERSION.SDK_INT < 22) {
            return O1.isKeyguardLocked();
        }
        isDeviceLocked = O1.isDeviceLocked();
        return isDeviceLocked;
    }

    public static void e4(final Context context, final int i2, final CharSequence charSequence, final int i3, final File file, final int i4, final int i5, final boolean z) {
        if (!s3()) {
            j.m(new Runnable() {
                @Override
                public final void run() {
                    Utils.e4(context, i2, charSequence, i3, file, i4, i5, z);
                }
            });
            return;
        }
        Toast makeText = Toast.makeText(context.getApplicationContext(), charSequence, i5);
        E(makeText, i2, i3, file, i4, z);
        makeText.show();
    }

    public static void f(String str) {
        if (s3()) {
            throw new IllegalStateException(str + " cannot be called from the UI thread");
        }
    }

    public static boolean f0(Context context, File file, String str, String str2) {
        boolean isRequestPinShortcutSupported;
        ShortcutInfo build;
        Icon createWithBitmap;
        String p1 = p1(file.getParent(), "app.ini", "Caption");
        if (TextUtils.isEmpty(p1)) {
            p1 = str2;
        }
        Bitmap A2 = A2(context, file);
        Intent H1 = H1(context, str, str2);
        if (Build.VERSION.SDK_INT < 26) {
            Intent intent = new Intent();
            intent.putExtra("android.intent.extra.shortcut.ICON", A2);
            intent.putExtra("android.intent.extra.shortcut.INTENT", H1);
            intent.putExtra("android.intent.extra.shortcut.NAME", p1);
            intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
            context.sendBroadcast(intent);
            return true;
        }
        ShortcutManager a2 = AbstractC0313i1.a(y2(context, "shortcut"));
        isRequestPinShortcutSupported = a2.isRequestPinShortcutSupported();
        if (!isRequestPinShortcutSupported) {
            l("XOneAndroidFramework", "Cannot create shortcut for app " + str2 + ", shortcuts are disabled on this launcher application, or they are not supported.");
            return false;
        }
        ShortcutInfo.Builder a3 = AbstractC0298d1.a(context, str2);
        a3.setIntent(H1);
        a3.setShortLabel(p1);
        if (A2 != null) {
            createWithBitmap = Icon.createWithBitmap(A2);
            a3.setIcon(createWithBitmap);
        }
        try {
            build = a3.build();
            a2.requestPinShortcut(build, null);
            return true;
        } catch (IllegalStateException unused) {
            l("XOneAndroidFramework", "Cannot create new shortcut for application " + str2 + ", no activity or service in foreground.");
            return true;
        }
    }

    public static int f1(Context context, String str, int i2, int i3, int i4, int i5) {
        return g1(context.getResources(), str, i2, i3, i4, i5);
    }

    public static PackageInfo f2(PackageManager packageManager, String str) {
        try {
            return packageManager.getPackageInfo(str, 128);
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    public static boolean f3(Context context) {
        String str = Build.TAGS;
        return (str != null && str.contains("test-keys")) || l3(context, "eu.chainfire.supersu") || l3(context, "com.noshufou.android.su") || new File("/system/app/Superuser.apk").exists() || new File("/system/xbin/su").exists() || new File("/system/sbin/su").exists() || new File("/bin/su").exists() || new File("/sbin/su").exists();
    }

    public static void f4(final Context context, final View view) {
        if (s3()) {
            i4(context, view);
        } else {
            j.m(new Runnable() {
                @Override
                public final void run() {
                    Utils.i4(context, view);
                }
            });
        }
    }

    public static void g(String str, Object[] objArr, int i2) {
        if (objArr == null) {
            if (i2 == 0) {
                return;
            }
            throw new IllegalArgumentException("Error de ejecución. Número incorrecto de parámetros para '" + str + "'");
        }
        if (objArr.length == i2) {
            return;
        }
        throw new IllegalArgumentException("Error de ejecución. Número incorrecto de parámetros para '" + str + "'");
    }

    public static boolean g0(Context context, String str, String str2, File file, boolean z, Bundle bundle) {
        ShortcutInfo build;
        Icon createWithBitmap;
        PackageManager packageManager = context.getPackageManager();
        String packageName = context.getPackageName();
        File file2 = new File(packageManager.getPackageInfo(packageName, 0).applicationInfo.dataDir, "/app_" + str);
        if (file == null || !file.exists() || !file.isFile()) {
            file = new File(file2, "/icon.png");
        }
        if (TextUtils.isEmpty(str2)) {
            str2 = p1(file2.getAbsolutePath(), "app.ini", "Caption");
            if (TextUtils.isEmpty(str2)) {
                str2 = str;
            }
        }
        if (!file.exists() || !file.isFile()) {
            return false;
        }
        Bitmap A2 = A2(context, file);
        Intent H1 = H1(context, packageName, str);
        H1.putExtras(bundle);
        if (Build.VERSION.SDK_INT < 26) {
            Intent intent = new Intent();
            intent.putExtra("android.intent.extra.shortcut.ICON", A2);
            intent.putExtra("android.intent.extra.shortcut.INTENT", H1);
            intent.putExtra("android.intent.extra.shortcut.NAME", str2);
            if (z) {
                intent.putExtra("duplicate", false);
            }
            intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
            context.sendBroadcast(intent);
            return true;
        }
        ShortcutManager a2 = AbstractC0313i1.a(y2(context, "shortcut"));
        ShortcutInfo.Builder a3 = AbstractC0298d1.a(context, str);
        a3.setIntent(H1);
        a3.setShortLabel(str2);
        if (A2 != null) {
            createWithBitmap = Icon.createWithBitmap(A2);
            a3.setIcon(createWithBitmap);
        }
        build = a3.build();
        a2.requestPinShortcut(build, null);
        return true;
    }

    public static int g1(Resources resources, String str, int i2, int i3, int i4, int i5) {
        if (TextUtils.isEmpty(str)) {
            return i5;
        }
        String trim = str.trim();
        if (trim.indexOf("dp") >= 0) {
            return (int) z4(resources, s2(Integer.parseInt(trim.substring(0, r7)), i2, i4));
        }
        int indexOf = trim.indexOf("p");
        if (indexOf >= 0) {
            return s2(Integer.parseInt(trim.substring(0, indexOf)), i2, i4);
        }
        int indexOf2 = trim.indexOf("%");
        if (indexOf2 < 0) {
            int parseInt = Integer.parseInt(trim);
            return parseInt >= 0 ? i2 > 0 ? s2(parseInt, i2, i4) : (int) z4(resources, s2(parseInt, i2, i4)) : parseInt;
        }
        if (i4 < 0) {
            return -2;
        }
        double parseDouble = Double.parseDouble(trim.substring(0, indexOf2)) / 100.0d;
        return i3 < 0 ? (int) (i4 * parseDouble) : (int) (i3 * parseDouble);
    }

    public static String g2(String str, File file, String str2) {
        if (TextUtils.isEmpty(str)) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): sAppName == null");
        }
        if (file == null) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): sExecutionPath == null");
        }
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): sValue == null");
        }
        if (!file.exists()) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): Execution path does not exist");
        }
        if (!file.isDirectory()) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): Execution path is not a directory");
        }
        File A1 = A1(file, "files", str2);
        if (A1 != null) {
            return A1.getAbsolutePath();
        }
        String E0 = E0(str, file.getAbsolutePath(), str2, false, 1);
        File A12 = A1(E0);
        return A12 != null ? A12.getAbsolutePath() : E0;
    }

    public static boolean g3(Context context) {
        if (Build.VERSION.SDK_INT >= 29) {
            return true;
        }
        return !C9.e.c(context.getApplicationContext(), "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_EXTERNAL_STORAGE");
    }

    public static void g4(Context context, CharSequence charSequence) {
        h4(context, charSequence, 1);
    }

    @Keep
    public static String getIntuneAgentOutdatedMessage() {
        String agentOutdatedMessage;
        return (isIntuneCompilation() && (agentOutdatedMessage = MAMComponents.getAgentOutdatedMessage()) != null) ? agentOutdatedMessage : "";
    }

    @Keep
    public static String getIntuneId() {
        MAMUserInfo mAMUserInfo;
        String primaryUser;
        return (!isIntuneCompilation() || (mAMUserInfo = (MAMUserInfo) MAMComponents.get(MAMUserInfo.class)) == null || (primaryUser = mAMUserInfo.getPrimaryUser()) == null) ? "" : primaryUser;
    }

    public static void h(String str, Object[] objArr, int i2, int i3) {
        if (objArr == null) {
            if (i2 == 0) {
                return;
            }
            throw new IllegalArgumentException("Error de ejecución. Número incorrecto de parámetros para '" + str + "'");
        }
        if (objArr.length < i2) {
            throw new IllegalArgumentException("Error de ejecución. Número incorrecto de parámetros para '" + str + "'");
        }
        if (objArr.length <= i3 || i3 == -1) {
            return;
        }
        throw new IllegalArgumentException("Error de ejecución. Número incorrecto de parámetros para '" + str + "'");
    }

    public static byte[] h0(byte[] bArr) {
        ByteArrayOutputStream byteArrayOutputStream;
        if (bArr == null) {
            throw new IllegalArgumentException("Input buffer must not be null");
        }
        DeflaterOutputStream deflaterOutputStream = null;
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            try {
                DeflaterOutputStream deflaterOutputStream2 = new DeflaterOutputStream(byteArrayOutputStream);
                try {
                    deflaterOutputStream2.write(bArr);
                    deflaterOutputStream2.close();
                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                    P(deflaterOutputStream2, byteArrayOutputStream);
                    return byteArray;
                } catch (Throwable th) {
                    th = th;
                    deflaterOutputStream = deflaterOutputStream2;
                    P(deflaterOutputStream, byteArrayOutputStream);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            th = th3;
            byteArrayOutputStream = null;
        }
    }

    public static int h1(String str, int i2) {
        if (TextUtils.isEmpty(str)) {
            return -1;
        }
        int indexOf = str.indexOf("p");
        if (indexOf >= 0) {
            return Integer.parseInt(str.substring(0, indexOf));
        }
        int indexOf2 = str.indexOf("%");
        return indexOf2 >= 0 ? (int) ((i2 * Double.parseDouble(str.substring(0, indexOf2))) / 100.0d) : Integer.parseInt(str);
    }

    public static String h2(String str, String str2, String str3) {
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getPathFromAllDirectories(): sExecutionPath == null");
        }
        return g2(str, new File(str2), str3);
    }

    public static boolean h3(Context context) {
        return context.getApplicationContext().getPackageManager().hasSystemFeature("android.hardware.location.gps");
    }

    public static void h4(final Context context, final CharSequence charSequence, final int i2) {
        if (s3()) {
            Toast.makeText(context, charSequence, i2).show();
        } else {
            j.m(new Runnable() {
                @Override
                public final void run() {
                    Toast.makeText(context, charSequence, i2).show();
                }
            });
        }
    }

    public static void i(String str, Object[] objArr, int i2) {
        if (objArr == null) {
            if (i2 == 0) {
                return;
            }
            throw new IllegalArgumentException("Error de ejecución. Se necesita un mínimo de " + i2 + " parámetros para '" + str + "'");
        }
        if (objArr.length >= i2) {
            return;
        }
        throw new IllegalArgumentException("Error de ejecución. Se necesita un mínimo de " + i2 + " parámetros para '" + str + "'");
    }

    public static byte[] i0(byte[] bArr) {
        ByteArrayOutputStream byteArrayOutputStream;
        GZIPOutputStream gZIPOutputStream = null;
        try {
            byteArrayOutputStream = new ByteArrayOutputStream();
            try {
                GZIPOutputStream gZIPOutputStream2 = new GZIPOutputStream(byteArrayOutputStream);
                try {
                    gZIPOutputStream2.write(bArr);
                    N(gZIPOutputStream2);
                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                    P(gZIPOutputStream2, byteArrayOutputStream);
                    return byteArray;
                } catch (Throwable th) {
                    th = th;
                    gZIPOutputStream = gZIPOutputStream2;
                    P(gZIPOutputStream, byteArrayOutputStream);
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            th = th3;
            byteArrayOutputStream = null;
        }
    }

    public static int i1(Resources resources, String str, int i2, int i3, int i4, int i5) {
        if (TextUtils.isEmpty(str)) {
            return i5;
        }
        String trim = str.trim();
        if (trim.indexOf("dp") >= 0) {
            return (int) z4(resources, s2(Integer.parseInt(trim.substring(0, r7)), i2, i4));
        }
        int indexOf = trim.indexOf("p");
        if (indexOf >= 0) {
            return s2(Integer.parseInt(trim.substring(0, indexOf)), i2, i4);
        }
        int indexOf2 = trim.indexOf("%");
        if (indexOf2 < 0) {
            int parseInt = Integer.parseInt(trim);
            return parseInt >= 0 ? (int) z4(resources, parseInt) : parseInt;
        }
        if (i4 < 0) {
            return -2;
        }
        double parseDouble = Double.parseDouble(trim.substring(0, indexOf2)) / 100.0d;
        return i3 < 0 ? (int) (i4 * parseDouble) : (int) (i3 * parseDouble);
    }

    public static String i2(String str, String str2, String str3) {
        try {
            return h2(str, str2, str3);
        } catch (Exception unused) {
            return null;
        }
    }

    public static boolean i3(Context context) {
        if ((context.getResources().getConfiguration().screenLayout & 2) > 0) {
            DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
            if (context.getResources().getConfiguration().orientation == 1) {
                return displayMetrics.widthPixels > 700 && displayMetrics.heightPixels > 1200;
            }
            if (displayMetrics.widthPixels > 1200 && displayMetrics.heightPixels > 700) {
                return true;
            }
        }
        return false;
    }

    public static void i4(Context context, View view) {
        Toast toast = new Toast(context);
        toast.setDuration(1);
        toast.setGravity(80, 0, 0);
        toast.setView(view);
        toast.show();
    }

    @Keep
    public static boolean isIntuneAgentOutdated() {
        if (isIntuneCompilation()) {
            return MAMComponents.getAgentOutdated();
        }
        return false;
    }

    @Keep
    public static boolean isIntuneCompilation() {
        return M.d("com.microsoft.intune.mam.policy.MAMUserInfo") != null;
    }

    @Keep
    public static boolean isIntunePinRequired(Context context) {
        if (isIntuneCompilation()) {
            return MAMPolicyManager.getPolicy(context.getApplicationContext()).getIsPinRequired();
        }
        return false;
    }

    public static void j(String str, Object[] objArr) {
        if (objArr != null) {
            return;
        }
        throw new IllegalArgumentException("Error de ejecución. Faltan parámetros para '" + str + "'");
    }

    public static boolean j0(Context context, String str, String str2) {
        String packageName = context.getPackageName();
        if (TextUtils.isEmpty(str2)) {
            str2 = p1(new File(context.getPackageManager().getPackageInfo(packageName, 0).applicationInfo.dataDir, "/app_" + str).getAbsolutePath(), "app.ini", "Caption");
            if (TextUtils.isEmpty(str2)) {
                str2 = str;
            }
        }
        Intent H1 = H1(context, packageName, str);
        Intent intent = new Intent();
        intent.putExtra("android.intent.extra.shortcut.INTENT", H1);
        intent.putExtra("android.intent.extra.shortcut.NAME", str2);
        intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
        context.sendBroadcast(intent);
        return true;
    }

    public static File j1(String str, File file, String str2, boolean z) {
        File l1;
        File l12;
        if (TextUtils.isEmpty(str)) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): sAppName == null");
        }
        if (file == null) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): sExecutionPath == null");
        }
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): sValue == null");
        }
        if (!file.exists()) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): Execution path does not exist");
        }
        if (!file.isDirectory()) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): Execution path is not a directory");
        }
        if (str2.startsWith("##APP##")) {
            str2 = str2.replace("##APP##", file.getAbsolutePath());
        }
        File l13 = l1(file, "files", str2);
        if (l13 != null) {
            return l13;
        }
        if (z && (l12 = l1(file, "icons", str2)) != null) {
            return l12;
        }
        File l14 = l1(E0(str, file.getAbsolutePath(), str2, false, 1));
        if (l14 != null) {
            return l14;
        }
        if (z && (l1 = l1(E0(str, file.getAbsolutePath(), str2, false, 2))) != null) {
            return l1;
        }
        throw new NullPointerException("getDirectoryFromAllDirectories(): Cannot find file " + str2);
    }

    public static String j2(String str, String str2, String str3) {
        if (!TextUtils.isEmpty(str3) && (str3.toLowerCase().startsWith("http://") || str3.toLowerCase().startsWith("https://"))) {
            return str3;
        }
        File q1 = q1(str, str2, str3, false, 1);
        if (q1.exists()) {
            return q1.getAbsolutePath();
        }
        File q12 = q1(str, str2, str3, false, 3);
        if (q12.exists()) {
            return q12.getAbsolutePath();
        }
        File q13 = q1(str, str2, str3, false, 4);
        if (q13.exists()) {
            return q13.getAbsolutePath();
        }
        File q14 = q1(str, str2, str3, false, 2);
        if (q14.exists()) {
            return q14.getAbsolutePath();
        }
        throw new FileNotFoundException("File " + q14.getName() + " not found on any resource directory");
    }

    public static boolean j3(Context context) {
        Context applicationContext = context.getApplicationContext();
        return k3(applicationContext, applicationContext.getPackageName());
    }

    public static String[] j4(String str) {
        String[] split = str.split(":");
        try {
            Integer.parseInt(split[0]);
            return split;
        } catch (NumberFormatException unused) {
            String[] split2 = str.split("\\.");
            Integer.parseInt(split2[0]);
            return split2;
        }
    }

    public static void k(String str, CharSequence charSequence) {
        AbstractC0750e.e(str, charSequence);
    }

    public static void k0(File file) {
        if (file == null || !file.exists() || file.delete()) {
            return;
        }
        throw AbstractC0751f.c("Cannot delete file " + file.getAbsolutePath());
    }

    public static File k1(String str, String str2, String str3, boolean z) {
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getDirectoryFromAllDirectories(): sExecutionPath == null");
        }
        return j1(str, new File(str2), str3, z);
    }

    public static File k2(Object... objArr) {
        if (objArr == null || objArr.length == 0) {
            return null;
        }
        StringBuilder sb2 = new StringBuilder();
        for (Object obj : objArr) {
            if (obj != null) {
                if (obj instanceof File) {
                    sb2.append(((File) obj).getAbsolutePath());
                    sb2.append(File.separator);
                } else {
                    if (!(obj instanceof CharSequence)) {
                        throw new IllegalArgumentException("getFileIfExists(): Invalid argument of type: " + obj.getClass().getSimpleName());
                    }
                    sb2.append(obj);
                    sb2.append(File.separator);
                }
            }
        }
        File file = new File(sb2.toString());
        if (file.exists()) {
            return file;
        }
        return null;
    }

    public static boolean k3(Context context, String str) {
        boolean isIgnoringBatteryOptimizations;
        Context applicationContext = context.getApplicationContext();
        if (Build.VERSION.SDK_INT < 23) {
            return true;
        }
        isIgnoringBatteryOptimizations = o2(applicationContext).isIgnoringBatteryOptimizations(str);
        return isIgnoringBatteryOptimizations;
    }

    public static boolean k4(Context context, String str, String str2, Bundle bundle) {
        ComponentName startForegroundService;
        if (g == null) {
            Class d2 = M.d("com.xone.replicator.ReplicatorIntentService");
            g = d2;
            if (d2 == null) {
                return false;
            }
        }
        Context applicationContext = context.getApplicationContext();
        if (TextUtils.isEmpty(str)) {
            str = "Framework";
        }
        Intent intent = new Intent();
        intent.setClass(applicationContext, g);
        intent.setFlags(268435456);
        intent.putExtra("com.xone.android.replicator.source", str);
        if (bundle != null) {
            intent.putExtra("com.xone.android.replicator.params", bundle);
        }
        if (!TextUtils.isEmpty(str2)) {
            intent.setAction(str2);
        }
        try {
            return applicationContext.startService(intent) != null;
        } catch (IllegalStateException e2) {
            if (H2(applicationContext) < 26 || Build.VERSION.SDK_INT < 26) {
                throw e2;
            }
            l("XOneReplicator", "Utils.startReplicator(): Catched an IllegalStateException while starting replicator cycle, targetSdkVersion >= 26 and Android >= 8.X, retrying as a foreground service");
            intent.putExtra("isForegroundService", true);
            startForegroundService = applicationContext.startForegroundService(intent);
            return startForegroundService != null;
        }
    }

    public static void l(String str, String str2) {
        AbstractC0750e.e(str, str2);
    }

    public static void l0(File file) {
        if (file == null) {
            return;
        }
        try {
            if (file.exists() && !file.delete()) {
                l("XOneAndroidFramework", "Error deleting file " + file.getAbsolutePath());
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static File l1(Object... objArr) {
        File k2 = k2(objArr);
        if (k2 == null || k2.isDirectory()) {
            return k2;
        }
        return null;
    }

    public static int l2(boolean r3, int... r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.xone.android.utils.Utils.l2(boolean, int[]):int");
    }

    public static boolean l3(Context context, String str) {
        return context.getApplicationContext().getPackageManager().getPackageInfo(str, 0) != null;
    }

    public static boolean l4(Context context) {
        ComponentName startForegroundService;
        if (g == null) {
            Class d2 = M.d("com.xone.replicator.ReplicatorIntentService");
            g = d2;
            if (d2 == null) {
                return false;
            }
        }
        Context applicationContext = context.getApplicationContext();
        Intent intent = new Intent();
        intent.setClass(applicationContext, g);
        intent.setFlags(268435456);
        intent.putExtra("com.xone.android.replicator.source", "Framework");
        intent.setAction("com.xone.android.framework.replica.stop");
        try {
            return applicationContext.startService(intent) != null;
        } catch (IllegalStateException e2) {
            if (H2(applicationContext) < 26 || Build.VERSION.SDK_INT < 26) {
                throw e2;
            }
            l("XOneReplicator", "Utils.startReplicator(): Catched an IllegalStateException while starting replicator cyle, targetSdkVersion >= 26 and Android >= 8.X, retrying as a foreground service");
            intent.putExtra("isForegroundService", true);
            startForegroundService = applicationContext.startForegroundService(intent);
            return startForegroundService != null;
        }
    }

    public static void m(String str, String str2) {
        AbstractC0750e.b(str, str2);
    }

    public static void m0(File... fileArr) {
        if (fileArr == null) {
            return;
        }
        for (File file : fileArr) {
            l0(file);
        }
    }

    public static double m1(CharSequence charSequence, double d2) {
        if (!TextUtils.isEmpty(charSequence)) {
            try {
                return Double.parseDouble(charSequence.toString());
            } catch (Exception unused) {
            }
        }
        return d2;
    }

    public static int m2(Context context) {
        TelephonyManager I2 = I2(context.getApplicationContext());
        return Build.VERSION.SDK_INT >= 23 ? d.a(I2) : TextUtils.isEmpty(I2.getDeviceId()) ? 0 : 1;
    }

    public static boolean m3(Context context, Class cls) {
        return n3(context, cls.getName());
    }

    public static void m4(View view, Bitmap.CompressFormat compressFormat, int i2, int i3, String str) {
        view.setDrawingCacheQuality(1048576);
        view.setDrawingCacheEnabled(true);
        Bitmap drawingCache = view.getDrawingCache();
        if (drawingCache == null) {
            return;
        }
        if (drawingCache.getWidth() != i2 || drawingCache.getHeight() != i3) {
            Bitmap createScaledBitmap = Bitmap.createScaledBitmap(drawingCache, i2, i3, false);
            if (!drawingCache.isRecycled()) {
                drawingCache.recycle();
            }
            drawingCache = createScaledBitmap;
        }
        FileOutputStream fileOutputStream = new FileOutputStream(new File(str));
        try {
            drawingCache.compress(compressFormat, 100, fileOutputStream);
            N(fileOutputStream);
            view.setDrawingCacheEnabled(false);
            if (drawingCache.isRecycled()) {
                return;
            }
            drawingCache.recycle();
        } catch (Throwable th) {
            N(fileOutputStream);
            throw th;
        }
    }

    public static void n() {
        o("XOneAndroidFramework", null);
    }

    public static void n0(File file) {
        if (file.exists() && file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File file2 : listFiles) {
                    if (file2.isDirectory()) {
                        n0(file2);
                    } else if (!file2.delete()) {
                        l("XOneAndroidFramework", "Error, cannot delete file " + file2.getAbsolutePath());
                    }
                }
            }
            if (file.delete()) {
                return;
            }
            l("XOneAndroidFramework", "Error, cannot delete folder " + file.getAbsolutePath());
        }
    }

    public static String n1(JSONObject jSONObject) {
        String q = AbstractC0699l.q(jSONObject, "errorMessage");
        if (TextUtils.isEmpty(q)) {
            return "";
        }
        throw new C0394a(q);
    }

    public static String n2(Context context) {
        return ((TelephonyManager) y2(context, "phone")).getLine1Number();
    }

    public static boolean n3(Context context, String str) {
        Context applicationContext = context.getApplicationContext();
        List<ActivityManager.RunningServiceInfo> runningServices = F0(applicationContext).getRunningServices(Integer.MAX_VALUE);
        for (int i2 = 0; i2 < runningServices.size(); i2++) {
            if (applicationContext.getPackageName().equals(runningServices.get(i2).service.getPackageName()) && str.equals(runningServices.get(i2).service.getClassName())) {
                return true;
            }
        }
        return false;
    }

    public static byte[] n4(String str) {
        int length = str.length();
        byte[] bArr = new byte[length / 2];
        for (int i2 = 0; i2 < length; i2 += 2) {
            bArr[i2 / 2] = (byte) ((Character.digit(str.charAt(i2), 16) << 4) + Character.digit(str.charAt(i2 + 1), 16));
        }
        return bArr;
    }

    public static void o(String str, CharSequence charSequence) {
        if (!TextUtils.isEmpty(charSequence)) {
            k(str, charSequence);
        }
        l(str, L2(new a()));
    }

    public static boolean o0(File file) {
        File[] listFiles;
        if (!file.exists() || !file.isDirectory() || (listFiles = file.listFiles()) == null || listFiles.length == 0) {
            return false;
        }
        for (File file2 : listFiles) {
            if (file2.isDirectory()) {
                n0(file2);
            } else if (!file2.delete()) {
                l("XOneAndroidFramework", "Error, cannot delete " + file2.getAbsolutePath());
            }
        }
        return true;
    }

    public static String o1(File file, String str) {
        if (file.exists()) {
            return new C0694g(file).f(str);
        }
        return null;
    }

    public static PowerManager o2(Context context) {
        Object y2 = y2(context, "power");
        if (y2 instanceof PowerManager) {
            return (PowerManager) y2;
        }
        throw new NullPointerException("Cannot obtain PowerManager instance");
    }

    public static boolean o3(Context context) {
        int i2 = context.getResources().getConfiguration().screenLayout;
        if ((i2 & 2) <= 0) {
            return (i2 & 1) > 0;
        }
        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        return Math.sqrt(Math.pow((double) (((float) displayMetrics.widthPixels) / displayMetrics.xdpi), 2.0d) + Math.pow((double) (((float) displayMetrics.heightPixels) / displayMetrics.ydpi), 2.0d)) < 3.4d;
    }

    public static String o4(Context context, Calendar calendar) {
        return p4(context, calendar.getTime());
    }

    public static void p(Dialog dialog) {
        if (dialog == null) {
            return;
        }
        try {
            if (dialog.isShowing()) {
                dialog.dismiss();
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static void p0(File file) {
        if (file != null && file.exists() && file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File file2 : listFiles) {
                    if (file2.isDirectory()) {
                        p0(file2);
                    } else if (!file2.delete()) {
                        l("XOneAndroidFramework", "Error, cannot delete file " + file2.getAbsolutePath());
                    }
                }
            }
            if (file.delete()) {
                return;
            }
            l("XOneAndroidFramework", "Error, cannot delete folder " + file.getAbsolutePath());
        }
    }

    public static String p1(String str, String str2, String str3) {
        return o1(new File(str + "/" + str2), str3);
    }

    public static JSONObject p2(Context context) {
        JSONObject jSONObject = new JSONObject();
        long memoryClass = ((ActivityManager) y2(context, "activity")).getMemoryClass();
        Runtime runtime = Runtime.getRuntime();
        long maxMemory = runtime.maxMemory();
        long freeMemory = runtime.totalMemory() - runtime.freeMemory();
        long freeMemory2 = runtime.freeMemory();
        jSONObject.put("TOTAL", maxMemory);
        jSONObject.put("MAX", memoryClass);
        jSONObject.put("USED", freeMemory);
        jSONObject.put("FREE", freeMemory2);
        return jSONObject;
    }

    public static boolean p3() {
        if (TextUtils.isEmpty(b)) {
            return false;
        }
        return b.equals("playStoreDeveloper");
    }

    public static String p4(Context context, Date date) {
        return DateFormat.getDateFormat(context).format(date);
    }

    public static boolean q(Object[] objArr, int i2, boolean z) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? z : t.l(obj.toString(), z);
    }

    public static void q0(File file) {
        if (file.exists() && file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File file2 : listFiles) {
                    if (file2.isDirectory()) {
                        q0(file2);
                    } else if (!file2.delete()) {
                        throw new IOException("Error, cannot delete file " + file2.getAbsolutePath());
                    }
                }
            }
            if (file.delete()) {
                return;
            }
            throw new IOException("Error, cannot delete folder " + file.getAbsolutePath());
        }
    }

    public static File q1(String str, String str2, String str3, boolean z, int i2) {
        String E0 = E0(str, str2, str3, z, i2);
        if (TextUtils.isEmpty(E0)) {
            throw new NullPointerException("getFile(): sPath == null");
        }
        return new File(E0);
    }

    public static String q2(int i2) {
        StringBuilder sb2 = new StringBuilder(i2);
        for (int i3 = 0; i3 < i2; i3++) {
            sb2.append("ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(new Random().nextInt(26)));
        }
        return sb2.toString();
    }

    public static boolean q3(Context context) {
        return context.getApplicationContext().getResources().getBoolean(s.b);
    }

    public static String q4(Context context, Date date) {
        return DateFormat.getDateFormat(context).format(date) + ' ' + DateFormat.getTimeFormat(context).format(date);
    }

    public static Boolean r(Object[] objArr, int i2, Boolean bool) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? bool : t.m(obj.toString(), bool);
    }

    public static void r0(HttpURLConnection httpURLConnection) {
        if (httpURLConnection == null) {
            return;
        }
        try {
            httpURLConnection.disconnect();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public static String r1(File file) {
        return s1(file, "adler32", false);
    }

    public static Set r2(String str, boolean z) {
        int i2;
        int i3;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (z) {
            i2 = str.toLowerCase().indexOf("refresh");
            i3 = 7;
        } else {
            i2 = 0;
            i3 = 0;
        }
        if (i2 < 0) {
            return null;
        }
        int i4 = i2 + i3;
        if (i4 == str.length()) {
            HashSet hashSet = new HashSet(1);
            hashSet.add("255");
            return hashSet;
        }
        String trim = str.substring(i4).trim();
        if (trim.startsWith("(")) {
            int indexOf = trim.indexOf(")");
            if (indexOf < 0) {
                indexOf = trim.length();
            }
            return r4(trim.substring(1, indexOf).split(","));
        }
        if (!trim.startsWith(",")) {
            return r4(trim.split(","));
        }
        HashSet hashSet2 = new HashSet(1);
        hashSet2.add("255");
        return hashSet2;
    }

    public static boolean r3(Context context) {
        return (context.getResources().getConfiguration().screenLayout & 15) > 2;
    }

    public static Set r4(String... strArr) {
        if (strArr == null || strArr.length == 0) {
            return new HashSet();
        }
        HashSet hashSet = new HashSet(strArr.length);
        Collections.addAll(hashSet, strArr);
        return hashSet;
    }

    public static double s(Object[] objArr, int i2, double d2) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? d2 : q.i(obj, d2);
    }

    public static void s0(Uri uri, File file) {
        File parentFile = file.getParentFile();
        if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs()) {
            throw new IOException("Download failed! Cannot create parent folder " + parentFile.getAbsolutePath());
        }
        String uri2 = uri.toString();
        if (!uri2.startsWith("http://") && !uri2.startsWith("https://")) {
            throw new IllegalArgumentException("Invalid URL");
        }
        l("XOneAndroidFramework", "Downloading file " + uri2 + " to " + file.getAbsolutePath() + "...");
        W1.i b2 = new i.a().h(E.n).l(uri).k(15000).b();
        G7.a aVar = new G7.a();
        try {
            File file2 = (File) W1.h.p().k(b2, file, aVar).get();
            aVar.d();
            if (file2 == null) {
                throw new NullPointerException("Download failed, file == null");
            }
            if (!file2.exists()) {
                throw new IOException("Download failed, file doesn't exist");
            }
            if (file2.isFile()) {
                l("XOneAndroidFramework", "Download OK!");
                return;
            }
            throw new NullPointerException("Download failed, path " + file2.getAbsolutePath() + " is not a file");
        } catch (ExecutionException e2) {
            throw AbstractC0751f.f(e2);
        }
    }

    public static String s1(File file, String str, boolean z) {
        FileInputStream fileInputStream;
        FileInputStream fileInputStream2 = null;
        try {
            try {
                fileInputStream = new FileInputStream(file);
            } catch (Throwable th) {
                th = th;
            }
        } catch (FileNotFoundException e2) {
            e = e2;
        }
        try {
            String M1 = M1(fileInputStream, str, z);
            N(fileInputStream);
            return M1;
        } catch (FileNotFoundException e3) {
            e = e3;
            throw AbstractC0751f.e(e);
        } catch (Throwable th2) {
            th = th2;
            fileInputStream2 = fileInputStream;
            N(fileInputStream2);
            throw th;
        }
    }

    public static int s2(int i2, int i3, int i4) {
        return i3 < 0 ? i2 : (i2 * i4) / i3;
    }

    public static boolean s3() {
        Looper myLooper = Looper.myLooper();
        if (myLooper == null) {
            return false;
        }
        return myLooper.equals(Looper.getMainLooper());
    }

    public static String s4(byte b2) {
        return t4(b2, true);
    }

    public static float t(Object[] objArr, int i2, float f2) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? f2 : q.m(obj, f2);
    }

    public static void t0(String str, String str2) {
        s0(Uri.parse(str), new File(str2));
    }

    public static String t1(File file) {
        return file == null ? "" : u1(file.getAbsolutePath());
    }

    public static int t2(View view) {
        return view.getParent() == view.getRootView() ? view.getTop() : view.getTop() + t2((View) view.getParent());
    }

    public static boolean t3(Context context) {
        return context.getApplicationContext().getPackageManager().hasSystemFeature("android.hardware.type.watch");
    }

    public static String t4(byte b2, boolean z) {
        StringBuilder sb2 = new StringBuilder();
        sb2.append("0x");
        char[] cArr = i;
        sb2.append(cArr[(b2 & 255) >>> 4]);
        sb2.append(cArr[b2 & 15]);
        String sb3 = sb2.toString();
        if (!z) {
            return sb3;
        }
        return "(byte) " + sb3;
    }

    public static int u(Object[] objArr, int i2, int i3) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? i3 : q.p(obj, i3);
    }

    public static void u0(URL url, String str) {
        s0(Uri.parse(url.toString()), new File(str));
    }

    public static String u1(String str) {
        int lastIndexOf;
        return (!TextUtils.isEmpty(str) && (lastIndexOf = str.lastIndexOf(".")) >= 0) ? str.substring(lastIndexOf + 1).toLowerCase() : "";
    }

    public static String u2(Context context, boolean z) {
        DisplayMetrics displayMetrics = context.getApplicationContext().getResources().getDisplayMetrics();
        StringBuilder sb2 = new StringBuilder();
        if (z) {
            sb2.append('\"');
        }
        sb2.append(Build.MANUFACTURER);
        sb2.append(" ");
        String str = Build.MODEL;
        if (TextUtils.isEmpty(str)) {
            String str2 = Build.DEVICE;
            if (!TextUtils.isEmpty(str2)) {
                sb2.append(str2);
            }
        } else {
            sb2.append(str);
        }
        sb2.append(" ");
        sb2.append(Build.PRODUCT);
        sb2.append(" Display: ");
        sb2.append(displayMetrics.widthPixels);
        sb2.append("X");
        sb2.append(displayMetrics.heightPixels);
        if (z) {
            sb2.append('\"');
        }
        return sb2.toString();
    }

    public static boolean u3(File file) {
        if (file == null || !file.exists() || !file.getName().startsWith("app_")) {
            return false;
        }
        File file2 = new File(file, "license.ini");
        return file2.exists() && file2.isFile();
    }

    public static String u4(byte[] bArr) {
        StringBuilder sb2 = new StringBuilder();
        for (byte b2 : bArr) {
            sb2.append(t4(b2, true));
            sb2.append(", ");
        }
        String sb3 = sb2.toString();
        return sb3.endsWith(", ") ? sb3.substring(0, sb3.length() - 2) : sb3;
    }

    public static Object v(Object[] objArr, int i2, Object obj) {
        Object obj2;
        return (objArr == null || objArr.length <= i2 || (obj2 = objArr[i2]) == null) ? obj : obj2;
    }

    public static String v0(String str, boolean z) {
        if (str != null) {
            return str.contains("\\") ? v0(str.replace("\\", "/"), z) : z ? str.toLowerCase() : str;
        }
        throw new NullPointerException("fixPath(): Empty path parameter");
    }

    public static File v1(String str, File file, String str2, boolean z) {
        File A1;
        File A12;
        if (TextUtils.isEmpty(str)) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): sAppName == null");
        }
        if (file == null) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): sExecutionPath == null");
        }
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): sValue == null");
        }
        if (!file.exists()) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): Execution path does not exist");
        }
        if (!file.isDirectory()) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): Execution path is not a directory");
        }
        if (str2.startsWith("##APP##")) {
            str2 = str2.replace("##APP##", file.getAbsolutePath());
        }
        File A13 = A1(file, "files", str2);
        if (A13 != null) {
            return A13;
        }
        if (z && (A12 = A1(file, "icons", str2)) != null) {
            return A12;
        }
        File A14 = A1(E0(str, file.getAbsolutePath(), str2, false, 1));
        if (A14 != null) {
            return A14;
        }
        if (z && (A1 = A1(E0(str, file.getAbsolutePath(), str2, false, 2))) != null) {
            return A1;
        }
        throw new NullPointerException("getFileFromAllDirectories(): Cannot find file " + str2);
    }

    public static String v2(String str, String str2, String str3) {
        if (!TextUtils.isEmpty(str3)) {
            String lowerCase = str3.toLowerCase();
            if (lowerCase.startsWith("http://") || lowerCase.startsWith("https://")) {
                return str3;
            }
            if (str3.contains("/") || str3.startsWith(".")) {
                return E0(str, str2, str3, false, 2);
            }
        }
        return "icons/" + str3;
    }

    public static boolean v3(File file) {
        FileInputStream fileInputStream;
        DataInputStream dataInputStream;
        Throwable th;
        FilterInputStream filterInputStream;
        try {
            if (file.isDirectory() || !file.canRead() || file.length() < 4) {
                return false;
            }
            try {
                fileInputStream = new FileInputStream(file);
            } catch (Throwable th2) {
                th = th2;
                fileInputStream = null;
                dataInputStream = null;
            }
            try {
                filterInputStream = new BufferedInputStream(fileInputStream);
                try {
                    dataInputStream = new DataInputStream(filterInputStream);
                    try {
                        boolean z = dataInputStream.readInt() == 1347093252;
                        P(dataInputStream, filterInputStream, fileInputStream);
                        return z;
                    } catch (Throwable th3) {
                        th = th3;
                        P(dataInputStream, filterInputStream, fileInputStream);
                        throw th;
                    }
                } catch (Throwable th4) {
                    dataInputStream = null;
                    th = th4;
                }
            } catch (Throwable th5) {
                th = th5;
                dataInputStream = null;
                th = th;
                filterInputStream = dataInputStream;
                P(dataInputStream, filterInputStream, fileInputStream);
                throw th;
            }
        } catch (Exception e2) {
            e2.printStackTrace();
            return false;
        }
    }

    public static String v4(String str) {
        char[] charArray = str.toCharArray();
        StringBuilder sb2 = new StringBuilder();
        for (char c2 : charArray) {
            sb2.append(Integer.toHexString(c2));
        }
        return sb2.toString();
    }

    public static Object w(Object[] objArr, int i2, Object obj) {
        return (objArr != null && objArr.length > i2) ? objArr[i2] : obj;
    }

    public static String w0(Context context, String str) {
        JSONObject p2 = p2(context);
        return str + "\r\n" + String.format("%s%12s%12s", "MAX", "USED", "FREE") + "\r\n" + String.format("%s%12s%12s", android.text.format.Formatter.formatShortFileSize(context, AbstractC0699l.k(p2, "MAX")), android.text.format.Formatter.formatShortFileSize(context, AbstractC0699l.k(p2, "USED")), android.text.format.Formatter.formatShortFileSize(context, AbstractC0699l.k(p2, "FREE")));
    }

    public static File w1(String str, String str2, String str3) {
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): sExecutionPath == null");
        }
        return v1(str, new File(str2), str3, false);
    }

    public static String w2(Context context) {
        try {
            File I0 = I0(context);
            return !I0.exists() ? "" : new String(B3(I0), "UTF-8");
        } catch (Exception e2) {
            e2.printStackTrace();
            return "";
        }
    }

    public static void w3(Context context, File file) {
        if (H2(context) >= 24 && Build.VERSION.SDK_INT >= 24) {
            Uri B1 = B1(context, file);
            Intent intent = new Intent("android.intent.action.INSTALL_PACKAGE");
            intent.setData(B1);
            intent.setFlags(268435456);
            intent.addFlags(1);
            context.startActivity(intent);
            return;
        }
        try {
            Intent intent2 = new Intent("android.intent.action.VIEW");
            intent2.setFlags(268435456);
            intent2.setDataAndType(H0(context, file), "application/vnd.android.package-archive");
            context.startActivity(intent2);
        } catch (ActivityNotFoundException unused) {
            l("XOneAndroidFramework", "An ActivityNotFoundException happened while trying to install APK. Retrying without using the FileProvider uri.");
            Intent intent3 = new Intent("android.intent.action.VIEW");
            intent3.setFlags(268435456);
            if (Build.VERSION.SDK_INT >= 24) {
                intent3.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
            } else {
                if (!C9.e.q(context, "android.permission.WRITE_EXTERNAL_STORAGE")) {
                    throw new SecurityException("External storage permission is needed to install APKs on API levels < 24");
                }
                File file2 = new File(Environment.getExternalStorageDirectory(), "temp.apk");
                Z(file, file2);
                intent3.setDataAndType(Uri.fromFile(file2), "application/vnd.android.package-archive");
            }
            context.startActivity(intent3);
        }
    }

    public static String w4(byte[] bArr) {
        StringBuilder sb2 = new StringBuilder();
        for (byte b2 : bArr) {
            char[] cArr = i;
            sb2.append(cArr[(b2 & 255) >>> 4]);
            sb2.append(cArr[b2 & 15]);
        }
        return sb2.toString();
    }

    public static String x(Object[] objArr, int i2, String str) {
        Object obj;
        return (objArr == null || objArr.length <= i2 || (obj = objArr[i2]) == null) ? str : t.z(obj, str);
    }

    public static void x0(Date date) {
        date.setTime(date.getTime() + TimeZone.getDefault().getOffset(date.getTime()));
    }

    public static File x1(String str, String str2, String str3, boolean z) {
        if (TextUtils.isEmpty(str2)) {
            throw new IllegalArgumentException("getFileFromAllDirectories(): sExecutionPath == null");
        }
        return v1(str, new File(str2), str3, z);
    }

    public static String x2(int i2) {
        SecureRandom secureRandom = new SecureRandom();
        StringBuilder sb2 = new StringBuilder(i2);
        for (int i3 = 0; i3 < i2; i3++) {
            sb2.append("ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(secureRandom.nextInt(26)));
        }
        return sb2.toString();
    }

    public static void x3(DialogInterface dialogInterface, int i2) {
        if (dialogInterface == null) {
            return;
        }
        dialogInterface.dismiss();
    }

    public static int[] x4(List list) {
        int[] iArr = new int[list.size()];
        for (int i2 = 0; i2 < list.size(); i2++) {
            iArr[i2] = ((Integer) list.get(i2)).intValue();
        }
        return iArr;
    }

    public static CharSequence y(TextView textView, CharSequence charSequence) {
        if (textView != null) {
            try {
                CharSequence text = textView.getText();
                if (!TextUtils.isEmpty(text)) {
                    return text;
                }
            } catch (Exception unused) {
            }
        }
        return charSequence;
    }

    public static void y0(Date date) {
        date.setTime(date.getTime() + TimeZone.getDefault().getOffset(date.getTime()));
    }

    public static File y1(String str, String str2, String str3) {
        try {
            return w1(str, str2, str3);
        } catch (Exception unused) {
            return null;
        }
    }

    public static Object y2(Context context, String str) {
        return context.getApplicationContext().getSystemService(str);
    }

    public static void y3(WeakReference weakReference, DialogInterface dialogInterface, int i2) {
        if (dialogInterface != null) {
            dialogInterface.dismiss();
        }
        Activity activity = (Activity) weakReference.get();
        if (activity == null || activity.isDestroyed()) {
            return;
        }
        activity.finish();
    }

    public static float y4(Context context, float f2) {
        return A4(context.getApplicationContext().getResources().getDisplayMetrics(), f2);
    }

    public static String z(TextView textView, String str) {
        if (textView != null) {
            try {
                CharSequence text = textView.getText();
                if (!TextUtils.isEmpty(text)) {
                    return text.toString();
                }
            } catch (Exception unused) {
            }
        }
        return str;
    }

    public static String z0(String str, String str2) {
        return str + "_$_" + str2;
    }

    public static File z1(String str, String str2, String str3, boolean z) {
        try {
            if (TextUtils.isEmpty(str2)) {
                throw new IllegalArgumentException("getFileFromAllDirectoriesSafe(): sExecutionPath == null");
            }
            return v1(str, new File(str2), str3, z);
        } catch (Exception unused) {
            return null;
        }
    }

    public static String z2(File file) {
        return s1(file, "sha1", false);
    }

    public static StringBuilder z3(File file, String str) {
        InputStreamReader inputStreamReader;
        FileInputStream fileInputStream;
        BufferedReader bufferedReader;
        StringBuilder sb2 = new StringBuilder();
        BufferedReader bufferedReader2 = null;
        try {
            fileInputStream = new FileInputStream(file);
            try {
                inputStreamReader = new InputStreamReader(fileInputStream, str);
                try {
                    bufferedReader = new BufferedReader(inputStreamReader);
                } catch (Throwable th) {
                    th = th;
                }
                try {
                    for (String readLine = bufferedReader.readLine(); readLine != null; readLine = bufferedReader.readLine()) {
                        sb2.append(readLine);
                        sb2.append('\n');
                    }
                    P(bufferedReader, inputStreamReader, fileInputStream);
                    return sb2;
                } catch (Throwable th2) {
                    th = th2;
                    bufferedReader2 = bufferedReader;
                    P(bufferedReader2, inputStreamReader, fileInputStream);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inputStreamReader = null;
            }
        } catch (Throwable th4) {
            th = th4;
            inputStreamReader = null;
            fileInputStream = null;
        }
    }

    public static float z4(Resources resources, float f2) {
        return A4(resources.getDisplayMetrics(), f2);
    }
}