AutoInstallCfg.smali
.class public Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
.super Ljava/lang/Object;
.source "AutoInstallCfg.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg$AICfgEventCfgChange;
}
.end annotation
# static fields
.field private static final CFGFILENAME:Ljava/lang/String; = "autoinstall_acc.json"
.field private static sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
# direct methods
.method static constructor <clinit>()V
.registers 1
.prologue
.line 19
const/4 v0, 0x0
sput-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
return-void
.end method
.method private constructor <init>()V
.registers 1
.prologue
.line 30
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 31
return-void
.end method
.method private copyAssertFileToDest(Landroid/content/Context;Ljava/io/File;)Z
.registers 8
.prologue
const/4 v0, 0x0
.line 94
const/4 v2, 0x0
.line 96
:try_start_2
invoke-virtual {p1}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;
move-result-object v1
const-string v3, "autoinstall_acc.json"
const/4 v4, 0x0
invoke-virtual {v1, v3, v4}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;I)Ljava/io/InputStream;
move-result-object v2
.line 97
invoke-static {v2, p2}, Lcom/cleanmaster/hpsharelib/service/acc4install/CFileUtil;->copyFile(Ljava/io/InputStream;Ljava/io/File;)Z
:try_end_10
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_10} :catch_1c
.catchall {:try_start_2 .. :try_end_10} :catchall_2b
move-result v0
.line 101
if-eqz v2, :cond_16
.line 103
:try_start_13
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
:try_end_16
.catch Ljava/io/IOException; {:try_start_13 .. :try_end_16} :catch_17
.line 110
:cond_16
:goto_16
return v0
.line 104
:catch_17
move-exception v1
.line 105
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_16
.line 98
:catch_1c
move-exception v1
.line 99
:try_start_1d
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
:try_end_20
.catchall {:try_start_1d .. :try_end_20} :catchall_2b
.line 101
if-eqz v2, :cond_16
.line 103
:try_start_22
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
:try_end_25
.catch Ljava/io/IOException; {:try_start_22 .. :try_end_25} :catch_26
goto :goto_16
.line 104
:catch_26
move-exception v1
.line 105
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_16
.line 101
:catchall_2b
move-exception v0
if-eqz v2, :cond_31
.line 103
:try_start_2e
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
:try_end_31
.catch Ljava/io/IOException; {:try_start_2e .. :try_end_31} :catch_32
.line 106
:cond_31
:goto_31
throw v0
.line 104
:catch_32
move-exception v1
.line 105
invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V
goto :goto_31
.end method
.method private static fetchJsonStrFromFile(Ljava/io/File;)Ljava/lang/String;
.registers 4
.prologue
.line 114
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
.line 116
:try_start_5
new-instance v0, Ljava/io/BufferedReader;
new-instance v2, Ljava/io/FileReader;
invoke-direct {v2, p0}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V
invoke-direct {v0, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
.line 118
:goto_f
invoke-virtual {v0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object v2
if-eqz v2, :cond_1d
.line 119
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
:try_end_18
.catch Ljava/io/IOException; {:try_start_5 .. :try_end_18} :catch_19
goto :goto_f
.line 121
:catch_19
move-exception v0
.line 122
invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
.line 124
:cond_1d
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public static getInstance()Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
.registers 2
.prologue
.line 34
sget-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
if-eqz v0, :cond_7
.line 35
sget-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
.line 41
:goto_6
return-object v0
.line 36
:cond_7
const-class v1, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
monitor-enter v1
.line 37
:try_start_a
sget-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
if-nez v0, :cond_15
.line 38
new-instance v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
invoke-direct {v0}, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;-><init>()V
sput-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
.line 40
:cond_15
monitor-exit v1
:try_end_16
.catchall {:try_start_a .. :try_end_16} :catchall_19
.line 41
sget-object v0, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->sInstance:Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;
goto :goto_6
.line 40
:catchall_19
move-exception v0
:try_start_1a
monitor-exit v1
:try_end_1b
.catchall {:try_start_1a .. :try_end_1b} :catchall_19
throw v0
.end method
# virtual methods
.method public load(Landroid/content/Context;)V
.registers 4
.prologue
.line 45
if-nez p1, :cond_3
.line 87
:goto_2
return-void
.line 47
:cond_3
monitor-enter p0
.line 48
:try_start_4
const-string v0, "autoinstall_acc.json"
invoke-virtual {p1, v0}, Landroid/content/Context;->getFileStreamPath(Ljava/lang/String;)Ljava/io/File;
move-result-object v0
.line 49
invoke-virtual {v0}, Ljava/io/File;->exists()Z
move-result v1
if-nez v1, :cond_21
.line 50
invoke-direct {p0, p1, v0}, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->copyAssertFileToDest(Landroid/content/Context;Ljava/io/File;)Z
move-result v0
if-nez v0, :cond_1b
.line 52
monitor-exit p0
goto :goto_2
.line 86
:catchall_18
move-exception v0
monitor-exit p0
:try_end_1a
.catchall {:try_start_4 .. :try_end_1a} :catchall_18
throw v0
.line 54
:cond_1b
:try_start_1b
const-string v0, "autoinstall_acc.json"
invoke-virtual {p1, v0}, Landroid/content/Context;->getFileStreamPath(Ljava/lang/String;)Ljava/io/File;
move-result-object v0
.line 56
:cond_21
invoke-virtual {v0}, Ljava/io/File;->exists()Z
move-result v1
if-nez v1, :cond_29
.line 57
monitor-exit p0
goto :goto_2
.line 61
:cond_29
invoke-static {v0}, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->fetchJsonStrFromFile(Ljava/io/File;)Ljava/lang/String;
move-result-object v0
.line 62
if-eqz v0, :cond_35
invoke-virtual {v0}, Ljava/lang/String;->length()I
move-result v1
if-nez v1, :cond_37
.line 63
:cond_35
monitor-exit p0
:try_end_36
.catchall {:try_start_1b .. :try_end_36} :catchall_18
goto :goto_2
.line 70
:cond_37
:try_start_37
new-instance v1, Lorg/json/JSONObject;
invoke-direct {v1, v0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V
:try_end_3c
.catch Lorg/json/JSONException; {:try_start_37 .. :try_end_3c} :catch_47
.catch Ljava/lang/Exception; {:try_start_37 .. :try_end_3c} :catch_4d
.catchall {:try_start_37 .. :try_end_3c} :catchall_18
.line 80
:try_start_3c
invoke-static {}, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallPolicyFactory;->getPolicy()Lcom/cleanmaster/hpsharelib/service/acc4install/IAutoInstallPolicyBase;
move-result-object v0
.line 81
if-eqz v0, :cond_45
.line 82
invoke-virtual {v0, v1}, Lcom/cleanmaster/hpsharelib/service/acc4install/IAutoInstallPolicyBase;->loadFromJsonRoot(Lorg/json/JSONObject;)Z
.line 86
:cond_45
monitor-exit p0
goto :goto_2
.line 71
:catch_47
move-exception v0
.line 72
invoke-virtual {v0}, Lorg/json/JSONException;->printStackTrace()V
.line 73
monitor-exit p0
goto :goto_2
.line 74
:catch_4d
move-exception v0
.line 75
invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
.line 76
monitor-exit p0
:try_end_52
.catchall {:try_start_3c .. :try_end_52} :catchall_18
goto :goto_2
.end method
.method public reload(Landroid/content/Context;)V
.registers 2
.prologue
.line 90
invoke-virtual {p0, p1}, Lcom/cleanmaster/hpsharelib/service/acc4install/AutoInstallCfg;->load(Landroid/content/Context;)V
.line 91
return-void
.end method