三只羊.apk(点击下载) / b.java


package io.dcloud.g;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Build;
import android.os.Process;
import android.text.TextUtils;
import io.dcloud.base.R;
import io.dcloud.common.DHInterface.AbsMgr;
import io.dcloud.common.DHInterface.BaseFeature;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.IBoot;
import io.dcloud.common.DHInterface.ICore;
import io.dcloud.common.DHInterface.IFeature;
import io.dcloud.common.DHInterface.IFrameView;
import io.dcloud.common.DHInterface.IMgr;
import io.dcloud.common.DHInterface.IWaiter;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.io.DHFile;
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.PlatformUtil;
import io.dcloud.common.adapter.util.SP;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.constant.IntentConst;
import io.dcloud.common.core.permission.PermissionControler;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.DataUtil;
import io.dcloud.common.util.ErrorDialogUtil;
import io.dcloud.common.util.JSUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.StringUtil;
import io.dcloud.feature.internal.sdk.SDK;
import io.src.dcloud.adapter.DCloudAdapterUtil;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Set;
import org.json.JSONArray;
import org.json.JSONException;

public class b extends AbsMgr implements IMgr.FeatureEvent {
    private HashMap<String, HashMap<String, String>> a = null;
    private HashMap<String, String> b = null;
    private HashMap<String, IFeature> c = null;
    private HashMap<String, String> d = null;
    private HashMap<String, IBoot> e = null;
    private String f = null;
    private ArrayList<String> g = new ArrayList<>();
    HashMap<String, String> h = new HashMap<>();
    c i = null;

    public b(ICore iCore) {
        super(iCore, "featuremgr", IMgr.MgrType.FeatureMgr);
        b();
        if (!c()) {
            c();
        }
    }

    private String a(IApp iApp, IFrameView iFrameView) {
        HashMap<String, String> hashMap = this.h;
        String str = hashMap.get(iApp.obtainAppId() + "_" + iApp.obtainAppVersionName());
        if (str == null) {
            str = a(iApp, iFrameView.obtainWebView());
            if (Build.VERSION.SDK_INT > 19) {
                HashMap<String, String> hashMap2 = this.h;
                hashMap2.put(iApp.obtainAppId() + "_" + iApp.obtainAppVersionName(), str);
            }
        }
        return str;
    }

    private String b(IApp iApp) {
        String metaValue = AndroidResources.getMetaValue("DCLOUD_UNIPUSH");
        return (PdrUtil.isEmpty(metaValue) || !Boolean.valueOf(metaValue).booleanValue()) ? "" : "window.__isUniPush__ = true;";
    }

    private void c(String str) {
        if (this.c.get(str) == null) {
            try {
                IFeature iFeature = (IFeature) Class.forName(str).newInstance();
                this.c.put(str, iFeature);
                iFeature.init(this, str);
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException unused) {
            }
        }
    }

