Info Call to Reflection API

Description

List of calls allowing the application to examine and modify the structure and behavior of an object at runtime.

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method org.apache.cordova.PermissionHelper.hasPermission() calling method java.lang.reflect.Method.invoke()


    public static boolean hasPermission(org.apache.cordova.CordovaPlugin p11, String p12)
    {
        try {
            int v8_2 = new Class[1];
            v8_2[0] = String;
            reflect.Method v0 = org.apache.cordova.CordovaInterface.getDeclaredMethod("hasPermission", v8_2);
            String v4_0 = p11.cordova;
            String v7_1 = new Object[1];
            v7_1[0] = p12;
            String v4_4 = ((Boolean) v0.invoke(v4_0, v7_1)).booleanValue();
        } catch (NoSuchMethodException v3) {
            org.apache.cordova.LOG.d("CordovaPermissionHelper", new StringBuilder().append("No need to check for permission ").append(p12).toString());
            v4_4 = 1;
        } catch (IllegalAccessException v1) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", new StringBuilder().append("IllegalAccessException when checking permission ").append(p12).toString(), v1);
            v4_4 = 0;
        } catch (reflect.InvocationTargetException v2) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", new StringBuilder().append("invocationTargetException when checking permission ").append(p12).toString(), v2);
        }
        return v4_4;
    }

Method org.apache.cordova.PermissionHelper.deliverPermissionResult() calling method java.lang.reflect.Method.invoke()


    private static void deliverPermissionResult(org.apache.cordova.CordovaPlugin p10, int p11, String[] p12)
    {
        int[] v4 = new int[p12.length];
        java.util.Arrays.fill(v4, 0);
        try {
            Integer v7_2 = new Class[3];
            v7_2[0] = Integer.TYPE;
            v7_2[1] = String[];
            v7_2[2] = int[];
            reflect.Method v3 = org.apache.cordova.CordovaPlugin.getDeclaredMethod("onRequestPermissionResult", v7_2);
            String v5_2 = new Object[3];
            v5_2[0] = Integer.valueOf(p11);
            v5_2[1] = p12;
            v5_2[2] = v4;
            v3.invoke(p10, v5_2);
        } catch (NoSuchMethodException v2) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", "NoSuchMethodException when delivering permissions results", v2);
        } catch (IllegalAccessException v0) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", "IllegalAccessException when delivering permissions results", v0);
        } catch (reflect.InvocationTargetException v1) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", "InvocationTargetException when delivering permissions results", v1);
        }
        return;
    }

Method org.apache.cordova.PermissionHelper.requestPermissions() calling method java.lang.reflect.Method.invoke()


    public static void requestPermissions(org.apache.cordova.CordovaPlugin p9, int p10, String[] p11)
    {
        try {
            String v6_4 = new Class[3];
            v6_4[0] = org.apache.cordova.CordovaPlugin;
            v6_4[1] = Integer.TYPE;
            v6_4[2] = String[];
            reflect.Method v3 = org.apache.cordova.CordovaInterface.getDeclaredMethod("requestPermissions", v6_4);
            String v4_1 = p9.cordova;
            String v5_2 = new Object[3];
            v5_2[0] = p9;
            v5_2[1] = Integer.valueOf(p10);
            v5_2[2] = p11;
            v3.invoke(v4_1, v5_2);
        } catch (NoSuchMethodException v2) {
            org.apache.cordova.LOG.d("CordovaPermissionHelper", new StringBuilder().append("No need to request permissions ").append(java.util.Arrays.toString(p11)).toString());
            org.apache.cordova.PermissionHelper.deliverPermissionResult(p9, p10, p11);
        } catch (IllegalAccessException v0) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", new StringBuilder().append("IllegalAccessException when requesting permissions ").append(java.util.Arrays.toString(p11)).toString(), v0);
        } catch (reflect.InvocationTargetException v1) {
            org.apache.cordova.LOG.e("CordovaPermissionHelper", new StringBuilder().append("invocationTargetException when requesting permissions ").append(java.util.Arrays.toString(p11)).toString(), v1);
        }
        return;
    }

