575 lines
15 KiB
Smali
575 lines
15 KiB
Smali
.class public final Lcom/discord/utilities/SystemLogUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "SystemLogUtils.kt"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/discord/utilities/SystemLogUtils$Tombstone;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final INSTANCE:Lcom/discord/utilities/SystemLogUtils;
|
|
|
|
.field public static final maxLogSize:I = 0x2625a0
|
|
|
|
.field public static final regexExtractTombstone:Lkotlin/text/Regex;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 2
|
|
|
|
new-instance v0, Lcom/discord/utilities/SystemLogUtils;
|
|
|
|
invoke-direct {v0}, Lcom/discord/utilities/SystemLogUtils;-><init>()V
|
|
|
|
sput-object v0, Lcom/discord/utilities/SystemLogUtils;->INSTANCE:Lcom/discord/utilities/SystemLogUtils;
|
|
|
|
new-instance v0, Lkotlin/text/Regex;
|
|
|
|
const-string v1, "^(?:[^\\s]+\\s+){4}F\\s+DEBUG\\s+:\\s(.+)"
|
|
|
|
invoke-direct {v0, v1}, Lkotlin/text/Regex;-><init>(Ljava/lang/String;)V
|
|
|
|
sput-object v0, Lcom/discord/utilities/SystemLogUtils;->regexExtractTombstone:Lkotlin/text/Regex;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static final synthetic access$waitFor(Lcom/discord/utilities/SystemLogUtils;Ljava/lang/Process;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0, p1}, Lcom/discord/utilities/SystemLogUtils;->waitFor(Ljava/lang/Process;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private final fetch(Lkotlin/text/Regex;)Lrx/Observable;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lkotlin/text/Regex;",
|
|
")",
|
|
"Lrx/Observable<",
|
|
"Ljava/util/LinkedList<",
|
|
"Ljava/lang/String;",
|
|
">;>;"
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/util/LinkedList;
|
|
|
|
invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V
|
|
|
|
new-instance v1, Ljava/io/File;
|
|
|
|
const-string v2, "/system/bin/logcat"
|
|
|
|
invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
if-nez p1, :cond_0
|
|
|
|
const-string p1, "Unable to locate \'/system/bin/logcat\'"
|
|
|
|
invoke-virtual {v0, p1}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_0
|
|
new-instance p1, Ll0/l/e/j;
|
|
|
|
invoke-direct {p1, v0}, Ll0/l/e/j;-><init>(Ljava/lang/Object;)V
|
|
|
|
const-string v0, "Observable.just(output)"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
|
|
:cond_1
|
|
new-instance v1, Lcom/discord/utilities/SystemLogUtils$fetch$2;
|
|
|
|
invoke-direct {v1, v2, v0, p1}, Lcom/discord/utilities/SystemLogUtils$fetch$2;-><init>(Ljava/lang/String;Ljava/util/LinkedList;Lkotlin/text/Regex;)V
|
|
|
|
new-instance p1, Ll0/l/a/s;
|
|
|
|
invoke-direct {p1, v1}, Ll0/l/a/s;-><init>(Ljava/util/concurrent/Callable;)V
|
|
|
|
invoke-static {p1}, Lrx/Observable;->d0(Lrx/Observable$a;)Lrx/Observable;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {}, Ll0/p/a;->c()Ll0/p/a;
|
|
|
|
move-result-object v0
|
|
|
|
iget-object v0, v0, Ll0/p/a;->c:Lrx/Scheduler;
|
|
|
|
invoke-virtual {p1, v0}, Lrx/Observable;->T(Lrx/Scheduler;)Lrx/Observable;
|
|
|
|
move-result-object p1
|
|
|
|
const-string v0, "Observable.fromCallable \u2026n(Schedulers.newThread())"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method private final waitFor(Ljava/lang/Process;)V
|
|
.locals 5
|
|
|
|
invoke-static {}, Ljava/lang/System;->nanoTime()J
|
|
|
|
move-result-wide v0
|
|
|
|
sget-object v2, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
|
|
|
|
const-wide/16 v3, 0xf
|
|
|
|
invoke-virtual {v2, v3, v4}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J
|
|
|
|
move-result-wide v2
|
|
|
|
add-long/2addr v2, v0
|
|
|
|
:cond_0
|
|
:try_start_0
|
|
invoke-virtual {p1}, Ljava/lang/Process;->exitValue()I
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalThreadStateException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-void
|
|
|
|
:catch_0
|
|
const-wide/16 v0, 0x64
|
|
|
|
invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
|
|
|
|
invoke-static {}, Ljava/lang/System;->nanoTime()J
|
|
|
|
move-result-wide v0
|
|
|
|
cmp-long v4, v0, v2
|
|
|
|
if-ltz v4, :cond_0
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final fetch()Lrx/Observable;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lrx/Observable<",
|
|
"Ljava/lang/String;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-direct {p0, v0}, Lcom/discord/utilities/SystemLogUtils;->fetch(Lkotlin/text/Regex;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/utilities/SystemLogUtils$fetch$1;->INSTANCE:Lcom/discord/utilities/SystemLogUtils$fetch$1;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->E(Ll0/k/b;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "fetch(null).map { it.joinToString(\"\\n\") }"
|
|
|
|
invoke-static {v0, v1}, Lc0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final fetchLastTombstone()Lrx/Observable;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lrx/Observable<",
|
|
"Lcom/discord/utilities/SystemLogUtils$Tombstone;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
sget-object v0, Lcom/discord/utilities/SystemLogUtils;->regexExtractTombstone:Lkotlin/text/Regex;
|
|
|
|
invoke-direct {p0, v0}, Lcom/discord/utilities/SystemLogUtils;->fetch(Lkotlin/text/Regex;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$1;->INSTANCE:Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$1;
|
|
|
|
invoke-virtual {v0, v1}, Lrx/Observable;->x(Ll0/k/b;)Lrx/Observable;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "fetch(regexExtractTombst\u2026ble.just(tombstone)\n }"
|
|
|
|
invoke-static {v0, v1}, Lc0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final fetchLastTombstone$app_productionDiscordExternalRelease(Ljava/util/Collection;)Lcom/discord/utilities/SystemLogUtils$Tombstone;
|
|
.locals 11
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/util/Collection<",
|
|
"Ljava/lang/String;",
|
|
">;)",
|
|
"Lcom/discord/utilities/SystemLogUtils$Tombstone;"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "crashes"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
invoke-interface {p1}, Ljava/util/Collection;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return-object p1
|
|
|
|
:cond_0
|
|
new-instance v0, Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$text$1;
|
|
|
|
invoke-direct {v0, p1}, Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$text$1;-><init>(Ljava/util/Collection;)V
|
|
|
|
invoke-interface {v0}, Lkotlin/jvm/functions/Function0;->invoke()Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
const-string/jumbo v0, "{\n val sb = StringB\u2026 sb.toString()\n }()"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/i;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
check-cast p1, Ljava/lang/String;
|
|
|
|
new-instance v0, Lkotlin/text/Regex;
|
|
|
|
sget-object v1, Lc0/t/d;->e:Lc0/t/d;
|
|
|
|
const-string v2, "^\\s+#\\d+ pc .+/(.+? .+?)\\+?[+)]"
|
|
|
|
invoke-direct {v0, v2, v1}, Lkotlin/text/Regex;-><init>(Ljava/lang/String;Lc0/t/d;)V
|
|
|
|
new-instance v1, Lkotlin/text/Regex;
|
|
|
|
const-string v2, "classes\\d+.dex"
|
|
|
|
invoke-direct {v1, v2}, Lkotlin/text/Regex;-><init>(Ljava/lang/String;)V
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-virtual {v0, p1, v2}, Lkotlin/text/Regex;->findAll(Ljava/lang/CharSequence;I)Lkotlin/sequences/Sequence;
|
|
|
|
move-result-object v0
|
|
|
|
new-instance v2, Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$extractedGroups$1;
|
|
|
|
invoke-direct {v2, v1}, Lcom/discord/utilities/SystemLogUtils$fetchLastTombstone$extractedGroups$1;-><init>(Lkotlin/text/Regex;)V
|
|
|
|
invoke-static {v0, v2}, Lc0/j/a;->map(Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
|
|
|
|
move-result-object v3
|
|
|
|
const-string v0, "libc.so (abort"
|
|
|
|
const-string v1, "libart.so (art::Runtime::Abort(char const*"
|
|
|
|
const-string v2, "libbase.so (android::base::LogMessage::~LogMessage("
|
|
|
|
filled-new-array {v0, v1, v2}, [Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lf/h/a/f/e/n/f;->hashSetOf([Ljava/lang/Object;)Ljava/util/HashSet;
|
|
|
|
move-result-object v0
|
|
|
|
:try_start_0
|
|
move-object v1, v3
|
|
|
|
check-cast v1, Lc0/s/u;
|
|
|
|
iget-object v2, v1, Lc0/s/u;->a:Lkotlin/sequences/Sequence;
|
|
|
|
invoke-interface {v2}, Lkotlin/sequences/Sequence;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v2
|
|
|
|
:cond_1
|
|
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_2
|
|
|
|
iget-object v4, v1, Lc0/s/u;->b:Lkotlin/jvm/functions/Function1;
|
|
|
|
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-interface {v4, v5}, Lkotlin/jvm/functions/Function1;->invoke(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v4
|
|
|
|
move-object v5, v4
|
|
|
|
check-cast v5, Ljava/lang/String;
|
|
|
|
invoke-virtual {v0, v5}, Ljava/util/HashSet;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v5
|
|
|
|
xor-int/lit8 v5, v5, 0x1
|
|
|
|
if-eqz v5, :cond_1
|
|
|
|
check-cast v4, Ljava/lang/String;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
new-instance v0, Ljava/util/NoSuchElementException;
|
|
|
|
const-string v1, "Sequence contains no element matching the predicate."
|
|
|
|
invoke-direct {v0, v1}, Ljava/util/NoSuchElementException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
:try_end_0
|
|
.catch Ljava/util/NoSuchElementException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:catch_0
|
|
const-string v4, "Unknown"
|
|
|
|
:goto_0
|
|
move-object v0, v4
|
|
|
|
const/4 v5, 0x0
|
|
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x0
|
|
|
|
const/4 v8, 0x0
|
|
|
|
const/4 v9, 0x0
|
|
|
|
const/16 v10, 0x3e
|
|
|
|
const-string v4, "\n"
|
|
|
|
invoke-static/range {v3 .. v10}, Lc0/j/a;->joinToString$default(Lkotlin/sequences/Sequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Ljava/lang/CharSequence;ILjava/lang/CharSequence;Lkotlin/jvm/functions/Function1;I)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
new-instance v2, Lcom/discord/utilities/SystemLogUtils$Tombstone;
|
|
|
|
invoke-direct {v2, p1, v1, v0}, Lcom/discord/utilities/SystemLogUtils$Tombstone;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object v2
|
|
.end method
|
|
|
|
.method public final getRegexExtractTombstone$app_productionDiscordExternalRelease()Lkotlin/text/Regex;
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/discord/utilities/SystemLogUtils;->regexExtractTombstone:Lkotlin/text/Regex;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public final processLogs$app_productionDiscordExternalRelease(Ljava/io/BufferedReader;Ljava/util/LinkedList;Lkotlin/text/Regex;)V
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/io/BufferedReader;",
|
|
"Ljava/util/LinkedList<",
|
|
"Ljava/lang/String;",
|
|
">;",
|
|
"Lkotlin/text/Regex;",
|
|
")V"
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "reader"
|
|
|
|
invoke-static {p1, v0}, Lc0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const-string v0, "output"
|
|
|
|
invoke-static {p2, v0}, Lc0/n/c/i;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
:cond_0
|
|
:goto_0
|
|
const v2, 0x2625a0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
if-eqz v3, :cond_5
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
invoke-virtual {p3, v3, v0}, Lkotlin/text/Regex;->find(Ljava/lang/CharSequence;I)Lkotlin/text/MatchResult;
|
|
|
|
move-result-object v3
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
invoke-interface {v3}, Lkotlin/text/MatchResult;->getGroupValues()Ljava/util/List;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-static {v3}, Lc0/i/f;->last(Ljava/util/List;)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Ljava/lang/String;
|
|
|
|
:cond_1
|
|
invoke-static {v3}, Lc0/t/k;->isBlank(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_2
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
const-string v4, "Accessing hidden method"
|
|
|
|
const/4 v5, 0x2
|
|
|
|
invoke-static {v3, v4, v0, v5}, Lc0/t/p;->contains$default(Ljava/lang/CharSequence;Ljava/lang/CharSequence;ZI)Z
|
|
|
|
move-result v4
|
|
|
|
if-eqz v4, :cond_3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
invoke-virtual {v3}, Ljava/lang/String;->length()I
|
|
|
|
move-result v4
|
|
:try_end_0
|
|
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
add-int/lit8 v4, v4, 0x1
|
|
|
|
add-int/2addr v4, v1
|
|
|
|
:try_start_1
|
|
invoke-virtual {p2, v3}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z
|
|
|
|
if-le v4, v2, :cond_4
|
|
|
|
invoke-virtual {p2}, Ljava/util/LinkedList;->pop()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/lang/String;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/String;->length()I
|
|
|
|
move-result v1
|
|
:try_end_1
|
|
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
add-int/lit8 v1, v1, -0x1
|
|
|
|
sub-int/2addr v4, v1
|
|
|
|
:cond_4
|
|
move v1, v4
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
move v1, v4
|
|
|
|
goto :goto_1
|
|
|
|
:catch_1
|
|
move-exception p1
|
|
|
|
:goto_1
|
|
invoke-virtual {p1}, Ljava/lang/Exception;->printStackTrace()V
|
|
|
|
if-nez p3, :cond_5
|
|
|
|
new-instance p3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v0, "IOException: "
|
|
|
|
invoke-virtual {p3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p2, p1}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z
|
|
|
|
:cond_5
|
|
if-le v1, v2, :cond_6
|
|
|
|
invoke-virtual {p2}, Ljava/util/LinkedList;->pop()Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/lang/String;
|
|
|
|
invoke-virtual {p1}, Ljava/lang/String;->length()I
|
|
|
|
:cond_6
|
|
return-void
|
|
.end method
|