    /* access modifiers changed from: package-private */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x00c7  */
    /* JADX WARNING: Removed duplicated region for block: B:40:0x0023 A[SYNTHETIC] */
    public HashMap<String, IBoot> d() {
        IBoot iBoot;
        InstantiationException e2;
        IllegalAccessException e3;
        ClassNotFoundException e4;
        ClassCastException e5;
        HashMap<String, IBoot> hashMap = this.e;
        HashMap<String, String> hashMap2 = this.d;
        PdrUtil.loadProperties2HashMap(hashMap2, this.b, this.a, BaseInfo.s_properties);
        Set<String> keySet = hashMap2.keySet();
        if (keySet != null) {
            hashMap = new HashMap<>(2);
            this.e = hashMap;
            for (String str : keySet) {
                IBoot b2 = a.b(this, str);
                if (b2 == null) {
                    try {
                        iBoot = (IBoot) Class.forName(hashMap2.get(str)).newInstance();
                        try {
                            if (iBoot instanceof BaseFeature) {
                                ((BaseFeature) iBoot).init(this, str);
                            }
                        } catch (InstantiationException e6) {
                            e2 = e6;
                            Logger.d(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e2.getMessage());
                            b2 = iBoot;
                            if (b2 != null) {
                            }
                        } catch (IllegalAccessException e7) {
                            e3 = e7;
                            Logger.d(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e3.getMessage());
                            b2 = iBoot;
                            if (b2 != null) {
                            }
                        } catch (ClassNotFoundException e8) {
                            e4 = e8;
                            Logger.e(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e4.getMessage());
                            b2 = iBoot;
                            if (b2 != null) {
                            }
                        } catch (ClassCastException e9) {
                            e5 = e9;
                            Logger.e(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e5.getMessage());
                            b2 = iBoot;
                            if (b2 != null) {
                            }
                        }
                    } catch (InstantiationException e10) {
                        iBoot = b2;
                        e2 = e10;
                        Logger.d(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e2.getMessage());
                        b2 = iBoot;
                        if (b2 != null) {
                        }
                    } catch (IllegalAccessException e11) {
                        iBoot = b2;
                        e3 = e11;
                        Logger.d(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e3.getMessage());
                        b2 = iBoot;
                        if (b2 != null) {
                        }
                    } catch (ClassNotFoundException e12) {
                        iBoot = b2;
                        e4 = e12;
                        Logger.e(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e4.getMessage());
                        b2 = iBoot;
                        if (b2 != null) {
                        }
                    } catch (ClassCastException e13) {
                        iBoot = b2;
                        e5 = e13;
                        Logger.e(Logger.MAIN_TAG, "FeatureMgr.loadBootOptions " + e5.getMessage());
                        b2 = iBoot;
                        if (b2 != null) {
                        }
                    }
                    b2 = iBoot;
                }
                if (b2 != null) {
                    hashMap.put(str, b2);
                }
            }
        }
        HashMap<String, IBoot> a2 = a(hashMap);
        a(this.b.values().iterator());
        for (HashMap<String, String> hashMap3 : this.a.values()) {
            a(hashMap3.values().iterator());
        }
        return a2;
    }

    @Override // io.dcloud.common.DHInterface.AbsMgr
    public void dispose() {
        HashMap<String, IFeature> hashMap = this.c;
        if (hashMap != null) {
            Collection<IFeature> values = hashMap.values();
            if (values != null) {
                for (IFeature iFeature : values) {
                    iFeature.dispose(null);
                }
            }
            this.c.clear();
            this.c = null;
        }
    }

    @Override // io.dcloud.common.DHInterface.IMgr
    public Object processEvent(IMgr.MgrType mgrType, int i2, Object obj) {
        Object obj2;
        Activity activity;
        try {
            if (!checkMgrId(mgrType)) {
                obj2 = this.mCore.dispatchEvent(mgrType, i2, obj);
            } else {
                switch (i2) {
                    case 0:
                        this.c = new HashMap<>(1);
                        this.b = new HashMap<>(1);
                        this.a = new HashMap<>(1);
                        this.e = new HashMap<>();
                        this.d = new HashMap<>(1);
                        return d();
                    case 1:
                        Object[] objArr = (Object[]) obj;
                        if (!AbsoluteConst.UNI_SYNC_EXEC_METHOD.equalsIgnoreCase(String.valueOf(objArr[2]))) {
                            obj2 = b(objArr);
                            break;
                        } else {
                            obj2 = a(objArr);
                            break;
                        }
                    case 2:
                        Object[] objArr2 = (Object[]) obj;
                        String a2 = a((IApp) objArr2[0], (IFrameView) objArr2[1]);
                        if (a2 != null) {
                            return a2;
                        }
                        Process.killProcess(Process.myPid());
                        return a2;
                    case 3:
                        a(String.valueOf(obj));
                        return null;
                    case 4:
                        obj2 = this.a.get(String.valueOf(obj));
                        break;
                    case 5:
                        String[] strArr = (String[]) obj;
                        String str = strArr[0];
                        String str2 = strArr[1];
                        String str3 = strArr[2];
                        if (!PdrUtil.isEmpty(str) && !PdrUtil.isEmpty(str2)) {
                            this.b.put(str.toLowerCase(Locale.ENGLISH), str2);
                        }
                        if (PdrUtil.isEmpty(str3)) {
                            return null;
                        }
                        this.g.add(str3);
                        return null;
                    case 6:
                    case 7:
                    default:
                        return null;
                    case 8:
                        String[] strArr2 = (String[]) obj;
                        obj2 = Boolean.valueOf(PermissionControler.checkPermission(strArr2[0], strArr2[1]));
                        break;
                    case 9:
                        obj2 = Boolean.valueOf(b(String.valueOf(obj)));
                        break;
                    case 10:
                        try {
                            Object[] objArr3 = (Object[]) obj;
                            if (objArr3[0] instanceof IWebview) {
                                activity = ((IWebview) objArr3[0]).getActivity();
                            } else {
                                activity = objArr3[0] instanceof IApp ? ((IApp) objArr3[0]).getActivity() : null;
                            }
                            IFeature b2 = b(String.valueOf(objArr3[1]), activity);
                            if (b2 instanceof IWaiter) {
                                obj2 = ((IWaiter) b2).doForFeature(String.valueOf(objArr3[2]), objArr3[3]);
                                break;
                            } else {
                                return null;
                            }
                        } catch (Exception e2) {
                            e2.printStackTrace();
                            return null;
                        }
                    case 11:
                        c((String) ((Object[]) obj)[0]);
                        return null;
                }
            }
            return obj2;
        } catch (Throwable th) {
            Logger.w("FeatureMgr.processEvent", th);
            return null;
        }
    }

