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 com.urbandroid.common.error.LogCatExtractor.getLogcatOutput() calling method java.lang.Runtime.exec()


    protected static java.util.List getLogcatOutput(String p6, int p7, String p8)
    {
        try {
            java.util.ArrayList v2_1 = new java.util.ArrayList();
            v2_1.add("logcat");
        } catch (String v6_3) {
            String v0_4 = 0;
            com.urbandroid.common.logging.Logger.logWarning("Failed to retrieve data from Logcat.", v6_3);
            return v0_4;
        }
        if (p6 != null) {
            v2_1.add("-b");
            v2_1.add(p6);
        }
        int v3_1 = new String[4];
        v3_1[0] = "-t";
        v3_1[1] = String.valueOf(p7);
        v3_1[2] = "-v";
        v3_1[3] = "time";
        String v6_2 = new java.util.ArrayList(java.util.Arrays.asList(v3_1));
        if (com.urbandroid.common.util.Environment.getAPILevel() < 8) {
            String v0_1 = v6_2.indexOf("-t");
            if ((v0_1 > -1) && (v0_1 < v6_2.size())) {
                v6_2.remove((v0_1 + 1));
                v6_2.remove(v0_1);
                v6_2.add("-d");
            }
        }
        v0_4 = new com.urbandroid.common.util.BoundedLinkedList(p7);
        try {
            v2_1.addAll(v6_2);
            String v6_5 = new StringBuilder();
            v6_5.append("*:");
            v6_5.append(p8);
            v2_1.add(v6_5.toString());
            java.io.BufferedReader v7_3 = new String[v2_1.size()];
            java.io.BufferedReader v7_7 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec(((String[]) v2_1.toArray(v7_3))).getInputStream()));
        } catch (String v6_3) {
        }
        while(true) {
            String v6_10 = v7_7.readLine();
            if (v6_10 == null) {
                break;
            }
            StringBuilder v8_4 = new StringBuilder();
            v8_4.append(v6_10);
            v8_4.append("\n");
            v0_4.add(v8_4.toString());
        }
        return v0_4;
    }

Method com.urbandroid.common.error.LogCatExtractor.initiatePermanentLogcat() calling method java.lang.Runtime.exec()


    public static void initiatePermanentLogcat(String p5)
    {
        String v0_1 = new StringBuilder();
        v0_1.append(p5);
        v0_1.append(System.currentTimeMillis());
        com.urbandroid.common.error.LogCatExtractor.backupFileIfAny(p5, v0_1.toString());
        try {
            String v0_2 = new java.util.ArrayList();
            v0_2.add("logcat");
            String[] v2_1 = new String[4];
            v2_1[0] = "-f";
            v2_1[1] = p5;
            v2_1[2] = "-v";
            v2_1[3] = "time";
            v0_2.addAll(new java.util.ArrayList(java.util.Arrays.asList(v2_1)));
            String[] v1_4 = new String[v0_2.size()];
            Runtime.getRuntime().exec(((String[]) v0_2.toArray(v1_4)));
        } catch (java.io.IOException v5_5) {
            com.urbandroid.common.logging.Logger.logWarning("Failed to initiate logcat.", v5_5);
        }
        return;
    }

Method com.urbandroid.common.util.RootUtil$ExecShell.executeCommand() calling method java.lang.Runtime.exec()


    public java.util.ArrayList executeCommand(com.urbandroid.common.util.RootUtil$ExecShell$SHELL_CMD p5)
    {
        java.util.ArrayList v0_1 = new java.util.ArrayList();
        try {
            Exception v5_6 = Runtime.getRuntime().exec(p5.command);
            new java.io.BufferedWriter(new java.io.OutputStreamWriter(v5_6.getOutputStream()));
            java.io.BufferedReader v1_1 = new java.io.BufferedReader(new java.io.InputStreamReader(v5_6.getInputStream()));
            try {
                while(true) {
                    Exception v5_3 = v1_1.readLine();
                    v0_1.add(v5_3);
                }
                return v0_1;
            } catch (Exception v5_4) {
                v5_4.printStackTrace();
                return v0_1;
            }
            if (v5_3 != null) {
            }
            return v0_1;
        } catch (Exception) {
            return 0;
        }
    }

