多宝语音 v1.5.0版本的 MD5 值为:dcfcdc4e4f0a662eb0256f88e60f66b1

以下内容为反编译后的 d.java 源代码,内容仅作参考


package ix;

import android.app.Application;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.alipay.sdk.m.u.i;
import com.tencent.mm.opensdk.modelmsg.WXMediaMessage;
import ix.d;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import jy.j;
import jy.l;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import tech.sud.mgp.base.ThreadUtils;
import tech.sud.mgp.core.PkgDownloadStatus;
import tech.sud.mgp.logger.SudLogger;
import tx.c;

public class d extends jx.a implements Comparable<d> {
    public Map<Class, Object> A;

    public final int f36921c;

    public final String f36922d;

    public final Uri f36923e;

    public final Map<String, List<String>> f36924f;

    public ux.d f36925g;

    public final int f36926h;

    public final int f36927i;

    public final int f36928j;

    public final int f36929k;

    public final int f36930l;

    public final Integer f36931m;

    public final boolean f36933o;

    public final boolean f36934p;

    public final int f36935q;

    public volatile ix.b f36936r;

    public final boolean f36937s;

    public final boolean f36939u;

    public final c.a f36940v;

    public final File f36941w;

    public final File f36942x;

    public File f36943y;

    public String f36944z;

    public final AtomicLong f36938t = new AtomicLong();

    public final Boolean f36932n = null;

    public static class a {

        public final String f36945a;

        public final Uri f36946b;

        public volatile Map<String, List<String>> f36947c;

        public Map<Class, Object> f36948d;

        public int f36949e;

        public int f36950f;

        public int f36951g;

        public int f36952h;

        public int f36953i;

        public boolean f36954j;

        public int f36955k;

        public String f36956l;

        public boolean f36957m;

        public Boolean f36958n;

        public Integer f36959o;

        public a(String str, Uri uri) {
            this.f36950f = 4096;
            this.f36951g = 16384;
            this.f36952h = WXMediaMessage.THUMB_LENGTH_LIMIT;
            this.f36953i = com.alipay.sdk.m.p0.c.f10340n;
            this.f36954j = true;
            this.f36955k = 3000;
            this.f36957m = true;
            this.f36945a = str;
            this.f36946b = uri;
            if (jx.d.g(uri)) {
                this.f36956l = jx.d.c(uri);
            }
        }

        public a a(int i11) {
            if (i11 >= 0) {
                this.f36953i = i11;
                return this;
            }
            throw new IllegalArgumentException("Value must be positive!");
        }

        public a b(int i11) {
            this.f36959o = Integer.valueOf(i11);
            return this;
        }

        public a c(boolean z11) {
            this.f36954j = z11;
            return this;
        }

        public d d() {
            return new d(this.f36945a, this.f36946b, this.f36949e, this.f36950f, this.f36951g, this.f36952h, this.f36953i, this.f36954j, this.f36955k, this.f36947c, this.f36956l, this.f36957m, false, this.f36958n, this.f36959o, null, this.f36948d);
        }

        public <T> void e(Class cls, T t11) {
            if (this.f36948d == null) {
                this.f36948d = new HashMap();
            }
            this.f36948d.put(cls, t11);
        }

        public synchronized void f(String str, String str2) {
            if (this.f36947c == null) {
                this.f36947c = new HashMap();
            }
            List<String> list = this.f36947c.get(str);
            if (list == null) {
                list = new ArrayList<>();
                this.f36947c.put(str, list);
            }
            list.add(str2);
        }

        public a g(int i11) {
            if (i11 >= 0) {
                this.f36952h = i11;
                return this;
            }
            throw new IllegalArgumentException("Value must be positive!");
        }

        public a h(int i11) {
            this.f36955k = i11;
            return this;
        }

        public a i(int i11) {
            if (i11 >= 0) {
                this.f36951g = i11;
                return this;
            }
            throw new IllegalArgumentException("Value must be positive!");
        }

        public a j(boolean z11) {
            this.f36957m = z11;
            return this;
        }

        public a k(int i11) {
            this.f36949e = i11;
            return this;
        }

        public a l(int i11) {
            if (i11 >= 0) {
                this.f36950f = i11;
                return this;
            }
            throw new IllegalArgumentException("Value must be positive!");
        }