    private synchronized String b(Object[] objArr) {
        return a(objArr);
    }

    /* access modifiers changed from: package-private */
    /* JADX WARNING: Removed duplicated region for block: B:38:0x0095 A[SYNTHETIC, Splitter:B:38:0x0095] */
    /* JADX WARNING: Removed duplicated region for block: B:63:? A[RETURN, SYNTHETIC] */
    public IFeature b(String str, Activity activity) {
        String str2;
        Exception e2;
        InstantiationException e3;
        IllegalAccessException e4;
        ClassNotFoundException e5;
        IFeature iFeature;
        Exception e6;
        IFeature iFeature2;
        if (str.contains(",")) {
            String[] split = str.split(",");
            String str3 = split[0];
            str2 = split[1];
            str = str3;
        } else {
            str2 = null;
        }
        IFeature iFeature3 = this.c.get(str);
        if (iFeature3 != null) {
            return iFeature3;
        }
        String str4 = this.b.get(str);
        if (!PdrUtil.isEmpty(str4)) {
            str2 = str4;
        }
        if (str2 != null && this.e.containsKey(str)) {
            IBoot iBoot = this.e.get(str);
            if ((iBoot instanceof BaseFeature) && str2.equals(iBoot.getClass().getName())) {
                iFeature3 = (BaseFeature) iBoot;
            }
        }
        if (iFeature3 != null) {
            this.c.put(str, iFeature3);
            return iFeature3;
        } else if (str2 != null) {
            try {
                IFeature a2 = a.a(this, str);
                if (a2 == null) {
                    iFeature = (IFeature) Class.forName(str2).newInstance();
                    try {
                        this.c.put(str, iFeature);
                        iFeature.init(this, str);
                        return iFeature;
                    } catch (InstantiationException e7) {
                        e3 = e7;
                        iFeature3 = iFeature;
                        e3.printStackTrace();
                        return iFeature3;
                    } catch (IllegalAccessException e8) {
                        e4 = e8;
                        iFeature3 = iFeature;
                        e4.printStackTrace();
                        return iFeature3;
                    } catch (ClassNotFoundException e9) {
                        e5 = e9;
                        e5.printStackTrace();
                        try {
                            iFeature2 = (IFeature) a(str, activity);
                            if (iFeature2 != null) {
                            }
                        } catch (Exception e10) {
                            e6 = e10;
                            iFeature2 = iFeature;
                            e6.printStackTrace();
                            return iFeature2;
                        }
                    }
                } else {
                    this.c.put(str, a2);
                    return a2;
                }
            } catch (InstantiationException e11) {
                e3 = e11;
                e3.printStackTrace();
                return iFeature3;
            } catch (IllegalAccessException e12) {
                e4 = e12;
                e4.printStackTrace();
                return iFeature3;
            } catch (ClassNotFoundException e13) {
                e5 = e13;
                iFeature = iFeature3;
                e5.printStackTrace();
                iFeature2 = (IFeature) a(str, activity);
                if (iFeature2 != null) {
                    return iFeature2;
                }
                try {
                    this.c.put(str, iFeature2);
                    iFeature2.init(this, str);
                    return iFeature2;
                } catch (Exception e14) {
                    e6 = e14;
                }
            }
        } else {
            try {
                IFeature iFeature4 = (IFeature) a(str, activity);
                if (iFeature4 != null) {
                    try {
                        this.c.put(str, iFeature4);
                        iFeature4.init(this, str);
                    } catch (Exception e15) {
                        e2 = e15;
                        iFeature3 = iFeature4;
                    }
                }
                return iFeature4;
            } catch (Exception e16) {
                e2 = e16;
                e2.printStackTrace();
                return iFeature3;
            }
        }
    }