Method com.urbandroid.common.os.ShellBasedResourceUsageMonitor.parseData() calling method java.lang.Runtime.exec()


    private void parseData(int p21)
    {
        Exception v2_0 = "N/A";
        try {
            Exception v0_9 = Runtime.getRuntime();
            int v5_4 = new StringBuilder();
            v5_4.append("top -n 1 -d ");
            v5_4.append(p21);
            int v5_2 = new java.io.BufferedReader(new java.io.InputStreamReader(v0_9.exec(v5_4.toString()).getInputStream()));
            try {
                String v4_1 = "";
                try {
                    v5_2.readLine();
                    v5_2.readLine();
                    v5_2.readLine();
                    v2_0 = v5_2.readLine();
                    Exception v0_8 = this.totalCpuUsagePattern.matcher(v2_0);
                } catch (Exception v0_0) {
                    com.urbandroid.common.os.ProcessResourceUsage v6_6 = new StringBuilder();
                    v6_6.append("Failed to parse usage data. Overal usage: ");
                    v6_6.append(v2_0);
                    v6_6.append(" Last line: ");
                    v6_6.append(v4_1);
                    com.urbandroid.common.logging.Logger.logWarning(v6_6.toString(), v0_0);
                    if (v5_2 == 0) {
                        return;
                    } else {
                        v5_2.close();
                        return;
                    }
                }
                if (v0_8.matches()) {
                    String v13_1 = new com.urbandroid.common.os.TotalCpuUsage(Integer.parseInt(v0_8.group(1)), Integer.parseInt(v0_8.group(2)), Integer.parseInt(v0_8.group(3)), Integer.parseInt(v0_8.group(4)));
                    Exception v0_13 = this.listeners.iterator();
                    while (v0_13.hasNext()) {
                        ((com.urbandroid.common.os.IResourceUsageUpdatesListener) v0_13.next()).cpuUsageUpdate(v13_1);
                    }
                }
                v5_2.readLine();
                v5_2.readLine();
                v5_2.readLine();
                Exception v0_15 = new java.util.LinkedList();
                do {
                    v4_1 = v5_2.readLine();
                    if (v4_1 == null) {
                        com.urbandroid.common.os.ProcessResourceUsage v6_14 = this.listeners.iterator();
                        while (v6_14.hasNext()) {
                            ((com.urbandroid.common.os.IResourceUsageUpdatesListener) v6_14.next()).procUsageUpdate(v0_15);
                        }
                        v5_2.close();
                        return;
                    } else {
                        com.urbandroid.common.os.ProcessResourceUsage v6_17 = this.processUsagePattern.matcher(v4_1);
                    }
                } while(!v6_17.matches());
                com.urbandroid.common.os.ProcessResourceUsage v6_2 = new com.urbandroid.common.os.ProcessResourceUsage;
                v6_2(v6_17.group(9), Integer.parseInt(v6_17.group(1)), Integer.parseInt(v6_17.group(2)), v6_17.group(3), Integer.parseInt(v6_17.group(5)), Integer.parseInt(v6_17.group(6)), Integer.parseInt(v6_17.group(4)));
                v0_15.add(v6_2);
            } catch (Exception v0_0) {
                v4_1 = "N/A";
            }
        } catch (Exception v0_6) {
            Exception v2_4 = v0_6;
            v5_2 = 0;
            if (v5_2 != 0) {
                try {
                    v5_2.close();
                } catch (Exception v0_4) {
                    com.urbandroid.common.logging.Logger.logWarning("Failed to close stream.", v0_4);
                }
            }
            throw v2_4;
        } catch (Exception v0_0) {
            v5_2 = 0;
        } catch (Exception v0_2) {
            v2_4 = v0_2;
        } catch (Exception v0_1) {
            com.urbandroid.common.logging.Logger.logWarning("Failed to close stream.", v0_1);
            return;
        }
    }

Method com.urbandroid.common.os.ShellBasedResourceUsageMonitor.parseMemoryData() calling method java.lang.Runtime.exec()


    private void parseMemoryData()
    {
        try {
            Throwable v3_0 = new java.io.BufferedReader(new java.io.InputStreamReader(Runtime.getRuntime().exec("cat /proc/meminfo").getInputStream()));
            try {
                Exception v1_4 = this.memoryPattern.matcher(v3_0.readLine());
                v1_4.matches();
                int v5 = Integer.parseInt(v1_4.group(1));
                Exception v1_7 = this.memoryPattern.matcher(v3_0.readLine());
                v1_7.matches();
                int v6 = Integer.parseInt(v1_7.group(1));
                Exception v1_10 = this.memoryPattern.matcher(v3_0.readLine());
                v1_10.matches();
                int v7 = Integer.parseInt(v1_10.group(1));
                Exception v1_13 = this.memoryPattern.matcher(v3_0.readLine());
                v1_13.matches();
                int v8 = Integer.parseInt(v1_13.group(1));
                Exception v1_16 = this.memoryPattern.matcher(v3_0.readLine());
                v1_16.matches();
                Exception v1_18 = new com.urbandroid.common.os.MemoryUsage;
                v1_18(v5, v6, v7, v8, Integer.parseInt(v1_16.group(1)));
                Exception v2_8 = this.listeners.iterator();
            } catch (Exception v1_1) {
                com.urbandroid.common.logging.Logger.logWarning("Failed to parse memory usage.", v1_1);
                if (v3_0 == null) {
                    return;
                } else {
                    v3_0.close();
                    return;
                }
            }
            while (v2_8.hasNext()) {
                ((com.urbandroid.common.os.IResourceUsageUpdatesListener) v2_8.next()).memoryUpdate(v1_18);
            }
            v3_0.close();
            return;
        } catch (Exception v2_2) {
            v3_0 = 0;
            Exception v1_2 = v2_2;
            if (v3_0 != null) {
                try {
                    v3_0.close();
                } catch (Exception v2_10) {
                    com.urbandroid.common.logging.Logger.logWarning("Failed to close stream.", v2_10);
                }
            }
            throw v1_2;
        } catch (Exception v2_1) {
            v3_0 = 0;
            v1_1 = v2_1;
        } catch (Exception v1_2) {
        } catch (Exception v1_19) {
            com.urbandroid.common.logging.Logger.logWarning("Failed to close stream.", v1_19);
            return;
        }
    }