        public a(String str, String str2, String str3) {
            this(str, Uri.fromFile(new File(str2)));
            if (jx.d.f(str3)) {
                this.f36958n = Boolean.TRUE;
            } else {
                this.f36956l = str3;
            }
        }
    }

    public static class b {

        public static Application f36960a;

        public static String A() {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("https://mgp.sud.tech/");
            String str = yx.b.f49961f;
            if (str != null) {
                sb2.append(str);
            }
            sb2.append("?platform=");
            sb2.append(2);
            Application w11 = w();
            if (w11 != null) {
                sb2.append("&netType=");
                sb2.append(a(w11));
            }
            return sb2.toString();
        }

        public static iy.e B() {
            boolean z11;
            String str = "TechSudMGPGlobal.sp";
            Map<String, iy.e> map = iy.e.f36996b;
            int i11 = 0;
            while (true) {
                if (i11 < 19) {
                    if (!Character.isWhitespace("TechSudMGPGlobal.sp".charAt(i11))) {
                        z11 = false;
                        break;
                    }
                    i11++;
                } else {
                    z11 = true;
                    break;
                }
            }
            if (z11) {
                str = "spUtils";
            }
            Map<String, iy.e> map2 = iy.e.f36996b;
            iy.e eVar = map2.get(str);
            if (eVar == null) {
                synchronized (iy.e.class) {
                    eVar = map2.get(str);
                    if (eVar == null) {
                        eVar = new iy.e(str, 0);
                        map2.put(str, eVar);
                    }
                }
            }
            return eVar;
        }

        public static int a(Context context) {
            boolean z11;
            NetworkInfo networkInfo;
            ConnectivityManager connectivityManager;
            ConnectivityManager connectivityManager2;
            NetworkInfo networkInfo2;
            NetworkInfo.State state;
            if (s(context, "android.permission.ACCESS_NETWORK_STATE") && (connectivityManager2 = (ConnectivityManager) context.getApplicationContext().getSystemService("connectivity")) != null && (networkInfo2 = connectivityManager2.getNetworkInfo(9)) != null && (state = networkInfo2.getState()) != null && (state == NetworkInfo.State.CONNECTED || state == NetworkInfo.State.CONNECTING)) {
                z11 = true;
            } else {
                z11 = false;
            }
            if (z11) {
                return 1;
            }
            if (s(context, "android.permission.ACCESS_NETWORK_STATE") && (connectivityManager = (ConnectivityManager) context.getApplicationContext().getSystemService("connectivity")) != null) {
                networkInfo = connectivityManager.getActiveNetworkInfo();
            } else {
                networkInfo = null;
            }
            if (networkInfo != null && networkInfo.isAvailable()) {
                if (networkInfo.getType() == 1) {
                    return 100;
                }
                if (networkInfo.getType() != 0) {
                    return 0;
                }
                switch (networkInfo.getSubtype()) {
                    case 1:
                    case 2:
                    case 4:
                    case 7:
                    case 11:
                    case 16:
                        return 2;
                    case 3:
                    case 5:
                    case 6:
                    case 8:
                    case 9:
                    case 10:
                    case 12:
                    case 14:
                    case 15:
                    case 17:
                        return 3;
                    case 13:
                    case 18:
                        return 4;
                    case 19:
                    default:
                        String subtypeName = networkInfo.getSubtypeName();
                        if (!subtypeName.equalsIgnoreCase("TD-SCDMA") && !subtypeName.equalsIgnoreCase("WCDMA") && !subtypeName.equalsIgnoreCase("CDMA2000")) {
                            return 0;
                        }
                        return 3;
                    case 20:
                        return 5;
                }
            }
            return 999;
        }

        public static int b(Context context, int i11) {
            return (int) ((i11 * context.getResources().getDisplayMetrics().density) + 0.5f);
        }

        public static long c(byte[] bArr, int i11, int i12) {
            if (i12 <= 8) {
                long j11 = 0;
                for (int i13 = 0; i13 < i12; i13++) {
                    j11 |= (bArr[i11 + i13] & 255) << (i13 * 8);
                }
                return j11;
            }
            throw new IllegalArgumentException("Can't read more than eight bytes into a long value");
        }