    public String a(IWebview iWebview) {
        StringBuffer stringBuffer = new StringBuffer();
        String webviewUUID = iWebview.getWebviewUUID();
        if (PdrUtil.isEmpty(webviewUUID)) {
            webviewUUID = String.valueOf(iWebview.obtainFrameView().hashCode());
        }
        stringBuffer.append("window.__HtMl_Id__= '" + webviewUUID + "';");
        if (PdrUtil.isEmpty(iWebview.obtainFrameId())) {
            stringBuffer.append("window.__WebVieW_Id__= undefined;");
        } else {
            stringBuffer.append("window.__WebVieW_Id__= '" + iWebview.obtainFrameId() + "';");
        }
        stringBuffer.append("try{window.plus.__tag__='_plus_all_'}catch(e){}");
        return stringBuffer.toString();
    }

    public boolean c() {
        try {
            if (!BaseInfo.ISDEBUG || !DHFile.isExist("/sdcard/dcloud/all.js")) {
                this.f = new String(PlatformUtil.getFileContent(DCloudAdapterUtil.getRuntimeJsPath(), 1));
            } else {
                this.f = new String(PlatformUtil.getFileContent("/sdcard/dcloud/all.js", 2));
            }
            return true;
        } catch (Exception e2) {
            e2.printStackTrace();
            return false;
        }
    }

