apkfuckery/com.discord/smali/com/bugsnag/android/MetaData.smali
2019-02-04 21:05:16 +01:00

653 lines
17 KiB
Smali

.class public Lcom/bugsnag/android/MetaData;
.super Ljava/lang/Object;
.source "MetaData.java"
# interfaces
.implements Lcom/bugsnag/android/JsonStream$Streamable;
# static fields
.field private static final FILTERED_PLACEHOLDER:Ljava/lang/String; = "[FILTERED]"
.field private static final OBJECT_PLACEHOLDER:Ljava/lang/String; = "[OBJECT]"
# instance fields
.field private filters:[Ljava/lang/String;
.field private final store:Ljava/util/Map;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 1
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
iput-object v0, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
return-void
.end method
.method public constructor <init>(Ljava/util/Map;)V
.locals 1
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;)V"
}
.end annotation
.prologue
.local p1, "m":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v0, p1}, Ljava/util/concurrent/ConcurrentHashMap;-><init>(Ljava/util/Map;)V
iput-object v0, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
return-void
.end method
.method static varargs merge([Lcom/bugsnag/android/MetaData;)Lcom/bugsnag/android/MetaData;
.locals 6
.param p0, "metaDataList" # [Lcom/bugsnag/android/MetaData;
.prologue
const/4 v3, 0x0
new-instance v1, Ljava/util/ArrayList;
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
.local v1, "stores":Ljava/util/ArrayList;, "Ljava/util/ArrayList<Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;>;"
array-length v4, p0
move v2, v3
:goto_0
if-ge v2, v4, :cond_1
aget-object v0, p0, v2
.local v0, "metaData":Lcom/bugsnag/android/MetaData;
if-eqz v0, :cond_0
iget-object v5, v0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
invoke-virtual {v1, v5}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
:cond_0
add-int/lit8 v2, v2, 0x1
goto :goto_0
.end local v0 # "metaData":Lcom/bugsnag/android/MetaData;
:cond_1
new-instance v4, Lcom/bugsnag/android/MetaData;
new-array v2, v3, [Ljava/util/Map;
invoke-virtual {v1, v2}, Ljava/util/ArrayList;->toArray([Ljava/lang/Object;)[Ljava/lang/Object;
move-result-object v2
check-cast v2, [Ljava/util/Map;
invoke-static {v2}, Lcom/bugsnag/android/MetaData;->mergeMaps([Ljava/util/Map;)Ljava/util/Map;
move-result-object v2
invoke-direct {v4, v2}, Lcom/bugsnag/android/MetaData;-><init>(Ljava/util/Map;)V
return-object v4
.end method
.method private static varargs mergeMaps([Ljava/util/Map;)Ljava/util/Map;
.locals 12
.annotation system Ldalvik/annotation/Signature;
value = {
"([",
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;)",
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.prologue
.local p0, "maps":[Ljava/util/Map;, "[Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
const/4 v7, 0x0
new-instance v5, Ljava/util/concurrent/ConcurrentHashMap;
invoke-direct {v5}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
.local v5, "result":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
array-length v8, p0
move v6, v7
:goto_0
if-ge v6, v8, :cond_4
aget-object v3, p0, v6
.local v3, "map":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
if-nez v3, :cond_1
:cond_0
add-int/lit8 v6, v6, 0x1
goto :goto_0
:cond_1
new-instance v0, Ljava/util/HashSet;
invoke-interface {v5}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v9
invoke-direct {v0, v9}, Ljava/util/HashSet;-><init>(Ljava/util/Collection;)V
.local v0, "allKeys":Ljava/util/Set;, "Ljava/util/Set<Ljava/lang/String;>;"
invoke-interface {v3}, Ljava/util/Map;->keySet()Ljava/util/Set;
move-result-object v9
invoke-interface {v0, v9}, Ljava/util/Set;->addAll(Ljava/util/Collection;)Z
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v9
:goto_1
invoke-interface {v9}, Ljava/util/Iterator;->hasNext()Z
move-result v10
if-eqz v10, :cond_0
invoke-interface {v9}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v2
check-cast v2, Ljava/lang/String;
.local v2, "key":Ljava/lang/String;
invoke-interface {v5, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v1
.local v1, "baseValue":Ljava/lang/Object;
invoke-interface {v3, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v4
.local v4, "overridesValue":Ljava/lang/Object;
if-eqz v4, :cond_3
if-eqz v1, :cond_2
instance-of v10, v1, Ljava/util/Map;
if-eqz v10, :cond_2
instance-of v10, v4, Ljava/util/Map;
if-eqz v10, :cond_2
const/4 v10, 0x2
new-array v10, v10, [Ljava/util/Map;
check-cast v1, Ljava/util/Map;
.end local v1 # "baseValue":Ljava/lang/Object;
aput-object v1, v10, v7
const/4 v11, 0x1
check-cast v4, Ljava/util/Map;
.end local v4 # "overridesValue":Ljava/lang/Object;
aput-object v4, v10, v11
invoke-static {v10}, Lcom/bugsnag/android/MetaData;->mergeMaps([Ljava/util/Map;)Ljava/util/Map;
move-result-object v10
invoke-interface {v5, v2, v10}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
.restart local v1 # "baseValue":Ljava/lang/Object;
.restart local v4 # "overridesValue":Ljava/lang/Object;
:cond_2
invoke-interface {v5, v2, v4}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
:cond_3
invoke-interface {v5, v2, v1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_1
.end local v0 # "allKeys":Ljava/util/Set;, "Ljava/util/Set<Ljava/lang/String;>;"
.end local v1 # "baseValue":Ljava/lang/Object;
.end local v2 # "key":Ljava/lang/String;
.end local v3 # "map":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
.end local v4 # "overridesValue":Ljava/lang/Object;
:cond_4
return-object v5
.end method
.method private objectToStream(Ljava/lang/Object;Lcom/bugsnag/android/JsonStream;)V
.locals 8
.param p1, "obj" # Ljava/lang/Object;
.param p2, "writer" # Lcom/bugsnag/android/JsonStream;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
if-nez p1, :cond_0
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->nullValue()Lcom/bugsnag/android/JsonWriter;
.end local p1 # "obj":Ljava/lang/Object;
:goto_0
return-void
.restart local p1 # "obj":Ljava/lang/Object;
:cond_0
instance-of v6, p1, Ljava/lang/String;
if-eqz v6, :cond_1
check-cast p1, Ljava/lang/String;
.end local p1 # "obj":Ljava/lang/Object;
invoke-virtual {p2, p1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
goto :goto_0
.restart local p1 # "obj":Ljava/lang/Object;
:cond_1
instance-of v6, p1, Ljava/lang/Number;
if-eqz v6, :cond_2
check-cast p1, Ljava/lang/Number;
.end local p1 # "obj":Ljava/lang/Object;
invoke-virtual {p2, p1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/Number;)Lcom/bugsnag/android/JsonWriter;
goto :goto_0
.restart local p1 # "obj":Ljava/lang/Object;
:cond_2
instance-of v6, p1, Ljava/lang/Boolean;
if-eqz v6, :cond_3
check-cast p1, Ljava/lang/Boolean;
.end local p1 # "obj":Ljava/lang/Object;
invoke-virtual {p2, p1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/Boolean;)V
goto :goto_0
.restart local p1 # "obj":Ljava/lang/Object;
:cond_3
instance-of v6, p1, Ljava/util/Map;
if-eqz v6, :cond_7
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->beginObject()Lcom/bugsnag/android/JsonWriter;
check-cast p1, Ljava/util/Map;
.end local p1 # "obj":Ljava/lang/Object;
invoke-interface {p1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
move-result-object v6
invoke-interface {v6}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
move-result-object v0
.local v0, "entries":Ljava/util/Iterator;
:cond_4
:goto_1
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v6
if-eqz v6, :cond_6
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/util/Map$Entry;
.local v1, "entry":Ljava/util/Map$Entry;
invoke-interface {v1}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
move-result-object v4
.local v4, "keyObj":Ljava/lang/Object;
instance-of v6, v4, Ljava/lang/String;
if-eqz v6, :cond_4
move-object v3, v4
check-cast v3, Ljava/lang/String;
.local v3, "key":Ljava/lang/String;
invoke-virtual {p2, v3}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
invoke-direct {p0, v3}, Lcom/bugsnag/android/MetaData;->shouldFilter(Ljava/lang/String;)Z
move-result v6
if-eqz v6, :cond_5
const-string v6, "[FILTERED]"
invoke-virtual {p2, v6}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
goto :goto_1
:cond_5
invoke-interface {v1}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
move-result-object v6
invoke-direct {p0, v6, p2}, Lcom/bugsnag/android/MetaData;->objectToStream(Ljava/lang/Object;Lcom/bugsnag/android/JsonStream;)V
goto :goto_1
.end local v1 # "entry":Ljava/util/Map$Entry;
.end local v3 # "key":Ljava/lang/String;
.end local v4 # "keyObj":Ljava/lang/Object;
:cond_6
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->endObject()Lcom/bugsnag/android/JsonWriter;
goto :goto_0
.end local v0 # "entries":Ljava/util/Iterator;
.restart local p1 # "obj":Ljava/lang/Object;
:cond_7
instance-of v6, p1, Ljava/util/Collection;
if-eqz v6, :cond_9
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->beginArray()Lcom/bugsnag/android/JsonWriter;
check-cast p1, Ljava/util/Collection;
.end local p1 # "obj":Ljava/lang/Object;
invoke-interface {p1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
move-result-object v6
:goto_2
invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z
move-result v7
if-eqz v7, :cond_8
invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
.local v1, "entry":Ljava/lang/Object;
invoke-direct {p0, v1, p2}, Lcom/bugsnag/android/MetaData;->objectToStream(Ljava/lang/Object;Lcom/bugsnag/android/JsonStream;)V
goto :goto_2
.end local v1 # "entry":Ljava/lang/Object;
:cond_8
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->endArray()Lcom/bugsnag/android/JsonWriter;
goto :goto_0
.restart local p1 # "obj":Ljava/lang/Object;
:cond_9
invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v6
invoke-virtual {v6}, Ljava/lang/Class;->isArray()Z
move-result v6
if-eqz v6, :cond_b
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->beginArray()Lcom/bugsnag/android/JsonWriter;
invoke-static {p1}, Ljava/lang/reflect/Array;->getLength(Ljava/lang/Object;)I
move-result v5
.local v5, "length":I
const/4 v2, 0x0
.local v2, "i":I
:goto_3
if-ge v2, v5, :cond_a
invoke-static {p1, v2}, Ljava/lang/reflect/Array;->get(Ljava/lang/Object;I)Ljava/lang/Object;
move-result-object v6
invoke-direct {p0, v6, p2}, Lcom/bugsnag/android/MetaData;->objectToStream(Ljava/lang/Object;Lcom/bugsnag/android/JsonStream;)V
add-int/lit8 v2, v2, 0x1
goto :goto_3
:cond_a
invoke-virtual {p2}, Lcom/bugsnag/android/JsonStream;->endArray()Lcom/bugsnag/android/JsonWriter;
goto/16 :goto_0
.end local v2 # "i":I
.end local v5 # "length":I
:cond_b
const-string v6, "[OBJECT]"
invoke-virtual {p2, v6}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
goto/16 :goto_0
.end method
.method private shouldFilter(Ljava/lang/String;)Z
.locals 6
.param p1, "key" # Ljava/lang/String;
.prologue
const/4 v1, 0x0
iget-object v2, p0, Lcom/bugsnag/android/MetaData;->filters:[Ljava/lang/String;
if-eqz v2, :cond_0
if-nez p1, :cond_1
:cond_0
:goto_0
return v1
:cond_1
iget-object v3, p0, Lcom/bugsnag/android/MetaData;->filters:[Ljava/lang/String;
array-length v4, v3
move v2, v1
:goto_1
if-ge v2, v4, :cond_0
aget-object v0, v3, v2
.local v0, "filter":Ljava/lang/String;
invoke-virtual {p1, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
move-result v5
if-eqz v5, :cond_2
const/4 v1, 0x1
goto :goto_0
:cond_2
add-int/lit8 v2, v2, 0x1
goto :goto_1
.end method
# virtual methods
.method public addToTab(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
.locals 1
.param p1, "tabName" # Ljava/lang/String;
.param p2, "key" # Ljava/lang/String;
.param p3, "value" # Ljava/lang/Object;
.prologue
invoke-virtual {p0, p1}, Lcom/bugsnag/android/MetaData;->getTab(Ljava/lang/String;)Ljava/util/Map;
move-result-object v0
.local v0, "tab":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
if-eqz p3, :cond_0
invoke-interface {v0, p2, p3}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:goto_0
return-void
:cond_0
invoke-interface {v0, p2}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
goto :goto_0
.end method
.method public clearTab(Ljava/lang/String;)V
.locals 1
.param p1, "tabName" # Ljava/lang/String;
.prologue
iget-object v0, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
invoke-interface {v0, p1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
return-void
.end method
.method getTab(Ljava/lang/String;)Ljava/util/Map;
.locals 2
.param p1, "tabName" # Ljava/lang/String;
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/Map",
"<",
"Ljava/lang/String;",
"Ljava/lang/Object;",
">;"
}
.end annotation
.prologue
iget-object v1, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
invoke-interface {v1, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/util/Map;
.local v0, "tab":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
if-nez v0, :cond_0
new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;
.end local v0 # "tab":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V
.restart local v0 # "tab":Ljava/util/Map;, "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
iget-object v1, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
invoke-interface {v1, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
:cond_0
return-object v0
.end method
.method varargs setFilters([Ljava/lang/String;)V
.locals 0
.param p1, "filters" # [Ljava/lang/String;
.prologue
iput-object p1, p0, Lcom/bugsnag/android/MetaData;->filters:[Ljava/lang/String;
return-void
.end method
.method public toStream(Lcom/bugsnag/android/JsonStream;)V
.locals 1
.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
iget-object v0, p0, Lcom/bugsnag/android/MetaData;->store:Ljava/util/Map;
invoke-direct {p0, v0, p1}, Lcom/bugsnag/android/MetaData;->objectToStream(Ljava/lang/Object;Lcom/bugsnag/android/JsonStream;)V
return-void
.end method