i.smali

.class public abstract Lcom/baidu/techain/v/i;
.super Ljava/lang/Object;


# static fields
.field private static a:Ljava/lang/Object;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    new-instance v0, Ljava/lang/Object;

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

    sput-object v0, Lcom/baidu/techain/v/i;->a:Ljava/lang/Object;

    return-void
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;)Lorg/json/JSONObject;
    .registers 9

    .prologue
    const/4 v0, 0x0

    .line 0
    sget-object v3, Lcom/baidu/techain/v/i;->a:Ljava/lang/Object;

    monitor-enter v3

    :try_start_4
    invoke-static {p0, p1}, Lcom/baidu/techain/v/i;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Landroid/content/Context;->openFileInput(Ljava/lang/String;)Ljava/io/FileInputStream;
    :try_end_b
    .catch Ljava/io/FileNotFoundException; {:try_start_4 .. :try_end_b} :catch_c7
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_b} :catch_77
    .catch Lorg/json/JSONException; {:try_start_4 .. :try_end_b} :catch_90
    .catchall {:try_start_4 .. :try_end_b} :catchall_ac

    move-result-object v2

    :try_start_c
    new-instance v1, Lcom/baidu/techain/v/b;

    const/16 v4, 0x800

    invoke-direct {v1, v4}, Lcom/baidu/techain/v/b;-><init>(I)V

    const/16 v4, 0x800

    new-array v4, v4, [B

    :goto_17
    invoke-virtual {v2, v4}, Ljava/io/FileInputStream;->read([B)I

    move-result v5

    const/4 v6, -0x1

    if-eq v5, v6, :cond_32

    invoke-virtual {v1, v4, v5}, Lcom/baidu/techain/v/b;->a([BI)V
    :try_end_21
    .catch Ljava/io/FileNotFoundException; {:try_start_c .. :try_end_21} :catch_22
    .catch Ljava/io/IOException; {:try_start_c .. :try_end_21} :catch_c5
    .catch Lorg/json/JSONException; {:try_start_c .. :try_end_21} :catch_c3
    .catchall {:try_start_c .. :try_end_21} :catchall_be

    goto :goto_17

    :catch_22
    move-exception v1

    move-object v1, v2

    :goto_24
    :try_start_24
    const-string v2, "StorageUtil"

    const-string v4, "getInfoFromFile(): is not found file"

    invoke-static {v2, v4}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_2b
    .catchall {:try_start_24 .. :try_end_2b} :catchall_c0

    if-eqz v1, :cond_30

    :try_start_2d
    invoke-virtual {v1}, Ljava/io/FileInputStream;->close()V
    :try_end_30
    .catch Ljava/io/IOException; {:try_start_2d .. :try_end_30} :catch_6e
    .catchall {:try_start_2d .. :try_end_30} :catchall_3d

    :cond_30
    :goto_30
    :try_start_30
    monitor-exit v3
    :try_end_31
    .catchall {:try_start_30 .. :try_end_31} :catchall_3d

    :goto_31
    return-object v0

    .line 1000
    :cond_32
    :try_start_32
    iget v4, v1, Lcom/baidu/techain/v/b;->a:I
    :try_end_34
    .catch Ljava/io/FileNotFoundException; {:try_start_32 .. :try_end_34} :catch_22
    .catch Ljava/io/IOException; {:try_start_32 .. :try_end_34} :catch_c5
    .catch Lorg/json/JSONException; {:try_start_32 .. :try_end_34} :catch_c3
    .catchall {:try_start_32 .. :try_end_34} :catchall_be

    .line 0
    if-nez v4, :cond_49

    if-eqz v2, :cond_3b

    :try_start_38
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_3b
    .catch Ljava/io/IOException; {:try_start_38 .. :try_end_3b} :catch_40
    .catchall {:try_start_38 .. :try_end_3b} :catchall_3d

    :cond_3b
    :goto_3b
    :try_start_3b
    monitor-exit v3

    goto :goto_31

    :catchall_3d
    move-exception v0

    monitor-exit v3
    :try_end_3f
    .catchall {:try_start_3b .. :try_end_3f} :catchall_3d

    throw v0

    :catch_40
    move-exception v1

    :try_start_41
    const-string v1, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_48
    .catchall {:try_start_41 .. :try_end_48} :catchall_3d

    goto :goto_3b

    :cond_49
    :try_start_49
    new-instance v4, Ljava/lang/String;

    invoke-virtual {v1}, Lcom/baidu/techain/v/b;->a()[B

    move-result-object v1

    const-string v5, "UTF-8"

    invoke-direct {v4, v1, v5}, Ljava/lang/String;-><init>([BLjava/lang/String;)V

    invoke-static {v4, p0}, Lcom/baidu/techain/v/j;->a(Ljava/lang/String;Landroid/content/Context;)Ljava/lang/String;

    move-result-object v4

    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, v4}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
    :try_end_5d
    .catch Ljava/io/FileNotFoundException; {:try_start_49 .. :try_end_5d} :catch_22
    .catch Ljava/io/IOException; {:try_start_49 .. :try_end_5d} :catch_c5
    .catch Lorg/json/JSONException; {:try_start_49 .. :try_end_5d} :catch_c3
    .catchall {:try_start_49 .. :try_end_5d} :catchall_be

    if-eqz v2, :cond_62

    :try_start_5f
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_62
    .catch Ljava/io/IOException; {:try_start_5f .. :try_end_62} :catch_65
    .catchall {:try_start_5f .. :try_end_62} :catchall_3d

    :cond_62
    :goto_62
    :try_start_62
    monitor-exit v3

    move-object v0, v1

    goto :goto_31

    :catch_65
    move-exception v0

    const-string v0, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v0, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_62

    :catch_6e
    move-exception v1

    const-string v1, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_76
    .catchall {:try_start_62 .. :try_end_76} :catchall_3d

    goto :goto_30

    :catch_77
    move-exception v1

    move-object v2, v0

    :goto_79
    :try_start_79
    const-string v1, "StorageUtil"

    const-string v4, "getInfoFromFile(): IOException"

    invoke-static {v1, v4}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_80
    .catchall {:try_start_79 .. :try_end_80} :catchall_be

    if-eqz v2, :cond_85

    :try_start_82
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_85
    .catch Ljava/io/IOException; {:try_start_82 .. :try_end_85} :catch_87
    .catchall {:try_start_82 .. :try_end_85} :catchall_3d

    :cond_85
    :goto_85
    :try_start_85
    monitor-exit v3

    goto :goto_31

    :catch_87
    move-exception v1

    const-string v1, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_8f
    .catchall {:try_start_85 .. :try_end_8f} :catchall_3d

    goto :goto_85

    :catch_90
    move-exception v1

    move-object v2, v0

    :goto_92
    :try_start_92
    const-string v1, "StorageUtil"

    const-string v4, "getInfoFromFile(): JSONException"

    invoke-static {v1, v4}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    invoke-static {p0, p1}, Lcom/baidu/techain/v/i;->b(Landroid/content/Context;Ljava/lang/String;)V
    :try_end_9c
    .catchall {:try_start_92 .. :try_end_9c} :catchall_be

    if-eqz v2, :cond_a1

    :try_start_9e
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_a1
    .catch Ljava/io/IOException; {:try_start_9e .. :try_end_a1} :catch_a3
    .catchall {:try_start_9e .. :try_end_a1} :catchall_3d

    :cond_a1
    :goto_a1
    :try_start_a1
    monitor-exit v3

    goto :goto_31

    :catch_a3
    move-exception v1

    const-string v1, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_ab
    .catchall {:try_start_a1 .. :try_end_ab} :catchall_3d

    goto :goto_a1

    :catchall_ac
    move-exception v1

    move-object v2, v0

    move-object v0, v1

    :goto_af
    if-eqz v2, :cond_b4

    :try_start_b1
    invoke-virtual {v2}, Ljava/io/FileInputStream;->close()V
    :try_end_b4
    .catch Ljava/io/IOException; {:try_start_b1 .. :try_end_b4} :catch_b5
    .catchall {:try_start_b1 .. :try_end_b4} :catchall_3d

    :cond_b4
    :goto_b4
    :try_start_b4
    throw v0

    :catch_b5
    move-exception v1

    const-string v1, "StorageUtil"

    const-string v2, "IOException happened when getInfoFromFile\'s FileOutputStream close"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_bd
    .catchall {:try_start_b4 .. :try_end_bd} :catchall_3d

    goto :goto_b4

    :catchall_be
    move-exception v0

    goto :goto_af

    :catchall_c0
    move-exception v0

    move-object v2, v1

    goto :goto_af

    :catch_c3
    move-exception v1

    goto :goto_92

    :catch_c5
    move-exception v1

    goto :goto_79

    :catch_c7
    move-exception v1

    move-object v1, v0

    goto/16 :goto_24
.end method

.method public static a(Landroid/content/Context;Lorg/json/JSONObject;Ljava/lang/String;)V
    .registers 8

    invoke-static {p0, p2}, Lcom/baidu/techain/v/i;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    const/4 v0, 0x0

    sget-object v2, Lcom/baidu/techain/v/i;->a:Ljava/lang/Object;

    monitor-enter v2

    const/4 v3, 0x0

    :try_start_9
    invoke-virtual {p0, v1, v3}, Landroid/content/Context;->openFileOutput(Ljava/lang/String;I)Ljava/io/FileOutputStream;
    :try_end_c
    .catch Ljava/io/FileNotFoundException; {:try_start_9 .. :try_end_c} :catch_34
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_c} :catch_4b
    .catchall {:try_start_9 .. :try_end_c} :catchall_62

    move-result-object v0

    :try_start_d
    invoke-virtual {p1}, Lorg/json/JSONObject;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1, p0}, Lcom/baidu/techain/v/j;->b(Ljava/lang/String;Landroid/content/Context;)Ljava/lang/String;

    move-result-object v1

    const-string v3, "UTF-8"

    invoke-virtual {v1, v3}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/io/FileOutputStream;->write([B)V

    invoke-virtual {v0}, Ljava/io/FileOutputStream;->flush()V
    :try_end_21
    .catch Ljava/io/FileNotFoundException; {:try_start_d .. :try_end_21} :catch_34
    .catch Ljava/io/IOException; {:try_start_d .. :try_end_21} :catch_4b
    .catchall {:try_start_d .. :try_end_21} :catchall_75

    if-eqz v0, :cond_26

    :try_start_23
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_26
    .catch Ljava/io/IOException; {:try_start_23 .. :try_end_26} :catch_28
    .catchall {:try_start_23 .. :try_end_26} :catchall_31

    :cond_26
    :goto_26
    :try_start_26
    monitor-exit v2

    return-void

    :catch_28
    move-exception v0

    const-string v0, "StorageUtil"

    const-string v1, "IOException happened when saveInfoToFile\'s FileOutputStream close"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_26

    :catchall_31
    move-exception v0

    monitor-exit v2
    :try_end_33
    .catchall {:try_start_26 .. :try_end_33} :catchall_31

    throw v0

    :catch_34
    move-exception v1

    :try_start_35
    const-string v1, "StorageUtil"

    const-string v3, "saveInfoToFile(): is not found file"

    invoke-static {v1, v3}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_3c
    .catchall {:try_start_35 .. :try_end_3c} :catchall_75

    if-eqz v0, :cond_26

    :try_start_3e
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_41
    .catch Ljava/io/IOException; {:try_start_3e .. :try_end_41} :catch_42
    .catchall {:try_start_3e .. :try_end_41} :catchall_31

    goto :goto_26

    :catch_42
    move-exception v0

    :try_start_43
    const-string v0, "StorageUtil"

    const-string v1, "IOException happened when saveInfoToFile\'s FileOutputStream close"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_4a
    .catchall {:try_start_43 .. :try_end_4a} :catchall_31

    goto :goto_26

    :catch_4b
    move-exception v1

    :try_start_4c
    const-string v1, "StorageUtil"

    const-string v3, "saveInfoToFile(): IOException"

    invoke-static {v1, v3}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_53
    .catchall {:try_start_4c .. :try_end_53} :catchall_75

    if-eqz v0, :cond_26

    :try_start_55
    invoke-virtual {v0}, Ljava/io/FileOutputStream;->close()V
    :try_end_58
    .catch Ljava/io/IOException; {:try_start_55 .. :try_end_58} :catch_59
    .catchall {:try_start_55 .. :try_end_58} :catchall_31

    goto :goto_26

    :catch_59
    move-exception v0

    :try_start_5a
    const-string v0, "StorageUtil"

    const-string v1, "IOException happened when saveInfoToFile\'s FileOutputStream close"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_61
    .catchall {:try_start_5a .. :try_end_61} :catchall_31

    goto :goto_26

    :catchall_62
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    :goto_66
    if-eqz v1, :cond_6b

    :try_start_68
    invoke-virtual {v1}, Ljava/io/FileOutputStream;->close()V
    :try_end_6b
    .catch Ljava/io/IOException; {:try_start_68 .. :try_end_6b} :catch_6c
    .catchall {:try_start_68 .. :try_end_6b} :catchall_31

    :cond_6b
    :goto_6b
    :try_start_6b
    throw v0

    :catch_6c
    move-exception v1

    const-string v1, "StorageUtil"

    const-string v3, "IOException happened when saveInfoToFile\'s FileOutputStream close"

    invoke-static {v1, v3}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_74
    .catchall {:try_start_6b .. :try_end_74} :catchall_31

    goto :goto_6b

    :catchall_75
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    goto :goto_66
.end method

.method public static b(Landroid/content/Context;Ljava/lang/String;)V
    .registers 4

    sget-object v1, Lcom/baidu/techain/v/i;->a:Ljava/lang/Object;

    monitor-enter v1

    :try_start_3
    invoke-static {p0, p1}, Lcom/baidu/techain/v/i;->c(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {p0, v0}, Landroid/content/Context;->deleteFile(Ljava/lang/String;)Z

    monitor-exit v1

    return-void

    :catchall_c
    move-exception v0

    monitor-exit v1
    :try_end_e
    .catchall {:try_start_3 .. :try_end_e} :catchall_c

    throw v0
.end method

.method private static c(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;
    .registers 5

    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v0

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "hianalytics_"

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

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

    move-result-object v1

    const-string v2, "_"

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

    move-result-object v1

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

    move-result-object v0

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

    move-result-object v0

    return-object v0
.end method