    private String a(IApp iApp, IWebview iWebview) {
        String str;
        StringBuffer stringBuffer = new StringBuffer(AbsoluteConst.PROTOCOL_JAVASCRIPT);
        stringBuffer.append("function ");
        stringBuffer.append(AbsoluteConst.LOAD_PLUS_FUN_NAME);
        stringBuffer.append("(){try{");
        int i2 = Build.VERSION.SDK_INT;
        if (i2 <= 19) {
            stringBuffer.append(a(iWebview));
        }
        if (TextUtils.isEmpty(this.f) || this.f.length() < 400) {
            return null;
        }
        stringBuffer.append("window._____isDebug_____=" + BaseInfo.ISDEBUG + ";");
        stringBuffer.append("window._____platform_____=1;");
        stringBuffer.append("window._____platform_os_version_____=" + i2 + ";");
        stringBuffer.append(this.f);
        if (PermissionControler.checkPermission(iApp.obtainAppId(), IFeature.F_DEVICE.toLowerCase(Locale.ENGLISH)) || !iApp.manifestBeParsed()) {
            if (PdrUtil.isEmpty(DeviceInfo.DEVICESTATUS_JS)) {
                try {
                    DeviceInfo.initGsmCdmaCell();
                } catch (SecurityException e2) {
                    e2.printStackTrace();
                }
                DeviceInfo.getDevicestatus_js(iApp);
            }
            stringBuffer.append(DeviceInfo.DEVICESTATUS_JS);
        }
        SDK.IntegratedMode integratedMode = BaseInfo.sRuntimeMode;
        StringBuilder sb = new StringBuilder();
        sb.append("window.__NWin_Enable__=");
        sb.append(integratedMode == SDK.IntegratedMode.WEBVIEW ? String.valueOf(false) : String.valueOf(true));
        sb.append(";");
        stringBuffer.append(sb.toString());
        if (PermissionControler.checkPermission(iApp.obtainAppId(), IFeature.F_RUNTIME) || !iApp.manifestBeParsed()) {
            String obtainConfigProperty = iApp.obtainConfigProperty(IApp.ConfigProperty.CONFIG_LOADED_TIME);
            if (BaseInfo.ISAMU) {
                str = StringUtil.format(AbsoluteConst.JS_RUNTIME_VERSIONs, iApp.obtainAppVersionName(), "1.9.9.81507", iApp.obtainAppId(), obtainConfigProperty);
            } else {
                str = StringUtil.format(AbsoluteConst.JS_RUNTIME_VERSIONs, AndroidResources.mApplicationInfo.versionName, "1.9.9.81507", iApp.obtainAppId(), obtainConfigProperty);
            }
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, str));
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_ARGUMENTS, DataUtil.utf8ToUnicode(iApp.obtainRuntimeArgs(true)))));
            String launcherData = BaseInfo.getLauncherData(iApp.obtainAppId());
            if (!PdrUtil.isEmpty(iApp.obtainWebAppIntent())) {
                String stringExtra = iApp.obtainWebAppIntent().getStringExtra(IntentConst.FROM_STREAM_OPEN_FLAG);
                if (!TextUtils.isEmpty(stringExtra) && !TextUtils.equals(stringExtra, iApp.obtainAppId())) {
                    launcherData = launcherData + ":" + stringExtra;
                }
            }
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_LAUNCHER, launcherData)));
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_CHANNEL, BaseInfo.getAnalysisChannel())));
            String bundleData = SP.getBundleData(iApp.getActivity(), "pdr", iApp.obtainAppId() + AbsoluteConst.LAUNCHTYPE);
            if (TextUtils.isEmpty(bundleData)) {
                bundleData = "default";
            }
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_ORIGIN, bundleData)));
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_STARTUPTIME, String.valueOf(BaseInfo.getStartupTimeData(iApp.obtainAppId())))));
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format(AbsoluteConst.JS_RUNTIME_PROCESSID, Long.valueOf(BaseInfo.sProcessId))));
            stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format("p.runtime.versionCode = %d;", Integer.valueOf(AndroidResources.versionCode))));
            if (BaseInfo.isUniAppAppid(iApp)) {
                stringBuffer.append(StringUtil.format(AbsoluteConst.JS_RUNTIME_BASE, StringUtil.format("p.runtime.uniVersion = '%s';", BaseInfo.uniVersionV3)));
            }
        }
        if (PermissionControler.checkPermission(iApp.obtainAppId(), IFeature.F_NAVIGATOR)) {
            DeviceInfo.updateStatusBarHeight(iWebview.getActivity());
            stringBuffer.append(String.format(Locale.UK, AbsoluteConst.JS_NAVIGATOR_STATUSBAR_HEIGHT, Float.valueOf(((float) DeviceInfo.sStatusBarHeight) / iWebview.getScale())));
        }
        int size = this.g.size();
        for (int i3 = 0; i3 < size; i3++) {
            stringBuffer.append(this.g.get(i3));
        }
        stringBuffer.append(a());
        stringBuffer.append("}catch(e){console.log('__load__plus__ function error=' + e);}}");
        stringBuffer.append(AbsoluteConst.EXECUTE_LOAD_FUNS_FUN);
        stringBuffer.append(a(iApp));
        stringBuffer.append(b(iApp));
        return stringBuffer.toString();
    }

    private void b() {
        try {
            this.i = (c) Class.forName("io.dcloud.feature.d").getConstructor(Context.class).newInstance(getContext());
        } catch (Exception unused) {
            Logger.e("fmgr no dp");
        }
    }

    private boolean b(String str) {
        return this.b.containsKey(str);
    }

    private String a(IApp iApp) {
        if (BaseInfo.isUniNViewBackgroud()) {
            String str = (String) processEvent(IMgr.MgrType.FeatureMgr, 10, new Object[]{iApp, "weex,io.dcloud.feature.weex.WeexFeature", "getUniNViewModules", null});
            if (!PdrUtil.isEmpty(str)) {
                return "window.__NATIVE_PLUGINS__ = " + str + ";window.__NATIVE_PLUGINS_REGISTERED__ = true;";
            }
        }
        return "";
    }

    private String a() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append(";Object.defineProperty(plus.screen,\"resolutionHeight\",{get:function(){var e=window,l=e.__html5plus__&&e.__html5plus__.isReady?e.__html5plus__:n.plus&&n.plus.isReady?n.plus:window.plus;return l.bridge.execSync(\"Device\",\"s.resolutionHeight\",[])}}),Object.defineProperty(plus.screen,\"resolutionWidth\",{get:function(){var e=window,l=e.__html5plus__&&e.__html5plus__.isReady?e.__html5plus__:n.plus&&n.plus.isReady?n.plus:window.plus;return l.bridge.execSync(\"Device\",\"s.resolutionWidth\",[])}}),Object.defineProperty(plus.display,\"resolutionHeight\",{get:function(){var e=window,l=e.__html5plus__&&e.__html5plus__.isReady?e.__html5plus__:n.plus&&n.plus.isReady?n.plus:window.plus;return l.bridge.execSync(\"Device\",\"d.resolutionHeight\",[])}}),Object.defineProperty(plus.display,\"resolutionWidth\",{get:function(){var e=window,l=e.__html5plus__&&e.__html5plus__.isReady?e.__html5plus__:n.plus&&n.plus.isReady?n.plus:window.plus;return l.bridge.execSync(\"Device\",\"d.resolutionWidth\",[])}});");
        stringBuffer.append(";plus.webview.__test__('save');");
        if (Build.VERSION.SDK_INT > 19) {
            stringBuffer.append("plus.webview.__test__('update');");
        }
        return stringBuffer.toString();
    }

    private String a(Object[] objArr) {
        IWebview iWebview = (IWebview) objArr[0];
        String lowerCase = String.valueOf(objArr[1]).toLowerCase(Locale.ENGLISH);
        String valueOf = String.valueOf(objArr[2]);
        JSONArray jSONArray = (JSONArray) objArr[3];
        String str = null;
        r6 = null;
        String[] strArr = null;
        str = null;
        str = null;
        str = null;
        if (!(iWebview == null || iWebview.obtainApp() == null || iWebview.obtainFrameView() == null || iWebview.obtainFrameView().obtainWebView() == null)) {
            IFeature b2 = b(lowerCase, iWebview.getActivity());
            if (b2 != null) {
                if (b2 instanceof BaseFeature) {
                    BaseFeature baseFeature = (BaseFeature) b2;
                    if (!baseFeature.isOldMode()) {
                        return baseFeature.execute(iWebview, valueOf, jSONArray);
                    }
                }
                if (jSONArray != null) {
                    try {
                        strArr = JSUtil.jsonArrayToStringArr(jSONArray);
                    } catch (JSONException e2) {
                        e2.printStackTrace();
                    }
                }
                return b2.execute(iWebview, valueOf, strArr);
            }
            str = "";
            if (iWebview.obtainFrameView().getFrameType() != 3 && !PermissionControler.checkSafePermission(iWebview.obtainApp().obtainAppId(), lowerCase)) {
                String format = StringUtil.format(getContext().getString(R.string.dcloud_feature_error_tips), lowerCase);
                Logger.e("featuremgr", "not found " + lowerCase + " feature plugin ; action=" + valueOf + ";" + format);
                a(iWebview, lowerCase);
            }
        }
        return str;
    }

    private Object a(String str, Activity activity) {
        c cVar = this.i;
        if (cVar != null) {
            return cVar.a(str, activity);
        }
        return null;
    }

    private HashMap<String, IBoot> a(HashMap<String, IBoot> hashMap) {
        if (this.i == null) {
            return hashMap;
        }
        if (hashMap == null) {
            hashMap = new HashMap<>();
        }
        Set<String> keySet = this.i.a().keySet();
        if (keySet != null) {
            for (String str : keySet) {
                Object a2 = this.i.a(str);
                if (a2 != null) {
                    if (a2 instanceof BaseFeature) {
                        ((BaseFeature) a2).init(this, str);
                    }
                    hashMap.put(str, (IBoot) a2);
                }
            }
        }
        return hashMap;
    }

    private void a(Iterator<String> it) {
        if (!SDK.isUniMPSDK()) {
            while (it.hasNext()) {
                String valueOf = String.valueOf(PlatformUtil.invokeMethod(it.next(), "getJsContent"));
                if (!PdrUtil.isEmpty(valueOf)) {
                    this.g.add(valueOf);
                }
            }
        }
    }

    public void a(String str) {
        Collection<IFeature> values;
        HashMap<String, IFeature> hashMap = this.c;
        if (!(hashMap == null || (values = hashMap.values()) == null)) {
            for (IFeature iFeature : values) {
                try {
                    iFeature.dispose(str);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }
        HashMap<String, String> hashMap2 = this.h;
        if (hashMap2 != null) {
            String str2 = null;
            Iterator<String> it = hashMap2.keySet().iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                String next = it.next();
                if (next.startsWith(str + "_")) {
                    str2 = next;
                    break;
                }
            }
            if (!TextUtils.isEmpty(str2)) {
                this.h.remove(str2);
            }
        }
    }

    public void a(IWebview iWebview, String str) {
        Dialog lossDialog = ErrorDialogUtil.getLossDialog(iWebview, StringUtil.format(iWebview.getContext().getString(R.string.dcloud_feature_error_tips2) + "http://ask.dcloud.net.cn/article/283", str), "http://ask.dcloud.net.cn/article/283", str);
        if (lossDialog != null) {
            lossDialog.show();
        }
    }
}