a.smali
.class public final Lcn/jiguang/b/a;
.super Ljava/lang/Object;
# interfaces
.implements Ljava/lang/Thread$UncaughtExceptionHandler;
# static fields
.field private static b:Lcn/jiguang/b/a;
.field private static c:I
# instance fields
.field public a:Z
.field private d:Ljava/lang/Thread$UncaughtExceptionHandler;
# direct methods
.method static constructor <clinit>()V
.registers 1
new-instance v0, Lcn/jiguang/b/a;
invoke-direct {v0}, Lcn/jiguang/b/a;-><init>()V
sput-object v0, Lcn/jiguang/b/a;->b:Lcn/jiguang/b/a;
const/high16 v0, 0x100000
sput v0, Lcn/jiguang/b/a;->c:I
return-void
.end method
.method private constructor <init>()V
.registers 3
const/4 v1, 0x0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object v1, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
const/4 v0, 0x1
iput-boolean v0, p0, Lcn/jiguang/b/a;->a:Z
invoke-static {v1}, Lcn/jiguang/a/a;->a(Landroid/content/Context;)Landroid/content/Context;
move-result-object v0
invoke-static {}, Lcn/jiguang/e/a;->b()Lcn/jiguang/e/a;
move-result-object v1
invoke-static {v0, v1}, Lcn/jiguang/e/b;->a(Landroid/content/Context;Lcn/jiguang/e/a;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Ljava/lang/Boolean;
invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
move-result v0
iput-boolean v0, p0, Lcn/jiguang/b/a;->a:Z
return-void
.end method
.method public static a()Lcn/jiguang/b/a;
.registers 1
sget-object v0, Lcn/jiguang/b/a;->b:Lcn/jiguang/b/a;
return-object v0
.end method
.method private static a(Ljava/lang/Throwable;)Ljava/lang/String;
.registers 6
invoke-virtual {p0}, Ljava/lang/Throwable;->toString()Ljava/lang/String;
move-result-object v0
:try_start_4
const-string v1, ":"
invoke-virtual {v0, v1}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;
move-result-object v2
array-length v1, v2
const/4 v3, 0x1
if-le v1, v3, :cond_29
array-length v1, v2
add-int/lit8 v1, v1, -0x1
:goto_11
if-ltz v1, :cond_29
aget-object v3, v2, v1
const-string v4, "Exception"
invoke-virtual {v3, v4}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v3
if-nez v3, :cond_27
aget-object v3, v2, v1
const-string v4, "Error"
invoke-virtual {v3, v4}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v3
if-eqz v3, :cond_2a
:cond_27
aget-object v0, v2, v1
:try_end_29
.catch Ljava/lang/NullPointerException; {:try_start_4 .. :try_end_29} :catch_2f
.catch Ljava/util/regex/PatternSyntaxException; {:try_start_4 .. :try_end_29} :catch_2d
:cond_29
:goto_29
return-object v0
:cond_2a
add-int/lit8 v1, v1, -0x1
goto :goto_11
:catch_2d
move-exception v1
goto :goto_29
:catch_2f
move-exception v1
goto :goto_29
.end method
.method private a(Landroid/content/Context;Ljava/lang/Throwable;)Lorg/json/JSONArray;
.registers 7
const/4 v2, 0x0
const/4 v0, 0x0
const-string v1, "jpush_uncaughtexception_file"
invoke-static {p1, v1}, Lcn/jiguang/as/e;->a(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
move-result-object v1
invoke-static {v1}, Lcn/jiguang/as/e;->b(Ljava/io/File;)Ljava/lang/String;
move-result-object v3
invoke-static {v3}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-nez v1, :cond_25
:try_start_12
new-instance v1, Lorg/json/JSONArray;
invoke-direct {v1, v3}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V
:try_end_17
.catch Lorg/json/JSONException; {:try_start_12 .. :try_end_17} :catch_20
:try_start_17
invoke-virtual {v3}, Ljava/lang/String;->length()I
:try_end_1a
.catch Lorg/json/JSONException; {:try_start_17 .. :try_end_1a} :catch_23
move-result v0
:goto_1b
invoke-direct {p0, p1, v1, v0, p2}, Lcn/jiguang/b/a;->a(Landroid/content/Context;Lorg/json/JSONArray;ILjava/lang/Throwable;)Lorg/json/JSONArray;
move-result-object v0
return-object v0
:catch_20
move-exception v1
move-object v1, v2
goto :goto_1b
:catch_23
move-exception v2
goto :goto_1b
:cond_25
move-object v1, v2
goto :goto_1b
.end method
.method private a(Landroid/content/Context;Lorg/json/JSONArray;ILjava/lang/Throwable;)Lorg/json/JSONArray;
.registers 16
const-wide/16 v6, -0x1
const/4 v1, 0x0
const/4 v4, 0x0
invoke-static {}, Ljava/lang/System;->currentTimeMillis()J
move-result-wide v2
invoke-static {p1}, Lcn/jiguang/e/c;->c(Landroid/content/Context;)J
move-result-wide v8
add-long/2addr v8, v2
new-instance v0, Ljava/io/StringWriter;
invoke-direct {v0}, Ljava/io/StringWriter;-><init>()V
new-instance v2, Ljava/io/PrintWriter;
invoke-direct {v2, v0}, Ljava/io/PrintWriter;-><init>(Ljava/io/Writer;)V
invoke-virtual {p4, v2}, Ljava/lang/Throwable;->printStackTrace(Ljava/io/PrintWriter;)V
invoke-virtual {v0}, Ljava/io/StringWriter;->toString()Ljava/lang/String;
move-result-object v3
if-nez p2, :cond_25
new-instance p2, Lorg/json/JSONArray;
invoke-direct {p2}, Lorg/json/JSONArray;-><init>()V
:cond_25
move v2, v4
:goto_26
:try_start_26
invoke-virtual {p2}, Lorg/json/JSONArray;->length()I
move-result v0
if-ge v2, v0, :cond_ea
invoke-virtual {p2, v2}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;
move-result-object v0
if-eqz v0, :cond_b8
const-string v5, "stacktrace"
invoke-virtual {v0, v5}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;
move-result-object v5
invoke-virtual {v3, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v5
if-eqz v5, :cond_b8
const-string v1, "count"
invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I
move-result v1
add-int/lit8 v1, v1, 0x1
const-string v2, "count"
invoke-virtual {v0, v2, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
const-string v1, "crashtime"
invoke-virtual {v0, v1, v8, v9}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;
:goto_50
if-nez v0, :cond_b7
new-instance v10, Lorg/json/JSONObject;
invoke-direct {v10}, Lorg/json/JSONObject;-><init>()V
const-string v0, "crashtime"
invoke-virtual {v10, v0, v8, v9}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;
const-string v0, "stacktrace"
invoke-virtual {v10, v0, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v0, "message"
invoke-static {p4}, Lcn/jiguang/b/a;->a(Ljava/lang/Throwable;)Ljava/lang/String;
move-result-object v1
invoke-virtual {v10, v0, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v0, "count"
const/4 v1, 0x1
invoke-virtual {v10, v0, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
const-string v0, "networktype"
invoke-static {p1}, Lcn/jiguang/ap/a;->i(Landroid/content/Context;)Ljava/lang/String;
move-result-object v1
invoke-virtual {v10, v0, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v1
const/4 v2, 0x1
invoke-virtual {v0, v1, v2}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v1
if-eqz v1, :cond_a7
iget-object v0, v1, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String;
if-nez v0, :cond_bd
const-string v0, "null"
:goto_8e
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
iget v1, v1, Landroid/content/pm/PackageInfo;->versionCode:I
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
const-string v2, "versionname"
invoke-virtual {v10, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v0, "versioncode"
invoke-virtual {v10, v0, v1}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
:cond_a7
invoke-virtual {v10}, Lorg/json/JSONObject;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/String;->length()I
move-result v0
add-int/2addr v0, p3
sget v1, Lcn/jiguang/b/a;->c:I
if-ge v0, v1, :cond_c0
invoke-virtual {p2, v10}, Lorg/json/JSONArray;->put(Ljava/lang/Object;)Lorg/json/JSONArray;
:cond_b7
:goto_b7
return-object p2
:cond_b8
add-int/lit8 v0, v2, 0x1
move v2, v0
goto/16 :goto_26
:cond_bd
iget-object v0, v1, Landroid/content/pm/PackageInfo;->versionName:Ljava/lang/String;
goto :goto_8e
:cond_c0
move-wide v0, v6
move v5, v4
:goto_c2
invoke-virtual {p2}, Lorg/json/JSONArray;->length()I
move-result v2
if-ge v5, v2, :cond_e2
invoke-virtual {p2, v5}, Lorg/json/JSONArray;->optJSONObject(I)Lorg/json/JSONObject;
move-result-object v2
if-eqz v2, :cond_e8
const-string v3, "crashtime"
invoke-virtual {v2, v3}, Lorg/json/JSONObject;->optLong(Ljava/lang/String;)J
move-result-wide v2
cmp-long v8, v0, v6
if-eqz v8, :cond_dc
cmp-long v8, v2, v0
if-gez v8, :cond_e8
:cond_dc
move-wide v0, v2
move v2, v5
:goto_de
add-int/lit8 v5, v5, 0x1
move v4, v2
goto :goto_c2
:cond_e2
invoke-virtual {p2, v4, v10}, Lorg/json/JSONArray;->put(ILjava/lang/Object;)Lorg/json/JSONArray;
:try_end_e5
.catch Ljava/lang/Throwable; {:try_start_26 .. :try_end_e5} :catch_e6
goto :goto_b7
:catch_e6
move-exception v0
goto :goto_b7
:cond_e8
move v2, v4
goto :goto_de
:cond_ea
move-object v0, v1
goto/16 :goto_50
.end method
.method static synthetic a(Lcn/jiguang/b/a;Landroid/content/Context;)Lorg/json/JSONObject;
.registers 3
invoke-static {p1}, Lcn/jiguang/b/a;->d(Landroid/content/Context;)Lorg/json/JSONObject;
move-result-object v0
return-object v0
.end method
.method public static a(Landroid/content/Context;)V
.registers 3
if-nez p0, :cond_a
const-string v0, "JPushCrashHandler"
const-string v1, "Action - deleteCrashLog context is null"
invoke-static {v0, v1}, Lcn/jiguang/ac/d;->f(Ljava/lang/String;Ljava/lang/String;)V
:goto_9
return-void
:cond_a
const-string v0, "jpush_uncaughtexception_file"
invoke-static {p0, v0}, Lcn/jiguang/as/e;->a(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
move-result-object v0
invoke-static {v0}, Lcn/jiguang/as/e;->a(Ljava/io/File;)V
goto :goto_9
.end method
.method private static c(Landroid/content/Context;)Lorg/json/JSONArray;
.registers 4
const/4 v0, 0x0
const-string v1, "jpush_uncaughtexception_file"
invoke-static {p0, v1}, Lcn/jiguang/as/e;->a(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
move-result-object v1
invoke-static {v1}, Lcn/jiguang/as/e;->b(Ljava/io/File;)Ljava/lang/String;
move-result-object v2
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-eqz v1, :cond_12
:goto_11
return-object v0
:cond_12
:try_start_12
new-instance v1, Lorg/json/JSONArray;
invoke-direct {v1, v2}, Lorg/json/JSONArray;-><init>(Ljava/lang/String;)V
:try_end_17
.catch Lorg/json/JSONException; {:try_start_12 .. :try_end_17} :catch_19
move-object v0, v1
goto :goto_11
:catch_19
move-exception v1
goto :goto_11
.end method
.method private static d(Landroid/content/Context;)Lorg/json/JSONObject;
.registers 5
const/4 v1, 0x0
invoke-static {p0}, Lcn/jiguang/b/a;->c(Landroid/content/Context;)Lorg/json/JSONArray;
move-result-object v0
if-nez v0, :cond_9
move-object v0, v1
:goto_8
return-object v0
:cond_9
new-instance v2, Lorg/json/JSONObject;
invoke-direct {v2}, Lorg/json/JSONObject;-><init>()V
:try_start_e
const-string v3, "crashlogs"
invoke-virtual {v2, v3, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v0, "network_type"
invoke-static {p0}, Lcn/jiguang/ap/a;->i(Landroid/content/Context;)Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v0, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
const-string v0, "crash_log"
invoke-static {p0, v2, v0}, Lcn/jiguang/ad/k;->a(Landroid/content/Context;Lorg/json/JSONObject;Ljava/lang/String;)Lorg/json/JSONObject;
invoke-static {p0}, Lcn/jiguang/ab/f;->d(Landroid/content/Context;)Ljava/lang/Object;
move-result-object v0
instance-of v3, v0, Lorg/json/JSONObject;
if-eqz v3, :cond_3c
check-cast v0, Lorg/json/JSONObject;
:goto_2b
if-eqz v0, :cond_38
invoke-virtual {v0}, Lorg/json/JSONObject;->length()I
move-result v1
if-lez v1, :cond_38
const-string v1, "device_info"
invoke-virtual {v2, v1, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;
:try_end_38
.catch Ljava/lang/Exception; {:try_start_e .. :try_end_38} :catch_3a
:cond_38
:goto_38
move-object v0, v2
goto :goto_8
:catch_3a
move-exception v0
goto :goto_38
:cond_3c
move-object v0, v1
goto :goto_2b
.end method
# virtual methods
.method public final b()V
.registers 2
iget-object v0, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
if-nez v0, :cond_a
invoke-static {}, Ljava/lang/Thread;->getDefaultUncaughtExceptionHandler()Ljava/lang/Thread$UncaughtExceptionHandler;
move-result-object v0
iput-object v0, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
:cond_a
invoke-static {p0}, Ljava/lang/Thread;->setDefaultUncaughtExceptionHandler(Ljava/lang/Thread$UncaughtExceptionHandler;)V
return-void
.end method
.method public final b(Landroid/content/Context;)V
.registers 6
if-nez p1, :cond_a
const-string v0, "JPushCrashHandler"
const-string v1, "Action - reportCrashLog context is null"
invoke-static {v0, v1}, Lcn/jiguang/ac/d;->f(Ljava/lang/String;Ljava/lang/String;)V
:cond_9
:goto_9
return-void
:cond_a
invoke-static {p1}, Lcn/jiguang/e/c;->a(Landroid/content/Context;)Z
move-result v0
if-eqz v0, :cond_9
:try_start_10
new-instance v0, Lcn/jiguang/b/b;
invoke-direct {v0, p0}, Lcn/jiguang/b/b;-><init>(Lcn/jiguang/b/a;)V
invoke-virtual {v0}, Lcn/jiguang/b/b;->start()V
:try_end_18
.catch Ljava/lang/Throwable; {:try_start_10 .. :try_end_18} :catch_19
goto :goto_9
:catch_19
move-exception v0
const-string v1, "JPushCrashHandler"
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "report crash e:"
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v1, v0}, Lcn/jiguang/ac/d;->h(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_9
.end method
.method public final uncaughtException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
.registers 7
const/4 v0, 0x0
iget-boolean v1, p0, Lcn/jiguang/b/a;->a:Z
if-eqz v1, :cond_6d
const-string v1, "JPushCrashHandler"
const-string v2, "enable crash report"
invoke-static {v1, v2}, Lcn/jiguang/ac/d;->a(Ljava/lang/String;Ljava/lang/String;)V
iget-boolean v1, p0, Lcn/jiguang/b/a;->a:Z
if-eqz v1, :cond_34
invoke-static {v0}, Lcn/jiguang/a/a;->a(Landroid/content/Context;)Landroid/content/Context;
move-result-object v1
if-eqz v1, :cond_4f
invoke-direct {p0, v1, p2}, Lcn/jiguang/b/a;->a(Landroid/content/Context;Ljava/lang/Throwable;)Lorg/json/JSONArray;
move-result-object v2
invoke-static {v1}, Lcn/jiguang/b/a;->a(Landroid/content/Context;)V
if-eqz v2, :cond_23
invoke-virtual {v2}, Lorg/json/JSONArray;->toString()Ljava/lang/String;
move-result-object v0
:cond_23
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_34
const-string v2, "jpush_uncaughtexception_file"
invoke-static {v1, v2}, Lcn/jiguang/as/e;->a(Landroid/content/Context;Ljava/lang/String;)Ljava/io/File;
move-result-object v1
if-eqz v1, :cond_34
invoke-static {v1, v0}, Lcn/jiguang/as/e;->a(Ljava/io/File;Ljava/lang/String;)Z
:cond_34
:goto_34
:try_start_34
new-instance v0, Lcn/jiguang/b/b;
invoke-direct {v0, p0}, Lcn/jiguang/b/b;-><init>(Lcn/jiguang/b/a;)V
invoke-virtual {v0}, Lcn/jiguang/b/b;->start()V
const-wide/16 v2, 0x7d0
invoke-virtual {v0, v2, v3}, Lcn/jiguang/b/b;->join(J)V
:try_end_41
.catch Ljava/lang/InterruptedException; {:try_start_34 .. :try_end_41} :catch_75
.catch Ljava/lang/Throwable; {:try_start_34 .. :try_end_41} :catch_57
:goto_41
iget-object v0, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
if-eq v0, p0, :cond_4e
iget-object v0, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
if-eqz v0, :cond_4e
iget-object v0, p0, Lcn/jiguang/b/a;->d:Ljava/lang/Thread$UncaughtExceptionHandler;
invoke-interface {v0, p1, p2}, Ljava/lang/Thread$UncaughtExceptionHandler;->uncaughtException(Ljava/lang/Thread;Ljava/lang/Throwable;)V
:cond_4e
return-void
:cond_4f
const-string v0, "JPushCrashHandler"
const-string v1, "handleException failed: context is null"
invoke-static {v0, v1}, Lcn/jiguang/ac/d;->h(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_34
:catch_57
move-exception v0
const-string v1, "JPushCrashHandler"
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "report crash e:"
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-static {v1, v0}, Lcn/jiguang/ac/d;->h(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_41
:cond_6d
const-string v0, "JPushCrashHandler"
const-string v1, "disable crash report"
invoke-static {v0, v1}, Lcn/jiguang/ac/d;->a(Ljava/lang/String;Ljava/lang/String;)V
goto :goto_41
:catch_75
move-exception v0
goto :goto_41
.end method