153 lines
4.4 KiB
Smali
153 lines
4.4 KiB
Smali
.class Lcom/bugsnag/android/ThreadState;
|
|
.super Ljava/lang/Object;
|
|
.source "ThreadState.java"
|
|
|
|
# interfaces
|
|
.implements Lcom/bugsnag/android/JsonStream$Streamable;
|
|
|
|
|
|
# instance fields
|
|
.field final config:Lcom/bugsnag/android/Configuration;
|
|
|
|
|
|
# direct methods
|
|
.method constructor <init>(Lcom/bugsnag/android/Configuration;)V
|
|
.locals 0
|
|
.param p1, "config" # Lcom/bugsnag/android/Configuration;
|
|
|
|
.prologue
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/bugsnag/android/ThreadState;->config:Lcom/bugsnag/android/Configuration;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public toStream(Lcom/bugsnag/android/JsonStream;)V
|
|
.locals 10
|
|
.param p1, "writer" # Lcom/bugsnag/android/JsonStream;
|
|
.annotation build Landroid/support/annotation/NonNull;
|
|
.end annotation
|
|
.end param
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v7}, Ljava/lang/Thread;->getId()J
|
|
|
|
move-result-wide v0
|
|
|
|
.local v0, "currentId":J
|
|
invoke-static {}, Ljava/lang/Thread;->getAllStackTraces()Ljava/util/Map;
|
|
|
|
move-result-object v4
|
|
|
|
.local v4, "liveThreads":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/Thread;[Ljava/lang/StackTraceElement;>;"
|
|
invoke-interface {v4}, Ljava/util/Map;->keySet()Ljava/util/Set;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-interface {v7}, Ljava/util/Set;->toArray()[Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
.local v3, "keys":[Ljava/lang/Object;
|
|
new-instance v7, Lcom/bugsnag/android/ThreadState$1;
|
|
|
|
invoke-direct {v7, p0}, Lcom/bugsnag/android/ThreadState$1;-><init>(Lcom/bugsnag/android/ThreadState;)V
|
|
|
|
invoke-static {v3, v7}, Ljava/util/Arrays;->sort([Ljava/lang/Object;Ljava/util/Comparator;)V
|
|
|
|
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->beginArray()Lcom/bugsnag/android/JsonWriter;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.local v2, "i":I
|
|
:goto_0
|
|
array-length v7, v3
|
|
|
|
if-ge v2, v7, :cond_1
|
|
|
|
aget-object v6, v3, v2
|
|
|
|
check-cast v6, Ljava/lang/Thread;
|
|
|
|
.local v6, "thread":Ljava/lang/Thread;
|
|
invoke-virtual {v6}, Ljava/lang/Thread;->getId()J
|
|
|
|
move-result-wide v8
|
|
|
|
cmp-long v7, v8, v0
|
|
|
|
if-eqz v7, :cond_0
|
|
|
|
invoke-interface {v4, v6}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v5
|
|
|
|
check-cast v5, [Ljava/lang/StackTraceElement;
|
|
|
|
.local v5, "stacktrace":[Ljava/lang/StackTraceElement;
|
|
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->beginObject()Lcom/bugsnag/android/JsonWriter;
|
|
|
|
const-string v7, "id"
|
|
|
|
invoke-virtual {p1, v7}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v6}, Ljava/lang/Thread;->getId()J
|
|
|
|
move-result-wide v8
|
|
|
|
invoke-virtual {v7, v8, v9}, Lcom/bugsnag/android/JsonStream;->value(J)Lcom/bugsnag/android/JsonWriter;
|
|
|
|
const-string v7, "name"
|
|
|
|
invoke-virtual {p1, v7}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v6}, Ljava/lang/Thread;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v8
|
|
|
|
invoke-virtual {v7, v8}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
|
|
|
|
const-string v7, "stacktrace"
|
|
|
|
invoke-virtual {p1, v7}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
|
|
|
|
move-result-object v7
|
|
|
|
new-instance v8, Lcom/bugsnag/android/Stacktrace;
|
|
|
|
iget-object v9, p0, Lcom/bugsnag/android/ThreadState;->config:Lcom/bugsnag/android/Configuration;
|
|
|
|
invoke-direct {v8, v9, v5}, Lcom/bugsnag/android/Stacktrace;-><init>(Lcom/bugsnag/android/Configuration;[Ljava/lang/StackTraceElement;)V
|
|
|
|
invoke-virtual {v7, v8}, Lcom/bugsnag/android/JsonStream;->value(Lcom/bugsnag/android/JsonStream$Streamable;)V
|
|
|
|
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->endObject()Lcom/bugsnag/android/JsonWriter;
|
|
|
|
.end local v5 # "stacktrace":[Ljava/lang/StackTraceElement;
|
|
:cond_0
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.end local v6 # "thread":Ljava/lang/Thread;
|
|
:cond_1
|
|
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->endArray()Lcom/bugsnag/android/JsonWriter;
|
|
|
|
return-void
|
|
.end method
|