        public static Object d() {
            Object obj;
            try {
                Field declaredField = Class.forName("android.app.ActivityThread").getDeclaredField("sCurrentActivityThread");
                declaredField.setAccessible(true);
                obj = declaredField.get(null);
            } catch (Exception e11) {
                Log.e("UtilsActivityLifecycle", "getActivityThreadInActivityThreadStaticField: " + e11.getMessage());
                obj = null;
            }
            if (obj != null) {
                return obj;
            }
            try {
                return Class.forName("android.app.ActivityThread").getMethod("currentActivityThread", new Class[0]).invoke(null, new Object[0]);
            } catch (Exception e12) {
                Log.e("UtilsActivityLifecycle", "getActivityThreadInActivityThreadStaticMethod: " + e12.getMessage());
                return null;
            }
        }

        public static Object e(Class<?> cls, Object obj, String str) {
            try {
                Field declaredField = cls.getDeclaredField(str);
                declaredField.setAccessible(true);
                return declaredField.get(obj);
            } catch (Exception e11) {
                e11.printStackTrace();
                return null;
            }
        }

        public static String f(int i11, String str) {
            try {
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("retCode", i11);
                jSONObject.put("retMsg", str);
                return jSONObject.toString();
            } catch (Exception e11) {
                return e11.toString();
            }
        }

