Info Call to command execution API

Description

List of all command execution API calls

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method org.qtproject.qt5.android.QtActivityDelegate.startApplication() calling method java.lang.Runtime.exec()


    public boolean startApplication()
    {
        try {
            String v2_65;
            android.os.Bundle v7 = this.m_activity.getIntent().getExtras();
        } catch (String v2_102) {
            v2_102.printStackTrace();
            v2_65 = 0;
            return v2_65;
        } catch (String v2) {
            if (this.m_surfaces == null) {
                this.onCreate(0);
            }
            v2_65 = 1;
            return v2_65;
        } catch (String v2_70) {
            v2_70.printStackTrace();
        } catch (String v2_69) {
            v2_69.printStackTrace();
        }
        if (v7 == null) {
        } else {
            String v2_40 = new java.io.BufferedReader(new java.io.InputStreamReader(this.m_activity.getAssets().open("--Added-by-androiddeployqt--/debugger.command"))).readLine();
            if ((!v7.containsKey("debug_ping")) || (!v7.getString("debug_ping").equals("true"))) {
                if ((v7.containsKey("qml_debug")) && (v7.getString("qml_debug").equals("true"))) {
                    String v2_78;
                    if (!v7.containsKey("qmljsdebugger")) {
                        v2_78 = "port:3768";
                    } else {
                        v2_78 = v7.getString("qmljsdebugger");
                        v2_78.replaceAll("\\s", "");
                    }
                    org.qtproject.qt5.android.QtActivityDelegate.m_applicationParameters = new StringBuilder().append(org.qtproject.qt5.android.QtActivityDelegate.m_applicationParameters).append("\t-qmljsdebugger=").append(v2_78).toString();
                }
                if (v7.containsKey("extraenvvars")) {
                    org.qtproject.qt5.android.QtActivityDelegate.m_environmentVariables = new StringBuilder().append(org.qtproject.qt5.android.QtActivityDelegate.m_environmentVariables).append("\t").append(new String(android.util.Base64.decode(v7.getString("extraenvvars"), 0), "UTF-8")).toString();
                }
                if (!v7.containsKey("extraappparams")) {
                } else {
                    try {
                        org.qtproject.qt5.android.QtActivityDelegate.m_applicationParameters = new StringBuilder().append(org.qtproject.qt5.android.QtActivityDelegate.m_applicationParameters).append("\t").append(new String(android.util.Base64.decode(v7.getString("extraappparams"), 0), "UTF-8")).toString();
                    } catch (String v2_99) {
                        v2_99.printStackTrace();
                    }
                }
            } else {
                int v6_1;
                String v3_54 = new StringBuilder().append(this.m_activity.getPackageManager().getApplicationInfo(this.m_activity.getPackageName(), 16384).dataDir).append("/").toString();
                org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("extra parameters: ").append(v7).toString());
                this.m_activity.getPackageName();
                String v8 = v7.getString("ping_file");
                String v9 = v7.getString("pong_file");
                long v10_7 = v7.getString("gdbserver_socket");
                int v11_6 = new StringBuilder().append(v3_54).append(v2_40).append(v10_7).toString();
                String v12 = v7.getString("ping_socket");
                if (v8 == null) {
                    v6_1 = 0;
                } else {
                    v6_1 = 1;
                }
                int v5_8;
                if (v9 == null) {
                    v5_8 = 0;
                } else {
                    v5_8 = 1;
                }
                long v4_1;
                if (v10_7 == 0) {
                    v4_1 = 0;
                } else {
                    v4_1 = 1;
                }
                String v3_0;
                if (v12 == null) {
                    v3_0 = 0;
                } else {
                    v3_0 = 1;
                }
                if (v10_7 != 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("removing gdb socket ").append(v10_7).toString());
                    new java.io.File(v10_7).delete();
                }
                if (v6_1 != 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("removing ping file ").append(v8).toString());
                    String v2_17 = new java.io.File(v8);
                    if ((v2_17.exists()) && (!v2_17.delete())) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("ping file cannot be deleted");
                    }
                }
                if (v5_8 != 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("removing pong file ").append(v9).toString());
                    String v2_26 = new java.io.File(v9);
                    if ((v2_26.exists()) && (!v2_26.delete())) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("pong file cannot be deleted");
                    }
                }
                org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("starting ").append(v11_6).toString());
                this.m_debuggerProcess = Runtime.getRuntime().exec(v11_6);
                org.qtproject.qt5.android.QtActivityDelegate.debugLog("gdbserver started");
                if (v4_1 == 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog("socket not used");
                } else {
                    String v2_39 = 0;
                    while (v2_39 < 150) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("waiting for socket at ").append(v10_7).append(", attempt ").append(v2_39).toString());
                        long v4_12 = new java.io.File(v10_7);
                        if (!v4_12.exists()) {
                            Thread.sleep(((long) 200));
                            v2_39++;
                        } else {
                            v4_12.setReadable(1, 0);
                            v4_12.setWritable(1, 0);
                            v4_12.setExecutable(1, 0);
                            break;
                        }
                    }
                    if (v2_39 != 150) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("socket ok");
                    } else {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("time out when waiting for debug socket");
                        v2_65 = 0;
                        return v2_65;
                    }
                }
                if (v3_0 != null) {
                    String v3_5 = new org.qtproject.qt5.android.QtActivityDelegate$DebugWaitRunnable(this, v12);
                    long v4_14 = new Thread(v3_5);
                    v4_14.start();
                    String v2_42 = 0;
                    while ((v2_42 < 150) && (v4_14.isAlive())) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("Waiting for debug socket connect");
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("go to sleep");
                        Thread.sleep(((long) 200));
                        v2_42++;
                    }
                    if (v2_42 != 150) {
                        if (!v3_5.wasFailure) {
                            org.qtproject.qt5.android.QtActivityDelegate.debugLog("Got pid acknowledgment");
                        } else {
                            org.qtproject.qt5.android.QtActivityDelegate.debugLog("Could not connect to debug client");
                            v2_65 = 0;
                            return v2_65;
                        }
                    } else {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("time out when waiting for ping socket");
                        v3_5.shutdown();
                        v2_65 = 0;
                        return v2_65;
                    }
                }
                if (v6_1 == 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog("ping not requested");
                } else {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("writing ping at ").append(v8).toString());
                    String v2_52 = new java.io.FileWriter(v8);
                    v2_52.write(new StringBuilder().append("").append(android.os.Process.myPid()).toString());
                    v2_52.close();
                    String v2_54 = new java.io.File(v8);
                    v2_54.setReadable(1, 0);
                    v2_54.setWritable(1, 0);
                    v2_54.setExecutable(1, 0);
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog("wrote ping");
                }
                if (v5_8 == 0) {
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog("pong not requested");
                } else {
                    String v2_57 = 0;
                    while (v2_57 < 150) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("waiting for pong at ").append(v9).append(", attempt ").append(v2_57).toString());
                        String v3_26 = new java.io.File(v9);
                        if (!v3_26.exists()) {
                            org.qtproject.qt5.android.QtActivityDelegate.debugLog("go to sleep");
                            Thread.sleep(((long) 200));
                            v2_57++;
                        } else {
                            v3_26.delete();
                            break;
                        }
                    }
                    org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("Removing pingFile ").append(v8).toString());
                    new java.io.File(v8).delete();
                    if (v2_57 != 150) {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog(new StringBuilder().append("got pong ").append(v9).toString());
                    } else {
                        org.qtproject.qt5.android.QtActivityDelegate.debugLog("time out when waiting for pong file");
                        v2_65 = 0;
                        return v2_65;
                    }
                }
            }
        }
    }