Method org.apache.cordova.engine.SystemWebViewEngine.initWebViewSettings() calling method java.lang.reflect.Method.invoke()


    private void initWebViewSettings()
    {
        this.webView.setInitialScale(0);
        this.webView.setVerticalScrollBarEnabled(0);
        android.webkit.WebSettings v9 = this.webView.getSettings();
        v9.setJavaScriptEnabled(1);
        v9.setJavaScriptCanOpenWindowsAutomatically(1);
        v9.setLayoutAlgorithm(android.webkit.WebSettings$LayoutAlgorithm.NORMAL);
        try {
            int v12_3 = new Class[1];
            v12_3[0] = Boolean.TYPE;
            reflect.Method v5 = android.webkit.WebSettings.getMethod("setNavDump", v12_3);
            org.apache.cordova.LOG.d("SystemWebViewEngine", new StringBuilder().append("CordovaWebView is running on device made by: ").append(android.os.Build.MANUFACTURER).toString());
        } catch (reflect.InvocationTargetException v4) {
            org.apache.cordova.LOG.d("SystemWebViewEngine", "We are on a modern version of Android, we will deprecate HTC 2.3 devices in 2.8");
            v9.setSaveFormData(0);
            v9.setSavePassword(0);
            if (android.os.Build$VERSION.SDK_INT >= 16) {
                v9.setAllowUniversalAccessFromFileURLs(1);
            }
            if (android.os.Build$VERSION.SDK_INT >= 17) {
                v9.setMediaPlaybackRequiresUserGesture(0);
            }
            String v2 = this.webView.getContext().getApplicationContext().getDir("database", 0).getPath();
            v9.setDatabaseEnabled(1);
            v9.setDatabasePath(v2);
            if (((this.webView.getContext().getApplicationContext().getApplicationInfo().flags & 2) != 0) && (android.os.Build$VERSION.SDK_INT >= 19)) {
                this.enableRemoteDebugging();
            }
            v9.setGeolocationDatabasePath(v2);
            v9.setDomStorageEnabled(1);
            v9.setGeolocationEnabled(1);
            v9.setAppCacheMaxSize(5242880);
            v9.setAppCachePath(v2);
            v9.setAppCacheEnabled(1);
            v9.setUseWideViewPort(1);
            v9.setLoadWithOverviewMode(1);
            String v3 = v9.getUserAgentString();
            String v8 = this.preferences.getString("OverrideUserAgent", 0);
            if (v8 == null) {
                String v1 = this.preferences.getString("AppendUserAgent", 0);
                if (v1 != null) {
                    v9.setUserAgentString(new StringBuilder().append(v3).append(" ").append(v1).toString());
                }
            } else {
                v9.setUserAgentString(v8);
            }
            android.content.IntentFilter v6_1 = new android.content.IntentFilter();
            v6_1.addAction("android.intent.action.CONFIGURATION_CHANGED");
            if (this.receiver == null) {
                this.receiver = new org.apache.cordova.engine.SystemWebViewEngine$2(this, v9);
                this.webView.getContext().registerReceiver(this.receiver, v6_1);
            }
            return;
        } catch (reflect.InvocationTargetException v4) {
            org.apache.cordova.LOG.d("SystemWebViewEngine", "Doing the NavDump failed with bad arguments");
        } catch (reflect.InvocationTargetException v4) {
            org.apache.cordova.LOG.d("SystemWebViewEngine", "This should never happen: IllegalAccessException means this isn\'t Android anymore");
        } catch (reflect.InvocationTargetException v4) {
            org.apache.cordova.LOG.d("SystemWebViewEngine", "This should never happen: InvocationTargetException means this isn\'t Android anymore.");
        }
        if ((android.os.Build$VERSION.SDK_INT >= 11) || (!android.os.Build.MANUFACTURER.contains("HTC"))) {
        } else {
            android.content.Context v10_34 = new Object[1];
            v10_34[0] = Boolean.valueOf(1);
            v5.invoke(v9, v10_34);
        }
    }