        public static String g(Intent intent) {
            boolean z11;
            String g11;
            String str;
            StringBuilder sb2 = new StringBuilder(128);
            sb2.append("Intent { ");
            String action = intent.getAction();
            boolean z12 = false;
            boolean z13 = true;
            if (action != null) {
                sb2.append("act=");
                sb2.append(action);
                z11 = false;
            } else {
                z11 = true;
            }
            Set<String> categories = intent.getCategories();
            if (categories != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("cat=[");
                for (String str2 : categories) {
                    if (!z13) {
                        sb2.append(',');
                    }
                    sb2.append(str2);
                    z13 = false;
                }
                sb2.append("]");
                z11 = false;
            }
            Uri data = intent.getData();
            if (data != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("dat=");
                sb2.append(data);
                z11 = false;
            }
            String type = intent.getType();
            if (type != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("typ=");
                sb2.append(type);
                z11 = false;
            }
            int flags = intent.getFlags();
            if (flags != 0) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("flg=0x");
                sb2.append(Integer.toHexString(flags));
                z11 = false;
            }
            String str3 = intent.getPackage();
            if (str3 != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("pkg=");
                sb2.append(str3);
                z11 = false;
            }
            ComponentName component = intent.getComponent();
            if (component != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("cmp=");
                sb2.append(component.flattenToShortString());
                z11 = false;
            }
            Rect sourceBounds = intent.getSourceBounds();
            if (sourceBounds != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("bnds=");
                sb2.append(sourceBounds.toShortString());
                z11 = false;
            }
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                ClipData.Item itemAt = clipData.getItemAt(0);
                if (itemAt == null) {
                    sb2.append("ClipData.Item {}");
                } else {
                    sb2.append("ClipData.Item { ");
                    String htmlText = itemAt.getHtmlText();
                    if (htmlText != null) {
                        sb2.append("H:");
                        sb2.append(htmlText);
                    } else {
                        CharSequence text = itemAt.getText();
                        if (text != null) {
                            sb2.append("T:");
                            sb2.append(text);
                        } else {
                            Uri uri = itemAt.getUri();
                            if (uri != null) {
                                sb2.append("U:");
                                sb2.append(uri);
                            } else {
                                Intent intent2 = itemAt.getIntent();
                                if (intent2 != null) {
                                    sb2.append("I:");
                                    str = g(intent2);
                                } else {
                                    str = "NULL";
                                }
                                sb2.append(str);
                            }
                        }
                    }
                    sb2.append(i.f10487d);
                }
                z11 = false;
            }
            Bundle extras = intent.getExtras();
            if (extras != null) {
                if (!z11) {
                    sb2.append(' ');
                }
                sb2.append("extras={");
                sb2.append(h(extras));
                sb2.append('}');
            } else {
                z12 = z11;
            }
            Intent selector = intent.getSelector();
            if (selector != null) {
                if (!z12) {
                    sb2.append(' ');
                }
                sb2.append("sel={");
                if (selector == intent) {
                    g11 = "(this Intent)";
                } else {
                    g11 = g(selector);
                }
                sb2.append(g11);
                sb2.append(i.f10487d);
            }
            sb2.append(" }");
            return sb2.toString();
        }

        public static String h(Bundle bundle) {
            String h11;
            Iterator<String> it2 = bundle.keySet().iterator();
            if (!it2.hasNext()) {
                return "Bundle {}";
            }
            StringBuilder sb2 = new StringBuilder(128);
            sb2.append("Bundle { ");
            while (true) {
                String next = it2.next();
                Object obj = bundle.get(next);
                sb2.append(next);
                sb2.append(com.alipay.sdk.m.n.a.f10247h);
                if (obj instanceof Bundle) {
                    if (obj == bundle) {
                        h11 = "(this Bundle)";
                    } else {
                        h11 = h((Bundle) obj);
                    }
                    sb2.append(h11);
                } else {
                    sb2.append(e40.a.c(obj));
                }
                if (!it2.hasNext()) {
                    sb2.append(" }");
                    return sb2.toString();
                }
                sb2.append(',');
                sb2.append(' ');
            }
        }

        public static String i(Object obj, int i11) {
            List<String> list;
            String str;
            if (obj.getClass().isArray()) {
                if (obj instanceof Object[]) {
                    return Arrays.deepToString((Object[]) obj);
                }
                if (obj instanceof boolean[]) {
                    return Arrays.toString((boolean[]) obj);
                }
                if (obj instanceof byte[]) {
                    return Arrays.toString((byte[]) obj);
                }
                if (obj instanceof char[]) {
                    return Arrays.toString((char[]) obj);
                }
                if (obj instanceof double[]) {
                    return Arrays.toString((double[]) obj);
                }
                if (obj instanceof float[]) {
                    return Arrays.toString((float[]) obj);
                }
                if (obj instanceof int[]) {
                    return Arrays.toString((int[]) obj);
                }
                if (obj instanceof long[]) {
                    return Arrays.toString((long[]) obj);
                }
                if (obj instanceof short[]) {
                    return Arrays.toString((short[]) obj);
                }
                throw new IllegalArgumentException("Array has incompatible type: " + obj.getClass());
            }
            if (obj instanceof Throwable) {
                String str2 = xx.b.f49364a;
                ArrayList arrayList = new ArrayList();
                for (Throwable th2 = (Throwable) obj; th2 != null && !arrayList.contains(th2); th2 = th2.getCause()) {
                    arrayList.add(th2);
                }
                int size = arrayList.size();
                ArrayList arrayList2 = new ArrayList();
                int i12 = size - 1;
                List<String> b11 = xx.b.b((Throwable) arrayList.get(i12));
                while (true) {
                    size--;
                    if (size < 0) {
                        break;
                    }
                    if (size != 0) {
                        list = xx.b.b((Throwable) arrayList.get(size - 1));
                        int size2 = b11.size() - 1;
                        ArrayList arrayList3 = (ArrayList) list;
                        for (int size3 = arrayList3.size() - 1; size2 >= 0 && size3 >= 0; size3--) {
                            if (b11.get(size2).equals((String) arrayList3.get(size3))) {
                                b11.remove(size2);
                            }
                            size2--;
                        }
                    } else {
                        list = b11;
                    }
                    if (size == i12) {
                        str = ((Throwable) arrayList.get(size)).toString();
                    } else {
                        str = " Caused by: " + ((Throwable) arrayList.get(size)).toString();
                    }
                    arrayList2.add(str);
                    arrayList2.addAll(b11);
                    b11 = list;
                }
                StringBuilder sb2 = new StringBuilder();
                Iterator it2 = arrayList2.iterator();
                while (it2.hasNext()) {
                    sb2.append((String) it2.next());
                    sb2.append(xx.b.f49364a);
                }
                return sb2.toString();
            }
            if (obj instanceof Bundle) {
                return h((Bundle) obj);
            }
            if (obj instanceof Intent) {
                return g((Intent) obj);
            }
            if (i11 == 32) {
                if (obj instanceof CharSequence) {
                    String obj2 = obj.toString();
                    String str3 = xx.b.f49364a;
                    try {
                        int length = obj2.length();
                        for (int i13 = 0; i13 < length; i13++) {
                            char charAt = obj2.charAt(i13);
                            if (charAt == '{') {
                                obj2 = new JSONObject(obj2).toString(4);
                                break;
                            }
                            if (charAt == '[') {
                                obj2 = new JSONArray(obj2).toString(4);
                                break;
                            }
                            if (Character.isWhitespace(charAt)) {
                            }
                        }
                        return obj2;
                    } catch (JSONException e11) {
                        e11.printStackTrace();
                        return obj2;
                    }
                }
                try {
                    return obj.toString();
                } catch (Throwable unused) {
                    return obj.toString();
                }
            }
            if (i11 == 48) {
                String obj3 = obj.toString();
                try {
                    StreamSource streamSource = new StreamSource(new StringReader(obj3));
                    StreamResult streamResult = new StreamResult(new StringWriter());
                    Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
                    newTransformer.setOutputProperty("indent", "yes");
                    newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
                    newTransformer.transform(streamSource, streamResult);
                    return streamResult.getWriter().toString().replaceFirst(">", ">" + e40.a.f33456c);
                } catch (Exception e12) {
                    e12.printStackTrace();
                    return obj3;
                }
            }
            return obj.toString();
        }

        public static String j(byte[] bArr) {
            if (bArr != null && bArr.length != 0) {
                return Base64.encodeToString(bArr, 2);
            }
            return null;
        }

        public static Field k(Object obj, String str) {
            for (Class<?> cls = obj.getClass(); cls != null; cls = cls.getSuperclass()) {
                try {
                    Field declaredField = cls.getDeclaredField(str);
                    if (!declaredField.isAccessible()) {
                        declaredField.setAccessible(true);
                    }
                    return declaredField;
                } catch (NoSuchFieldException unused) {
                }
            }
            throw new NoSuchFieldException("Field " + str + " not found in " + obj.getClass());
        }

        public static Method l(Object obj, String str, Class<?>... clsArr) {
            for (Class<?> cls = obj.getClass(); cls != null; cls = cls.getSuperclass()) {
                try {
                    Method declaredMethod = cls.getDeclaredMethod(str, clsArr);
                    if (!declaredMethod.isAccessible()) {
                        declaredMethod.setAccessible(true);
                    }
                    return declaredMethod;
                } catch (NoSuchMethodException unused) {
                }
            }
            throw new NoSuchMethodException("Method " + str + " with parameters " + Arrays.asList(clsArr) + " not found in " + obj.getClass());
        }

        public static void m(Application application) {
            if (application == null) {
                Log.e("Utils", "app is null.");
                return;
            }
            Application application2 = f36960a;
            if (application2 == null) {
                f36960a = application;
            } else {
                if (application2.equals(application)) {
                    return;
                }
                f36960a = application;
            }
        }

        public static void n(Closeable closeable) {
            if (closeable != null) {
                try {
                    closeable.close();
                } catch (IOException unused) {
                }
            }
        }

        public static void o(final File file, final String str, final jy.e eVar) {
            ky.a.f38407a.execute(new Runnable() {
                @Override
                public final void run() {
                    d.b.x(file, str, eVar);
                }
            });
        }

        public static void p(Class<?> cls, Object obj, String str, Object obj2) {
            try {
                Field declaredField = cls.getDeclaredField(str);
                declaredField.setAccessible(true);
                declaredField.set(obj, obj2);
            } catch (Exception e11) {
                e11.printStackTrace();
            }
        }

        public static void q(jy.e eVar, File file, String str, boolean z11, String str2) {
            String absolutePath;
            if (eVar != null) {
                j jVar = (j) eVar;
                if (file == null) {
                    absolutePath = "";
                } else {
                    absolutePath = file.getAbsolutePath();
                }
                e40.a.j("SudDownloadTask", "checkMd5 onCompleted mdId:" + jVar.f37462a.f37467b + "  path:" + absolutePath + "  checkMd5:" + str + "  fileMd5:" + str2 + "  isMatch:" + z11);
                if (z11) {
                    e40.a.j("SudDownloadTask", "checkMd5 match:" + jVar.f37462a.f37473h + "  :mgId:" + jVar.f37462a.f37467b);
                    SudLogger.d(l.f37465x, "checkMd5 match:" + jVar.f37462a.f37473h + "  :mgId:" + jVar.f37462a.f37467b);
                    l lVar = jVar.f37462a;
                    ly.a aVar = lVar.f37474i;
                    if (aVar == null) {
                        lVar.j(PkgDownloadStatus.PKG_DOWNLOAD_COMPLETED);
                        l.e(jVar.f37462a, absolutePath, null);
                        return;
                    } else {
                        aVar.a(file, lVar.f37482q, lVar.f37472g.f39874g, new jy.g(jVar, absolutePath));
                        return;
                    }
                }
                e40.a.j("SudDownloadTask", "checkMd5 error:" + jVar.f37462a.f37473h + "  :mgId:" + jVar.f37462a.f37467b + "  checkMd5:" + str + "  fileMd5:" + str2);
                SudLogger.d(l.f37465x, "checkMd5 error:" + jVar.f37462a.f37473h + "  :mgId:" + jVar.f37462a.f37467b + "  checkMd5:" + str + "  fileMd5:" + str2);
                iy.c.b(absolutePath);
                jVar.f37462a.c(-10200, "package flaw");
            }
        }

        public static void r(byte[] bArr, long j11, int i11, int i12) {
            for (int i13 = 0; i13 < i12; i13++) {
                bArr[i11 + i13] = (byte) (255 & j11);
                j11 >>= 8;
            }
        }

        public static boolean s(Context context, String str) {
            if (context.checkPermission(str, Process.myPid(), Process.myUid()) == 0) {
                return true;
            }
            return false;
        }

        public static boolean t(String str) {
            File file = new File(str);
            if (file.isDirectory()) {
                return true;
            }
            if (file.isFile()) {
                return false;
            }
            String parent = file.getParent();
            if (parent != null && !t(parent)) {
                return false;
            }
            return file.mkdir();
        }

        public static boolean u(String str, String str2) {
            FileInputStream fileInputStream;
            IOException e11;
            FileChannel fileChannel;
            Closeable closeable;
            FileChannel fileChannel2;
            String str3;
            ?? file = new File(str2);
            boolean z11 = true;
            if (file.exists()) {
                return true;
            }
            File parentFile = file.getParentFile();
            if (!parentFile.exists() && !parentFile.mkdirs()) {
                str3 = "Make dir failed: " + parentFile.getAbsolutePath();
            } else {
                ?? file2 = new File(str);
                if (!file2.exists()) {
                    str3 = "File not exist: " + str;
                } else {
                    FileChannel fileChannel3 = null;
                    try {
                        try {
                            fileInputStream = new FileInputStream((File) file2);
                            try {
                                file2 = new FileOutputStream((File) file);
                            } catch (IOException e12) {
                                e11 = e12;
                                fileChannel = null;
                                closeable = null;
                            } catch (Throwable th2) {
                                th = th2;
                                file = 0;
                                file2 = 0;
                            }
                        } catch (Throwable th3) {
                            th = th3;
                        }
                        try {
                            FileChannel channel = fileInputStream.getChannel();
                            try {
                                fileChannel3 = file2.getChannel();
                                channel.transferTo(0L, channel.size(), fileChannel3);
                                n(fileInputStream);
                                n(channel);
                                n(file2);
                                n(fileChannel3);
                                file = channel;
                                file2 = file2;
                            } catch (IOException e13) {
                                e11 = e13;
                                FileChannel fileChannel4 = fileChannel3;
                                fileChannel3 = channel;
                                fileChannel2 = fileChannel4;
                                FileChannel fileChannel5 = fileChannel3;
                                fileChannel3 = fileChannel2;
                                fileChannel = fileChannel5;
                                closeable = file2;
                                Log.e("RuntimeCopy", "File copy failed: " + str + " -> " + str2);
                                e11.printStackTrace();
                                n(fileInputStream);
                                n(fileChannel);
                                n(closeable);
                                n(fileChannel3);
                                z11 = false;
                                file = fileChannel;
                                file2 = closeable;
                                return z11;
                            }
                        } catch (IOException e14) {
                            e11 = e14;
                            fileChannel2 = null;
                        } catch (Throwable th4) {
                            th = th4;
                            file = 0;
                            n(fileInputStream);
                            n(file);
                            n(file2);
                            n(fileChannel3);
                            throw th;
                        }
                    } catch (IOException e15) {
                        e11 = e15;
                        fileChannel = null;
                        closeable = null;
                        fileInputStream = null;
                    } catch (Throwable th5) {
                        th = th5;
                        file = 0;
                        file2 = 0;
                        fileInputStream = null;
                    }
                    return z11;
                }
            }
            Log.e("RuntimeCopy", str3);
            return false;
        }

        public static String v() {
            String str = Build.CPU_ABI;
            if (str != null && (str.equals("armeabi-v7a") || str.equals("arm64-v8a") || str.equals("x86") || str.equals("x86_64"))) {
                return str;
            }
            String str2 = Build.CPU_ABI2;
            if (str2 == null || (!str2.equals("armeabi-v7a") && !str2.equals("arm64-v8a") && !str2.equals("x86") && !str2.equals("x86_64"))) {
                return "arm64-v8a";
            }
            return str2;
        }

        public static Application w() {
            Object invoke;
            Application application = f36960a;
            if (application != null) {
                return application;
            }
            Application application2 = null;
            try {
                Class<?> cls = Class.forName("android.app.ActivityThread");
                Object d11 = d();
                if (d11 != null && (invoke = cls.getMethod("getApplication", new Class[0]).invoke(d11, new Object[0])) != null) {
                    application2 = (Application) invoke;
                }
            } catch (Exception e11) {
                e11.printStackTrace();
            }
            m(application2);
            if (f36960a != null) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(xx.b.a());
                sb2.append(" reflect app success.");
                return f36960a;
            }
            throw new NullPointerException("reflect failed.");
        }

        public static void x(final File file, final String str, final jy.e eVar) {
            final boolean equalsIgnoreCase;
            final String a11 = iy.d.a(file, true);
            if (TextUtils.isEmpty(str)) {
                equalsIgnoreCase = true;
            } else {
                equalsIgnoreCase = str.equalsIgnoreCase(a11);
            }
            ThreadUtils.postUITask(new Runnable() {
                @Override
                public final void run() {
                    d.b.q(jy.e.this, file, str, equalsIgnoreCase, a11);
                }
            });
        }

        public static boolean y(String str) {
            String[] list;
            e40.a.j("PathUtils", "start deleteFolderRecursive:" + str);
            File file = new File(str);
            if (!file.exists()) {
                e40.a.j("PathUtils", "文件不存在 deleteFolderRecursive:" + str);
                return true;
            }
            if (file.isDirectory() && (list = file.list()) != null) {
                for (String str2 : list) {
                    y(file.getPath() + File.separator + str2);
                }
            }
            boolean delete = file.delete();
            e40.a.j("PathUtils", "end deleteFolderRecursive:" + str + "  result:" + delete);
            return delete;
        }

        public static boolean z(String str, String str2) {
            File file = new File(str2);
            if (file.exists()) {
                file.delete();
            }
            return u(str, str2);
        }
    }

    public static class c extends jx.a {

        public final int f36961c;

        public final String f36962d;

        public final File f36963e;

        public final String f36964f;

        public final File f36965g;

        public c(int i11, d dVar) {
            this.f36961c = i11;
            this.f36962d = dVar.f36922d;
            this.f36965g = dVar.c();
            this.f36963e = dVar.f36941w;
            this.f36964f = dVar.a();
        }

        @Override
        public String a() {
            return this.f36964f;
        }

        @Override
        public File c() {
            return this.f36965g;
        }

        @Override
        public int d() {
            return this.f36961c;
        }

        @Override
        public File e() {
            return this.f36963e;
        }

        @Override
        public String f() {
            return this.f36962d;
        }
    }

    public d(String str, Uri uri, int i11, int i12, int i13, int i14, int i15, boolean z11, int i16, Map<String, List<String>> map, String str2, boolean z12, boolean z13, Boolean bool, Integer num, Boolean bool2, Map<Class, Object> map2) {
        File file;
        Boolean bool3;
        this.f36922d = str;
        this.f36923e = uri;
        this.f36926h = i11;
        this.f36927i = i12;
        this.f36928j = i13;
        this.f36929k = i14;
        this.f36930l = i15;
        this.f36934p = z11;
        this.f36935q = i16;
        this.f36924f = map;
        this.f36933o = z12;
        this.f36937s = z13;
        this.f36931m = num;
        String str3 = null;
        this.A = map2;
        if (jx.d.i(uri)) {
            File file2 = new File(uri.getPath());
            if (bool != null) {
                if (bool.booleanValue()) {
                    if (file2.exists() && file2.isFile()) {
                        throw new IllegalArgumentException("If you want filename from response please make sure you provide path is directory " + file2.getPath());
                    }
                } else {
                    if (file2.exists() && file2.isDirectory() && jx.d.f(str2)) {
                        throw new IllegalArgumentException("If you don't want filename from response please make sure you have already provided valid filename or not directory path " + file2.getPath());
                    }
                    if (jx.d.f(str2)) {
                        bool3 = bool;
                        str3 = file2.getName();
                        file2 = jx.d.b(file2);
                        this.f36942x = file2;
                        this.f36939u = bool3.booleanValue();
                    }
                }
                str3 = str2;
                bool3 = bool;
                this.f36942x = file2;
                this.f36939u = bool3.booleanValue();
            } else if (!file2.exists() || !file2.isDirectory()) {
                bool3 = Boolean.FALSE;
                if (file2.exists()) {
                    if (!jx.d.f(str2) && !file2.getName().equals(str2)) {
                        throw new IllegalArgumentException("Uri already provided filename!");
                    }
                } else if (!jx.d.f(str2)) {
                    str3 = str2;
                    this.f36942x = file2;
                    this.f36939u = bool3.booleanValue();
                }
                str3 = file2.getName();
                file2 = jx.d.b(file2);
                this.f36942x = file2;
                this.f36939u = bool3.booleanValue();
            } else {
                bool3 = Boolean.TRUE;
                this.f36942x = file2;
                str3 = str2;
                this.f36939u = bool3.booleanValue();
            }
        } else {
            this.f36939u = false;
            this.f36942x = new File(uri.getPath());
            str3 = str2;
        }
        if (jx.d.f(str3)) {
            this.f36940v = new c.a();
            file = this.f36942x;
        } else {
            this.f36940v = new c.a(str3);
            file = new File(this.f36942x, str3);
            this.f36943y = file;
        }
        this.f36941w = file;
        this.f36921c = g.e().a().h(this);
    }

    @Override
    public String a() {
        return this.f36940v.f46150a;
    }

    @Override
    public File c() {
        return this.f36942x;
    }

    @Override
    public int compareTo(d dVar) {
        return dVar.f36926h - this.f36926h;
    }

    @Override
    public int d() {
        return this.f36921c;
    }

    @Override
    public File e() {
        return this.f36941w;
    }

    public boolean equals(Object obj) {
        if (super.equals(obj)) {
            return true;
        }
        if (obj instanceof d) {
            d dVar = (d) obj;
            if (dVar.f36921c == this.f36921c) {
                return true;
            }
            return b(dVar);
        }
        return false;
    }

    @Override
    public String f() {
        return this.f36922d;
    }

    public int g() {
        return this.f36927i;
    }

    public void h() {
        sx.b bVar = g.e().f36975a;
        bVar.f45048h.incrementAndGet();
        synchronized (bVar) {
            d();
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            try {
                bVar.d(this, arrayList, arrayList2);
                bVar.c(arrayList, arrayList2);
                if (arrayList.size() <= 0) {
                    arrayList2.size();
                }
            } catch (Throwable th2) {
                bVar.c(arrayList, arrayList2);
                throw th2;
            }
        }
        bVar.f45048h.decrementAndGet();
        bVar.j();
    }

    public int hashCode() {
        return (this.f36922d + this.f36941w.toString() + this.f36940v.f46150a).hashCode();
    }

    public int i() {
        return this.f36930l;
    }

    public int j() {
        return this.f36929k;
    }

    public void l(ix.b bVar) {
        this.f36936r = bVar;
        sx.b bVar2 = g.e().f36975a;
        bVar2.f45048h.incrementAndGet();
        synchronized (bVar2) {
            toString();
            if (!bVar2.f(this) && !bVar2.k(this)) {
                int size = bVar2.f45042b.size();
                synchronized (bVar2) {
                    tx.g gVar = new tx.g(this, true, new ArrayList(), bVar2.f45049i);
                    if (bVar2.h() < bVar2.f45041a) {
                        bVar2.f45043c.add(gVar);
                        bVar2.a().execute(gVar);
                    } else {
                        bVar2.f45042b.add(gVar);
                    }
                    if (size != bVar2.f45042b.size()) {
                        Collections.sort(bVar2.f45042b);
                    }
                }
            }
        }
        bVar2.f45048h.decrementAndGet();
    }

    public File m() {
        String str = this.f36940v.f46150a;
        if (str == null) {
            return null;
        }
        if (this.f36943y == null) {
            this.f36943y = new File(this.f36942x, str);
        }
        return this.f36943y;
    }

    public int n() {
        return this.f36928j;
    }

    public ux.d p() {
        if (this.f36925g == null) {
            this.f36925g = g.e().f36977c.o(this.f36921c);
        }
        return this.f36925g;
    }

    public String toString() {
        return super.toString() + "@" + this.f36921c + "@" + this.f36922d + "@" + this.f36942x.toString() + "/" + this.f36940v.f46150a;
    }
}