BRXT v5.6.8版本的 MD5 值为:caa0615cd5f4a3ae4ac8e2f0f9e0bebe

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


package io.dcloud.js.file;

import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.media.ExifInterface;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.request.target.CustomTarget;
import com.bumptech.glide.request.transition.Transition;
import io.dcloud.common.DHInterface.AbsMgr;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.IFeature;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.io.DHFile;
import io.dcloud.common.adapter.io.UnicodeInputStream;
import io.dcloud.common.adapter.util.AsyncTaskHandler;
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.constant.DOMException;
import io.dcloud.common.util.Base64;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.Deprecated_JSUtil;
import io.dcloud.common.util.FileUtil;
import io.dcloud.common.util.IOUtil;
import io.dcloud.common.util.JSONUtil;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.Md5Utils;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.common.util.ThreadPool;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class FileFeatureImpl implements IFeature {
    private static String a;
    private static String b;
    private static String c;
    private static String d;
    private static String e;
    private static final String[] f = {"getAudioInfo", "getFileInfo", "getImageInfo", "getVideoInfo"};

    class a implements AsyncTaskHandler.IAsyncTaskListener {
        final String a;
        final int b;
        final int c;
        final String d;
        final IWebview e;
        final String f;

        a(String str, int i, int i2, String str2, IWebview iWebview, String str3) {
            this.a = str;
            this.b = i;
            this.c = i2;
            this.d = str2;
            this.e = iWebview;
            this.f = str3;
        }

        @Override
        public void onCancel() {
        }

        @Override
        public void onExecuteBegin() {
        }

        @Override
        public void onExecuteEnd(Object obj) {
            if (obj != null) {
                Deprecated_JSUtil.execCallback(this.e, this.f, String.valueOf(obj), JSUtil.OK, true, false);
            } else {
                FileFeatureImpl.this.a(10, this.e, this.f);
            }
        }

        @Override
        public Object onExecuting() {
            InputStream inputStream;
            Exception e;
            Exception exc;
            InputStream inputStream2;
            Object obj;
            ByteArrayOutputStream byteArrayOutputStream;
            Throwable th;
            int available;
            ByteArrayOutputStream byteArrayOutputStream2 = null;
            try {
                inputStream = DHFile.getInputStream(DHFile.createFileHandler(this.a));
                try {
                    try {
                        available = inputStream.available();
                        try {
                            inputStream = new UnicodeInputStream(inputStream, Charset.defaultCharset().name());
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                        byteArrayOutputStream = new ByteArrayOutputStream();
                    } catch (Throwable th2) {
                        th = th2;
                        if (inputStream != null) {
                            try {
                                inputStream.close();
                            } catch (IOException e3) {
                                e3.printStackTrace();
                                throw th;
                            }
                        }
                        if (byteArrayOutputStream2 != null) {
                            byteArrayOutputStream2.close();
                        }
                        throw th;
                    }
                } catch (Exception e4) {
                    e = e4;
                    exc = e;
                    inputStream2 = inputStream;
                    obj = null;
                    try {
                        exc.printStackTrace();
                        if (inputStream2 != null) {
                            try {
                                inputStream2.close();
                            } catch (IOException e5) {
                                e5.printStackTrace();
                                return obj;
                            }
                        }
                        if (byteArrayOutputStream2 != null) {
                            byteArrayOutputStream2.close();
                        }
                        return obj;
                    } catch (Throwable th3) {
                        byteArrayOutputStream = byteArrayOutputStream2;
                        th = th3;
                        inputStream = inputStream2;
                        th = th;
                        byteArrayOutputStream2 = byteArrayOutputStream;
                        if (inputStream != null) {
                        }
                        if (byteArrayOutputStream2 != null) {
                        }
                        throw th;
                    }
                }
            } catch (Exception e6) {
                e = e6;
                inputStream = null;
            } catch (Throwable th4) {
                th = th4;
                inputStream = null;
            }
            try {
                int i = this.b;
                if (i > 0) {
                    if (i >= available) {
                        i = available - 1;
                    }
                    int i2 = this.c;
                    int i3 = (i - i2) + 1;
                    byte[] bArr = new byte[i3];
                    inputStream.skip(i2);
                    inputStream.read(bArr, 0, i3);
                    byteArrayOutputStream.write(bArr, 0, i3);
                } else {
                    while (true) {
                        byte[] bArr2 = new byte[DHFile.BUF_SIZE];
                        int read = inputStream.read(bArr2);
                        if (read == -1) {
                            break;
                        }
                        byteArrayOutputStream.write(bArr2, 0, read);
                    }
                }
                String jSONableString = JSONUtil.toJSONableString(PdrUtil.isEmpty(this.d) ? byteArrayOutputStream.toString() : byteArrayOutputStream.toString(this.d));
                if (inputStream != null) {
                    try {
                        inputStream.close();
                    } catch (IOException e7) {
                        e7.printStackTrace();
                        return jSONableString;
                    }
                }
                byteArrayOutputStream.close();
                return jSONableString;
            } catch (Exception e8) {
                InputStream inputStream3 = inputStream;
                obj = null;
                byteArrayOutputStream2 = byteArrayOutputStream;
                exc = e8;
                inputStream2 = inputStream3;
                exc.printStackTrace();
                if (inputStream2 != null) {
                }
                if (byteArrayOutputStream2 != null) {
                }
                return obj;
            } catch (Throwable th5) {
                th = th5;
                th = th;
                byteArrayOutputStream2 = byteArrayOutputStream;
                if (inputStream != null) {
                }
                if (byteArrayOutputStream2 != null) {
                }
                throw th;
            }
        }
    }

    class b extends CustomTarget<File> {
        final String a;
        final IWebview b;
        final String c;

        b(String str, IWebview iWebview, String str2) {
            this.a = str;
            this.b = iWebview;
            this.c = str2;
        }

        @Override
        public void onResourceReady(File file, Transition<? super File> transition) {
            if (PdrUtil.isEmpty(this.a)) {
                FileFeatureImpl.this.a(file.getAbsolutePath(), this.b, this.c);
            } else if (DHFile.copyFile(file.getPath(), this.a) == 1) {
                FileFeatureImpl.this.a(this.a, this.b, this.c);
            } else {
                Deprecated_JSUtil.execCallback(this.b, this.c, DOMException.toJSON(13, "Failed to load resource"), JSUtil.ERROR, true, false);
            }
        }

        @Override
        public void onLoadCleared(Drawable drawable) {
        }

        @Override
        public void onLoadFailed(Drawable drawable) {
            Deprecated_JSUtil.execCallback(this.b, this.c, DOMException.toJSON(13, "Failed to load resource"), JSUtil.ERROR, true, false);
        }
    }

    class c implements Runnable {
        final File a;
        final String b;
        final IWebview c;
        final String d;

        c(FileFeatureImpl fileFeatureImpl, File file, String str, IWebview iWebview, String str2) {
            this.a = file;
            this.b = str;
            this.c = iWebview;
            this.d = str2;
        }

        @Override
        public void run() {
            String md5 = Md5Utils.md5(this.a, this.b);
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("size", this.a.length());
                if (md5 != null) {
                    jSONObject.put("digest", md5.toUpperCase(Locale.US));
                }
            } catch (JSONException unused) {
            }
            Deprecated_JSUtil.execCallback(this.c, this.d, jSONObject.toString(), JSUtil.OK, true, false);
        }
    }

    public class d implements AsyncTaskHandler.IAsyncTaskListener {
        final String[] a;
        final IWebview b;
        final String c;
        final int d;
        final String e;

        d(FileFeatureImpl fileFeatureImpl, String[] strArr, IWebview iWebview, String str, int i, String str2) {
            this.a = strArr;
            this.b = iWebview;
            this.c = str;
            this.d = i;
            this.e = str2;
        }

        @Override
        public void onCancel() {
        }

        @Override
        public void onExecuteBegin() {
        }

        @Override
        public void onExecuteEnd(Object obj) {
        }

        @Override
        public Object onExecuting() {
            byte[] decode2bytes = Base64.decode2bytes(this.a[1]);
            if (decode2bytes == null) {
                Deprecated_JSUtil.execCallback(this.b, this.c, StringUtil.format(DOMException.JSON_ERROR_INFO, 16, "写入数据非base64字符串,请检查").toString(), JSUtil.ERROR, true, false);
                return null;
            }
            DHFile.writeFile(decode2bytes, this.d, this.e);
            JSUtil.execCallback(this.b, this.c, decode2bytes.length, JSUtil.OK, false);
            return null;
        }
    }

    public class e implements AsyncTaskHandler.IAsyncTaskListener {
        final String a;
        final int b;
        final int c;
        final IWebview d;
        final String e;

        e(String str, int i, int i2, IWebview iWebview, String str2) {
            this.a = str;
            this.b = i;
            this.c = i2;
            this.d = iWebview;
            this.e = str2;
        }

        @Override
        public void onCancel() {
        }

        @Override
        public void onExecuteBegin() {
        }

        @Override
        public void onExecuteEnd(Object obj) {
            if (obj != null) {
                Deprecated_JSUtil.execCallback(this.d, this.e, String.valueOf(obj), JSUtil.OK, true, false);
            } else {
                FileFeatureImpl.this.a(10, this.d, this.e);
            }
        }

        @Override
        public Object onExecuting() {
            ByteArrayOutputStream byteArrayOutputStream;
            ?? r3;
            ByteArrayOutputStream byteArrayOutputStream2;
            String encode;
            String str = null;
            try {
                r3 = DHFile.getInputStream(DHFile.createFileHandler(this.a));
                try {
                    int available = r3.available();
                    int i = this.b;
                    if (i > 0) {
                        if (i >= available) {
                            i = available - 1;
                        }
                        int i2 = this.c;
                        int i3 = (i - i2) + 1;
                        byte[] bArr = new byte[i3];
                        r3.skip(i2);
                        r3.read(bArr, 0, i3);
                        encode = Base64.encode(bArr);
                        byteArrayOutputStream = null;
                    } else {
                        byteArrayOutputStream2 = new ByteArrayOutputStream();
                        while (true) {
                            try {
                                byte[] bArr2 = new byte[DHFile.BUF_SIZE];
                                int read = r3.read(bArr2);
                                if (read == -1) {
                                    break;
                                }
                                byteArrayOutputStream2.write(bArr2, 0, read);
                            } catch (Exception e) {
                                byteArrayOutputStream = byteArrayOutputStream2;
                                e = e;
                                try {
                                    Deprecated_JSUtil.execCallback(this.d, this.e, StringUtil.format(DOMException.JSON_ERROR_INFO, 13, e.getMessage()), JSUtil.ERROR, true, false);
                                    if (r3 != 0) {
                                    }
                                    if (byteArrayOutputStream != null) {
                                    }
                                    return str;
                                } catch (Throwable th) {
                                    th = th;
                                    str = r3;
                                    r3 = str;
                                    byteArrayOutputStream2 = byteArrayOutputStream;
                                    if (r3 != 0) {
                                        try {
                                            r3.close();
                                        } catch (IOException e2) {
                                            e2.printStackTrace();
                                            throw th;
                                        }
                                    }
                                    if (byteArrayOutputStream2 != null) {
                                        byteArrayOutputStream2.close();
                                    }
                                    throw th;
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                if (r3 != 0) {
                                }
                                if (byteArrayOutputStream2 != null) {
                                }
                                throw th;
                            }
                        }
                        byteArrayOutputStream = byteArrayOutputStream2;
                        encode = Base64.encode(byteArrayOutputStream2.toByteArray());
                    }
                    try {
                        str = JSONUtil.toJSONableString(encode);
                        if (r3 != 0) {
                            try {
                                r3.close();
                            } catch (IOException e3) {
                                e3.printStackTrace();
                            }
                        }
                        if (byteArrayOutputStream != null) {
                            byteArrayOutputStream.close();
                        }
                    } catch (Exception e4) {
                        e = e4;
                        Deprecated_JSUtil.execCallback(this.d, this.e, StringUtil.format(DOMException.JSON_ERROR_INFO, 13, e.getMessage()), JSUtil.ERROR, true, false);
                        if (r3 != 0) {
                            try {
                                r3.close();
                            } catch (IOException e5) {
                                e5.printStackTrace();
                            }
                        }
                        if (byteArrayOutputStream != null) {
                            byteArrayOutputStream.close();
                        }
                        return str;
                    } catch (Throwable th3) {
                        th = th3;
                        byteArrayOutputStream2 = byteArrayOutputStream;
                        if (r3 != 0) {
                        }
                        if (byteArrayOutputStream2 != null) {
                        }
                        throw th;
                    }
                } catch (Exception e6) {
                    e = e6;
                    byteArrayOutputStream = null;
                    Deprecated_JSUtil.execCallback(this.d, this.e, StringUtil.format(DOMException.JSON_ERROR_INFO, 13, e.getMessage()), JSUtil.ERROR, true, false);
                    if (r3 != 0) {
                    }
                    if (byteArrayOutputStream != null) {
                    }
                    return str;
                } catch (Throwable th4) {
                    th = th4;
                    byteArrayOutputStream = null;
                    str = r3;
                    r3 = str;
                    byteArrayOutputStream2 = byteArrayOutputStream;
                    if (r3 != 0) {
                    }
                    if (byteArrayOutputStream2 != null) {
                    }
                    throw th;
                }
            } catch (Exception e7) {
                e = e7;
                r3 = 0;
            } catch (Throwable th5) {
                th = th5;
                byteArrayOutputStream = null;
                r3 = str;
                byteArrayOutputStream2 = byteArrayOutputStream;
                if (r3 != 0) {
                }
                if (byteArrayOutputStream2 != null) {
                }
                throw th;
            }
            return str;
        }
    }

    public static String b(String str) {
        String fileExtensionFromUrl = MimeTypeMap.getFileExtensionFromUrl(str);
        if (fileExtensionFromUrl != null) {
            return MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtensionFromUrl);
        }
        return null;
    }

    private String c(String str) {
        if (str.startsWith(a)) {
            return AbsoluteConst.MINI_SERVER_APP_WWW + str.substring(a.length(), str.length());
        }
        if (str.startsWith(c)) {
            return AbsoluteConst.MINI_SERVER_APP_DOC + str.substring(c.length(), str.length());
        }
        if (str.startsWith(d)) {
            return "_documents/" + str.substring(d.length(), str.length());
        }
        if (str.startsWith(e)) {
            return "_downloads/" + str.substring(e.length(), str.length());
        }
        return null;
    }

    private String d(String str) {
        boolean z;
        String b2 = b(str);
        if (PdrUtil.isEmpty(b2)) {
            b2 = String.valueOf(-1);
            z = true;
        } else {
            z = false;
        }
        if (z) {
            if (str.startsWith(a)) {
                return String.valueOf(1);
            }
            if (str.startsWith(c)) {
                return String.valueOf(2);
            }
            if (str.startsWith(d)) {
                return String.valueOf(3);
            }
            return str.startsWith(e) ? String.valueOf(4) : b2;
        }
        return b2;
    }

    private boolean e(String str) {
        return str.endsWith(BaseInfo.REL_PRIVATE_WWW_DIR) || str.endsWith(BaseInfo.REL_PUBLIC_DOCUMENTS_DIR) || str.endsWith(BaseInfo.REL_PUBLIC_DOWNLOADS_DIR) || str.endsWith(BaseInfo.REL_PRIVATE_DOC_DIR) || str.endsWith(AbsoluteConst.MINI_SERVER_APP_WWW) || str.endsWith("_documents/") || str.endsWith("_downloads/") || str.endsWith(AbsoluteConst.MINI_SERVER_APP_DOC);
    }

    @Override
    public void dispose(String str) {
    }

    @Override
    public String execute(IWebview iWebview, String str, String[] strArr) {
        String[] strArr2;
        char c2;
        String str2;
        String str3;
        boolean z;
        JSONObject a2;
        boolean z2;
        String str4;
        String str5;
        JSONObject a3;
        boolean z3;
        String name;
        byte[] bytes;
        int i;
        String encode;
        String format;
        boolean z4;
        boolean z5;
        String str6;
        String str7;
        JSONObject jSONObject;
        boolean z6;
        JSONObject a4;
        boolean z7;
        FileOutputStream fileOutputStream;
        FileInputStream fileInputStream;
        String str8;
        JSONArray b2;
        boolean z8;
        String str9 = strArr[0];
        if (strArr.length > 1 && strArr[1] != null) {
            try {
            } catch (JSONException e2) {
                e2.printStackTrace();
                a(8, iWebview, str9);
            }
            if (Arrays.binarySearch(f, str) < 0) {
                strArr2 = JSUtil.jsonArrayToStringArr(new JSONArray(strArr[1]));
                IApp obtainApp = iWebview.obtainFrameView().obtainApp();
                boolean isOnAppRunningMode = obtainApp.isOnAppRunningMode();
                a = obtainApp.getPathByType((byte) 0);
                b = obtainApp.getPathByType((byte) -1);
                c = obtainApp.getPathByType((byte) 1);
                d = obtainApp.getPathByType((byte) 2);
                e = obtainApp.getPathByType((byte) 3);
                str.hashCode();
                switch (str.hashCode()) {
                    case -1354714928:
                        if (str.equals("copyTo")) {
                            c2 = 0;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -1224446278:
                        if (str.equals("requestFileSystem")) {
                            c2 = 1;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -1068263892:
                        if (str.equals("moveTo")) {
                            c2 = 2;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -1017341515:
                        if (str.equals("readAsText")) {
                            c2 = 3;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -972189769:
                        if (str.equals("getDirectory")) {
                            c2 = 4;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -941263860:
                        if (str.equals("convertLocalFileSystemURL")) {
                            c2 = 5;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -934610812:
                        if (str.equals(AbsoluteConst.XML_REMOVE)) {
                            c2 = 6;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -888091149:
                        if (str.equals("getImageInfo")) {
                            c2 = 7;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -91542719:
                        if (str.equals("getFileMetadata")) {
                            c2 = '\b';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case -75538958:
                        if (str.equals("getFile")) {
                            c2 = '\t';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 113399775:
                        if (str.equals("write")) {
                            c2 = '\n';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 178260718:
                        if (str.equals("getAudioInfo")) {
                            c2 = 11;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 324074165:
                        if (str.equals("convertAbsoluteFileSystem")) {
                            c2 = '\f';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 529285085:
                        if (str.equals("readAsDataURL")) {
                            c2 = '\r';
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 676070354:
                        if (str.equals("writeAsBinary")) {
                            c2 = 14;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 700591008:
                        if (str.equals("getParent")) {
                            c2 = 15;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1068167127:
                        if (str.equals("readAsBase64")) {
                            c2 = 16;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1323018515:
                        if (str.equals("getVideoInfo")) {
                            c2 = 17;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1342041536:
                        if (str.equals("getFileInfo")) {
                            c2 = 18;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1352737307:
                        if (str.equals("removeRecursively")) {
                            c2 = 19;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1572117509:
                        if (str.equals("resolveLocalFileSystemURL")) {
                            c2 = 20;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1627895973:
                        if (str.equals("getMetadata")) {
                            c2 = 21;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1852984678:
                        if (str.equals("truncate")) {
                            c2 = 22;
                            break;
                        }
                        c2 = 65535;
                        break;
                    case 1963978266:
                        if (str.equals("readEntries")) {
                            c2 = 23;
                            break;
                        }
                        c2 = 65535;
                        break;
                    default:
                        c2 = 65535;
                        break;
                }
                str2 = "";
                switch (c2) {
                    case 0:
                        if (strArr2[1] != null) {
                            StringBuilder append = new StringBuilder().append(strArr2[1]);
                            String str10 = strArr2[1];
                            String str11 = File.separator;
                            str3 = append.append(str10.endsWith(str11) ? "" : str11).toString();
                        } else {
                            str3 = strArr2[1];
                        }
                        String str12 = str3 + strArr2[2];
                        String str13 = strArr2[0];
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), str12, str13)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            if (!obtainApp.checkPrivateDir(str12)) {
                                try {
                                } catch (IOException e3) {
                                    e3.printStackTrace();
                                }
                                if (!DHFile.isExist(str12)) {
                                    if (!DHFile.isExist(str13)) {
                                        break;
                                    } else if (DHFile.copyFile(str13, str12) == 1) {
                                        z = true;
                                        if (!z) {
                                            JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(strArr2[2], str12, obtainApp.convert2RelPath(str12), new File(str12).isDirectory()), JSUtil.OK, false);
                                            break;
                                        } else {
                                            a(10, iWebview, str9);
                                            break;
                                        }
                                    }
                                }
                            }
                            z = false;
                            if (!z) {
                            }
                        }
                    case 1:
                        try {
                            int parseInt = Integer.parseInt(strArr2[0]);
                            if (parseInt == 1) {
                                a2 = io.dcloud.js.file.a.a("PRIVATE_WWW", 1, BaseInfo.REAL_PRIVATE_WWW_DIR, a, BaseInfo.REL_PRIVATE_WWW_DIR);
                            } else if (parseInt == 2) {
                                a2 = io.dcloud.js.file.a.a("PRIVATE_DOCUMENTS", 2, BaseInfo.REAL_PRIVATE_DOC_DIR, c, BaseInfo.REL_PRIVATE_DOC_DIR);
                            } else if (parseInt == 3) {
                                a2 = io.dcloud.js.file.a.a("PUBLIC_DOCUMENTS", 3, BaseInfo.REAL_PUBLIC_DOCUMENTS_DIR, d, BaseInfo.REL_PUBLIC_DOCUMENTS_DIR);
                            } else if (parseInt != 4) {
                                String str14 = DeviceInfo.sDeviceRootDir;
                                a2 = io.dcloud.js.file.a.a("PUBLIC_DEVICE_ROOT", 5, str14, str14, str14);
                            } else {
                                a2 = io.dcloud.js.file.a.a("PUBLIC_DOWNLOADS", 4, BaseInfo.REAL_PUBLIC_DOWNLOADS_DIR, e, BaseInfo.REL_PUBLIC_DOWNLOADS_DIR);
                            }
                            JSUtil.execCallback(iWebview, str9, a2, JSUtil.OK, false);
                            break;
                        } catch (Exception e4) {
                            e4.printStackTrace();
                            a(10, iWebview, str9);
                            break;
                        }
                    case 2:
                        String convert2AbsFullPath = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), strArr2[1] + strArr2[2]);
                        if (obtainApp.checkPrivateDir(strArr2[0]) || obtainApp.checkPrivateDir(convert2AbsFullPath)) {
                            a(10, iWebview, str9);
                            break;
                        } else {
                            String convert2AbsFullPath2 = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), strArr2[0]);
                            if (!FileUtil.checkPathAccord(iWebview.getContext(), convert2AbsFullPath, convert2AbsFullPath2)) {
                                a(15, iWebview, str9);
                                break;
                            } else {
                                File file = new File(convert2AbsFullPath2);
                                boolean isDirectory = file.isDirectory();
                                File file2 = new File(convert2AbsFullPath);
                                if (file2.exists()) {
                                    z2 = false;
                                } else {
                                    File parentFile = file2.getParentFile();
                                    if (!parentFile.exists()) {
                                        parentFile.mkdirs();
                                    }
                                    z2 = file.renameTo(file2);
                                }
                                if (z2) {
                                    JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(strArr2[2], convert2AbsFullPath, obtainApp.convert2RelPath(convert2AbsFullPath), isDirectory), JSUtil.OK, false);
                                    break;
                                } else {
                                    a(10, iWebview, str9);
                                    break;
                                }
                            }
                        }
                        break;
                    case 3:
                        String str15 = strArr2[0];
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), str15)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            boolean checkPrivateDir = obtainApp.checkPrivateDir(str15);
                            String str16 = strArr2[1];
                            int parseInt2 = PdrUtil.parseInt(strArr2[2], 0);
                            int parseInt3 = PdrUtil.parseInt(strArr2[3], -1);
                            if (checkPrivateDir && isOnAppRunningMode) {
                                a(10, iWebview, str9);
                                break;
                            } else {
                                AsyncTaskHandler.executeThreadTask(new a(str15, parseInt3, parseInt2, str16, iWebview, str9));
                                break;
                            }
                        }
                    case 4:
                        if (strArr2[0] != null && !strArr2[0].endsWith("/")) {
                            strArr2[0] = strArr2[0] + "/";
                        }
                        String convert2AbsFullPath3 = obtainApp.convert2AbsFullPath(strArr2[0], strArr2[1]);
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), convert2AbsFullPath3)) {
                            a(15, iWebview, str9);
                            break;
                        } else if (strArr2[0] != null && strArr2[1] != null && strArr2[1].indexOf("../") != -1 && e(strArr2[0])) {
                            a(4, iWebview, str9);
                            return null;
                        } else {
                            if (!convert2AbsFullPath3.endsWith("/")) {
                                convert2AbsFullPath3 = convert2AbsFullPath3 + "/";
                            }
                            File file3 = new File(convert2AbsFullPath3);
                            try {
                                JSONObject jSONObject2 = new JSONObject(strArr2[2]);
                                boolean optBoolean = jSONObject2.optBoolean("create");
                                boolean optBoolean2 = jSONObject2.optBoolean("exclusive");
                                if (file3.exists()) {
                                    if (optBoolean2 && optBoolean2) {
                                        a(12, iWebview, str9);
                                    }
                                } else if (optBoolean) {
                                    byte createNewFile = DHFile.createNewFile(convert2AbsFullPath3);
                                    if (createNewFile == -1 || (createNewFile == -2 && optBoolean2)) {
                                        throw new RuntimeException();
                                    }
                                } else {
                                    a(14, iWebview, str9);
                                    return null;
                                }
                                JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(strArr2[1], convert2AbsFullPath3, obtainApp.convert2RelPath(convert2AbsFullPath3), true), JSUtil.OK, false);
                            } catch (Exception unused) {
                                Logger.d("Not Found " + convert2AbsFullPath3);
                                a(10, iWebview, str9);
                                break;
                            }
                        }
                        break;
                    case 5:
                        return Deprecated_JSUtil.wrapJsVar(obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), strArr[0]), true);
                    case 6:
                        String str17 = strArr2[0];
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), str17)) {
                            a(15, iWebview, str9);
                            break;
                        } else if (obtainApp.checkPrivateDir(str17)) {
                            a(4, iWebview, str9);
                            return null;
                        } else if (new File(str17).delete()) {
                            JSUtil.execCallback(iWebview, str9, "", JSUtil.OK, false);
                            break;
                        } else {
                            a(10, iWebview, str9);
                            break;
                        }
                    case 7:
                        String str18 = strArr[0];
                        String str19 = strArr[1];
                        if (!PdrUtil.isEmpty(str19)) {
                            if (strArr.length <= 2 || PdrUtil.isEmpty(strArr[2])) {
                                str4 = "android_asset/";
                                str5 = null;
                            } else {
                                String str20 = strArr[2];
                                if (!str20.endsWith("/")) {
                                    str20 = str20 + "/";
                                }
                                str4 = "android_asset/";
                                str5 = iWebview.obtainApp().convert2AbsFullPath(iWebview.obtainFullUrl(), str20) + System.currentTimeMillis() + "_" + Math.abs(str19.hashCode());
                            }
                            if (PdrUtil.isNetPath(str19)) {
                                try {
                                    Glide.with(iWebview.getContext()).asFile().load(str19).into((RequestBuilder<File>) new b(str5, iWebview, str18));
                                    break;
                                } catch (Exception unused2) {
                                    Deprecated_JSUtil.execCallback(iWebview, str18, DOMException.toJSON(13, "Failed to load resource"), JSUtil.ERROR, true, false);
                                    break;
                                }
                            } else {
                                String convert2AbsFullPath4 = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), str19);
                                if (!(FileUtil.checkPathAccord(iWebview.getContext(), convert2AbsFullPath4) || FileUtil.getPathForPublicType(convert2AbsFullPath4) != null)) {
                                    a(15, iWebview, str9);
                                    break;
                                } else {
                                    if (convert2AbsFullPath4.startsWith("apps/")) {
                                        convert2AbsFullPath4 = "/" + convert2AbsFullPath4;
                                    }
                                    if (convert2AbsFullPath4.startsWith("/android_asset/")) {
                                        convert2AbsFullPath4 = convert2AbsFullPath4.replace("/android_asset", "");
                                    } else if (convert2AbsFullPath4.startsWith(str4)) {
                                        convert2AbsFullPath4 = convert2AbsFullPath4.replace("android_asset", "");
                                    }
                                    String checkPrivateDirAndCopy2Temp = obtainApp.checkPrivateDirAndCopy2Temp(convert2AbsFullPath4);
                                    if (!new File(checkPrivateDirAndCopy2Temp).exists()) {
                                        a(14, iWebview, str9);
                                        break;
                                    } else {
                                        a(checkPrivateDirAndCopy2Temp, iWebview, str18);
                                        break;
                                    }
                                }
                            }
                        }
                        break;
                    case '\b':
                        String str21 = strArr2[0];
                        if (!(FileUtil.checkPathAccord(iWebview.getContext(), str21) || FileUtil.getPathForPublicType(str21) != null)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            if (!obtainApp.checkPrivateDir(str21) || !isOnAppRunningMode) {
                                try {
                                    a3 = io.dcloud.js.file.a.a(str21, d(str21));
                                    z3 = true;
                                } catch (Exception e5) {
                                    e5.printStackTrace();
                                }
                                if (!z3) {
                                    JSUtil.execCallback(iWebview, str9, a3, JSUtil.OK, false);
                                    break;
                                } else {
                                    a(10, iWebview, str9);
                                    break;
                                }
                            }
                            a3 = null;
                            z3 = false;
                            if (!z3) {
                            }
                        }
                        break;
                    case '\t':
                        String convert2AbsFullPath5 = obtainApp.convert2AbsFullPath(strArr2[0], strArr2[1]);
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), convert2AbsFullPath5)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            File file4 = new File(convert2AbsFullPath5);
                            try {
                                JSONObject jSONObject3 = new JSONObject(strArr2[2]);
                                String str22 = strArr2[1];
                                boolean optBoolean3 = jSONObject3.optBoolean("create");
                                boolean optBoolean4 = jSONObject3.optBoolean("exclusive");
                                if (file4.exists()) {
                                    if (optBoolean3 && optBoolean4) {
                                        a(12, iWebview, str9);
                                        return null;
                                    }
                                    name = file4.getName();
                                } else if (optBoolean3) {
                                    byte createNewFile2 = DHFile.createNewFile(file4);
                                    name = file4.getName();
                                    if (createNewFile2 == -1 || (createNewFile2 == -2 && optBoolean4)) {
                                        throw new RuntimeException();
                                    }
                                } else {
                                    a(14, iWebview, str9);
                                    return null;
                                }
                                JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(name, convert2AbsFullPath5, obtainApp.convert2RelPath(convert2AbsFullPath5), false), JSUtil.OK, false);
                            } catch (Exception unused3) {
                                a(10, iWebview, str9);
                                break;
                            }
                        }
                        break;
                    case '\n':
                        try {
                            String str23 = strArr2[0];
                            if (!FileUtil.checkPathAccord(iWebview.getContext(), str23)) {
                                a(15, iWebview, str9);
                                break;
                            } else {
                                boolean checkPrivateDir2 = obtainApp.checkPrivateDir(str23);
                                int intValue = Integer.valueOf(strArr2[2]).intValue();
                                if (strArr2[1] != null && !checkPrivateDir2) {
                                    DHFile.writeFile(strArr2[1].getBytes(), intValue, str23);
                                    JSUtil.execCallback(iWebview, str9, bytes.length, JSUtil.OK, false);
                                    break;
                                }
                                a(4, iWebview, str9);
                                return null;
                            }
                        } catch (Exception unused4) {
                            a(10, iWebview, str9);
                            break;
                        }
                    case 11:
                    case 17:
                        String str24 = strArr[0];
                        try {
                            str2 = new JSONObject(strArr[1]).optString("filePath");
                        } catch (JSONException unused5) {
                        }
                        a(str2, str24, iWebview, str);
                        break;
                    case '\f':
                        return Deprecated_JSUtil.wrapJsVar(obtainApp.convert2RelPath(strArr[0]), true);
                    case '\r':
                        String str25 = strArr2[0];
                        if (!obtainApp.checkPrivateDir(str25) || !isOnAppRunningMode) {
                            byte[] readAll = DHFile.readAll(str25);
                            try {
                                String mimeType = PdrUtil.getMimeType(str25);
                                if (DeviceInfo.sDeviceSdkVer >= 8) {
                                    i = 2;
                                    encode = android.util.Base64.encodeToString(readAll, 2);
                                } else {
                                    i = 2;
                                    encode = Base64.encode(readAll);
                                }
                                Object[] objArr = new Object[i];
                                objArr[0] = mimeType;
                                objArr[1] = encode;
                                format = String.format("data:%s;base64,%s", objArr);
                                z4 = true;
                            } catch (Exception e6) {
                                e6.printStackTrace();
                            }
                            if (!z4) {
                                JSUtil.execCallback(iWebview, str9, format, JSUtil.OK, false);
                                break;
                            } else {
                                a(10, iWebview, str9);
                                break;
                            }
                        }
                        format = null;
                        z4 = false;
                        if (!z4) {
                        }
                    case 14:
                        a(iWebview, strArr2, str9);
                        break;
                    case 15:
                        String str26 = strArr2[0];
                        if (!(FileUtil.checkPathAccord(iWebview.getContext(), str26) || FileUtil.getPathForPublicType(str26) != null)) {
                            a(15, iWebview, str9);
                            break;
                        } else if (str26 != null && e(str26)) {
                            a(4, iWebview, str9);
                            return null;
                        } else {
                            File file5 = new File(str26);
                            if (file5.exists()) {
                                String parent = file5.getParent();
                                JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(file5.getParentFile().getName(), parent, obtainApp.convert2RelPath(parent), true), JSUtil.OK, false);
                                z5 = true;
                            } else {
                                z5 = false;
                            }
                            if (!z5) {
                                a(10, iWebview, str9);
                                break;
                            }
                        }
                        break;
                    case 16:
                        a(iWebview, obtainApp, strArr2, str9);
                        break;
                    case 18:
                        String str27 = strArr[0];
                        try {
                            jSONObject = new JSONObject(strArr[1]);
                            str6 = jSONObject.optString("filePath");
                        } catch (JSONException unused6) {
                            str6 = "";
                        }
                        try {
                            str7 = jSONObject.optString("digestAlgorithm", Md5Utils.ALGORITHM);
                        } catch (JSONException unused7) {
                            str7 = Md5Utils.ALGORITHM;
                            if (!PdrUtil.isEmpty(str6)) {
                                String convert2AbsFullPath6 = iWebview.obtainApp().convert2AbsFullPath(iWebview.obtainFullUrl(), str6);
                                if ((FileUtil.checkPathAccord(iWebview.getContext(), str6) && FileUtil.getPathForPublicType(str6) == null) ? false : true) {
                                }
                            }
                            return null;
                        }
                        if (!PdrUtil.isEmpty(str6) && !PdrUtil.isNetPath(str6)) {
                            String convert2AbsFullPath62 = iWebview.obtainApp().convert2AbsFullPath(iWebview.obtainFullUrl(), str6);
                            if ((FileUtil.checkPathAccord(iWebview.getContext(), str6) && FileUtil.getPathForPublicType(str6) == null) ? false : true) {
                                a(15, iWebview, str9);
                            } else {
                                if (convert2AbsFullPath62.startsWith("apps/")) {
                                    convert2AbsFullPath62 = "/" + convert2AbsFullPath62;
                                }
                                if (convert2AbsFullPath62.startsWith("/android_asset/")) {
                                    convert2AbsFullPath62 = convert2AbsFullPath62.replace("/android_asset", "");
                                } else if (convert2AbsFullPath62.startsWith("android_asset/")) {
                                    convert2AbsFullPath62 = convert2AbsFullPath62.replace("android_asset", "");
                                }
                                File file6 = new File(obtainApp.checkPrivateDirAndCopy2Temp(convert2AbsFullPath62));
                                if (!file6.exists()) {
                                    Deprecated_JSUtil.execCallback(iWebview, str27, StringUtil.format(DOMException.JSON_ERROR_INFO, -4, DOMException.MSG_FILE_NOT_EXIST), JSUtil.ERROR, true, false);
                                } else {
                                    ThreadPool.self().addThreadTask(new c(this, file6, str7, iWebview, str27));
                                }
                            }
                        }
                    case 19:
                        if (!JSUtil.checkOperateDirErrorAndCallback(iWebview, str9, strArr2[0])) {
                            String str28 = strArr2[0];
                            if (!FileUtil.checkPathAccord(iWebview.getContext(), str28)) {
                                a(15, iWebview, str9);
                                break;
                            } else {
                                File file7 = new File(str28);
                                if (file7.isDirectory()) {
                                    try {
                                        String valueOf = String.valueOf(System.currentTimeMillis());
                                        DHFile.rename(file7.getAbsolutePath() + "/", valueOf);
                                        file7 = new File(file7.getParent() + "/" + valueOf);
                                    } catch (IOException e7) {
                                        e7.printStackTrace();
                                    }
                                }
                                if (DHFile.delete(file7)) {
                                    JSUtil.execCallback(iWebview, str9, "", JSUtil.OK, false);
                                    break;
                                } else {
                                    a(10, iWebview, str9);
                                    break;
                                }
                            }
                        } else {
                            return null;
                        }
                    case 20:
                        try {
                            boolean e8 = e(strArr2[0]);
                            boolean z9 = e8 && obtainApp.isOnAppRunningMode() && obtainApp.checkPrivateDir(strArr2[0]);
                            String convert2AbsFullPath7 = obtainApp.convert2AbsFullPath(iWebview.obtainFullUrl(), strArr2[0]);
                            if (z9) {
                                JSONObject a5 = a(convert2AbsFullPath7);
                                JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(BaseInfo.REL_PRIVATE_WWW_DIR, convert2AbsFullPath7, true, BaseInfo.REL_PRIVATE_WWW_DIR, a5.optString("fsName"), a5.optInt("type"), a5.optJSONObject("fsRoot")), JSUtil.OK, false);
                                break;
                            } else {
                                File file8 = new File(convert2AbsFullPath7);
                                boolean exists = file8.exists();
                                if (!exists && e8) {
                                    try {
                                        File parentFile2 = file8.getParentFile();
                                        if (!parentFile2.exists()) {
                                            parentFile2.mkdirs();
                                        }
                                        z6 = 1 == DHFile.createNewFile(DHFile.createFileHandler(convert2AbsFullPath7));
                                    } catch (Exception e9) {
                                        e9.printStackTrace();
                                    }
                                    if (!z6) {
                                        JSONObject a6 = a(convert2AbsFullPath7);
                                        JSUtil.execCallback(iWebview, str9, io.dcloud.js.file.a.a(file8.getName(), convert2AbsFullPath7, file8.isDirectory(), strArr2[0], a6.optString("fsName"), a6.optInt("type"), a6.optJSONObject("fsRoot")), JSUtil.OK, false);
                                        break;
                                    } else {
                                        a(14, iWebview, str9);
                                        break;
                                    }
                                }
                                z6 = exists;
                                if (!z6) {
                                }
                            }
                        } catch (JSONException unused8) {
                            a(10, iWebview, str9);
                            break;
                        }
                        break;
                    case 21:
                        String str29 = strArr2[0];
                        if (!(FileUtil.checkPathAccord(iWebview.getContext(), str29) || FileUtil.getPathForPublicType(str29) != null)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            if (!obtainApp.checkPrivateDir(str29) || !isOnAppRunningMode) {
                                try {
                                    a4 = io.dcloud.js.file.a.a(str29, (strArr2.length == 2 && strArr2[1] != null && strArr2[1].equalsIgnoreCase(AbsoluteConst.TRUE)) ? Boolean.parseBoolean(strArr2[1]) : false);
                                    z7 = true;
                                } catch (Exception e10) {
                                    e10.printStackTrace();
                                }
                                if (!z7) {
                                    JSUtil.execCallback(iWebview, str9, a4, JSUtil.OK, false);
                                    break;
                                } else {
                                    a(10, iWebview, str9);
                                    break;
                                }
                            }
                            a4 = null;
                            z7 = false;
                            if (!z7) {
                            }
                        }
                        break;
                    case 22:
                        try {
                            str8 = strArr2[0];
                        } catch (Exception e11) {
                            e = e11;
                            fileOutputStream = null;
                            fileInputStream = null;
                        } catch (Throwable th) {
                            th = th;
                            fileOutputStream = null;
                            fileInputStream = null;
                        }
                        if (!FileUtil.checkPathAccord(iWebview.getContext(), str8)) {
                            a(15, iWebview, str9);
                            IOUtil.close((InputStream) null);
                            IOUtil.close((OutputStream) null);
                            return null;
                        }
                        File file9 = new File(str8);
                        fileInputStream = new FileInputStream(file9);
                        try {
                            File file10 = new File(file9.getParent() + "/" + (System.currentTimeMillis() + file9.getName()));
                            fileOutputStream = new FileOutputStream(file10);
                            try {
                                try {
                                    int parseInt4 = Integer.parseInt(strArr2[1]);
                                    int parseInt5 = Integer.parseInt(strArr2[2]);
                                    byte[] bArr = new byte[Math.min(parseInt5 + parseInt4, 10240)];
                                    int i2 = parseInt5;
                                    int i3 = 0;
                                    while (true) {
                                        int read = fileInputStream.read(bArr);
                                        if (read != -1) {
                                            int min = Math.min(parseInt4 - i3, read - i2);
                                            if (min > 0) {
                                                fileOutputStream.write(bArr, i2, min);
                                                i3 += min;
                                            }
                                            if (i3 < parseInt4) {
                                                i2 = i2 > 0 ? i2 - read : 0;
                                            }
                                        }
                                    }
                                    file9.delete();
                                    file10.renameTo(file9);
                                    Deprecated_JSUtil.execCallback(iWebview, str9, strArr2[1], JSUtil.OK, true, false);
                                } catch (Exception e12) {
                                    e = e12;
                                    e.printStackTrace();
                                    a(10, iWebview, str9);
                                    IOUtil.close(fileInputStream);
                                    IOUtil.close(fileOutputStream);
                                    return null;
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                IOUtil.close(fileInputStream);
                                IOUtil.close(fileOutputStream);
                                throw th;
                            }
                        } catch (Exception e13) {
                            e = e13;
                            fileOutputStream = null;
                        } catch (Throwable th3) {
                            th = th3;
                            fileOutputStream = null;
                            IOUtil.close(fileInputStream);
                            IOUtil.close(fileOutputStream);
                            throw th;
                        }
                        IOUtil.close(fileInputStream);
                        IOUtil.close(fileOutputStream);
                    case 23:
                        String str30 = strArr2[0];
                        if (!(FileUtil.checkPathAccord(iWebview.getContext(), str30) || FileUtil.getPathForPublicType(str30) != null)) {
                            a(15, iWebview, str9);
                            break;
                        } else {
                            if (!obtainApp.checkPrivateDir(str30) || !isOnAppRunningMode) {
                                try {
                                    b2 = io.dcloud.js.file.a.b(str30, obtainApp.convert2RelPath(str30));
                                    z8 = true;
                                } catch (Exception e14) {
                                    e14.printStackTrace();
                                }
                                if (!z8) {
                                    JSUtil.execCallback(iWebview, str9, b2, JSUtil.OK, false);
                                    break;
                                } else {
                                    a(10, iWebview, str9);
                                    break;
                                }
                            }
                            b2 = null;
                            z8 = false;
                            if (!z8) {
                            }
                        }
                        break;
                }
                return null;
            }
        }
        strArr2 = null;
        IApp obtainApp2 = iWebview.obtainFrameView().obtainApp();
        boolean isOnAppRunningMode2 = obtainApp2.isOnAppRunningMode();
        a = obtainApp2.getPathByType((byte) 0);
        b = obtainApp2.getPathByType((byte) -1);
        c = obtainApp2.getPathByType((byte) 1);
        d = obtainApp2.getPathByType((byte) 2);
        e = obtainApp2.getPathByType((byte) 3);
        str.hashCode();
        switch (str.hashCode()) {
            case -1354714928:
                break;
            case -1224446278:
                break;
            case -1068263892:
                break;
            case -1017341515:
                break;
            case -972189769:
                break;
            case -941263860:
                break;
            case -934610812:
                break;
            case -888091149:
                break;
            case -91542719:
                break;
            case -75538958:
                break;
            case 113399775:
                break;
            case 178260718:
                break;
            case 324074165:
                break;
            case 529285085:
                break;
            case 676070354:
                break;
            case 700591008:
                break;
            case 1068167127:
                break;
            case 1323018515:
                break;
            case 1342041536:
                break;
            case 1352737307:
                break;
            case 1572117509:
                break;
            case 1627895973:
                break;
            case 1852984678:
                break;
            case 1963978266:
                break;
        }
        str2 = "";
        switch (c2) {
        }
        return null;
    }

    @Override
    public void init(AbsMgr absMgr, String str) {
    }

    private void a(IWebview iWebview, String[] strArr, String str) {
        try {
            String str2 = strArr[0];
            if (!FileUtil.checkPathAccord(iWebview.getContext(), str2)) {
                a(15, iWebview, str);
                return;
            }
            boolean checkPrivateDir = iWebview.obtainApp().checkPrivateDir(str2);
            int intValue = Integer.valueOf(strArr[2]).intValue();
            if (strArr[1] != null && !checkPrivateDir) {
                AsyncTaskHandler.executeThreadTask(new d(this, strArr, iWebview, str, intValue, str2));
                return;
            }
            a(4, iWebview, str);
        } catch (Exception unused) {
            a(10, iWebview, str);
        }
    }

    private void a(IWebview iWebview, IApp iApp, String[] strArr, String str) {
        String str2 = strArr[0];
        if (!FileUtil.checkPathAccord(iWebview.getContext(), str2)) {
            a(15, iWebview, str);
            return;
        }
        boolean checkPrivateDir = iApp.checkPrivateDir(str2);
        int parseInt = PdrUtil.parseInt(strArr[1], 0);
        int parseInt2 = PdrUtil.parseInt(strArr[2], -1);
        if (checkPrivateDir && iApp.isOnAppRunningMode()) {
            a(10, iWebview, str);
        } else {
            AsyncTaskHandler.executeThreadTask(new e(str2, parseInt2, parseInt, iWebview, str));
        }
    }

    private void a(String str, String str2, IWebview iWebview, String str3) {
        if (PdrUtil.isEmpty(str) || PdrUtil.isNetPath(str)) {
            return;
        }
        String convert2AbsFullPath = iWebview.obtainApp().convert2AbsFullPath(iWebview.obtainFullUrl(), str);
        if (convert2AbsFullPath.startsWith("apps/")) {
            convert2AbsFullPath = "/" + convert2AbsFullPath;
        }
        if (convert2AbsFullPath.startsWith("/android_asset/")) {
            convert2AbsFullPath = convert2AbsFullPath.replace("/android_asset", "");
        } else if (convert2AbsFullPath.startsWith("android_asset/")) {
            convert2AbsFullPath = convert2AbsFullPath.replace("android_asset", "");
        }
        String checkPrivateDirAndCopy2Temp = iWebview.obtainApp().checkPrivateDirAndCopy2Temp(convert2AbsFullPath);
        if (!(FileUtil.checkPathAccord(iWebview.getContext(), checkPrivateDirAndCopy2Temp) || FileUtil.getPathForPublicType(checkPrivateDirAndCopy2Temp) != null)) {
            a(15, iWebview, str2);
        } else if (!new File(checkPrivateDirAndCopy2Temp).exists()) {
            Deprecated_JSUtil.execCallback(iWebview, str2, StringUtil.format(DOMException.JSON_ERROR_INFO, -4, DOMException.MSG_FILE_NOT_EXIST), JSUtil.ERROR, true, false);
        } else {
            try {
                MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
                if (FileUtil.checkPrivatePath(iWebview.getContext(), checkPrivateDirAndCopy2Temp)) {
                    mediaMetadataRetriever.setDataSource(checkPrivateDirAndCopy2Temp);
                } else {
                    Uri videoFileUri = FileUtil.getVideoFileUri(iWebview.getContext(), checkPrivateDirAndCopy2Temp);
                    if (videoFileUri != null) {
                        mediaMetadataRetriever.setDataSource(iWebview.getContext(), videoFileUri);
                    }
                }
                String extractMetadata = mediaMetadataRetriever.extractMetadata(9);
                String extractMetadata2 = mediaMetadataRetriever.extractMetadata(18);
                String extractMetadata3 = mediaMetadataRetriever.extractMetadata(19);
                JSONObject jSONObject = new JSONObject();
                if (str3.equals("getVideoInfo")) {
                    if (extractMetadata2 != null && extractMetadata3 != null) {
                        jSONObject.put("resolution", extractMetadata2 + "*" + extractMetadata3);
                    }
                    if (extractMetadata2 != null) {
                        jSONObject.put(AbsoluteConst.JSON_KEY_WIDTH, extractMetadata2);
                    }
                    if (extractMetadata3 != null) {
                        jSONObject.put("height", extractMetadata3);
                    }
                    jSONObject.put("size", new File(checkPrivateDirAndCopy2Temp).length());
                }
                jSONObject.put(AbsoluteConst.TRANS_DURATION, StringUtil.format("%.2f", Float.valueOf(Float.parseFloat(extractMetadata) / 1000.0f)));
                Deprecated_JSUtil.execCallback(iWebview, str2, jSONObject.toString(), JSUtil.OK, true, false);
            } catch (Exception e2) {
                JSONObject jSONObject2 = new JSONObject();
                try {
                    jSONObject2.put("code", 13);
                    jSONObject2.put(DOMException.MESSAGE, e2.getMessage());
                } catch (JSONException unused) {
                }
                Deprecated_JSUtil.execCallback(iWebview, str2, jSONObject2.toString(), JSUtil.ERROR, true, false);
            }
        }
    }

    private JSONObject a(String str) throws JSONException {
        JSONObject jSONObject = new JSONObject();
        if (str.startsWith(a)) {
            jSONObject.put("type", 1);
            jSONObject.put("fsName", "PRIVATE_WWW");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PRIVATE_WWW", a, c(str), true));
        } else if (str.startsWith(c)) {
            jSONObject.put("type", 2);
            jSONObject.put("fsName", "PRIVATE_DOCUMENTS");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PRIVATE_DOCUMENTS", c, c(str), true));
        } else if (str.startsWith(d)) {
            jSONObject.put("type", 3);
            jSONObject.put("fsName", "PUBLIC_DOCUMENTS");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PUBLIC_DOCUMENTS", d, c(str), true));
        } else if (str.startsWith(e)) {
            jSONObject.put("type", 4);
            jSONObject.put("fsName", "PUBLIC_DOWNLOADS");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PUBLIC_DOWNLOADS", e, c(str), true));
        } else if (str.startsWith(b)) {
            jSONObject.put("type", 1);
            jSONObject.put("fsName", "PRIVATE_WWW");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PRIVATE_WWW", b, c(str), true));
        } else if (PdrUtil.isDeviceRootDir(str)) {
            jSONObject.put("type", 5);
            jSONObject.put("fsName", "PUBLIC_DEVICE_ROOT");
            jSONObject.put("fsRoot", io.dcloud.js.file.a.a("PUBLIC_DEVICE_ROOT", DeviceInfo.sDeviceRootDir, c(str), true));
        }
        return jSONObject;
    }

    public void a(int i, IWebview iWebview, String str) {
        Deprecated_JSUtil.execCallback(iWebview, str, a(i), JSUtil.ERROR, true, false);
    }

    private String a(int i) {
        switch (i) {
            case 1:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "文件没有发现");
            case 2:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "没有获得授权");
            case 3:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), AbsoluteConst.STREAMAPP_UPD_ZHCancel);
            case 4:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "不允许读");
            case 5:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "编码错误");
            case 6:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "不允许修改");
            case 7:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "无效的状态");
            case 8:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "语法错误");
            case 9:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "无效的修改");
            case 10:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "执行出错");
            case 11:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "类型不匹配");
            case 12:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "路径存在");
            case 13:
            default:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), DOMException.MSG_UNKNOWN_ERROR);
            case 14:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), "路径不存在");
            case 15:
                return StringUtil.format(DOMException.JSON_ERROR_INFO, Integer.valueOf(i), DOMException.MSG_PATH_NOT_PRIVATE_ERROR);
        }
    }

    public void a(String str, IWebview iWebview, String str2) {
        String attribute;
        JSONObject jSONObject;
        try {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            String str3 = null;
            if (!FileUtil.checkPrivatePath(iWebview.getContext(), str) && Build.VERSION.SDK_INT >= 24) {
                InputStream fileInputStream = FileUtil.getFileInputStream(iWebview.getContext(), str);
                if (fileInputStream != null) {
                    BitmapFactory.decodeStream(fileInputStream, null, options);
                    attribute = new ExifInterface(fileInputStream).getAttribute(IFeature.F_ORIENTATION);
                    fileInputStream.close();
                } else {
                    attribute = null;
                }
            } else {
                attribute = new ExifInterface(str).getAttribute(IFeature.F_ORIENTATION);
                BitmapFactory.decodeFile(str, options);
            }
            int i = options.outWidth;
            int i2 = options.outHeight;
            String str4 = options.outMimeType;
            if (!PdrUtil.isEmpty(str4) && str4.contains("/")) {
                String[] split = str4.split("/");
                str4 = split[split.length - 1];
            }
            if (!TextUtils.isEmpty(attribute)) {
                char c2 = 65535;
                switch (attribute.hashCode()) {
                    case 48:
                        if (attribute.equals("0")) {
                            c2 = 1;
                            break;
                        }
                        break;
                    case 49:
                        if (attribute.equals("1")) {
                            c2 = 2;
                            break;
                        }
                        break;
                    case 50:
                        if (attribute.equals("2")) {
                            c2 = 3;
                            break;
                        }
                        break;
                    case 51:
                        if (attribute.equals("3")) {
                            c2 = 4;
                            break;
                        }
                        break;
                    case 52:
                        if (attribute.equals("4")) {
                            c2 = 5;
                            break;
                        }
                        break;
                    case 53:
                        if (attribute.equals("5")) {
                            c2 = 6;
                            break;
                        }
                        break;
                    case 54:
                        if (attribute.equals("6")) {
                            c2 = 7;
                            break;
                        }
                        break;
                    case 55:
                        if (attribute.equals("7")) {
                            c2 = '\b';
                            break;
                        }
                        break;
                    case 56:
                        if (attribute.equals("8")) {
                            c2 = '\t';
                            break;
                        }
                        break;
                }
                switch (c2) {
                    case 3:
                        str3 = "up-mirrored";
                        break;
                    case 4:
                        str3 = "down";
                        break;
                    case 5:
                        str3 = "down-mirrored";
                        break;
                    case 6:
                        str3 = "left-mirrored";
                        break;
                    case 7:
                        str3 = "right";
                        break;
                    case '\b':
                        str3 = "right-mirrored";
                        break;
                    case '\t':
                        str3 = "left";
                        break;
                    default:
                        str3 = "up";
                        break;
                }
            }
            jSONObject = new JSONObject();
            jSONObject.put(AbsoluteConst.XML_PATH, DeviceInfo.FILE_PROTOCOL + str);
            jSONObject.put(AbsoluteConst.JSON_KEY_WIDTH, i);
            jSONObject.put("height", i2);
            jSONObject.put("orientation", str3);
            if (!PdrUtil.isEmpty(str4)) {
                str4 = str4.toLowerCase();
            }
            jSONObject.put("type", str4);
        } catch (IOException e2) {
            e = e2;
        } catch (JSONException e3) {
            e = e3;
        }
        try {
            JSUtil.execCallback(iWebview, str2, jSONObject, JSUtil.OK, false);
        } catch (IOException e4) {
            e = e4;
            Deprecated_JSUtil.execCallback(iWebview, str2, StringUtil.format(DOMException.JSON_ERROR_INFO, 13, e.getMessage()), JSUtil.ERROR, true, false);
        } catch (JSONException e5) {
            e = e5;
            Deprecated_JSUtil.execCallback(iWebview, str2, StringUtil.format(DOMException.JSON_ERROR_INFO, 13, e.getMessage()), JSUtil.ERROR, true, false);
        }
    }
}