apkfuckery/com.discord/smali/com/bugsnag/android/AppData.smali

448 lines
14 KiB
Smali
Raw Normal View History

2019-02-04 20:05:16 +00:00
.class Lcom/bugsnag/android/AppData;
.super Ljava/lang/Object;
.source "AppData.java"
# interfaces
.implements Lcom/bugsnag/android/JsonStream$Streamable;
# instance fields
.field private final appName:Ljava/lang/String;
.field private final config:Lcom/bugsnag/android/Configuration;
.field private final guessedReleaseStage:Ljava/lang/String;
.field private final packageName:Ljava/lang/String;
.field private final versionCode:Ljava/lang/Integer;
.field private final versionName:Ljava/lang/String;
# direct methods
.method constructor <init>(Landroid/content/Context;Lcom/bugsnag/android/Configuration;)V
.locals 1
.param p1, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.param p2, "config" # Lcom/bugsnag/android/Configuration;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.end param
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p2, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
invoke-static {p1}, Lcom/bugsnag/android/AppData;->getPackageName(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/bugsnag/android/AppData;->packageName:Ljava/lang/String;
invoke-static {p1}, Lcom/bugsnag/android/AppData;->getAppName(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/bugsnag/android/AppData;->appName:Ljava/lang/String;
invoke-static {p1}, Lcom/bugsnag/android/AppData;->getVersionCode(Landroid/content/Context;)Ljava/lang/Integer;
move-result-object v0
iput-object v0, p0, Lcom/bugsnag/android/AppData;->versionCode:Ljava/lang/Integer;
invoke-static {p1}, Lcom/bugsnag/android/AppData;->getVersionName(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/bugsnag/android/AppData;->versionName:Ljava/lang/String;
invoke-static {p1}, Lcom/bugsnag/android/AppData;->guessReleaseStage(Landroid/content/Context;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/bugsnag/android/AppData;->guessedReleaseStage:Ljava/lang/String;
return-void
.end method
.method private static getAppName(Landroid/content/Context;)Ljava/lang/String;
.locals 5
.param p0, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.prologue
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
.local v2, "packageManager":Landroid/content/pm/PackageManager;
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v3
const/4 v4, 0x0
invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
move-result-object v0
.local v0, "appInfo":Landroid/content/pm/ApplicationInfo;
invoke-virtual {v2, v0}, Landroid/content/pm/PackageManager;->getApplicationLabel(Landroid/content/pm/ApplicationInfo;)Ljava/lang/CharSequence;
move-result-object v3
check-cast v3, Ljava/lang/String;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.end local v0 # "appInfo":Landroid/content/pm/ApplicationInfo;
.end local v2 # "packageManager":Landroid/content/pm/PackageManager;
:goto_0
return-object v3
:catch_0
move-exception v1
.local v1, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v3, "Could not get app name"
invoke-static {v3}, Lcom/bugsnag/android/Logger;->warn(Ljava/lang/String;)V
const/4 v3, 0x0
goto :goto_0
.end method
.method private static getPackageName(Landroid/content/Context;)Ljava/lang/String;
.locals 1
.param p0, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.prologue
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method private static getVersionCode(Landroid/content/Context;)Ljava/lang/Integer;
.locals 4
.param p0, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.prologue
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v1
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v2
const/4 v3, 0x0
invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v1
iget v1, v1, Landroid/content/pm/PackageInfo;->versionCode:I
invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v1
:goto_0
return-object v1
:catch_0
move-exception v0
.local v0, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v1, "Could not get versionCode"
invoke-static {v1}, Lcom/bugsnag/android/Logger;->warn(Ljava/lang/String;)V
const/4 v1, 0x0
goto :goto_0
.end method
.method private static getVersionName(Landroid/content/Context;)Ljava/lang/String;
.locals 4
.param p0, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.prologue
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v1
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v2
const/4 v3, 0x0
invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v1
iget-object v1, v1, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
:goto_0
return-object v1
:catch_0
move-exception v0
.local v0, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v1, "Could not get versionName"
invoke-static {v1}, Lcom/bugsnag/android/Logger;->warn(Ljava/lang/String;)V
const/4 v1, 0x0
goto :goto_0
.end method
.method private static guessReleaseStage(Landroid/content/Context;)Ljava/lang/String;
.locals 5
.param p0, "appContext" # Landroid/content/Context;
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.prologue
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v2
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v3
const/4 v4, 0x0
invoke-virtual {v2, v3, v4}, Landroid/content/pm/PackageManager;->getApplicationInfo(Ljava/lang/String;I)Landroid/content/pm/ApplicationInfo;
move-result-object v2
iget v0, v2, Landroid/content/pm/ApplicationInfo;->flags:I
.local v0, "appFlags":I
and-int/lit8 v2, v0, 0x2
if-eqz v2, :cond_0
const-string v2, "development"
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.end local v0 # "appFlags":I
:goto_0
return-object v2
:catch_0
move-exception v1
.local v1, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v2, "Could not get releaseStage"
invoke-static {v2}, Lcom/bugsnag/android/Logger;->warn(Ljava/lang/String;)V
.end local v1 # "e":Landroid/content/pm/PackageManager$NameNotFoundException;
:cond_0
const-string v2, "production"
goto :goto_0
.end method
# virtual methods
.method public getAppVersion()Ljava/lang/String;
.locals 1
.annotation build Landroid/support/annotation/Nullable;
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v0, v0, Lcom/bugsnag/android/Configuration;->appVersion:Ljava/lang/String;
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v0, v0, Lcom/bugsnag/android/Configuration;->appVersion:Ljava/lang/String;
:goto_0
return-object v0
:cond_0
iget-object v0, p0, Lcom/bugsnag/android/AppData;->versionName:Ljava/lang/String;
goto :goto_0
.end method
.method public getReleaseStage()Ljava/lang/String;
.locals 1
.annotation build Landroid/support/annotation/NonNull;
.end annotation
.prologue
iget-object v0, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v0, v0, Lcom/bugsnag/android/Configuration;->releaseStage:Ljava/lang/String;
if-eqz v0, :cond_0
iget-object v0, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v0, v0, Lcom/bugsnag/android/Configuration;->releaseStage:Ljava/lang/String;
:goto_0
return-object v0
:cond_0
iget-object v0, p0, Lcom/bugsnag/android/AppData;->guessedReleaseStage:Ljava/lang/String;
goto :goto_0
.end method
.method public toStream(Lcom/bugsnag/android/JsonStream;)V
.locals 2
.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-virtual {p1}, Lcom/bugsnag/android/JsonStream;->beginObject()Lcom/bugsnag/android/JsonWriter;
const-string v0, "id"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->packageName:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
const-string v0, "name"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->appName:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
const-string v0, "packageName"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->packageName:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
const-string v0, "versionName"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->versionName:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
const-string v0, "versionCode"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->versionCode:Ljava/lang/Integer;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/Number;)Lcom/bugsnag/android/JsonWriter;
iget-object v0, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v0, v0, Lcom/bugsnag/android/Configuration;->buildUUID:Ljava/lang/String;
if-eqz v0, :cond_0
const-string v0, "buildUUID"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
iget-object v1, p0, Lcom/bugsnag/android/AppData;->config:Lcom/bugsnag/android/Configuration;
iget-object v1, v1, Lcom/bugsnag/android/Configuration;->buildUUID:Ljava/lang/String;
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
:cond_0
invoke-virtual {p0}, Lcom/bugsnag/android/AppData;->getAppVersion()Ljava/lang/String;
move-result-object v0
if-eqz v0, :cond_1
const-string v0, "version"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
invoke-virtual {p0}, Lcom/bugsnag/android/AppData;->getAppVersion()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
:cond_1
const-string v0, "releaseStage"
invoke-virtual {p1, v0}, Lcom/bugsnag/android/JsonStream;->name(Ljava/lang/String;)Lcom/bugsnag/android/JsonStream;
move-result-object v0
invoke-virtual {p0}, Lcom/bugsnag/android/AppData;->getReleaseStage()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/bugsnag/android/JsonStream;->value(Ljava/lang/String;)Lcom/bugsnag/android/JsonWriter;
invoke-virtual {p1}, Lcom/bugsnag/android/JsonStream;->endObject()Lcom/bugsnag/android/JsonWriter;
return-void
.end method