零距离 v1.0版本的 MD5 值为:250cd43fb2f0f5dc8d41b0026cf86adf

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


package io.dcloud.g.a;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import io.dcloud.WebAppActivity;
import io.dcloud.common.DHInterface.IActivityHandler;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.IBoot;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.DHInterface.IConfusionMgr;
import io.dcloud.common.DHInterface.IDCloudWebviewClientListener;
import io.dcloud.common.DHInterface.IFeature;
import io.dcloud.common.DHInterface.IFrameView;
import io.dcloud.common.DHInterface.IMgr;
import io.dcloud.common.DHInterface.IOnCreateSplashView;
import io.dcloud.common.DHInterface.IPdrModule;
import io.dcloud.common.DHInterface.ISysEventListener;
import io.dcloud.common.DHInterface.IWebviewStateListener;
import io.dcloud.common.DHInterface.ReceiveSystemEventVoucher;
import io.dcloud.common.adapter.io.DHFile;
import io.dcloud.common.adapter.io.UnicodeInputStream;
import io.dcloud.common.adapter.ui.AdaFrameView;
import io.dcloud.common.adapter.ui.webview.WebViewFactory;
import io.dcloud.common.adapter.util.AndroidResources;
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.adapter.util.MessageHandler;
import io.dcloud.common.adapter.util.MobilePhoneModel;
import io.dcloud.common.adapter.util.PermissionUtil;
import io.dcloud.common.adapter.util.PlatformUtil;
import io.dcloud.common.adapter.util.SP;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.constant.DOMException;
import io.dcloud.common.constant.IntentConst;
import io.dcloud.common.core.permission.PermissionControler;
import io.dcloud.common.util.ADUtils;
import io.dcloud.common.util.AppRuntime;
import io.dcloud.common.util.AppStatus;
import io.dcloud.common.util.AppStatusBarManager;
import io.dcloud.common.util.AppStreamUtil;
import io.dcloud.common.util.Base64;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.CreateShortResultReceiver;
import io.dcloud.common.util.IOUtil;
import io.dcloud.common.util.JSONUtil;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.LoadAppUtils;
import io.dcloud.common.util.Md5Utils;
import io.dcloud.common.util.NetworkTypeUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.common.util.TestUtil;
import io.dcloud.common.util.ThreadPool;
import io.dcloud.common.util.XmlUtil;
import io.dcloud.common.util.ZipUtils;
import io.dcloud.feature.gg.dcloud.ADSim;
import io.dcloud.feature.internal.sdk.SDK;
import io.dcloud.feature.nativeObj.BannerLayout;
import io.src.dcloud.adapter.DCloudAdapterUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class e extends io.dcloud.g.a.f implements IApp, ISysEventListener {
    public static String B1 = "webapp";
    private String M0;
    private String b0;
    private String c0;
    private String d0;
    private String e0;
    private boolean n1;
    g o;
    private IConfusionMgr p1;
    io.dcloud.g.a.a u;
    ArrayList<String> x0;
    BaseInfo.BaseAppInfo p = null;
    byte q = 1;
    boolean r = false;
    boolean s = false;
    boolean t = false;
    String v = null;
    String w = "";
    String x = "";
    String y = "";
    String z = null;
    String A = "";
    String B = null;
    String C = null;
    String D = null;
    String E = null;
    String F = null;
    String G = null;
    String H = null;
    boolean I = true;
    boolean J = true;
    boolean K = true;
    boolean L = false;
    boolean M = false;
    boolean N = true;
    boolean O = false;
    private String P = null;
    boolean Q = false;
    private byte R = 1;
    private boolean S = false;
    private boolean T = false;
    private boolean U = true;
    private boolean V = true;
    private int W = ADSim.INTISPLSH;
    private int X = 0;
    private int Y = 0;
    private String Z = null;
    private String a0 = null;
    boolean f0 = false;
    private String g0 = null;
    String h0 = null;
    String i0 = null;
    String j0 = null;
    boolean k0 = false;
    String l0 = "accept";
    String m0 = "file:///android_asset/data/dcloud_error.html";
    String n0 = null;
    private String o0 = null;
    String p0 = null;
    private String q0 = "-1";
    private JSONObject r0 = null;
    private String s0 = "";
    private boolean t0 = true;
    private boolean u0 = false;
    private String v0 = AbsoluteConst.UNI_V3;
    private String w0 = "fast";
    HashMap<ISysEventListener.SysEventType, ArrayList<ISysEventListener>> y0 = null;
    JSONObject z0 = null;
    JSONObject A0 = null;
    JSONObject B0 = null;
    JSONObject C0 = null;
    JSONObject D0 = null;
    JSONObject E0 = null;
    JSONObject F0 = null;
    JSONObject G0 = null;
    String H0 = null;
    String I0 = null;
    Intent J0 = null;
    IApp.IAppStatusListener K0 = null;
    String L0 = null;
    private String N0 = "none";
    boolean O0 = false;
    private boolean P0 = false;
    private boolean Q0 = false;
    private String R0 = BannerLayout.CIRCULAR_INDICATOR;
    private String S0 = null;
    private String T0 = null;
    private String U0 = null;
    private String V0 = "";
    protected boolean W0 = false;
    private boolean X0 = false;
    private boolean Y0 = false;
    private String Z0 = null;
    private String a1 = null;
    private boolean b1 = false;
    long c1 = 0;
    boolean d1 = true;
    boolean e1 = false;
    boolean f1 = false;
    ArrayList<String> g1 = new ArrayList<>();
    ArrayList<String> h1 = new ArrayList<>();
    String i1 = null;
    String j1 = null;
    private String k1 = "";
    private boolean l1 = false;
    private String m1 = null;
    private int o1 = 1;
    IWebviewStateListener q1 = null;
    JSONObject r1 = null;
    private boolean s1 = false;
    private String t1 = "none";
    private String u1 = AbsoluteConst.INSTALL_OPTIONS_FORCE;
    private String v1 = null;
    private String w1 = null;
    boolean x1 = true;
    HashMap<String, Integer> y1 = null;
    String z1 = null;
    boolean A1 = false;

    public class a implements Runnable {
        a(e eVar) {
        }

        @Override
        public void run() {
            try {
                DHFile.deleteFile(BaseInfo.sBaseWap2AppTemplatePath + "wap2app_temp/");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public class b implements Runnable {
        b(e eVar) {
        }

        @Override
        public void run() {
            try {
                DHFile.deleteFile(BaseInfo.sBaseWap2AppTemplatePath + "wap2app_temp/");
                DHFile.deleteFile(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template.zip");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    class c implements Runnable {
        final ICallBack a;

        class a implements MessageHandler.IMessages {
            a() {
            }

            @Override
            public void execute(Object obj) {
                c.this.a.onCallBack(0, null);
            }
        }

        c(ICallBack iCallBack) {
            this.a = iCallBack;
        }

        @Override
        public void run() {
            String str = BaseInfo.sCacheFsAppsPath + e.this.m + DeviceInfo.sSeparatorChar + BaseInfo.APP_WWW_FS_DIR;
            long currentTimeMillis = System.currentTimeMillis();
            Logger.d(e.B1, e.this.m + " copy resoure begin!!!");
            DHFile.delete(str);
            DHFile.copyDir(e.this.g0, str);
            long currentTimeMillis2 = System.currentTimeMillis();
            Logger.d(e.B1, e.this.m + " copy resoure end!!! useTime=" + (currentTimeMillis2 - currentTimeMillis));
            e.this.R = (byte) 0;
            e.this.setAppDataPath(str);
            e eVar = e.this;
            BaseInfo.BaseAppInfo baseAppInfo = eVar.p;
            if (baseAppInfo != null) {
                baseAppInfo.saveToBundleData(eVar.getActivity());
            }
            MessageHandler.sendMessage(new a(), null);
        }
    }

    public class d implements Runnable {
        final String a;

        d(String str) {
            this.a = str;
        }

        @Override
        public void run() {
            TestUtil.PointTime.commitTid(e.this.getActivity(), this.a, null, e.this.I0, 1);
        }
    }

    public class RunnableC0053e implements Runnable {
        RunnableC0053e() {
        }

        @Override
        public void run() {
            try {
                DHFile.deleteFile(e.this.obtainAppTempPath());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    static class f {
        static final int[] a;

        static {
            int[] iArr = new int[IApp.ConfigProperty.ThridInfo.values().length];
            a = iArr;
            try {
                iArr[IApp.ConfigProperty.ThridInfo.OverrideUrlJsonData.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.OverrideResourceJsonData.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.SecondWebviewJsonData.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.LaunchWebviewJsonData.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.TitleNViewJsonData.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.SitemapJsonData.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.URDJsonData.ordinal()] = 7;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.DirectPageJsonData.ordinal()] = 8;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                a[IApp.ConfigProperty.ThridInfo.Tabbar.ordinal()] = 9;
            } catch (NoSuchFieldError unused9) {
            }
        }
    }

    public e(io.dcloud.g.a.a aVar, String str, byte b2) {
        this.o = null;
        this.u = null;
        this.x0 = null;
        this.n1 = false;
        this.u = aVar;
        this.m = str;
        b(b2);
        this.p1 = io.dcloud.g.b.b.c();
        this.o = new g();
        this.x0 = new ArrayList<>(2);
        this.n1 = AppRuntime.isUniApp(str);
    }

    private void d() {
    }

    private void e() {
        JSONObject jSONObject = this.G0;
        if (jSONObject != null) {
            try {
                String optString = jSONObject.optString("webviewid");
                if (TextUtils.isEmpty(optString)) {
                    this.G0.put("webviewid", IntentConst.DIRECT_PAGE);
                }
                if (this.m.equals(optString)) {
                    this.F0 = this.G0.optJSONObject("titleNView");
                    return;
                }
                JSONObject optJSONObject = this.G0.has("titleNView") ? this.G0.optJSONObject("titleNView") : null;
                if (optJSONObject == null) {
                    optJSONObject = new JSONObject();
                    this.G0.put("titleNView", optJSONObject);
                }
                optJSONObject.put("autoBackButton", true);
                if (optJSONObject.has("homeButton")) {
                    return;
                }
                optJSONObject.put("homeButton", true);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    private boolean e(String str) {
        return false;
    }

    private void f() {
        try {
            int rename = DHFile.rename(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/", BaseInfo.sBaseWap2AppTemplatePath + "wap2app_temp/");
            DHFile.copyDir("data/wap2app", BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/");
            if (rename == 1) {
                ThreadPool.self().addThreadTask(new a(this));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private String h() {
        return "UWV/BnpHVVhMahB0EU1XA15hAEFOAWlGVHBkcgluSF0HFhlQZx15Yhhjb3xCHgRfWxV+cQhPS1ICFxRzdkUfeyo2YTNkODhmYS00YmEwLTQ3OWYtOTQyMi1lNWFhYmUxNTg5N2IxMjQ=";
    }

    private JSONObject i() {
        JSONObject jSONObject = null;
        try {
            InputStream obtainResInStream = obtainResInStream("_www/__template.json");
            if (obtainResInStream != null) {
                jSONObject = a(obtainResInStream);
                IOUtil.close(obtainResInStream);
                return jSONObject;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return jSONObject;
        }
    }

    private JSONObject j() {
        ThreadPool self;
        b bVar;
        JSONObject jSONObject = null;
        try {
            boolean z = true;
            boolean z2 = false;
            if (BaseInfo.sCoverApkRuning) {
                if (new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json").exists()) {
                    InputStream inputStream = PlatformUtil.getInputStream(BaseInfo.sBaseConfigTemplatePath);
                    JSONObject a2 = a(inputStream);
                    String optString = a2.optString("version");
                    IOUtil.close(inputStream);
                    InputStream inputStream2 = DHFile.getInputStream(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json");
                    JSONObject a3 = a(inputStream2);
                    String optString2 = a3.optString("version");
                    IOUtil.close(inputStream2);
                    BaseInfo.mWap2appTemplateFiles.clear();
                    BaseInfo.mW2AE.clear();
                    if (BaseInfo.BaseAppInfo.compareVersion(optString, optString2)) {
                        f();
                        jSONObject = a2;
                        z2 = true;
                    } else {
                        jSONObject = a3;
                    }
                }
            }
            if (DHFile.isExist(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template.zip")) {
                DHFile.rename(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/", BaseInfo.sBaseWap2AppTemplatePath + "wap2app_temp/");
                try {
                    ZipUtils.upZipFile(new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template.zip"), BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/");
                    self = ThreadPool.self();
                    bVar = new b(this);
                } catch (IOException e) {
                    e.printStackTrace();
                    self = ThreadPool.self();
                    bVar = new b(this);
                    z = z2;
                }
                self.addThreadTask(bVar);
            } else {
                if (new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json").exists()) {
                    z = z2;
                } else {
                    f();
                }
            }
            if (z || TextUtils.isEmpty(BaseInfo.sWap2AppTemplateVersion) || BaseInfo.mWap2appTemplateFiles.size() == 0 || this.p1.getData("__w2a__template__") == null) {
                if (DHFile.isExist(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json")) {
                    InputStream inputStream3 = DHFile.getInputStream(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json");
                    jSONObject = a(inputStream3);
                    IOUtil.close(inputStream3);
                    BaseInfo.mWap2appTemplateFiles.clear();
                    BaseInfo.mW2AE.clear();
                    this.p1.removeData("__w2a__template__");
                    return jSONObject;
                }
                return jSONObject;
            }
            return jSONObject;
        } catch (Exception e2) {
            e2.printStackTrace();
            return jSONObject;
        }
    }

    private void m() {
        String[] split;
        this.y1 = new HashMap<>();
        String string = SP.getOrCreateBundle(getActivity(), this.m + "_1").getString("Authorize", null);
        this.z1 = string;
        if (string == null || (split = string.split("&")) == null || split.length <= 0) {
            return;
        }
        for (String str : split) {
            if (!TextUtils.isEmpty(str)) {
                String[] split2 = str.split("=");
                this.y1.put(split2[0], Integer.valueOf(Integer.parseInt(split2[1])));
            }
        }
    }

    private void y() {
        boolean z;
        Context activity;
        String handleEncryption;
        if (BaseInfo.isWap2AppAppid(this.m)) {
            JSONObject j = j();
            String optString = j == null ? BaseInfo.sWap2AppTemplateVersion : j.optString("version");
            try {
                JSONObject i = i();
                if (i != null) {
                    String optString2 = i.optString("version");
                    if (!TextUtils.isEmpty(optString2) && BaseInfo.BaseAppInfo.compareVersion(optString2, optString)) {
                        DHFile.deleteFile(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/");
                        BaseInfo.mWap2appTemplateFiles.clear();
                        BaseInfo.mW2AE.clear();
                        optString = optString2;
                        j = i;
                        z = true;
                        if (BaseInfo.mWap2appTemplateFiles.size() == 0) {
                            if (j != null && j.has("files")) {
                                JSONArray optJSONArray = j.optJSONArray("files");
                                int length = optJSONArray.length();
                                boolean z2 = obtainRunningAppMode() == 1;
                                for (int i2 = 0; i2 < length; i2++) {
                                    String optString3 = optJSONArray.optString(i2);
                                    BaseInfo.mWap2appTemplateFiles.add(optString3);
                                    if (z) {
                                        if (z2) {
                                            DHFile.copyAssetsFile(BaseInfo.sBaseResAppsPath + this.m + "/www/" + optString3, BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/" + optString3);
                                        } else {
                                            DHFile.copyFile(BaseInfo.sCacheFsAppsPath + this.m + "/www/" + optString3, BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/" + optString3, true, false);
                                        }
                                    }
                                }
                                if (z && !BaseInfo.mWap2appTemplateFiles.contains("__template.json")) {
                                    if (z2) {
                                        DHFile.copyAssetsFile(BaseInfo.sBaseResAppsPath + this.m + "/www/__template.json", BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json");
                                    } else {
                                        DHFile.copyFile(BaseInfo.sCacheFsAppsPath + this.m + "/www/__template.json", BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json", true, false);
                                    }
                                }
                            } else {
                                String[] list = new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/").list();
                                if (list != null) {
                                    for (String str : list) {
                                        BaseInfo.mWap2appTemplateFiles.add(str);
                                    }
                                }
                            }
                        }
                        if ((!z || this.p1.getData("__w2a__template__") == null) && j != null && j.has(IApp.ConfigProperty.CONFIG_CONFUSION)) {
                            byte[] decode2bytes = Base64.decode2bytes(j.optString(IApp.ConfigProperty.CONFIG_CONFUSION));
                            activity = getActivity();
                            if (activity == null) {
                                activity = DeviceInfo.sApplicationContext;
                            }
                            handleEncryption = this.p1.handleEncryption(activity, decode2bytes);
                            if (PdrUtil.isEmpty(handleEncryption)) {
                                handleEncryption = "{}";
                            }
                            this.p1.removeData("__w2a__template__");
                            this.p1.recordEncryptionResources("__w2a__template__", new JSONObject(handleEncryption));
                        }
                        BaseInfo.sTemplateModifyTime = new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json").lastModified();
                        BaseInfo.sWap2AppTemplateVersion = optString;
                        this.z = optString;
                    }
                }
                z = false;
                if (BaseInfo.mWap2appTemplateFiles.size() == 0) {
                }
                if (!z) {
                }
                byte[] decode2bytes2 = Base64.decode2bytes(j.optString(IApp.ConfigProperty.CONFIG_CONFUSION));
                activity = getActivity();
                if (activity == null) {
                }
                handleEncryption = this.p1.handleEncryption(activity, decode2bytes2);
                if (PdrUtil.isEmpty(handleEncryption)) {
                }
                this.p1.removeData("__w2a__template__");
                this.p1.recordEncryptionResources("__w2a__template__", new JSONObject(handleEncryption));
                BaseInfo.sTemplateModifyTime = new File(BaseInfo.sBaseWap2AppTemplatePath + "wap2app__template/__template.json").lastModified();
                BaseInfo.sWap2AppTemplateVersion = optString;
                this.z = optString;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    @Override
    public void addAllFeaturePermission() {
        PermissionControler.registerRootPermission(this.m);
    }

    @Override
    public void addFeaturePermission(String str) {
        this.x0.add(str.toLowerCase());
    }

    @Override
    public void applyMani() {
        try {
            a(DHFile.getInputStream(DHFile.createFileHandler(a(BaseInfo.sConfigXML))), this.m, null);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void applySmartUpdate() {
        a(false);
    }

    public void b(InputStream inputStream) {
    }

    public boolean b(String str, JSONObject jSONObject) {
        boolean z;
        HashMap<String, BaseInfo.BaseAppInfo> hashMap;
        boolean z2 = false;
        InputStream inputStream = null;
        try {
            try {
                this.m = str;
                this.p1.removeData(str);
                l();
            } catch (Exception e) {
                Logger.w("parseConfig", e);
            }
            if (this.R != 0 && ((hashMap = BaseInfo.mBaseAppInfoSet) == null || hashMap.containsKey(this.m))) {
                if (this.R == 1) {
                    inputStream = PlatformUtil.getResInputStream(a(BaseInfo.sConfigXML));
                }
                if (BaseInfo.isWap2AppAppid(this.m)) {
                    z = true;
                } else {
                    y();
                    z = false;
                }
                if (inputStream != null) {
                    if (!BaseInfo.isWap2AppAppid(this.m) || TextUtils.isEmpty(this.i1)) {
                        if (!r() || TextUtils.isEmpty(this.n0)) {
                            g gVar = this.o;
                            gVar.a = true;
                            if (gVar.c) {
                                gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_WWW_MANIFEST_NOT_EXIST, DOMException.MSG_RUNTIME_WGTU_WWW_MANIFEST_NOT_EXIST);
                            } else {
                                gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGT_MANIFEST_NOT_EXIST, DOMException.MSG_RUNTIME_WGT_MANIFEST_NOT_EXIST);
                            }
                            return false;
                        }
                        return true;
                    }
                    return true;
                }
                z2 = a(inputStream, str, jSONObject);
                if (z) {
                    y();
                }
                IActivityHandler iActivityHandler = DCloudAdapterUtil.getIActivityHandler(getActivity());
                if (iActivityHandler != null) {
                    iActivityHandler.updateSplash(this.p0);
                }
                this.r = true;
                return z2;
            }
            inputStream = DHFile.getInputStream(DHFile.createFileHandler(a(BaseInfo.sConfigXML)));
            if (inputStream == null && (inputStream = PlatformUtil.getResInputStream(a(BaseInfo.sConfigXML))) != null) {
                this.R = (byte) 1;
            }
            if (BaseInfo.isWap2AppAppid(this.m)) {
            }
            if (inputStream != null) {
            }
        } finally {
            IOUtil.close((InputStream) null);
        }
    }

    public void c() {
        Activity activity = this.a;
        if (activity != null && (activity instanceof WebAppActivity)) {
            ((WebAppActivity) activity).onAppActive(this.m);
            ((WebAppActivity) this.a).onAppActive(this);
        }
        diyStatusBarState();
        setStatus((byte) 3);
        this.b.onAppActive(this);
        callSysEventListener(ISysEventListener.SysEventType.onWebAppForeground, IntentConst.obtainArgs(obtainWebAppIntent(), this.m));
    }

    @Override
    public boolean callSysEventListener(ISysEventListener.SysEventType sysEventType, Object obj) {
        HashMap<ISysEventListener.SysEventType, ArrayList<ISysEventListener>> hashMap = this.y0;
        boolean z = false;
        if (hashMap == null) {
            return false;
        }
        ArrayList<ISysEventListener> arrayList = hashMap.get(sysEventType);
        ArrayList<ISysEventListener> arrayList2 = this.y0.get(ISysEventListener.SysEventType.AllSystemEvent);
        ArrayList arrayList3 = new ArrayList();
        if (arrayList != null) {
            arrayList3.addAll(arrayList);
        }
        if (arrayList2 != null) {
            arrayList3.addAll(arrayList2);
        }
        for (int size = arrayList3.size() - 1; size >= 0; size--) {
            ISysEventListener iSysEventListener = (ISysEventListener) arrayList3.get(size);
            if (a(iSysEventListener, sysEventType) && (z || iSysEventListener.onExecute(sysEventType, obj)) && !a(sysEventType)) {
                break;
            }
        }
        return z;
    }

    @Override
    public boolean checkIsCustomPath() {
        return this.k0;
    }

    @Override
    public void checkOrLoadlaunchWebview() {
        io.dcloud.g.a.a aVar = this.u;
        if (aVar != null) {
            AdaFrameView adaFrameView = (AdaFrameView) aVar.processEvent(IMgr.MgrType.WindowMgr, 46, obtainAppId());
            Logger.d("Direct_page", "checkOrLoadlaunchWebview " + manifestBeParsed() + ";adaFrameView=" + adaFrameView);
            manifestBeParsed();
            if (adaFrameView == null || !manifestBeParsed()) {
                return;
            }
            adaFrameView.obtainWebView().checkIfNeedLoadOriginalUrl();
        }
    }

    @Override
    public boolean checkPrivateDir(String str) {
        return str.startsWith(obtainAppDataPath()) || str.startsWith(BaseInfo.REL_PRIVATE_WWW_DIR);
    }

    @Override
    public String checkPrivateDirAndCopy2Temp(String str) {
        if (obtainRunningAppMode() == 1 && checkPrivateDir(str)) {
            String str2 = "/" + BaseInfo.APP_WWW_FS_DIR;
            String substring = str.substring(str.indexOf(str2) + str2.length());
            String str3 = this.g0 + substring;
            str = obtainAppTempPath() + substring;
            if (!DHFile.exists(str)) {
                DHFile.copyAssetsFile(str3, str);
            }
        }
        return str;
    }

    @Override
    public boolean checkSchemeWhite(String str) {
        if (r()) {
            if (TextUtils.isEmpty(str)) {
                return false;
            }
            Iterator<String> it = this.h1.iterator();
            while (it.hasNext()) {
                String next = it.next();
                if (!TextUtils.equals(next, "*")) {
                    if (str.startsWith(next + ":")) {
                    }
                }
                return true;
            }
            return false;
        }
        return true;
    }

    @Override
    public boolean checkWhiteUrl(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return this.g1.contains("*") || this.g1.contains(str);
    }

    @Override
    public void clearRuntimeArgs() {
        this.A = "";
    }

    @Override
    public String convert2AbsFullPath(String str, String str2) {
        boolean z = true;
        try {
            if (!PdrUtil.isEmpty(str2)) {
                if (this.R == 1 && PlatformUtil.isResFileExists(str2)) {
                    return str2;
                }
                if (DHFile.isExist(str2)) {
                    return str2;
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (PdrUtil.isEmpty(str2)) {
            return str2;
        }
        int indexOf = str2.indexOf("?");
        if (indexOf > 0) {
            str2 = str2.substring(0, indexOf);
        }
        if (str2.startsWith("_documents/")) {
            return BaseInfo.sDocumentFullPath + str2.substring(11);
        } else if (str2.startsWith(BaseInfo.REL_PUBLIC_DOCUMENTS_DIR)) {
            return BaseInfo.sDocumentFullPath + str2.substring(10);
        } else if (str2.startsWith(AbsoluteConst.MINI_SERVER_APP_DOC)) {
            return obtainAppDocPath() + str2.substring(5);
        } else if (str2.startsWith(BaseInfo.REL_PRIVATE_DOC_DIR)) {
            return obtainAppDocPath() + str2.substring(4);
        } else if (str2.startsWith("_downloads/")) {
            return BaseInfo.sDownloadFullPath + str2.substring(11);
        } else if (str2.startsWith(BaseInfo.REL_PUBLIC_DOWNLOADS_DIR)) {
            return BaseInfo.sDownloadFullPath + str2.substring(10);
        } else if (str2.startsWith(AbsoluteConst.MINI_SERVER_APP_WWW)) {
            byte b2 = this.R;
            if (b2 != 1) {
                if (b2 == 0) {
                    return this.g0 + str2.substring(5);
                }
                return str2;
            }
            return BaseInfo.sBaseResAppsPath + this.m + "/" + BaseInfo.APP_WWW_FS_DIR + str2.substring(5);
        } else if (str2.startsWith(BaseInfo.REL_PRIVATE_WWW_DIR)) {
            byte b3 = this.R;
            if (b3 != 1) {
                if (b3 == 0) {
                    return this.g0 + str2.substring(4);
                }
                return str2;
            }
            return BaseInfo.sBaseResAppsPath + this.m + "/" + BaseInfo.APP_WWW_FS_DIR + str2.substring(4);
        } else if (str2.startsWith(DeviceInfo.FILE_PROTOCOL)) {
            return str2.substring(7);
        } else {
            if (str2.startsWith("content://") || str2.startsWith(DeviceInfo.sDeviceRootDir)) {
                return str2;
            }
            if (str2.startsWith("http://localhost")) {
                String substring = str2.substring(16);
                return convert2AbsFullPath(null, substring.substring(substring.indexOf("/") + 1));
            }
            if (!str2.startsWith("/") && str != null) {
                z = false;
            } else if (str2.startsWith("/")) {
                str2 = str2.substring(1);
            }
            if (str != null) {
                if (str.startsWith(SDK.ANDROID_ASSET)) {
                    str = str.substring(22);
                } else if (str.startsWith(DeviceInfo.FILE_PROTOCOL)) {
                    str = str.substring(7);
                }
            }
            if (str == null || z) {
                if (z) {
                    String obtainAppDataPath = obtainAppDataPath();
                    if (str != null && !PdrUtil.isEquals(str, obtainAppDataPath) && str.contains("/www/")) {
                        obtainAppDataPath = str.substring(0, str.indexOf("/www/") + 5);
                    }
                    return obtainAppDataPath + b(str2);
                }
                return str2;
            }
            return PdrUtil.standardizedURL(str, str2);
        }
    }

    @Override
    public String convert2LocalFullPath(String str, String str2) {
        InputStream inputStream;
        String convert2AbsFullPath = convert2AbsFullPath(str, str2);
        byte b2 = this.R;
        if (b2 == 1 || DeviceInfo.isPrivateDirectory) {
            if (b2 == 1) {
                inputStream = PlatformUtil.getResInputStream(convert2AbsFullPath);
            } else {
                inputStream = PlatformUtil.getInputStream(convert2AbsFullPath);
            }
            if (inputStream != null) {
                convert2AbsFullPath = obtainAppTempPath() + System.currentTimeMillis();
                try {
                    DHFile.writeFile(inputStream, convert2AbsFullPath);
                    inputStream.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        } else if (b2 == 0) {
            return convert2AbsFullPath;
        }
        return convert2AbsFullPath;
    }

    @Override
    public String convert2RelPath(String str) {
        int i;
        int i2;
        int i3;
        int i4;
        try {
            int length = obtainAppDataPath().length();
            int length2 = obtainAppDocPath().length();
            int length3 = BaseInfo.sDocumentFullPath.length();
            int length4 = BaseInfo.sDownloadFullPath.length();
            if (str.startsWith(obtainAppDataPath())) {
                str = BaseInfo.REL_PRIVATE_WWW_DIR + str.substring(length - 1);
            } else {
                if (str.startsWith(obtainAppDataPath().substring(0, length - 1))) {
                    str = BaseInfo.REL_PRIVATE_WWW_DIR + str.substring(i, str.length());
                } else if (str.startsWith(obtainAppDocPath())) {
                    str = BaseInfo.REL_PRIVATE_DOC_DIR + str.substring(length2 - 1);
                } else {
                    if (str.startsWith(obtainAppDocPath().substring(0, length2 - 1))) {
                        str = BaseInfo.REL_PRIVATE_DOC_DIR + str.substring(i2);
                    } else if (str.startsWith(BaseInfo.sDocumentFullPath)) {
                        str = BaseInfo.REL_PUBLIC_DOCUMENTS_DIR + str.substring(length3 - 1);
                    } else {
                        if (str.startsWith(BaseInfo.sDocumentFullPath.substring(0, length3 - 1))) {
                            str = BaseInfo.REL_PUBLIC_DOCUMENTS_DIR + str.substring(i3);
                        } else if (str.startsWith(BaseInfo.sDownloadFullPath)) {
                            str = BaseInfo.REL_PUBLIC_DOWNLOADS_DIR + str.substring(length4 - 1);
                        } else {
                            if (str.startsWith(BaseInfo.sDownloadFullPath.substring(0, length4 - 1))) {
                                str = BaseInfo.REL_PUBLIC_DOWNLOADS_DIR + str.substring(i4);
                            }
                        }
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return str;
    }

    @Override
    public String convert2WebviewFullPath(String str, String str2) {
        if (PdrUtil.isEmpty(str2)) {
            return str2;
        }
        if (this.Q) {
            if (str2.startsWith(DeviceInfo.HTTP_PROTOCOL)) {
                return str2;
            }
            return this.o0 + str2;
        } else if (str2.startsWith(DeviceInfo.FILE_PROTOCOL) || str2.startsWith(DeviceInfo.HTTP_PROTOCOL) || str2.startsWith(DeviceInfo.HTTPS_PROTOCOL)) {
            return str2;
        } else {
            try {
                if (DHFile.isExist(str2)) {
                    return "file:///" + b(str2);
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (str2.startsWith(DeviceInfo.sDeviceRootDir)) {
                return DeviceInfo.FILE_PROTOCOL + str2;
            }
            boolean z = true;
            if (str2.startsWith("/")) {
                str2 = str2.substring(1);
            } else {
                z = false;
            }
            if (str2.startsWith(BaseInfo.REL_PRIVATE_WWW_DIR)) {
                return obtainWebviewBaseUrl() + b(str2.substring(4));
            } else if (str2.startsWith(BaseInfo.REL_PUBLIC_DOCUMENTS_DIR)) {
                return DeviceInfo.FILE_PROTOCOL + BaseInfo.sDocumentFullPath + b(str2.substring(10));
            } else if (str2.startsWith(BaseInfo.REL_PRIVATE_DOC_DIR)) {
                return DeviceInfo.FILE_PROTOCOL + obtainAppDocPath() + b(str2.substring(4));
            } else if (str2.startsWith(BaseInfo.REL_PUBLIC_DOWNLOADS_DIR)) {
                return DeviceInfo.FILE_PROTOCOL + BaseInfo.sDownloadFullPath + b(str2.substring(10));
            } else if (str != null && !z) {
                return PdrUtil.standardizedURL(str, str2);
            } else {
                String obtainWebviewBaseUrl = obtainWebviewBaseUrl();
                if (str != null && !PdrUtil.isEquals(str, obtainWebviewBaseUrl) && str.contains("/www/")) {
                    obtainWebviewBaseUrl = str.substring(0, str.indexOf("/www/") + 5);
                }
                return obtainWebviewBaseUrl + b(str2);
            }
        }
    }

    JSONObject d(String str) {
        if (this.r1 == null) {
            n();
        }
        if (this.r1 == null || TextUtils.isEmpty(str)) {
            return null;
        }
        return PdrUtil.getSitemapParameters(this.r1, obtainAppId(), str);
    }

    @Override
    public void deleteAppTemp() {
        ThreadPool.self().addThreadTask(new RunnableC0053e(), true);
    }

    @Override
    public void diyStatusBarState() {
        AppStatusBarManager appStatusBarManager = this.k;
        if (appStatusBarManager == null) {
            return;
        }
        appStatusBarManager.setFullScreen(getActivity(), isFullScreen());
        if (this.k.checkImmersedStatusBar(getActivity(), this.W0)) {
            BaseInfo.isImmersive = true;
            this.k.setImmersive(getActivity(), true);
        } else {
            BaseInfo.isImmersive = false;
            this.k.setImmersive(getActivity(), false);
        }
        if (Build.VERSION.SDK_INT >= 21 && getActivity() != null) {
            if (!PdrUtil.isEmpty(this.S0)) {
                this.k.setStatusBarColor(getActivity(), this.S0.startsWith("#") ? PdrUtil.stringToColor(this.S0) : 0);
            } else {
                this.k.setStatusBarColor(getActivity(), BaseInfo.mDeStatusBarBackground);
            }
        }
        this.k.setStatusBarMode(getActivity(), this.V0);
        if (this.k.isFullScreenOrImmersive()) {
            updateScreenInfo(2);
        }
    }

    @Override
    public String forceShortCut() {
        return this.u1;
    }

    public boolean g(String str) {
        AppStatus.setAppStatus(this.m, 2);
        setRuntimeArgs(str);
        setStatus((byte) 3);
        Object processEvent = this.u.processEvent(IMgr.MgrType.WindowMgr, 41, new Object[]{this, convert2WebviewFullPath(null, this.n0), Boolean.valueOf(this.O0)});
        if (processEvent == null) {
            return true;
        }
        return Boolean.parseBoolean(String.valueOf(processEvent));
    }

    @Override
    public IConfusionMgr getConfusionMgr() {
        return this.p1;
    }

    @Override
    public String getDirectPage() {
        return this.i1;
    }

    @Override
    public IApp.IAppStatusListener getIAppStatusListener() {
        return this.K0;
    }

    @Override
    public String getOriginalDirectPage() {
        return this.j1;
    }

    @Override
    public String getPathByType(byte b2) {
        if (b2 == 0) {
            return obtainAppDataPath();
        }
        if (b2 == 1) {
            return obtainAppDocPath();
        }
        if (b2 == 2) {
            return BaseInfo.sDocumentFullPath;
        }
        if (b2 == 3) {
            return BaseInfo.sDownloadFullPath;
        }
        if (b2 == -1) {
            return BaseInfo.sBaseResAppsPath + this.m + "/" + BaseInfo.APP_WWW_FS_DIR;
        }
        return null;
    }

    @Override
    public String getPopGesture() {
        return this.N0;
    }

    @Override
    public int getQuitModel() {
        return this.o1;
    }

    @Override
    public boolean isOnAppRunningMode() {
        return this.R == 1;
    }

    public float k() {
        return (PermissionControler.checkPermission(this.m, IFeature.F_DEVICE.toLowerCase()) && getActivity() != null && NetworkTypeUtil.getNetworkType(getActivity()) == 4) ? 1000.0f : 0.0f;
    }

    void l() {
        if (PdrUtil.isEmpty(this.g0) || !DeviceInfo.startsWithSdcard(this.g0)) {
            setAppDataPath(BaseInfo.sCacheFsAppsPath + this.m + "/" + BaseInfo.REAL_PRIVATE_WWW_DIR);
        }
        if (PdrUtil.isEmpty(this.v1) || !DeviceInfo.startsWithSdcard(this.v1)) {
            setAppDocPath(BaseInfo.sBaseFsAppsPath + this.m + "/" + BaseInfo.REAL_PRIVATE_DOC_DIR);
        }
        if (PdrUtil.isEmpty(this.w1) || !DeviceInfo.startsWithSdcard(this.w1)) {
            this.w1 = BaseInfo.sCacheFsAppsPath + this.m + "/" + BaseInfo.APP_WEB_CHACHE;
        }
    }

    @Override
    public boolean manifestBeParsed() {
        return this.r || SDK.IntegratedMode.WEBVIEW == BaseInfo.sRuntimeMode;
    }

    void n() {
        File file = new File(c(this.m));
        if (file.exists()) {
            try {
                JSONObject jSONObject = new JSONObject(IOUtil.toString(new FileInputStream(file)));
                this.r1 = jSONObject;
                this.y = jSONObject.optString("version");
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        }
        byte[] fileContent = PlatformUtil.getFileContent("data/sitemap/" + this.m + ".json", 0);
        if (fileContent != null) {
            DHFile.writeFile(fileContent, 0, c(this.m));
            n();
        }
    }

    @Override
    public boolean needRefreshApp() {
        return this.f1;
    }

    @Override
    public boolean needReload() {
        return this.e1;
    }

    public boolean o() {
        if (r() && this.r) {
            return this.L;
        }
        return true;
    }

    @Override
    public String obtainAdaptationJs() {
        if (this.P == null && !PdrUtil.isEmpty(this.G)) {
            byte[] fileContent = PlatformUtil.getFileContent(a(this.G), obtainRunningAppMode() == 1 ? 0 : 2);
            if (fileContent != null) {
                this.P = new String(fileContent);
            } else {
                this.P = "";
            }
        }
        return this.P;
    }

    @Override
    public String obtainAppDataPath() {
        String str = this.g0;
        if (str != null) {
            return str;
        }
        return this.m + "/www/";
    }

    @Override
    public String obtainAppDocPath() {
        return this.v1;
    }

    @Override
    public String obtainAppId() {
        return this.m;
    }

    @Override
    public String obtainAppInfo() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("appid", this.m);
            jSONObject.put("versionName", this.w);
            jSONObject.put("name", this.p0);
            jSONObject.put("versionCode", this.x);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jSONObject.toString();
    }

    @Override
    public String obtainAppLog() {
        return BaseInfo.sBaseFsAppsPath + this.m + "/log/";
    }

    @Override
    public String obtainAppName() {
        return this.p0;
    }

    @Override
    public byte obtainAppStatus() {
        return this.q;
    }

    @Override
    public String obtainAppTempPath() {
        return BaseInfo.sBaseFsAppsPath + this.m + "/temp/";
    }

    @Override
    public String obtainAppVersionName() {
        return this.w;
    }

    @Override
    public String obtainAppWebCachePath() {
        return this.w1;
    }

    @Override
    public String obtainAuthority(String str) {
        String str2 = BaseInfo.sGlobalAuthority;
        if ((str2 == null || !TextUtils.equals("*", str2)) && r() && !TextUtils.isEmpty(str) && !e(this.m)) {
            JSONObject jSONObject = this.E0;
            if (jSONObject != null) {
                Iterator<String> keys = jSONObject.keys();
                while (keys.hasNext()) {
                    String next = keys.next();
                    if (str.equalsIgnoreCase(next)) {
                        return this.E0.optString(next, IApp.AUTHORITY_UNDETERMINED);
                    }
                }
                return IApp.AUTHORITY_UNDETERMINED;
            }
            return IApp.AUTHORITY_UNDETERMINED;
        }
        return IApp.AUTHORITY_AUTHORIZED;
    }

    @Override
    public String obtainConfigProperty(String str) {
        String str2;
        if (PdrUtil.isEquals(str, "adid")) {
            str2 = this.I0;
        } else if (PdrUtil.isEquals(str, "launchError")) {
            str2 = this.H0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_AUTOCLOSE)) {
            str2 = String.valueOf(this.U);
        } else if (PdrUtil.isEquals(str, "timeout")) {
            str2 = String.valueOf(this.W);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_DELAY)) {
            str2 = String.valueOf(this.X);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_SPLASHSCREEN)) {
            str2 = String.valueOf(this.S);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_WAITING)) {
            str2 = String.valueOf(this.T);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_H5PLUS)) {
            str2 = String.valueOf(this.N);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_funSetUA)) {
            str2 = String.valueOf(this.O);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_USER_AGENT)) {
            str2 = this.H;
        } else if (PdrUtil.isEquals(str, "error")) {
            str2 = this.m0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_FULLSCREEN)) {
            str2 = String.valueOf(this.h);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_UNTRUSTEDCA)) {
            str2 = this.l0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_LOADED_TIME)) {
            str2 = this.L0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_RAM_CACHE_MODE)) {
            str2 = this.M0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_JSERROR)) {
            str2 = this.J + "";
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_CRASH)) {
            str2 = this.I + "";
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_USE_ENCRYPTION)) {
            str2 = this.P0 + "";
        } else if (PdrUtil.isEquals(str, "w2a_delay")) {
            str2 = String.valueOf(this.Y);
        } else if (PdrUtil.isEquals(str, "w2a_autoclose")) {
            str2 = String.valueOf(this.V);
        } else if (PdrUtil.isEquals(str, "wap2app_running_mode")) {
            str2 = this.K + "";
        } else if (PdrUtil.isEquals(str, "injection")) {
            str2 = this.d1 + "";
        } else if (PdrUtil.isEquals(str, "event")) {
            str2 = this.Z;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_TARGET)) {
            str2 = this.a0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_LPLUSERQUIRE)) {
            str2 = this.b0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_SPLUSERQUIRE)) {
            str2 = this.c0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_LGEOLOCATION)) {
            str2 = this.d0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_SGEOLOCATION)) {
            str2 = this.e0;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_BC)) {
            str2 = this.S0 + "";
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_MODE)) {
            str2 = this.V0;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED)) {
            str2 = this.W0 + "";
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_LAUNCH_ISSTATUS)) {
            str2 = String.valueOf(this.X0);
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_LAUNCH_STATUSBAR_COLOR)) {
            str2 = this.Z0;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_SECOND_ISATATUS)) {
            str2 = String.valueOf(this.Y0);
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_SECOND_STATUSBAR_COLOR)) {
            str2 = this.a1;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_MAP_COORD_TYPE)) {
            str2 = this.k1;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.UNIAPP_WEEX_JS_SERVICE)) {
            str2 = String.valueOf(this.b1);
        } else if (PdrUtil.isEquals(str, AbsoluteConst.APP_UNIAPP_VERSION)) {
            str2 = this.q0;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_UNIAPP_CONTROL)) {
            str2 = this.n1 ? this.v0 : "h5+";
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.UNI_NVUE_DATA)) {
            JSONObject jSONObject = this.r0;
            if (jSONObject == null) {
                return null;
            }
            return jSONObject.toString();
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_CONCATENATE)) {
            return this.M + "";
        } else if (PdrUtil.isEquals(str, AbsoluteConst.NVUE_LAUNCH_MODE)) {
            return this.w0;
        } else {
            if (PdrUtil.isEquals(str, AbsoluteConst.JSON_KEY_DEBUG_REFRESH)) {
                return this.m1;
            }
            if (PdrUtil.isEquals(str, IApp.ConfigProperty.UNI_RESTART_TO_DIRECT)) {
                return String.valueOf(this.l1);
            }
            if (PdrUtil.isEquals(str, AbsoluteConst.APP_IS_UNIAPP)) {
                return String.valueOf(this.n1);
            }
            if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_USE_V3_ENCRYPTION)) {
                return String.valueOf(this.Q0);
            }
            return null;
        }
        return str2;
    }

    @Override
    public IWebviewStateListener obtainLaunchPageStateListener() {
        return this.q1;
    }

    @Override
    public Object obtainMgrData(IMgr.MgrType mgrType, int i, Object[] objArr) {
        return this.u.processEvent(mgrType, i, objArr);
    }

    @Override
    public String obtainOriginalAppId() {
        return this.v;
    }

    @Override
    public InputStream obtainResInStream(String str, String str2) {
        String convert2AbsFullPath = convert2AbsFullPath(str, str2);
        byte b2 = this.R;
        if (b2 == 1) {
            if (PdrUtil.isDeviceRootDir(convert2AbsFullPath)) {
                try {
                    return DHFile.getInputStream(DHFile.createFileHandler(convert2AbsFullPath));
                } catch (IOException e) {
                    Logger.w("WebApp.obtainResInStream", e);
                }
            } else {
                return PlatformUtil.getResInputStream(convert2AbsFullPath);
            }
        } else if (b2 == 0) {
            try {
                return DHFile.getInputStream(DHFile.createFileHandler(convert2AbsFullPath));
            } catch (IOException e2) {
                Logger.w("WebApp.obtainResInStream", e2);
            }
        }
        return null;
    }

    @Override
    public byte obtainRunningAppMode() {
        return this.R;
    }

    @Override
    public String obtainRuntimeArgs(boolean z) {
        if (z) {
            return JSONObject.quote(this.A);
        }
        return this.A;
    }

    @Override
    public AppStatusBarManager obtainStatusBarMgr() {
        return this.k;
    }

    @Override
    public JSONObject obtainThridInfo(IApp.ConfigProperty.ThridInfo thridInfo) {
        switch (f.a[thridInfo.ordinal()]) {
            case 1:
                return this.z0;
            case 2:
                return this.B0;
            case 3:
                return this.C0;
            case 4:
                return this.D0;
            case 5:
                return this.F0;
            case 6:
                n();
                return this.r1;
            case 7:
                return this.u.f;
            case 8:
                return this.G0;
            case 9:
                return this.A0;
            default:
                return null;
        }
    }

    @Override
    public String obtainVersionSitemap() {
        return this.y;
    }

    @Override
    public Intent obtainWebAppIntent() {
        return this.J0;
    }

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

    @Override
    public boolean onExecute(ISysEventListener.SysEventType sysEventType, Object obj) {
        byte b2 = this.q;
        if (b2 == 3) {
            return callSysEventListener(sysEventType, obj);
        }
        if (b2 == 1 && (sysEventType == ISysEventListener.SysEventType.onWebAppStop || sysEventType == ISysEventListener.SysEventType.onStop)) {
            t();
        }
        return false;
    }

    @Override
    public void onSplashClosed() {
        diyStatusBarState();
    }

    public boolean p() {
        String str;
        if (PdrUtil.isEmpty(BaseInfo.uniVersionV3)) {
            String str2 = "uni-jsframework-dev.js";
            try {
                str = new JSONObject(new BufferedReader(new InputStreamReader(getActivity().getAssets().open((!BaseInfo.SyncDebug || PlatformUtil.getResInputStream("uni-jsframework-dev.js") == null || SDK.isUniMPSDK()) ? "uni-jsframework.js" : "uni-jsframework.js"))).readLine().substring(2)).optString("version");
                BaseInfo.uniVersionV3 = str;
            } catch (IOException | JSONException unused) {
                str = "";
            }
        } else {
            str = BaseInfo.uniVersionV3;
        }
        return ((!PdrUtil.isEmpty(this.s0) && this.s0.contains(str) && !this.t0) || this.u0 || !this.r || this.q0.equals("-1") || this.q0.trim().equals(str) || PdrUtil.isEmpty(str) || !this.n1) ? false : true;
    }

    public boolean q() {
        return this.q == 3;
    }

    public boolean r() {
        Intent obtainWebAppIntent = obtainWebAppIntent();
        if (obtainWebAppIntent != null) {
            boolean z = this.A1;
            this.A1 = obtainWebAppIntent.getBooleanExtra(IntentConst.IS_STREAM_APP, z) | z;
        }
        return this.A1;
    }

    @Override
    public void registerSysEventListener(ISysEventListener iSysEventListener, ISysEventListener.SysEventType sysEventType) {
        if (this.y0 == null) {
            this.y0 = new HashMap<>(1);
        }
        ArrayList<ISysEventListener> arrayList = this.y0.get(sysEventType);
        if (arrayList == null) {
            arrayList = new ArrayList<>();
            this.y0.put(sysEventType, arrayList);
        }
        arrayList.add(iSysEventListener);
    }

    public boolean s() {
        Logger.d(Logger.AppMgr_TAG, this.m + " onStop");
        IApp.IAppStatusListener iAppStatusListener = this.K0;
        if (iAppStatusListener != null) {
            return iAppStatusListener.onStop();
        }
        return true;
    }

    @Override
    public void setAppDataPath(String str) {
        if (this.R == 1) {
            if (str.startsWith(BaseInfo.sBaseResAppsPath)) {
                this.g0 = str;
                return;
            }
            this.g0 = BaseInfo.sBaseResAppsPath + this.m + "/" + BaseInfo.APP_WWW_FS_DIR;
        } else if (new File(str).exists()) {
            this.g0 = str;
        } else if (!str.startsWith(DeviceInfo.sCacheRootDir)) {
            this.g0 = DeviceInfo.sCacheRootDir + "/" + str;
        } else {
            this.g0 = str;
        }
    }

    @Override
    public void setAppDocPath(String str) {
        this.v1 = PdrUtil.appendByDeviceRootDir(str);
    }

    @Override
    public void setConfigProperty(String str, String str2) {
        if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_AUTOCLOSE)) {
            this.U = PdrUtil.parseBoolean(str2, this.U, false);
        } else if (PdrUtil.isEquals(str, "commit")) {
            a();
        } else if (PdrUtil.isEquals(str, "timeout")) {
            this.W = PdrUtil.parseInt(str2, this.W);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_DELAY)) {
            this.X = PdrUtil.parseInt(str2, this.X);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_SPLASHSCREEN)) {
            this.S = PdrUtil.parseBoolean(str2, this.S, false);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_WAITING)) {
            this.T = PdrUtil.parseBoolean(str2, this.T, false);
        } else if (PdrUtil.isEquals(str, "name")) {
            this.p0 = str2;
        } else if (PdrUtil.isEquals(str, "name")) {
            this.C = str2;
        } else if (PdrUtil.isEquals(str, "email")) {
            this.D = str2;
        } else if (PdrUtil.isEquals(str, "url")) {
            this.F = str2;
        } else if (PdrUtil.isEquals(str, "name")) {
            this.w = str2;
        } else if (PdrUtil.isEquals(str, "code")) {
            this.x = str2;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_RUNMODE_LIBERATE)) {
            this.f0 = PdrUtil.parseBoolean(str2, this.S, false);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_H5PLUS)) {
            this.N = PdrUtil.parseBoolean(str2, true, false);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_funSetUA)) {
            this.O = PdrUtil.parseBoolean(str2, true, false);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_USER_AGENT)) {
            this.H = str2;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_FULLSCREEN)) {
            this.h = PdrUtil.parseBoolean(str2, this.h, false);
        } else if (PdrUtil.isEquals(str, "webcache_path")) {
            this.w1 = str2;
        } else if (PdrUtil.isEquals(str, "wap2app_running_mode")) {
            this.K = PdrUtil.parseBoolean(str2, false, false);
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.CONFIG_LOADED_TIME)) {
            this.L0 = str2;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_BC)) {
            this.S0 = str2;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_MODE)) {
            this.V0 = str2;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED)) {
            this.W0 = Boolean.valueOf(str2).booleanValue();
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_LAUNCH_ISSTATUS)) {
            this.X0 = Boolean.valueOf(str2).booleanValue();
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_LAUNCH_STATUSBAR_COLOR)) {
            this.Z0 = str2;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_SECOND_ISATATUS)) {
            this.Y0 = Boolean.valueOf(str2).booleanValue();
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSONKEY_STATUSBAR_SECOND_STATUSBAR_COLOR)) {
            this.a1 = str2;
        } else if (PdrUtil.isEquals(str, AbsoluteConst.UNIAPP_WEEX_JS_SERVICE)) {
            this.b1 = Boolean.valueOf(str2).booleanValue();
        } else if (PdrUtil.isEquals(str, AbsoluteConst.JSON_KEY_DEBUG_REFRESH)) {
            this.m1 = str2;
        } else if (PdrUtil.isEquals(str, IApp.ConfigProperty.UNI_RESTART_TO_DIRECT)) {
            this.l1 = Boolean.valueOf(str2).booleanValue();
        }
    }

    @Override
    public void setDirectPage(String str) {
        this.i1 = str;
    }

    @Override
    public void setHideNavBarState(boolean z) {
        this.n = z;
    }

    @Override
    public void setIAppStatusListener(IApp.IAppStatusListener iAppStatusListener) {
        this.K0 = iAppStatusListener;
    }

    @Override
    public void setLaunchPageStateListener(IWebviewStateListener iWebviewStateListener) {
        this.q1 = iWebviewStateListener;
    }

    @Override
    public void setNeedRefreshApp(boolean z) {
        this.f1 = z;
    }

    @Override
    public void setQuitModel(int i) {
        this.o1 = i;
    }

    @Override
    public void setRuntimeArgs(String str) {
        if (PdrUtil.isEmpty(str)) {
            return;
        }
        this.A = str;
    }

    @Override
    public void setStatus(byte b2) {
        this.q = b2;
        if (b2 == 3) {
            this.c1 = System.currentTimeMillis();
        }
    }

    @Override
    public void setWebAppActivity(Activity activity) {
        this.a = activity;
        a(activity);
    }

    @Override
    public void setWebAppIntent(Intent intent) {
        URL url;
        String str;
        JSONObject d2;
        JSONObject optJSONObject;
        char c2 = 1;
        boolean booleanExtra = intent.getBooleanExtra(IntentConst.EXE_NEW_INTENT, true);
        if (booleanExtra || this.J0 == null) {
            this.J0 = new Intent(intent);
            if (TextUtils.isEmpty(this.p0)) {
                this.p0 = this.J0.getStringExtra(IntentConst.NAME);
            }
            String stringExtra = this.J0.getStringExtra(IntentConst.FIRST_WEB_URL);
            if (!TextUtils.equals(this.n0, "__no__")) {
                this.n0 = stringExtra;
            }
            String stringExtra2 = this.J0.getStringExtra(IntentConst.DIRECT_PAGE);
            if (!TextUtils.isEmpty(stringExtra2)) {
                try {
                    String query = new URL(stringExtra2).getQuery();
                    if (query != null) {
                        if (query.contains("webviewParameter") || query.contains("__html5plusWebviewParameter")) {
                            String str2 = query.contains("webviewParameter") ? "webviewParameter" : "__html5plusWebviewParameter";
                            this.i1 = url.getProtocol() + "://" + url.getHost() + url.getPath();
                            String[] split = query.split("&");
                            if (split != null) {
                                int i = 0;
                                boolean z = true;
                                String str3 = null;
                                while (i < split.length) {
                                    String[] split2 = split[i].split("=");
                                    if (str2.equals(split2[0])) {
                                        str3 = URLDecoder.decode(split2[c2]);
                                    } else {
                                        if (z) {
                                            try {
                                                this.i1 += "?";
                                                z = false;
                                            } catch (Exception e) {
                                                e.printStackTrace();
                                            }
                                        } else if (i < split.length) {
                                            this.i1 += "&";
                                        }
                                        this.i1 += split2[0] + "=" + split2[1];
                                    }
                                    i++;
                                    c2 = 1;
                                }
                                str = str3;
                                String str4 = this.i1;
                                this.j1 = str4;
                                this.J0.putExtra(IntentConst.DIRECT_PAGE, str4);
                                d2 = d(this.i1);
                                this.G0 = d2;
                                if (d2 == null) {
                                    try {
                                        if (!TextUtils.isEmpty(str)) {
                                            this.G0 = new JSONObject(str);
                                        } else {
                                            this.G0 = new JSONObject();
                                        }
                                    } catch (JSONException e2) {
                                        e2.printStackTrace();
                                    }
                                }
                                if (this.m.equals(this.G0.optString("webviewid"))) {
                                    if (!new File(a(BaseInfo.sConfigXML)).exists()) {
                                        String optString = this.G0.optString(IApp.ConfigProperty.CONFIG_LAUNCH_PATH);
                                        if (TextUtils.isEmpty(optString)) {
                                            optString = this.i1;
                                        }
                                        this.i0 = optString;
                                    }
                                    if (this.G0.has(AbsoluteConst.JSONKEY_STATUSBAR) && (optJSONObject = this.G0.optJSONObject(AbsoluteConst.JSONKEY_STATUSBAR)) != null && optJSONObject.optBoolean(AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED, true)) {
                                        this.X0 = true;
                                        if (optJSONObject.has("background")) {
                                            this.Z0 = optJSONObject.optString("background", this.S0);
                                        }
                                    }
                                    this.J0.removeExtra(IntentConst.DIRECT_PAGE);
                                    this.F0 = this.G0.optJSONObject("titleNView");
                                } else {
                                    e();
                                }
                            }
                            str = null;
                            String str42 = this.i1;
                            this.j1 = str42;
                            this.J0.putExtra(IntentConst.DIRECT_PAGE, str42);
                            d2 = d(this.i1);
                            this.G0 = d2;
                            if (d2 == null) {
                            }
                            if (this.m.equals(this.G0.optString("webviewid"))) {
                            }
                        }
                    }
                    this.i1 = stringExtra2;
                    str = null;
                    String str422 = this.i1;
                    this.j1 = str422;
                    this.J0.putExtra(IntentConst.DIRECT_PAGE, str422);
                    d2 = d(this.i1);
                    this.G0 = d2;
                    if (d2 == null) {
                    }
                    if (this.m.equals(this.G0.optString("webviewid"))) {
                    }
                } catch (MalformedURLException e3) {
                    e3.printStackTrace();
                } catch (Exception e4) {
                    e4.printStackTrace();
                }
            }
        }
        if (r() && BaseInfo.isWap2AppAppid(this.m) && !booleanExtra && intent.getBooleanExtra(IntentConst.WEBAPP_ACTIVITY_JUST_DOWNLOAD, false) && this.x1) {
            this.u.processEvent(IMgr.MgrType.WindowMgr, 50, this);
            this.x1 = false;
        }
    }

    @Override
    public String shortcutQuit() {
        return this.t1;
    }

    @Override
    public void showSplash() {
        Activity activity = getActivity();
        if (activity instanceof IOnCreateSplashView) {
            activity.setIntent(this.J0);
            ((IOnCreateSplashView) activity).onCreateSplash(activity);
        }
    }

    @Override
    public boolean startFromShortCut() {
        return this.s1;
    }

    public void t() {
        this.g1.clear();
        this.h1.clear();
        Activity activity = this.a;
        if (activity != null && (activity instanceof WebAppActivity)) {
            ((WebAppActivity) activity).onAppStop(this.m);
        }
        Logger.d(Logger.AppMgr_TAG, "webapp.onStoped");
        BaseInfo.s_Runing_App_Count--;
        callSysEventListener(ISysEventListener.SysEventType.onWebAppStop, this);
        d();
        PermissionUtil.removeTempPermission(this.a, this.m);
        PlatformUtil.invokeMethod("io.dcloud.feature.apsqh.QHNotifactionReceiver", "doSaveNotifications", null, new Class[]{Context.class}, new Object[]{this.a.getBaseContext()});
        PlatformUtil.invokeMethod("io.dcloud.appstream.actionbar.StreamAppActionBarUtil", "streamappStop", null, new Class[]{Activity.class, String.class}, new Object[]{getActivity(), obtainAppId()});
        b();
        deleteAppTemp();
        PermissionControler.unregisterRootPermission(this.m);
        this.u.e(this);
        if (getIAppStatusListener() != null) {
            getIAppStatusListener().onStoped(false, null);
        }
        this.u.processEvent(IMgr.MgrType.WindowMgr, 25, this);
    }

    public String toString() {
        return this.p0 + "-" + this.m + "-" + super.toString();
    }

    void u() {
        PermissionControler.registerPermission(this.m, this.x0);
    }

    @Override
    public void unregisterSysEventListener(ISysEventListener iSysEventListener, ISysEventListener.SysEventType sysEventType) {
        ArrayList<ISysEventListener> arrayList;
        HashMap<ISysEventListener.SysEventType, ArrayList<ISysEventListener>> hashMap = this.y0;
        if (hashMap == null || (arrayList = hashMap.get(sysEventType)) == null) {
            return;
        }
        arrayList.remove(iSysEventListener);
        if (arrayList.isEmpty()) {
            this.y0.remove(sysEventType);
        }
    }

    @Override
    public void updateDirectPage(String str) {
        if (TextUtils.isEmpty(str)) {
            str = this.i1;
        }
        JSONObject d2 = d(str);
        if (d2 != null) {
            this.G0 = d2;
            if (d2 != null) {
                e();
                this.u.processEvent(IMgr.MgrType.WindowMgr, 48, this);
            }
        }
    }

    public void v() {
        b(false);
        setStatus((byte) 1);
        this.u.processEvent(IMgr.MgrType.FeatureMgr, 3, this.m);
        Logger.d(Logger.AppMgr_TAG, this.m + " will active change to unrunning");
        this.u.processEvent(null, 0, this);
        WebViewFactory.sUsePermissionWebviews.clear();
    }

    public String w() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("appid", this.m);
            jSONObject.put("version", this.w);
            jSONObject.put("name", this.p0);
            jSONObject.put("versionCode", this.x);
            jSONObject.put("description", this.B);
            jSONObject.put("author", this.C);
            jSONObject.put("email", this.D);
            jSONObject.put(IApp.ConfigProperty.CONFIG_LICENSE, this.E);
            jSONObject.put("licensehref", this.F);
            jSONObject.put(IApp.ConfigProperty.CONFIG_FEATURES, new JSONArray((Collection) this.x0));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jSONObject.toString();
    }

    public void x() {
        b(true);
    }

    boolean a(InputStream inputStream, String str, JSONObject jSONObject) {
        String handleEncryption;
        boolean z;
        String string;
        boolean z2;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        boolean z3;
        boolean z4;
        String str7;
        String str8;
        Context context;
        JSONObject jSONObject2;
        String str9;
        String str10;
        JSONObject jSONObject3;
        JSONObject jSONObject4;
        JSONObject jSONObject5;
        boolean z5;
        boolean z6;
        JSONObject jSONObject6;
        String str11;
        JSONObject jSONObject7;
        String str12;
        boolean isEquals;
        JSONObject jSONObject8;
        boolean z7;
        boolean z8;
        String str13;
        String str14;
        String str15;
        String str16;
        boolean z9;
        boolean z10;
        int i;
        int i2;
        boolean z11;
        boolean z12;
        JSONObject jSONObject9;
        boolean z13;
        String str17;
        boolean z14;
        boolean z15;
        boolean z16;
        boolean z17;
        boolean z18;
        boolean z19;
        JSONArray names;
        boolean z20;
        boolean z21;
        JSONObject jSONObject10;
        boolean z22;
        boolean z23;
        boolean z24;
        int i3;
        int i4;
        StringBuilder sb;
        int i5;
        JSONObject jSONObject11;
        JSONArray jSONArray;
        JSONArray jSONArray2;
        JSONObject jSONObject12;
        JSONObject jSONObject13;
        String optString;
        String str18;
        JSONObject jSONObject14;
        Context context2;
        UnicodeInputStream unicodeInputStream = inputStream;
        String str19 = str;
        this.e1 = false;
        g gVar = this.o;
        boolean z25 = gVar != null && gVar.d;
        this.h1.addAll(AppStreamUtil.AppStreamSchemeWhiteDefaultList);
        Context activity = getActivity();
        if (activity == null) {
            activity = DeviceInfo.sApplicationContext;
        }
        try {
            if (unicodeInputStream != null) {
                try {
                    if (!this.n1) {
                        unicodeInputStream = new UnicodeInputStream(unicodeInputStream, Charset.defaultCharset().name());
                    }
                    byte[] bytes = IOUtil.getBytes(unicodeInputStream);
                    handleEncryption = this.p1.handleEncryption(activity, bytes);
                    if (handleEncryption != null) {
                        this.P0 = true;
                    } else {
                        this.P0 = false;
                        handleEncryption = new String(bytes);
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                    Logger.e("parseConfig error=" + e.getMessage());
                }
                JSONObject jSONObject15 = new JSONObject(handleEncryption);
                JSONObject jSONObject16 = JSONUtil.getJSONObject(jSONObject15, "version");
                String string2 = JSONUtil.getString(jSONObject16, "name");
                String string3 = JSONUtil.getString(jSONObject16, "code");
                String str20 = this.l0;
                String appSignatureSHA1 = LoadAppUtils.getAppSignatureSHA1(activity);
                if (z25) {
                    z = false;
                } else {
                    z = jSONObject != null ? Boolean.parseBoolean(JSONUtil.getString(jSONObject, AbsoluteConst.INSTALL_OPTIONS_FORCE)) : false;
                    if (!z && !TextUtils.isEmpty(this.w) && !BaseInfo.BaseAppInfo.compareVersion(string2, this.w)) {
                        if (gVar.c) {
                            gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_WWW_MANIFEST_VERSION_NOT_MATCH, DOMException.MSG_RUNTIME_WGTU_WWW_MANIFEST_VERSION_NOT_MATCH);
                        } else {
                            gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGT_MANIFEST_VERSION_NOT_MATCH, DOMException.MSG_RUNTIME_WGT_MANIFEST_VERSION_NOT_MATCH);
                        }
                        gVar.a = true;
                        return false;
                    }
                }
                string = JSONUtil.getString(jSONObject15, "id");
                BaseInfo.sCurrentAppOriginalAppid = string;
                if (BaseInfo.ISDEBUG || (context2 = DeviceInfo.sApplicationContext) == null || !BaseInfo.isBase(context2)) {
                    z2 = !PdrUtil.isEquals(str19, string) && PdrUtil.isEquals(this.m, string);
                    if (z2) {
                        gVar.a = true;
                        if (gVar.c) {
                            gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_WWW_MANIFEST_ERROR_MALFORMED, DOMException.MSG_RUNTIME_WGTU_WWW_MANIFEST_APPID_NOT_MATCH);
                        } else {
                            gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGT_MANIFEST_APPID_NOT_MATCH, DOMException.MSG_RUNTIME_WGT_MANIFEST_APPID_NOT_MATCH);
                        }
                        Log.e("Appmgr", "appid config is wrong pExpectAppid=" + str19 + ";appid=" + string);
                        return false;
                    }
                    str19 = string;
                } else {
                    z2 = true;
                }
                String string4 = JSONUtil.getString(jSONObject15, "name");
                boolean z26 = z2;
                if (io.dcloud.g.b.g.a()) {
                    str2 = string4;
                    str3 = string;
                    str4 = str20;
                } else {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(appSignatureSHA1);
                    str4 = str20;
                    str2 = string4;
                    str3 = string;
                    sb2.append(getConfusionMgr().decodeString(h(), true, 60));
                    appSignatureSHA1 = sb2.toString();
                }
                String str21 = appSignatureSHA1;
                String string5 = JSONUtil.getString(jSONObject15, "description");
                JSONObject jSONObject17 = JSONUtil.getJSONObject(jSONObject15, IApp.ConfigProperty.CONFIG_DEVELOPER);
                String string6 = JSONUtil.getString(jSONObject17, "name");
                String string7 = JSONUtil.getString(jSONObject17, "email");
                JSONUtil.getString(jSONObject17, "url");
                JSONObject jSONObject18 = JSONUtil.getJSONObject(jSONObject15, IApp.ConfigProperty.CONFIG_LICENSE);
                String string8 = JSONUtil.getString(jSONObject18, "url");
                JSONUtil.getString(jSONObject18, "description");
                String string9 = JSONUtil.getString(jSONObject15, IApp.ConfigProperty.CONFIG_LAUNCH_PATH);
                String string10 = JSONUtil.getString(jSONObject15, IApp.ConfigProperty.CONFIG_LAUNCH_PATH_W2A);
                boolean z27 = this.e1 || !(TextUtils.isEmpty(this.h0) || TextUtils.equals(string9, this.h0));
                this.e1 = z27;
                this.e1 = z27 || !(TextUtils.isEmpty(this.j0) || TextUtils.equals(string10, this.j0));
                String string11 = JSONUtil.getString(jSONObject15, IApp.ConfigProperty.CONFIG_BASEURL);
                boolean z28 = !PdrUtil.isEmpty(this.o0);
                JSONObject jSONObject19 = JSONUtil.getJSONObject(jSONObject15, IApp.ConfigProperty.CONFIG_PLUS);
                if (jSONObject19.has(IApp.ConfigProperty.CONFIG_CONFUSION)) {
                    str6 = string9;
                    JSONObject jSONObject20 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_CONFUSION);
                    if (jSONObject20 == null) {
                        str5 = string5;
                        if (jSONObject19.optString(IApp.ConfigProperty.CONFIG_CONFUSION).startsWith("BQ81KwABAA")) {
                            this.P0 = true;
                            this.Q0 = true;
                        }
                        if (this.p1.recordEncryptionV3Resources(this.m, jSONObject19.optString(IApp.ConfigProperty.CONFIG_CONFUSION))) {
                            this.P0 = true;
                            this.Q0 = true;
                        }
                    } else {
                        str5 = string5;
                        if (this.P0) {
                            this.p1.recordEncryptionResources(this.m, jSONObject20);
                        }
                    }
                } else {
                    str5 = string5;
                    str6 = string9;
                }
                JSONObject jSONObject21 = JSONUtil.getJSONObject(jSONObject19, AbsoluteConst.UNI_TABBAR_KEY);
                JSONObject jSONObject22 = JSONUtil.getJSONObject(jSONObject19, AbsoluteConst.JSONKEY_STATUSBAR);
                String str22 = "none";
                if (jSONObject22 != null) {
                    if (jSONObject22.has("background")) {
                        str7 = string2;
                        String optString2 = jSONObject22.optString("background");
                        if (!PdrUtil.isEmpty(optString2)) {
                            this.S0 = optString2;
                        }
                    } else {
                        str7 = string2;
                    }
                    if (jSONObject22.has("style")) {
                        z3 = z;
                        this.V0 = jSONObject22.optString("style", this.V0);
                    } else {
                        z3 = z;
                    }
                    if (jSONObject22.has(AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED)) {
                        z4 = z25;
                        if (Build.VERSION.SDK_INT >= 19) {
                            String optString3 = jSONObject22.optString(AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED);
                            this.l = optString3;
                            if (!optString3.equals("supportedDevice") && !this.l.equals("suggestedDevice")) {
                                if (this.l.equals("none")) {
                                    this.W0 = false;
                                } else {
                                    this.W0 = jSONObject22.optBoolean(AbsoluteConst.JSONKEY_STATUSBAR_IMMERSED, this.W0);
                                }
                            } else {
                                this.W0 = true;
                            }
                        }
                    } else {
                        z4 = z25;
                    }
                } else {
                    z3 = z;
                    z4 = z25;
                    str7 = string2;
                }
                JSONObject jSONObject23 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_LAUNCHWEBVIEW);
                String str23 = null;
                if (jSONObject23 != null) {
                    JSONObject jSONObject24 = JSONUtil.getJSONObject(jSONObject23, IApp.ConfigProperty.CONFIG_OVERRIDEURL);
                    JSONArray jSONArray3 = JSONUtil.getJSONArray(jSONObject23, IApp.ConfigProperty.CONFIG_OVERRIDE_RESOURCE);
                    str8 = str21;
                    if (jSONArray3 != null) {
                        jSONObject12 = new JSONObject();
                        context = activity;
                        try {
                            jSONObject12.put("0", jSONArray3);
                        } catch (JSONException e2) {
                            e2.printStackTrace();
                        }
                    } else {
                        context = activity;
                        jSONObject12 = null;
                    }
                    boolean optBoolean = jSONObject23.optBoolean("injection", this.d1);
                    String optString4 = jSONObject23.optString("plusrequire", IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL);
                    if (jSONObject23.has("titleNView")) {
                        jSONObject13 = JSONUtil.getJSONObject(jSONObject23, "titleNView");
                    } else {
                        jSONObject13 = jSONObject23.has("navigationbar") ? JSONUtil.getJSONObject(jSONObject23, "navigationbar") : null;
                    }
                    if (jSONObject23.has("replacewebapi")) {
                        jSONObject5 = jSONObject13;
                        JSONObject optJSONObject = jSONObject23.optJSONObject("replacewebapi");
                        if (optJSONObject != null && optJSONObject.has("geolocation")) {
                            optString = optJSONObject.optString("geolocation", "none");
                            str18 = optString;
                        }
                        str18 = "none";
                    } else {
                        jSONObject5 = jSONObject13;
                        if (jSONObject23.has("geolocation")) {
                            optString = jSONObject23.optString("geolocation", "none");
                            str18 = optString;
                        }
                        str18 = "none";
                    }
                    if (this.W0 && jSONObject23.has(AbsoluteConst.JSONKEY_STATUSBAR)) {
                        JSONObject jSONObject25 = jSONObject12;
                        this.X0 = true;
                        JSONObject optJSONObject2 = jSONObject23.optJSONObject(AbsoluteConst.JSONKEY_STATUSBAR);
                        if (optJSONObject2 == null || !optJSONObject2.has("background")) {
                            jSONObject14 = jSONObject25;
                        } else {
                            jSONObject14 = jSONObject25;
                            this.Z0 = optJSONObject2.optString("background", this.S0);
                        }
                    } else {
                        jSONObject14 = jSONObject12;
                    }
                    jSONObject3 = jSONObject24;
                    z5 = optBoolean;
                    str9 = str18;
                    jSONObject2 = jSONObject23;
                    str10 = optString4;
                    jSONObject4 = jSONObject14;
                } else {
                    str8 = str21;
                    context = activity;
                    jSONObject2 = jSONObject23;
                    str9 = "none";
                    str10 = IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL;
                    jSONObject3 = null;
                    jSONObject4 = null;
                    jSONObject5 = null;
                    z5 = true;
                }
                if (jSONObject19.has("appWhitelist")) {
                    JSONArray optJSONArray = jSONObject19.optJSONArray("appWhitelist");
                    z6 = z5;
                    jSONObject6 = jSONObject4;
                    int i6 = 0;
                    while (i6 < optJSONArray.length()) {
                        String optString5 = optJSONArray.optString(i6);
                        if (TextUtils.isEmpty(optString5)) {
                            jSONArray2 = optJSONArray;
                        } else {
                            jSONArray2 = optJSONArray;
                            if (!this.g1.contains(optString5)) {
                                this.g1.add(optString5);
                            }
                        }
                        i6++;
                        optJSONArray = jSONArray2;
                    }
                } else {
                    z6 = z5;
                    jSONObject6 = jSONObject4;
                }
                if (jSONObject19.has("schemeWhitelist")) {
                    JSONArray optJSONArray2 = jSONObject19.optJSONArray("schemeWhitelist");
                    int i7 = 0;
                    while (i7 < optJSONArray2.length()) {
                        String optString6 = optJSONArray2.optString(i7);
                        if (TextUtils.isEmpty(optString6)) {
                            jSONArray = optJSONArray2;
                        } else {
                            jSONArray = optJSONArray2;
                            if (!this.h1.contains(optString6)) {
                                this.h1.add(optString6);
                            }
                        }
                        i7++;
                        optJSONArray2 = jSONArray;
                    }
                }
                JSONObject jSONObject26 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_SECONDWEBVIEW);
                if (jSONObject26 != null) {
                    str11 = jSONObject26.optString("plusrequire", IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL);
                    if (jSONObject26.has("replacewebapi")) {
                        JSONObject optJSONObject3 = jSONObject26.optJSONObject("replacewebapi");
                        if (optJSONObject3 != null && optJSONObject3.has("geolocation")) {
                            str22 = optJSONObject3.optString("geolocation", "none");
                        }
                    } else if (jSONObject26.has("geolocation")) {
                        str22 = jSONObject26.optString("geolocation", "none");
                    }
                    if (this.W0 && jSONObject26.has(AbsoluteConst.JSONKEY_STATUSBAR)) {
                        this.Y0 = true;
                        JSONObject optJSONObject4 = jSONObject26.optJSONObject(AbsoluteConst.JSONKEY_STATUSBAR);
                        if (optJSONObject4 != null && optJSONObject4.has("background")) {
                            this.a1 = optJSONObject4.optString("background", this.S0);
                        }
                    }
                } else {
                    str11 = IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL;
                }
                if (BaseInfo.isBase(this.u.getContext())) {
                    this.M0 = JSONUtil.getString(jSONObject19, IApp.ConfigProperty.CONFIG_RAM_CACHE_MODE);
                }
                if (jSONObject19 != null) {
                    this.O0 = jSONObject19.optBoolean(AbsoluteConst.JSON_KEY_HARDWARE_ACCELERATED, MobilePhoneModel.checkPhoneBanAcceleration(Build.BRAND) || (BaseInfo.isWap2AppAppid(this.m) && r()));
                    this.N0 = jSONObject19.optString("popGesture", this.N0);
                }
                JSONObject jSONObject27 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_CACHE);
                if (jSONObject27 != null) {
                    String string12 = JSONUtil.getString(jSONObject27, IApp.ConfigProperty.CONFIG_SECONDWEBVIEW_MODE);
                    if (TextUtils.isEmpty(string12)) {
                        string12 = this.R0;
                    }
                    this.R0 = string12;
                }
                JSONObject jSONObject28 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_CERS);
                boolean parseBoolean = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject28, IApp.ConfigProperty.CONFIG_CRASH), this.I, false);
                boolean parseBoolean2 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject28, IApp.ConfigProperty.CONFIG_JSERROR), this.J, false);
                JSONObject optJSONObject5 = jSONObject19.optJSONObject("compatible");
                String str24 = str22;
                if (optJSONObject5 != null && jSONObject19.has("uni-app")) {
                    JSONObject optJSONObject6 = jSONObject19.optJSONObject("uni-app");
                    if (!a(optJSONObject6, gVar)) {
                        return false;
                    }
                    str12 = str11;
                    this.n1 = true;
                    this.v0 = AbsoluteConst.UNI_V3;
                    jSONObject7 = jSONObject26;
                    this.u0 = optJSONObject5.optBoolean("ignoreVersion", false);
                    String optString7 = optJSONObject5.optString("compilerVersion");
                    this.s0 = optJSONObject5.optString("runtimeVersion");
                    this.q0 = optJSONObject6.optString("compilerVersion");
                    this.w0 = optJSONObject6.optString(AbsoluteConst.NVUE_LAUNCH_MODE, IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL);
                    if (!PdrUtil.isEmpty(optString7) && optString7.trim().equals(this.q0)) {
                        this.t0 = false;
                    }
                } else {
                    jSONObject7 = jSONObject26;
                    str12 = str11;
                    if (jSONObject19.has("uni-app")) {
                        JSONObject optJSONObject7 = jSONObject19.optJSONObject("uni-app");
                        if (!a(optJSONObject7, gVar)) {
                            return false;
                        }
                        this.n1 = true;
                        this.q0 = optJSONObject7.optString("compilerVersion");
                        this.v0 = AbsoluteConst.UNI_V3;
                        this.r0 = optJSONObject7.optJSONObject("nvue");
                        this.w0 = optJSONObject7.optString(AbsoluteConst.NVUE_LAUNCH_MODE, IApp.ConfigProperty.CONFIG_RUNMODE_NORMAL);
                    } else {
                        this.n1 = false;
                    }
                }
                if (SDK.isUniMPSDK()) {
                    isEquals = true;
                } else {
                    String string13 = JSONUtil.getString(jSONObject19, IApp.ConfigProperty.CONFIG_RUNMODE);
                    if (TextUtils.isEmpty(string13) && this.n1) {
                        string13 = IApp.ConfigProperty.CONFIG_RUNMODE_LIBERATE;
                    }
                    isEquals = PdrUtil.isEquals(string13, IApp.ConfigProperty.CONFIG_RUNMODE_LIBERATE);
                }
                JSONObject jSONObject29 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_USER_AGENT);
                String string14 = JSONUtil.getString(jSONObject29, IApp.ConfigProperty.CONFIG_VALUE);
                boolean parseBoolean3 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject29, IApp.ConfigProperty.CONFIG_CONCATENATE), this.M, false);
                JSONObject jSONObject30 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_USER_AGENT_ANDROID);
                String string15 = JSONUtil.getString(jSONObject30, IApp.ConfigProperty.CONFIG_VALUE);
                boolean parseBoolean4 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject30, IApp.ConfigProperty.CONFIG_CONCATENATE), parseBoolean3, false);
                String str25 = !PdrUtil.isEmpty(string15) ? string15 : string14;
                JSONObject jSONObject31 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_SPLASHSCREEN);
                if (jSONObject31 != null) {
                    SharedPreferences orCreateBundle = SP.getOrCreateBundle(getActivity(), "pdr");
                    StringBuilder sb3 = new StringBuilder();
                    jSONObject8 = jSONObject3;
                    sb3.append(this.m);
                    sb3.append(SP.UPDATE_SPLASH_AUTOCLOSE);
                    if (orCreateBundle.contains(sb3.toString())) {
                        z22 = orCreateBundle.getBoolean(this.m + SP.UPDATE_SPLASH_AUTOCLOSE, true);
                    } else if (!JSONUtil.isNull(jSONObject31, IApp.ConfigProperty.CONFIG_AUTOCLOSE)) {
                        z22 = Boolean.parseBoolean(String.valueOf(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_AUTOCLOSE)));
                    } else {
                        z22 = false;
                        z23 = true;
                        if (z23) {
                            z8 = parseBoolean4;
                            z24 = z23;
                        } else {
                            z24 = z23;
                            StringBuilder sb4 = new StringBuilder();
                            z8 = parseBoolean4;
                            sb4.append(this.m);
                            sb4.append(SP.UPDATE_SPLASH_DELAY);
                            if (orCreateBundle.contains(sb4.toString())) {
                                i3 = orCreateBundle.getInt(this.m + SP.UPDATE_SPLASH_DELAY, 0);
                            } else if (!JSONUtil.isNull(jSONObject31, IApp.ConfigProperty.CONFIG_DELAY)) {
                                i3 = PdrUtil.parseInt(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_DELAY), this.X);
                            }
                            i4 = i3;
                            sb = new StringBuilder();
                            z7 = isEquals;
                            sb.append(this.m);
                            sb.append(SP.UPDATE_SPLASH_AUTOCLOSE_W2A);
                            if (orCreateBundle.contains(sb.toString())) {
                                z22 = orCreateBundle.getBoolean(this.m + SP.UPDATE_SPLASH_AUTOCLOSE_W2A, z22);
                            } else if (!JSONUtil.isNull(jSONObject31, IApp.ConfigProperty.CONFIG_AUTOCLOSE_W2A)) {
                                z22 = Boolean.parseBoolean(String.valueOf(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_AUTOCLOSE_W2A)));
                            }
                            if (z22) {
                                if (orCreateBundle.contains(this.m + SP.UPDATE_SPLASH_DELAY_W2A)) {
                                    i3 = orCreateBundle.getInt(this.m + SP.UPDATE_SPLASH_DELAY_W2A, i3);
                                } else if (!JSONUtil.isNull(jSONObject31, IApp.ConfigProperty.CONFIG_DELAY_W2A)) {
                                    i3 = PdrUtil.parseInt(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_DELAY_W2A), this.Y);
                                }
                                i5 = (int) (i3 + k());
                            } else {
                                i5 = i3;
                            }
                            boolean parseBoolean5 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_WAITING), this.T, false);
                            str13 = JSONUtil.getString(jSONObject31, "event");
                            boolean z29 = z22;
                            String optString8 = jSONObject31.optString(IApp.ConfigProperty.CONFIG_TARGET, BannerLayout.CIRCULAR_INDICATOR);
                            jSONObject11 = JSONUtil.getJSONObject(jSONObject31, "ads");
                            if (jSONObject11 != null) {
                                String optString9 = jSONObject11.optString("background", "#ffffff");
                                String optString10 = jSONObject11.optString("image", "");
                                z12 = parseBoolean5;
                                i2 = i4;
                                z10 = true;
                                str15 = optString9;
                                z11 = z24;
                                str14 = optString10;
                                i = i5;
                                z9 = z29;
                                str16 = optString8;
                            } else {
                                i = i5;
                                z12 = parseBoolean5;
                                z11 = z24;
                                i2 = i4;
                                z9 = z29;
                                z10 = true;
                                str16 = optString8;
                                str14 = null;
                                str15 = null;
                            }
                        }
                        i3 = 0;
                        i4 = 0;
                        sb = new StringBuilder();
                        z7 = isEquals;
                        sb.append(this.m);
                        sb.append(SP.UPDATE_SPLASH_AUTOCLOSE_W2A);
                        if (orCreateBundle.contains(sb.toString())) {
                        }
                        if (z22) {
                        }
                        boolean parseBoolean52 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_WAITING), this.T, false);
                        str13 = JSONUtil.getString(jSONObject31, "event");
                        boolean z292 = z22;
                        String optString82 = jSONObject31.optString(IApp.ConfigProperty.CONFIG_TARGET, BannerLayout.CIRCULAR_INDICATOR);
                        jSONObject11 = JSONUtil.getJSONObject(jSONObject31, "ads");
                        if (jSONObject11 != null) {
                        }
                    }
                    z23 = z22;
                    if (z23) {
                    }
                    i3 = 0;
                    i4 = 0;
                    sb = new StringBuilder();
                    z7 = isEquals;
                    sb.append(this.m);
                    sb.append(SP.UPDATE_SPLASH_AUTOCLOSE_W2A);
                    if (orCreateBundle.contains(sb.toString())) {
                    }
                    if (z22) {
                    }
                    boolean parseBoolean522 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject31, IApp.ConfigProperty.CONFIG_WAITING), this.T, false);
                    str13 = JSONUtil.getString(jSONObject31, "event");
                    boolean z2922 = z22;
                    String optString822 = jSONObject31.optString(IApp.ConfigProperty.CONFIG_TARGET, BannerLayout.CIRCULAR_INDICATOR);
                    jSONObject11 = JSONUtil.getJSONObject(jSONObject31, "ads");
                    if (jSONObject11 != null) {
                    }
                } else {
                    jSONObject8 = jSONObject3;
                    z7 = isEquals;
                    z8 = parseBoolean4;
                    str13 = null;
                    str14 = null;
                    str15 = null;
                    str16 = null;
                    z9 = false;
                    z10 = false;
                    i = 0;
                    i2 = 0;
                    z11 = true;
                    z12 = false;
                }
                JSONObject jSONObject32 = JSONUtil.getJSONObject(jSONObject19, "error");
                String string16 = (jSONObject32 == null || JSONUtil.isNull(jSONObject32, "url")) ? "file:///android_asset/data/dcloud_error.html" : JSONUtil.getString(jSONObject32, "url");
                JSONObject jSONObject33 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_SSL);
                String str26 = str13;
                String string17 = (jSONObject33 == null || JSONUtil.isNull(jSONObject33, IApp.ConfigProperty.CONFIG_UNTRUSTEDCA)) ? str4 : JSONUtil.getString(jSONObject33, IApp.ConfigProperty.CONFIG_UNTRUSTEDCA);
                JSONObject jSONObject34 = JSONUtil.getJSONObject(jSONObject19, IApp.ConfigProperty.CONFIG_STREAM);
                int i8 = i;
                boolean isWap2AppAppid = BaseInfo.isWap2AppAppid(this.m);
                this.L = isWap2AppAppid;
                int i9 = i2;
                if (jSONObject34 != null) {
                    this.L = jSONObject34.optBoolean(IApp.ConfigProperty.CONFIG_COMPETENT, isWap2AppAppid);
                    this.u1 = jSONObject34.optString(IApp.ConfigProperty.CONFIG_SHORTCUT);
                    this.t1 = jSONObject34.optString("shortcutQuit");
                    jSONObject9 = jSONObject34.optJSONObject(IApp.ConfigProperty.CONFIG_AUTHORITY);
                } else {
                    jSONObject9 = null;
                }
                if (!this.L) {
                    BaseInfo.createAppTestFile(str19);
                } else {
                    BaseInfo.removeTestFile(str19);
                }
                String str27 = B1;
                StringBuilder sb5 = new StringBuilder();
                JSONObject jSONObject35 = jSONObject9;
                sb5.append(this.m);
                sb5.append(" app competent=");
                sb5.append(this.L);
                Logger.i(str27, sb5.toString());
                if (this.n1 || io.dcloud.g.b.g.a()) {
                    z13 = z26;
                } else {
                    String metaValue = AndroidResources.getMetaValue(getConfusionMgr().decryptStr("lkdg}lWixxcmq"));
                    if (!TextUtils.isEmpty(metaValue)) {
                        String md5 = Md5Utils.md5((str19 + context.getPackageName().toLowerCase()) + str8);
                        if (!TextUtils.isEmpty(md5) && metaValue.equalsIgnoreCase(md5)) {
                            z13 = true;
                            if (!z13) {
                                setStatus((byte) 4);
                                return false;
                            }
                        }
                    }
                    z13 = false;
                    if (!z13) {
                    }
                }
                JSONUtil.getJSONObject(jSONObject19, "ads");
                String string18 = JSONUtil.getString(jSONObject19, "adid");
                JSONObject jSONObject36 = JSONUtil.getJSONObject(jSONObject19, "wap2app");
                boolean z30 = z13;
                if (jSONObject36 != null) {
                    str17 = string18;
                    str23 = jSONObject36.optString("launchError", "tip");
                } else {
                    str17 = string18;
                }
                String str28 = str23;
                Intent intent = this.J0;
                if (intent != null && intent.hasExtra(IntentConst.UNIMP_DIRECT_DATA)) {
                    this.l1 = true;
                    this.m1 = this.J0.getStringExtra(IntentConst.UNIMP_DIRECT_DATA);
                    this.J0.removeExtra(IntentConst.UNIMP_DIRECT_DATA);
                }
                if (jSONObject19.has("arguments")) {
                    setRuntimeArgs(JSONUtil.getString(jSONObject19, "arguments"));
                } else {
                    Intent intent2 = this.J0;
                    if (intent2 != null && intent2.hasExtra(IntentConst.UNIMP_RUN_ARGUMENTS)) {
                        setRuntimeArgs(this.J0.getStringExtra(IntentConst.UNIMP_RUN_ARGUMENTS));
                    }
                }
                boolean parseBoolean6 = PdrUtil.parseBoolean(JSONUtil.getString(jSONObject15, IApp.ConfigProperty.CONFIG_FULLSCREEN), this.h, false);
                String str29 = B1;
                StringBuilder sb6 = new StringBuilder();
                String str30 = string17;
                sb6.append(this.m);
                sb6.append(" app fullScreen=");
                sb6.append(parseBoolean6);
                Logger.i(str29, sb6.toString());
                ArrayList<String> arrayList = new ArrayList<>();
                boolean r = r();
                JSONObject jSONObject37 = JSONUtil.getJSONObject(jSONObject15, IApp.ConfigProperty.CONFIG_PERMISSIONS);
                if (jSONObject37 == null || (names = jSONObject37.names()) == null) {
                    z14 = z9;
                    z15 = z10;
                    z16 = parseBoolean6;
                    z17 = z11;
                    z18 = z12;
                    z19 = z30;
                } else {
                    z16 = parseBoolean6;
                    StringBuffer stringBuffer = new StringBuffer();
                    z19 = z30;
                    z14 = z9;
                    z18 = z12;
                    int i10 = 0;
                    while (i10 < names.length()) {
                        String lowerCase = JSONUtil.getString(names, i10).toLowerCase();
                        arrayList.add(lowerCase);
                        JSONArray jSONArray4 = names;
                        if (lowerCase.equals("push")) {
                            z21 = z11;
                            z20 = z10;
                            PlatformUtil.APS_COVER = PdrUtil.parseBoolean(JSONUtil.getString(JSONUtil.getJSONObject(jSONObject37, lowerCase), IApp.ConfigProperty.CONFIG_COVER), PlatformUtil.APS_COVER, false);
                        } else {
                            z20 = z10;
                            z21 = z11;
                            if (lowerCase.equals("webview")) {
                                arrayList.add(AbsoluteConst.F_UI);
                            } else if (lowerCase.equals(AbsoluteConst.F_UI)) {
                                arrayList.add("webview");
                                arrayList.add("nativeui");
                                arrayList.add("navigator");
                            } else if (lowerCase.equals("maps") && (jSONObject10 = JSONUtil.getJSONObject(jSONObject37, IFeature.F_MAPS)) != null && jSONObject10.has(AbsoluteConst.JSONKEY_MAP_COORD_TYPE)) {
                                this.k1 = JSONUtil.getString(jSONObject10, AbsoluteConst.JSONKEY_MAP_COORD_TYPE);
                            }
                        }
                        if (z4 && !z3 && !r && !PermissionControler.checkSafePermission(str19, lowerCase) && !((Boolean) this.u.processEvent(IMgr.MgrType.FeatureMgr, 9, lowerCase)).booleanValue()) {
                            if (stringBuffer.length() > 0) {
                                stringBuffer.append(JSUtil.COMMA);
                            }
                            stringBuffer.append(lowerCase);
                            z19 = false;
                        }
                        i10++;
                        names = jSONArray4;
                        z11 = z21;
                        z10 = z20;
                    }
                    z15 = z10;
                    z17 = z11;
                    if (!z19 && z4) {
                        gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_5PRUNTIME_LACK_MODULE, DOMException.MSG_RUNTIME_5PRUNTIME_LACK_MODULE + ":" + ((Object) stringBuffer));
                        gVar.a = true;
                        return false;
                    }
                }
                if (z19) {
                    BaseInfo.BaseAppInfo baseAppInfo = this.p;
                    if (baseAppInfo != null) {
                        baseAppInfo.mAppVer = this.w;
                    }
                    this.w = str7;
                    this.x = string3;
                    this.x0 = arrayList;
                    this.m = str19;
                    this.v = str3;
                    this.p0 = str2;
                    this.I = parseBoolean;
                    this.J = parseBoolean2;
                    this.B = str5;
                    this.C = string6;
                    this.D = string7;
                    this.F = string8;
                    this.h0 = str6;
                    this.j0 = string10;
                    this.o0 = string11;
                    this.H = str25;
                    this.m0 = string16;
                    this.S = z15;
                    this.U = z17;
                    this.V = z14;
                    this.f0 = z7;
                    this.T = z18;
                    this.M = z8;
                    this.h = z16;
                    this.Q = z28;
                    this.l0 = str30;
                    BaseInfo.untrustedca = str30;
                    this.X = i9;
                    this.Y = i8;
                    this.Z = str26;
                    this.a0 = str16;
                    this.z0 = jSONObject8;
                    this.B0 = jSONObject6;
                    this.d1 = z6;
                    this.C0 = jSONObject7;
                    this.D0 = jSONObject2;
                    this.F0 = jSONObject5;
                    this.E0 = jSONObject35;
                    this.I0 = str17;
                    this.b0 = str10;
                    this.c0 = str12;
                    this.d0 = str9;
                    this.e0 = str24;
                    this.T0 = str15;
                    this.U0 = str14;
                    this.H0 = str28;
                    this.A0 = jSONObject21;
                    m();
                    gVar.b = w();
                }
                gVar.a = !z19;
                return z19;
            }
            JSONObject jSONObject152 = new JSONObject(handleEncryption);
            JSONObject jSONObject162 = JSONUtil.getJSONObject(jSONObject152, "version");
            String string22 = JSONUtil.getString(jSONObject162, "name");
            String string32 = JSONUtil.getString(jSONObject162, "code");
            String str202 = this.l0;
            String appSignatureSHA12 = LoadAppUtils.getAppSignatureSHA1(activity);
            if (z25) {
            }
            string = JSONUtil.getString(jSONObject152, "id");
            BaseInfo.sCurrentAppOriginalAppid = string;
            if (BaseInfo.ISDEBUG) {
            }
            if (PdrUtil.isEquals(str19, string)) {
            }
            if (z2) {
            }
        } catch (Exception e3) {
            e3.printStackTrace();
            gVar.a = true;
            if (gVar.c) {
                gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_WWW_MANIFEST_ERROR_MALFORMED, DOMException.MSG_RUNTIME_WGTU_WWW_MANIFEST_ERROR_MALFORMED);
                return false;
            }
            gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGT_MANIFEST_ERROR_MALFORMED, DOMException.MSG_RUNTIME_WGT_MANIFEST_ERROR_MALFORMED);
            return false;
        }
        handleEncryption = "";
    }

    public void g() {
        ArrayList<String> arrayList = this.x0;
        if (arrayList != null) {
            arrayList.clear();
            this.x0 = null;
        }
        HashMap<ISysEventListener.SysEventType, ArrayList<ISysEventListener>> hashMap = this.y0;
        if (hashMap != null) {
            hashMap.clear();
            this.y0 = null;
        }
        this.p1.removeData(this.m);
        this.u = null;
        this.p = null;
        this.b1 = false;
    }

    public boolean c(String str, JSONObject jSONObject) {
        String str2;
        String obtainAppDataPath = obtainAppDataPath();
        StringBuilder sb = new StringBuilder();
        boolean z = false;
        sb.append(obtainAppDataPath.substring(0, obtainAppDataPath.length() - 1));
        sb.append("_backup");
        String sb2 = sb.toString();
        byte b2 = this.R;
        try {
            if (b2 == 1) {
                str2 = BaseInfo.sCacheFsAppsPath + this.m + File.separatorChar + BaseInfo.APP_WWW_FS_DIR;
                try {
                    DHFile.deleteFile(str2);
                    sb2 = str2.substring(0, str2.length() - 1) + "_backup";
                } catch (Exception e) {
                    e = e;
                    e.printStackTrace();
                    g gVar = this.o;
                    gVar.a = true;
                    gVar.b = StringUtil.format(DOMException.JSON_ERROR_INFO, 10, e.getMessage());
                    if (z) {
                    }
                    return z;
                }
            } else {
                if (b2 == 0) {
                    new File(obtainAppDataPath).renameTo(new File(sb2));
                }
                str2 = obtainAppDataPath;
            }
            ZipUtils.upZipFile(new File(str), str2);
            b((byte) 0);
            setAppDataPath(str2);
            z = b(this.m, jSONObject);
        } catch (Exception e2) {
            e = e2;
            str2 = obtainAppDataPath;
        }
        if (z) {
            Logger.e(Logger.AppMgr_TAG, "unZipWebApp failed pFilePath=" + str);
            b(b2);
            setAppDataPath(obtainAppDataPath);
            try {
                DHFile.deleteFile(str2);
            } catch (IOException e3) {
                e3.printStackTrace();
            }
            if (b2 == 0) {
                new File(sb2).renameTo(new File(str2));
            }
        } else {
            if (b2 == 0) {
                try {
                    DHFile.deleteFile(sb2);
                } catch (IOException e4) {
                    e4.printStackTrace();
                }
            }
            BaseInfo.BaseAppInfo baseAppInfo = new BaseInfo.BaseAppInfo(this.m, this.w);
            this.p = baseAppInfo;
            baseAppInfo.saveToBundleData(getActivity());
        }
        return z;
    }

    public boolean f(String str) {
        if (this.r || !this.t) {
            Logger.e("Webapp start " + this.m);
            Activity activity = this.a;
            if (activity != null && (activity instanceof WebAppActivity)) {
                ((WebAppActivity) activity).onAppStart(this.m);
                ((WebAppActivity) this.a).onAppStart(this);
            }
            AppStatus.setAppStatus(this.m, 2);
            BaseInfo.s_Runing_App_Count++;
            this.s = true;
            this.t = !this.r;
            setRuntimeArgs(str);
            return a(5);
        }
        return false;
    }

    @Override
    public InputStream obtainResInStream(String str) {
        return obtainResInStream(null, str);
    }

    private String c(String str) {
        return BaseInfo.sBaseFsSitMapPath + str + "/_sitemap.json";
    }

    @Override
    public String convert2AbsFullPath(String str) {
        return convert2AbsFullPath(null, str);
    }

    public void b(byte b2) {
        this.R = b2;
    }

    private static String b(String str) {
        return (str == null || str.length() <= 0 || str.charAt(0) != '/') ? str : b(str.substring(1));
    }

    void b(boolean z) {
        this.b.onAppUnActive(this);
        if (z) {
            callSysEventListener(ISysEventListener.SysEventType.onWebAppPause, this);
            callSysEventListener(ISysEventListener.SysEventType.onWebAppBackground, this);
        }
        IApp.IAppStatusListener iAppStatusListener = this.K0;
        if (iAppStatusListener != null) {
            iAppStatusListener.onPause(this, null);
        }
        setStatus((byte) 2);
    }

    private void b() {
        if (r()) {
            return;
        }
        ThreadPool.self().addThreadTask(new d(obtainAppId()));
    }

    private JSONObject a(InputStream inputStream) {
        try {
            if (!this.n1) {
                inputStream = new UnicodeInputStream(inputStream, Charset.defaultCharset().name());
            }
            return new JSONObject(new String(IOUtil.getBytes(inputStream)));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    @Override
    public void a(Activity activity) {
        super.a(activity);
        AppStatusBarManager appStatusBarManager = this.k;
        if (appStatusBarManager != null) {
            appStatusBarManager.checkImmersedStatusBar(activity, this.W0);
            this.k.isFullScreen = isFullScreen();
        }
        this.j.mJsonViewOption = JSONUtil.createJSONObject("{}");
        this.f = PdrUtil.parseInt(SP.getBundleData(getActivity(), BaseInfo.PDR, "StatusBarHeight"), 0);
        updateScreenInfo(4);
        this.s1 = false;
        IActivityHandler iActivityHandler = DCloudAdapterUtil.getIActivityHandler(getActivity());
        if (!r() && iActivityHandler != null) {
            HashMap hashMap = new HashMap();
            hashMap.put(CreateShortResultReceiver.KEY_VERSIONNAME, this.w);
            hashMap.put("appid", this.m);
            hashMap.put("name", this.p0);
            hashMap.put("adid", this.I0);
            hashMap.put("bg", this.T0);
            hashMap.put("img", convert2AbsFullPath(this.U0));
            io.dcloud.a.a(getActivity(), this.m, "save", hashMap);
        }
        Intent intent = activity.getIntent();
        if (intent != null) {
            Bundle extras = intent.getExtras();
            if (extras != null && extras.containsKey(IntentConst.FROM_SHORT_CUT_STRAT) && extras.getBoolean(IntentConst.FROM_SHORT_CUT_STRAT)) {
                this.s1 = true;
            }
            if (extras != null && extras.containsKey(IntentConst.WEBAPP_ACTIVITY_CREATE_SHORTCUT)) {
                this.u1 = extras.getString(IntentConst.WEBAPP_ACTIVITY_CREATE_SHORTCUT);
            }
            if (extras != null && extras.containsKey("shortcutQuit")) {
                this.t1 = extras.getString("shortcutQuit");
            }
            if (extras != null && extras.containsKey(IntentConst.START_FORCE_SHORT_QUIT)) {
                this.t1 = extras.getString(IntentConst.START_FORCE_SHORT_QUIT);
            }
            if (intent.hasExtra(IntentConst.START_FORCE_SHORT)) {
                this.u1 = intent.getStringExtra(IntentConst.START_FORCE_SHORT);
            }
            if (TextUtils.isEmpty(this.u1)) {
                String launchType = BaseInfo.getLaunchType(intent);
                this.u1 = AbsoluteConst.INSTALL_OPTIONS_FORCE;
                if (launchType.equals("scheme")) {
                    this.u1 = "query";
                } else if (this.L) {
                    this.u1 = AbsoluteConst.INSTALL_OPTIONS_FORCE;
                } else {
                    SharedPreferences orCreateBundle = SP.getOrCreateBundle(activity, "pdr");
                    String string = orCreateBundle.getString(AbsoluteConst.TEST_RUN + this.m, null);
                    if (!TextUtils.isEmpty(string) && string.equals("__am=t")) {
                        this.u1 = AbsoluteConst.INSTALL_OPTIONS_FORCE;
                    } else {
                        this.u1 = "none";
                    }
                }
            }
        }
        try {
            ADUtils.runThreadCheckADDownload(activity);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    String a(String str) {
        return this.g0 + str;
    }

    public void a(ICallBack iCallBack) {
        if ((BaseInfo.ISDEBUG || this.f0) && this.R == 1) {
            ThreadPool.self().addThreadTask(new c(iCallBack), true);
        } else {
            iCallBack.onCallBack(0, null);
        }
    }

    private boolean a(int i) {
        PermissionUtil.sUseStreamAppPermissionDialogCount = 0;
        WebViewFactory.sUsePermissionWebviews.clear();
        PermissionUtil.removeTempPermission(this.a, this.m);
        String str = B1;
        Logger.e(str, "start0 mAppid===" + this.m);
        BaseInfo.sCurrentAppOriginalAppid = this.v;
        BaseInfo.putStartupTimeData(this.m, String.valueOf(System.currentTimeMillis()));
        BaseInfo.sProcessId = (long) Process.myPid();
        String str2 = B1;
        StringBuilder sb = new StringBuilder();
        sb.append(this.m);
        sb.append(this.R == 1 ? " APP_RUNNING_MODE" : " FS_RUNNING_MODE");
        Logger.i(str2, sb.toString());
        u();
        setStatus((byte) 3);
        IApp.IAppStatusListener iAppStatusListener = this.K0;
        if (iAppStatusListener != null) {
            iAppStatusListener.onStart();
        }
        String str3 = B1;
        Logger.i(str3, "mLaunchPath=" + this.h0);
        Logger.i("download_manager", "webapp start task begin success appid=" + this.m + " mLaunchPath=" + this.h0);
        String str4 = TestUtil.START_STREAM_APP;
        StringBuilder sb2 = new StringBuilder();
        sb2.append("webapp start appid=");
        sb2.append(this.m);
        TestUtil.print(str4, sb2.toString());
        BaseInfo.setLoadingLaunchePage(true, "start0");
        String stringExtra = getActivity().getIntent().getStringExtra(IntentConst.WEBAPP_ACTIVITY_LAUNCH_PATH);
        if (stringExtra != null && !"".equals(stringExtra.trim())) {
            getActivity().getIntent().removeExtra(IntentConst.WEBAPP_ACTIVITY_LAUNCH_PATH);
            if (!"about:blank".equals(stringExtra)) {
                stringExtra = convert2WebviewFullPath(null, stringExtra);
            }
            this.k0 = true;
        } else if (BaseInfo.isWap2AppAppid(this.m) && !TextUtils.isEmpty(this.j0)) {
            stringExtra = convert2WebviewFullPath(null, this.j0);
        } else {
            stringExtra = convert2WebviewFullPath(null, this.h0);
        }
        if (a((IApp) this) && !new File(a(BaseInfo.sConfigXML)).exists()) {
            stringExtra = TextUtils.isEmpty(this.i0) ? this.j1 : this.i0;
        }
        Uri data = getActivity().getIntent().getData();
        if (data != null && data.toString().endsWith(".html")) {
            stringExtra = data.toString();
        }
        if (this.l1) {
            stringExtra = convert2WebviewFullPath(null, "__uniappview.html");
        }
        Object processEvent = this.u.processEvent(IMgr.MgrType.WindowMgr, i, new Object[]{this, stringExtra, Boolean.valueOf(this.O0), this.R0});
        if (processEvent == null) {
            return true;
        }
        return Boolean.parseBoolean(String.valueOf(processEvent));
    }

    private boolean a(IApp iApp) {
        return (TextUtils.isEmpty(iApp.getOriginalDirectPage()) || iApp.obtainWebAppIntent().hasExtra(IntentConst.DIRECT_PAGE)) ? false : true;
    }

    public boolean a(boolean z) {
        if (z) {
            this.m1 = null;
            this.u.processEvent(IMgr.MgrType.WindowMgr, 76, this);
        }
        setAppDataPath(BaseInfo.sCacheFsAppsPath + this.m + DeviceInfo.sSeparatorChar + BaseInfo.REAL_PRIVATE_WWW_DIR);
        boolean b2 = b(this.m, null);
        if (b2) {
            PermissionUtil.clearUseRejectedCache();
            showSplash();
            this.u.processEvent(IMgr.MgrType.FeatureMgr, 3, this.m);
            callSysEventListener(ISysEventListener.SysEventType.onWebAppReStart, null);
            this.b1 = false;
            TestUtil.record(AbsoluteConst.RUN_5AP_TIME_KEY);
            return a(10);
        }
        return b2;
    }

    private void a() {
        IPdrModule a2;
        if (this.n1) {
            return;
        }
        if (!SDK.isUniMPSDK()) {
            io.dcloud.g.b.a.f().a(this.a);
        }
        if (r() || (a2 = io.dcloud.g.b.e.a().a("commit")) == null) {
            return;
        }
        Object[] objArr = new Object[3];
        objArr[0] = this;
        objArr[1] = this.I0;
        JSONObject jSONObject = this.u.f;
        objArr[2] = jSONObject != null ? jSONObject.optString("version") : "0.1";
        a2.execute("start_up", objArr);
    }

    public IFrameView a(IWebviewStateListener iWebviewStateListener) {
        u();
        return (IFrameView) this.u.processEvent(IMgr.MgrType.WindowMgr, 17, new Object[]{this, convert2WebviewFullPath(null, this.h0), iWebviewStateListener});
    }

    public IFrameView a(IWebviewStateListener iWebviewStateListener, IDCloudWebviewClientListener iDCloudWebviewClientListener) {
        u();
        return (IFrameView) this.u.processEvent(IMgr.MgrType.WindowMgr, 17, new Object[]{this, convert2WebviewFullPath(null, this.h0), iWebviewStateListener, iDCloudWebviewClientListener});
    }

    private boolean a(ISysEventListener iSysEventListener, ISysEventListener.SysEventType sysEventType) {
        if (!(iSysEventListener instanceof IBoot) || PdrUtil.parseBoolean(String.valueOf(this.u.processEvent(null, 1, iSysEventListener)), false, false)) {
            return true;
        }
        return !(sysEventType == ISysEventListener.SysEventType.onStart || sysEventType == ISysEventListener.SysEventType.onStop || sysEventType == ISysEventListener.SysEventType.onPause || sysEventType == ISysEventListener.SysEventType.onResume) || (iSysEventListener instanceof ReceiveSystemEventVoucher);
    }

    public static boolean a(ISysEventListener.SysEventType sysEventType) {
        return (sysEventType == ISysEventListener.SysEventType.onKeyDown || sysEventType == ISysEventListener.SysEventType.onKeyUp || sysEventType == ISysEventListener.SysEventType.onKeyLongPress) ? false : true;
    }

    public boolean a(String str, JSONObject jSONObject) {
        String str2;
        boolean z;
        boolean z2;
        ArrayList<XmlUtil.DHNode> elements;
        int size;
        int i;
        g gVar = this.o;
        gVar.c = true;
        gVar.d = true;
        String str3 = BaseInfo.sCacheFsAppsPath + this.m + DeviceInfo.sSeparatorChar + BaseInfo.APP_WWW_FS_DIR;
        String str4 = str3.substring(0, str3.length() - 1) + "_unzip" + File.separatorChar;
        String str5 = str3.substring(0, str3.length() - 1) + "_backup" + File.separatorChar;
        String str6 = str3.substring(0, str3.length() - 1) + "_backup1" + File.separatorChar;
        ?? file = new File(str);
        InputStream inputStream = null;
        r8 = null;
        r8 = null;
        XmlUtil.DHNode dHNode = null;
        try {
            try {
                try {
                    try {
                        try {
                            DHFile.delete(str4);
                            ZipUtils.upZipFile(file, str4);
                        } catch (IOException e) {
                            e = e;
                            file = 0;
                            str2 = null;
                        }
                    } catch (IOException e2) {
                        e = e2;
                        str2 = null;
                    }
                    try {
                        file = DHFile.getInputStream(DHFile.createFileHandler(str4 + BaseInfo.WGTU_UPDATE_XML));
                        try {
                            if (file == 0) {
                                this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_UPDATE_NOT_EXIST, DOMException.MSG_RUNTIME_WGTU_UPDATE_NOT_EXIST);
                                this.o.a = true;
                                IOUtil.close((InputStream) file);
                                return false;
                            }
                            XmlUtil.DHNode XML_Parser = XmlUtil.XML_Parser(file);
                            if (XML_Parser != null) {
                                if (XML_Parser != null) {
                                    String attributeValue = XmlUtil.getAttributeValue(XML_Parser, "appid");
                                    String attributeValue2 = XmlUtil.getAttributeValue(XmlUtil.getElement(XML_Parser, AbsoluteConst.XML_BASIS), "version");
                                    if (!BaseInfo.ISDEBUG && !this.m.equalsIgnoreCase(attributeValue)) {
                                        this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_UPDATE_APPID_NOT_MATCH, DOMException.MSG_RUNTIME_WGTU_UPDATE_APPID_NOT_MATCH);
                                        str2 = null;
                                        z = false;
                                    }
                                    if (!this.w.equals(attributeValue2) && !jSONObject.optBoolean(AbsoluteConst.INSTALL_OPTIONS_FORCE)) {
                                        this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_UPDATE_VERSION_NOT_MATCH, DOMException.MSG_RUNTIME_WGTU_UPDATE_VERSION_NOT_MATCH);
                                        str2 = null;
                                        z = false;
                                    }
                                    str2 = str4 + BaseInfo.APP_WWW_FS_DIR;
                                    try {
                                        String str7 = str2 + BaseInfo.sConfigXML;
                                        if (DHFile.isExist(str7)) {
                                            InputStream inputStream2 = DHFile.getInputStream(DHFile.createFileHandler(str7));
                                            z = a(inputStream2, this.m, jSONObject);
                                            IOUtil.close(inputStream2);
                                            dHNode = XmlUtil.getElement(XML_Parser, AbsoluteConst.XML_REMOVE);
                                        } else {
                                            this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_WWW_MANIFEST_NOT_EXIST, DOMException.MSG_RUNTIME_WGTU_WWW_MANIFEST_NOT_EXIST);
                                            this.o.a = true;
                                            IOUtil.close((InputStream) file);
                                            return false;
                                        }
                                    } catch (IOException e3) {
                                        e = e3;
                                        e.printStackTrace();
                                        this.o.b = DOMException.toJSON(-5, DOMException.MSG_IO_ERROR);
                                        IOUtil.close((InputStream) file);
                                        z = false;
                                        if (!z) {
                                        }
                                        return false;
                                    }
                                } else {
                                    str2 = null;
                                    z = true;
                                }
                                IOUtil.close((InputStream) file);
                                if (!z) {
                                    try {
                                        DHFile.deleteFile(str5);
                                        byte b2 = this.R;
                                        if (b2 == 1) {
                                            DHFile.copyDir(this.g0, str5);
                                        } else if (b2 == 0) {
                                            DHFile.copyFile(str3, str5, true, false);
                                            z2 = true;
                                            elements = XmlUtil.getElements(dHNode, AbsoluteConst.XML_ITEM);
                                            if (elements != null && !elements.isEmpty()) {
                                                size = elements.size();
                                                for (i = 0; i < size; i++) {
                                                    DHFile.deleteFile(str5 + XmlUtil.getAttributeValue(elements.get(i), AbsoluteConst.XML_PATH));
                                                }
                                            }
                                            if (1 == DHFile.copyFile(str2, str5, true, false)) {
                                                DHFile.deleteFile(str5);
                                                this.o.b = DOMException.toJSON(-5, DOMException.MSG_IO_ERROR);
                                                this.o.a = true;
                                                return false;
                                            }
                                            try {
                                                DHFile.deleteFile(str4);
                                                if (z2) {
                                                    DHFile.rename(str3, str6.substring(str6.substring(0, str6.length() - 1).lastIndexOf(47) + 1));
                                                }
                                                DHFile.rename(str5, BaseInfo.APP_WWW_FS_DIR);
                                                if (z2) {
                                                    DHFile.deleteFile(str6);
                                                }
                                                b((byte) 0);
                                                setAppDataPath(str3);
                                                BaseInfo.BaseAppInfo baseAppInfo = new BaseInfo.BaseAppInfo(this.m, this.w);
                                                this.p = baseAppInfo;
                                                baseAppInfo.saveToBundleData(getActivity());
                                            } catch (IOException e4) {
                                                e4.printStackTrace();
                                                this.o.b = DOMException.toJSON(-5, DOMException.MSG_IO_ERROR);
                                                this.o.a = true;
                                                return false;
                                            }
                                        }
                                        z2 = false;
                                        elements = XmlUtil.getElements(dHNode, AbsoluteConst.XML_ITEM);
                                        if (elements != null) {
                                            size = elements.size();
                                            while (i < size) {
                                            }
                                        }
                                        if (1 == DHFile.copyFile(str2, str5, true, false)) {
                                        }
                                    } catch (Exception e5) {
                                        e5.printStackTrace();
                                        try {
                                            DHFile.deleteFile(str4);
                                        } catch (IOException e6) {
                                            e6.printStackTrace();
                                        }
                                        this.o.b = DOMException.toJSON(-99, DOMException.MSG_UNKNOWN_ERROR);
                                        this.o.a = true;
                                        return false;
                                    }
                                } else {
                                    this.o.a = true;
                                    try {
                                        DHFile.deleteFile(str4);
                                    } catch (IOException e7) {
                                        e7.printStackTrace();
                                    }
                                }
                                return false;
                            }
                            throw new Exception();
                        } catch (Exception e8) {
                            e = e8;
                            e.printStackTrace();
                            this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGTU_UPDATE_ERROR_MALFORMED, DOMException.MSG_RUNTIME_WGTU_UPDATE_ERROR_MALFORMED);
                            this.o.a = true;
                            IOUtil.close((InputStream) file);
                            return false;
                        }
                    } catch (Exception e9) {
                        e = e9;
                        file = 0;
                    }
                } catch (Throwable th) {
                    th = th;
                    inputStream = file;
                    IOUtil.close(inputStream);
                    throw th;
                }
            } catch (FileNotFoundException unused) {
                DHFile.delete(str4);
                this.o.b = DOMException.toJSON(-4, DOMException.MSG_FILE_NOT_EXIST);
                this.o.a = true;
                IOUtil.close((InputStream) null);
                return false;
            } catch (Exception e10) {
                Logger.w(e10);
                DHFile.delete(str4);
                this.o.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_WGT_OR_WGTU_ERROR_MALFORMED, DOMException.MSG_RUNTIME_WGT_OR_WGTU_ERROR_MALFORMED);
                this.o.a = true;
                IOUtil.close((InputStream) null);
                return false;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private String a(byte b2) {
        byte b3 = this.R;
        if (b3 == 1) {
            return BaseInfo.sBaseResAppsFullPath + this.m + "/" + BaseInfo.APP_WWW_FS_DIR;
        } else if (b3 == 0) {
            return DeviceInfo.FILE_PROTOCOL + this.g0;
        } else {
            return null;
        }
    }

    public void a(String str, int i) {
        this.y1.put(str, Integer.valueOf(i));
        if (TextUtils.isEmpty(this.z1)) {
            this.z1 = str + "=" + i;
        } else {
            this.z1 += "&" + str + "=" + i;
        }
        SP.getOrCreateBundle(getActivity(), this.m + "_1").edit().putString("Authorize", this.z1).commit();
    }

    private boolean a(JSONObject jSONObject, g gVar) {
        boolean z;
        if (jSONObject != null && jSONObject.has(IApp.ConfigProperty.CONFIG_UNIAPP_CONTROL)) {
            z = false;
            String optString = jSONObject.optString(IApp.ConfigProperty.CONFIG_UNIAPP_CONTROL);
            if (!TextUtils.isEmpty(optString)) {
            }
            if (!z) {
                gVar.a = true;
                gVar.b = DOMException.toJSON((int) DOMException.CODE_RUNTIME_COMPONENTS_MODE_NOT_SUPPORT, DOMException.MSG_RUNTIME_COMPONENTS_MODE_NOT_SUPPORT);
            }
            return z;
        }
        z = true;
        if (!z) {
        }
        return z;
    }
}