Some devices do not have logcat

pull/217/head
M66B 11 months ago
parent cccf897194
commit 63f51df94a

@ -1367,26 +1367,31 @@ public class DebugHelper {
File logcat = new File(context.getFilesDir(), "logcat.txt"); File logcat = new File(context.getFilesDir(), "logcat.txt");
// https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html#java try {
ProcessBuilder pb = new ProcessBuilder("logcat", // CASA "/system/bin/logcat",
"-d", // https://cheatsheetseries.owasp.org/cheatsheets/OS_Command_Injection_Defense_Cheat_Sheet.html#java
"-v", "threadtime", ProcessBuilder pb = new ProcessBuilder("logcat", // CASA "/system/bin/logcat",
//"-t", "1000", "-d",
"fairemail" + ":I"); "-v", "threadtime",
Map<String, String> env = pb.environment(); //"-t", "1000",
env.clear(); "fairemail" + ":I");
pb.directory(context.getFilesDir()); Map<String, String> env = pb.environment();
env.clear();
Process proc = null; pb.directory(context.getFilesDir());
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(logcat))) {
proc = pb.start(); Process proc = null;
Helper.copy(proc.getInputStream(), os); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(logcat))) {
} finally { proc = pb.start();
if (proc != null) Helper.copy(proc.getInputStream(), os);
proc.destroy(); } finally {
} if (proc != null)
proc.destroy();
}
files.add(logcat); files.add(logcat);
} catch (Throwable ex) {
Log.e(ex);
}
attachment.zip(context, files.toArray(new File[0])); attachment.zip(context, files.toArray(new File[0]));

Loading…
Cancel
Save