60 lines
2.5 KiB
Java
60 lines
2.5 KiB
Java
package com.discord.utilities.systemlog;
|
|
|
|
import d0.g0.c;
|
|
import d0.z.d.m;
|
|
import java.io.BufferedReader;
|
|
import java.io.InputStream;
|
|
import java.io.InputStreamReader;
|
|
import java.util.LinkedList;
|
|
import java.util.concurrent.Callable;
|
|
import kotlin.text.Regex;
|
|
/* compiled from: SystemLogUtils.kt */
|
|
public final class SystemLogUtils$fetch$1<V> implements Callable<LinkedList<String>> {
|
|
public final /* synthetic */ Regex $filter;
|
|
public final /* synthetic */ boolean $logErrors;
|
|
public final /* synthetic */ LinkedList $output;
|
|
|
|
public SystemLogUtils$fetch$1(LinkedList linkedList, Regex regex, boolean z2) {
|
|
this.$output = linkedList;
|
|
this.$filter = regex;
|
|
this.$logErrors = z2;
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:17:0x009b, code lost:
|
|
if (0 != 0) goto L_0x004a;
|
|
*/
|
|
@Override // java.util.concurrent.Callable
|
|
public final LinkedList<String> call() {
|
|
Process process = null;
|
|
try {
|
|
process = new ProcessBuilder("/system/bin/logcat", "-d").redirectErrorStream(true).start();
|
|
SystemLogUtils systemLogUtils = SystemLogUtils.INSTANCE;
|
|
m.checkNotNullExpressionValue(process, "logcatProcess");
|
|
SystemLogUtils.access$waitFor(systemLogUtils, process);
|
|
InputStream inputStream = process.getInputStream();
|
|
m.checkNotNullExpressionValue(inputStream, "logcatProcess.inputStream");
|
|
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, c.a);
|
|
BufferedReader bufferedReader = inputStreamReader instanceof BufferedReader ? (BufferedReader) inputStreamReader : new BufferedReader(inputStreamReader, 8192);
|
|
systemLogUtils.processLogs$app_productionBetaRelease(bufferedReader, this.$output, this.$filter);
|
|
bufferedReader.close();
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
if (this.$logErrors) {
|
|
this.$output.add("Exception getting system logs '" + e + '\'');
|
|
StackTraceElement[] stackTrace = e.getStackTrace();
|
|
m.checkNotNullExpressionValue(stackTrace, "e.stackTrace");
|
|
for (StackTraceElement stackTraceElement : stackTrace) {
|
|
this.$output.add(" " + stackTraceElement);
|
|
}
|
|
}
|
|
} catch (Throwable th) {
|
|
if (0 != 0) {
|
|
process.destroy();
|
|
}
|
|
throw th;
|
|
}
|
|
process.destroy();
|
|
return this.$output;
|
|
}
|
|
}
|