.class public Lcom/amap/api/mapcore2d/db;
.super Lcom/amap/api/mapcore2d/de;
.source "AnrLogProcessor.java"


# static fields
.field private static a:Z = true


# instance fields
.field private b:[Ljava/lang/String;

.field private c:I

.field private d:Z

.field private e:I


# direct methods
.method static constructor <clinit>()V
    .locals 0

    return-void
.end method

.method protected constructor <init>(I)V
    .locals 0

    .line 30
    invoke-direct {p0, p1}, Lcom/amap/api/mapcore2d/de;-><init>(I)V

    const/16 p1, 0xa

    .line 66
    new-array p1, p1, [Ljava/lang/String;

    iput-object p1, p0, Lcom/amap/api/mapcore2d/db;->b:[Ljava/lang/String;

    const/4 p1, 0x0

    .line 67
    iput p1, p0, Lcom/amap/api/mapcore2d/db;->c:I

    .line 68
    iput-boolean p1, p0, Lcom/amap/api/mapcore2d/db;->d:Z

    .line 69
    iput p1, p0, Lcom/amap/api/mapcore2d/db;->e:I

    return-void
.end method

.method private b(Ljava/lang/String;)V
    .locals 2

    .line 184
    :try_start_0
    iget v0, p0, Lcom/amap/api/mapcore2d/db;->c:I

    const/16 v1, 0x9

    if-le v0, v1, :cond_0

    const/4 v0, 0x0

    .line 185
    iput v0, p0, Lcom/amap/api/mapcore2d/db;->c:I

    .line 187
    :cond_0
    iget-object v0, p0, Lcom/amap/api/mapcore2d/db;->b:[Ljava/lang/String;

    iget v1, p0, Lcom/amap/api/mapcore2d/db;->c:I

    aput-object p1, v0, v1

    .line 188
    iget p1, p0, Lcom/amap/api/mapcore2d/db;->c:I

    add-int/lit8 p1, p1, 0x1

    iput p1, p0, Lcom/amap/api/mapcore2d/db;->c:I
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception p1

    const-string v0, "ANRWriter"

    const-string v1, "addData"

    .line 190
    invoke-static {p1, v0, v1}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    :goto_0
    return-void
.end method

.method private d()Ljava/lang/String;
    .locals 4

    .line 161
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 164
    :try_start_0
    iget v1, p0, Lcom/amap/api/mapcore2d/db;->c:I

    :goto_0
    const/16 v2, 0xa

    if-ge v1, v2, :cond_1

    const/16 v2, 0x9

    if-le v1, v2, :cond_0

    goto :goto_1

    .line 168
    :cond_0
    iget-object v2, p0, Lcom/amap/api/mapcore2d/db;->b:[Ljava/lang/String;

    aget-object v2, v2, v1

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_1
    :goto_1
    const/4 v1, 0x0

    .line 170
    :goto_2
    iget v2, p0, Lcom/amap/api/mapcore2d/db;->c:I

    if-ge v1, v2, :cond_2

    .line 171
    iget-object v2, p0, Lcom/amap/api/mapcore2d/db;->b:[Ljava/lang/String;

    aget-object v2, v2, v1

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_0
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0

    add-int/lit8 v1, v1, 0x1

    goto :goto_2

    :catch_0
    move-exception v1

    const-string v2, "ANRWriter"

    const-string v3, "getLogInfo"

    .line 175
    invoke-static {v1, v2, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    .line 179
    :cond_2
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method


# virtual methods
.method protected a(Ljava/util/List;)Ljava/lang/String;
    .locals 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List<",
            "Lcom/amap/api/mapcore2d/ct;",
            ">;)",
            "Ljava/lang/String;"
        }
    .end annotation

    const/4 v0, 0x0

    .line 77
    :try_start_0
    new-instance v1, Ljava/io/File;

    const-string v2, "/data/anr/traces.txt"

    invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 78
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_0

    return-object v0

    .line 81
    :cond_0
    new-instance v2, Ljava/io/FileInputStream;

    invoke-direct {v2, v1}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_0
    .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_f
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_8
    .catchall {:try_start_0 .. :try_end_0} :catchall_1

    .line 82
    :try_start_1
    new-instance v1, Lcom/amap/api/mapcore2d/eh;

    sget-object v3, Lcom/amap/api/mapcore2d/ei;->a:Ljava/nio/charset/Charset;

    invoke-direct {v1, v2, v3}, Lcom/amap/api/mapcore2d/eh;-><init>(Ljava/io/InputStream;Ljava/nio/charset/Charset;)V
    :try_end_1
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_7
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_6
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    const/4 v3, 0x0

    const/4 v4, 0x0

    .line 86
    :cond_1
    :goto_0
    :try_start_2
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->a()Ljava/lang/String;

    move-result-object v5

    const-string v6, "pid"

    .line 87
    invoke-virtual {v5, v6}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v6

    const/4 v7, 0x1

    if-eqz v6, :cond_3

    :goto_1
    const-string v4, "\"main\""

    .line 88
    invoke-virtual {v5, v4}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v4

    if-nez v4, :cond_2

    .line 89
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->a()Ljava/lang/String;

    move-result-object v5

    goto :goto_1

    :cond_2
    const/4 v4, 0x1

    :cond_3
    const-string v6, ""

    .line 94
    invoke-virtual {v5, v6}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_4

    const/4 v4, 0x0

    :cond_4
    if-eqz v4, :cond_1

    .line 98
    invoke-direct {p0, v5}, Lcom/amap/api/mapcore2d/db;->b(Ljava/lang/String;)V

    .line 99
    iget v6, p0, Lcom/amap/api/mapcore2d/db;->e:I

    const/4 v8, 0x5

    if-ne v6, v8, :cond_5

    goto :goto_3

    .line 102
    :cond_5
    iget-boolean v6, p0, Lcom/amap/api/mapcore2d/db;->d:Z

    if-nez v6, :cond_7

    .line 103
    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v6

    :cond_6
    :goto_2
    invoke-interface {v6}, Ljava/util/Iterator;->hasNext()Z

    move-result v7

    if-eqz v7, :cond_1

    invoke-interface {v6}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v7

    check-cast v7, Lcom/amap/api/mapcore2d/ct;

    .line 105
    invoke-virtual {v7}, Lcom/amap/api/mapcore2d/ct;->f()[Ljava/lang/String;

    move-result-object v8

    .line 104
    invoke-static {v8, v5}, Lcom/amap/api/mapcore2d/db;->b([Ljava/lang/String;Ljava/lang/String;)Z

    move-result v8

    iput-boolean v8, p0, Lcom/amap/api/mapcore2d/db;->d:Z

    .line 106
    iget-boolean v8, p0, Lcom/amap/api/mapcore2d/db;->d:Z

    if-eqz v8, :cond_6

    .line 107
    invoke-virtual {p0, v7}, Lcom/amap/api/mapcore2d/db;->a(Lcom/amap/api/mapcore2d/ct;)V

    goto :goto_2

    .line 111
    :cond_7
    iget v5, p0, Lcom/amap/api/mapcore2d/db;->e:I

    add-int/2addr v5, v7

    iput v5, p0, Lcom/amap/api/mapcore2d/db;->e:I
    :try_end_2
    .catch Ljava/io/EOFException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/FileNotFoundException; {:try_start_2 .. :try_end_2} :catch_10
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
    .catchall {:try_start_2 .. :try_end_2} :catchall_2

    goto :goto_0

    :catch_0
    move-exception p1

    goto :goto_5

    .line 130
    :catch_1
    :goto_3
    :try_start_3
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_3
    .catch Ljava/lang/Throwable; {:try_start_3 .. :try_end_3} :catch_2

    goto :goto_4

    :catch_2
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog2"

    .line 136
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_4

    :catch_3
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog1"

    .line 133
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    .line 141
    :goto_4
    :try_start_4
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_4
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_5
    .catch Ljava/lang/Throwable; {:try_start_4 .. :try_end_4} :catch_4

    goto/16 :goto_c

    :catch_4
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v2, "initLog4"

    .line 148
    invoke-static {p1, v1, v2}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_c

    :catch_5
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v2, "initLog3"

    .line 145
    invoke-static {p1, v1, v2}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_c

    :catchall_0
    move-exception p1

    move-object v1, v0

    goto :goto_7

    :catch_6
    move-exception p1

    move-object v1, v0

    goto :goto_5

    :catch_7
    move-object v1, v0

    goto/16 :goto_a

    :catchall_1
    move-exception p1

    move-object v1, v0

    move-object v2, v1

    goto :goto_7

    :catch_8
    move-exception p1

    move-object v1, v0

    move-object v2, v1

    :goto_5
    :try_start_5
    const-string v3, "ANRWriter"

    const-string v4, "initLog"

    .line 125
    invoke-static {p1, v3, v4}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_2

    if-eqz v1, :cond_8

    .line 130
    :try_start_6
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->close()V
    :try_end_6
    .catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_a
    .catch Ljava/lang/Throwable; {:try_start_6 .. :try_end_6} :catch_9

    goto :goto_6

    :catch_9
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog2"

    .line 136
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_6

    :catch_a
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog1"

    .line 133
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    :cond_8
    :goto_6
    if-eqz v2, :cond_c

    .line 141
    :try_start_7
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_7
    .catch Ljava/io/IOException; {:try_start_7 .. :try_end_7} :catch_5
    .catch Ljava/lang/Throwable; {:try_start_7 .. :try_end_7} :catch_4

    goto :goto_c

    :catchall_2
    move-exception p1

    :goto_7
    if-eqz v1, :cond_9

    .line 130
    :try_start_8
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->close()V
    :try_end_8
    .catch Ljava/io/IOException; {:try_start_8 .. :try_end_8} :catch_c
    .catch Ljava/lang/Throwable; {:try_start_8 .. :try_end_8} :catch_b

    goto :goto_8

    :catch_b
    move-exception v0

    const-string v1, "ANRWriter"

    const-string v3, "initLog2"

    .line 136
    invoke-static {v0, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_8

    :catch_c
    move-exception v0

    const-string v1, "ANRWriter"

    const-string v3, "initLog1"

    .line 133
    invoke-static {v0, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    :cond_9
    :goto_8
    if-eqz v2, :cond_a

    .line 141
    :try_start_9
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_9
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_e
    .catch Ljava/lang/Throwable; {:try_start_9 .. :try_end_9} :catch_d

    goto :goto_9

    :catch_d
    move-exception v0

    const-string v1, "ANRWriter"

    const-string v2, "initLog4"

    .line 148
    invoke-static {v0, v1, v2}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_9

    :catch_e
    move-exception v0

    const-string v1, "ANRWriter"

    const-string v2, "initLog3"

    .line 145
    invoke-static {v0, v1, v2}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    .line 128
    :cond_a
    :goto_9
    throw p1

    :catch_f
    move-object v1, v0

    move-object v2, v1

    :catch_10
    :goto_a
    if-eqz v1, :cond_b

    .line 130
    :try_start_a
    invoke-virtual {v1}, Lcom/amap/api/mapcore2d/eh;->close()V
    :try_end_a
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_a} :catch_12
    .catch Ljava/lang/Throwable; {:try_start_a .. :try_end_a} :catch_11

    goto :goto_b

    :catch_11
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog2"

    .line 136
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_b

    :catch_12
    move-exception p1

    const-string v1, "ANRWriter"

    const-string v3, "initLog1"

    .line 133
    invoke-static {p1, v1, v3}, Lcom/amap/api/mapcore2d/cx;->a(Ljava/lang/Throwable;Ljava/lang/String;Ljava/lang/String;)V

    :cond_b
    :goto_b
    if-eqz v2, :cond_c

    .line 141
    :try_start_b
    invoke-virtual {v2}, Ljava/io/InputStream;->close()V
    :try_end_b
    .catch Ljava/io/IOException; {:try_start_b .. :try_end_b} :catch_5
    .catch Ljava/lang/Throwable; {:try_start_b .. :try_end_b} :catch_4

    .line 153
    :cond_c
    :goto_c
    iget-boolean p1, p0, Lcom/amap/api/mapcore2d/db;->d:Z

    if-eqz p1, :cond_d

    .line 154
    invoke-direct {p0}, Lcom/amap/api/mapcore2d/db;->d()Ljava/lang/String;

    move-result-object p1

    return-object p1

    :cond_d
    return-object v0
.end method

.method protected a(Landroid/content/Context;)Z
    .locals 5

    .line 37
    invoke-static {p1}, Lcom/amap/api/mapcore2d/co;->m(Landroid/content/Context;)I

    move-result v0

    const/4 v1, 0x1

    const/4 v2, 0x0

    if-ne v0, v1, :cond_2

    sget-boolean v0, Lcom/amap/api/mapcore2d/db;->a:Z

    if-eqz v0, :cond_2

    .line 39
    sput-boolean v2, Lcom/amap/api/mapcore2d/db;->a:Z

    .line 40
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v0

    monitor-enter v0

    .line 42
    :try_start_0
    new-instance v3, Lcom/amap/api/mapcore2d/dr;

    invoke-direct {v3, p1}, Lcom/amap/api/mapcore2d/dr;-><init>(Landroid/content/Context;)V

    .line 46
    invoke-virtual {v3}, Lcom/amap/api/mapcore2d/dr;->a()Lcom/amap/api/mapcore2d/ds;

    move-result-object p1

    if-nez p1, :cond_0

    .line 49
    monitor-exit v0

    return v1

    .line 52
    :cond_0
    invoke-virtual {p1}, Lcom/amap/api/mapcore2d/ds;->c()Z

    move-result v4

    if-eqz v4, :cond_1

    .line 53
    invoke-virtual {p1, v2}, Lcom/amap/api/mapcore2d/ds;->c(Z)V

    .line 54
    invoke-virtual {v3, p1}, Lcom/amap/api/mapcore2d/dr;->a(Lcom/amap/api/mapcore2d/ds;)V

    .line 55
    monitor-exit v0

    return v1

    .line 57
    :cond_1
    monitor-exit v0

    return v2

    :catchall_0
    move-exception p1

    .line 59
    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1

    :cond_2
    return v2
.end method
