a.smali
.class public Lcom/xiaomi/push/service/a;
.super Ljava/lang/Object;
# static fields
.field private static volatile j:Lcom/xiaomi/push/service/a;
# instance fields
.field private final a:Ljava/lang/Object;
.field private final b:Ljava/lang/Object;
.field private final c:Ljava/lang/String;
.field private final d:Ljava/lang/String;
.field private final e:Ljava/lang/String;
.field private final f:Ljava/lang/String;
.field private volatile g:Ljava/lang/String;
.field private volatile h:Ljava/lang/String;
.field private i:Landroid/content/Context;
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.registers 3
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
iput-object v0, p0, Lcom/xiaomi/push/service/a;->a:Ljava/lang/Object;
new-instance v0, Ljava/lang/Object;
invoke-direct {v0}, Ljava/lang/Object;-><init>()V
iput-object v0, p0, Lcom/xiaomi/push/service/a;->b:Ljava/lang/Object;
const-string v0, "mipush_region"
iput-object v0, p0, Lcom/xiaomi/push/service/a;->c:Ljava/lang/String;
const-string v0, "mipush_country_code"
iput-object v0, p0, Lcom/xiaomi/push/service/a;->d:Ljava/lang/String;
const-string v0, "mipush_region.lock"
iput-object v0, p0, Lcom/xiaomi/push/service/a;->e:Ljava/lang/String;
const-string v0, "mipush_country_code.lock"
iput-object v0, p0, Lcom/xiaomi/push/service/a;->f:Ljava/lang/String;
iput-object p1, p0, Lcom/xiaomi/push/service/a;->i:Landroid/content/Context;
return-void
.end method
.method public static a(Landroid/content/Context;)Lcom/xiaomi/push/service/a;
.registers 3
sget-object v0, Lcom/xiaomi/push/service/a;->j:Lcom/xiaomi/push/service/a;
if-nez v0, :cond_13
const-class v1, Lcom/xiaomi/push/service/a;
monitor-enter v1
:try_start_7
sget-object v0, Lcom/xiaomi/push/service/a;->j:Lcom/xiaomi/push/service/a;
if-nez v0, :cond_12
new-instance v0, Lcom/xiaomi/push/service/a;
invoke-direct {v0, p0}, Lcom/xiaomi/push/service/a;-><init>(Landroid/content/Context;)V
sput-object v0, Lcom/xiaomi/push/service/a;->j:Lcom/xiaomi/push/service/a;
:cond_12
monitor-exit v1
:try_end_13
.catchall {:try_start_7 .. :try_end_13} :catchall_16
:cond_13
sget-object v0, Lcom/xiaomi/push/service/a;->j:Lcom/xiaomi/push/service/a;
return-object v0
:catchall_16
move-exception v0
:try_start_17
monitor-exit v1
:try_end_18
.catchall {:try_start_17 .. :try_end_18} :catchall_16
throw v0
.end method
.method private a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
.registers 10
const/4 v0, 0x0
new-instance v1, Ljava/io/File;
invoke-virtual {p1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;
move-result-object v2
invoke-direct {v1, v2, p2}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/io/File;->exists()Z
move-result v2
if-nez v2, :cond_27
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "No ready file to get data from "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/String;)V
:goto_26
return-object v0
:cond_27
monitor-enter p4
:try_start_28
new-instance v2, Ljava/io/File;
invoke-virtual {p1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;
move-result-object v3
invoke-direct {v2, v3, p3}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-static {v2}, Lcom/xiaomi/push/kq;->c(Ljava/io/File;)Z
new-instance v3, Ljava/io/RandomAccessFile;
const-string v4, "rw"
invoke-direct {v3, v2, v4}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
:try_end_3b
.catch Ljava/lang/Exception; {:try_start_28 .. :try_end_3b} :catch_5f
.catchall {:try_start_28 .. :try_end_3b} :catchall_7a
:try_start_3b
invoke-virtual {v3}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
move-result-object v2
invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
:try_end_42
.catch Ljava/lang/Exception; {:try_start_3b .. :try_end_42} :catch_98
.catchall {:try_start_3b .. :try_end_42} :catchall_92
move-result-object v2
:try_start_43
invoke-static {v1}, Lcom/xiaomi/push/kq;->b(Ljava/io/File;)Ljava/lang/String;
:try_end_46
.catch Ljava/lang/Exception; {:try_start_43 .. :try_end_46} :catch_9b
.catchall {:try_start_43 .. :try_end_46} :catchall_96
move-result-object v0
if-eqz v2, :cond_52
:try_start_49
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_4c
.catchall {:try_start_49 .. :try_end_4c} :catchall_57
move-result v1
if-eqz v1, :cond_52
:try_start_4f
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->release()V
:try_end_52
.catch Ljava/io/IOException; {:try_start_4f .. :try_end_52} :catch_5a
.catchall {:try_start_4f .. :try_end_52} :catchall_57
:cond_52
:goto_52
:try_start_52
invoke-static {v3}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
monitor-exit p4
goto :goto_26
:catchall_57
move-exception v0
monitor-exit p4
:try_end_59
.catchall {:try_start_52 .. :try_end_59} :catchall_57
throw v0
:catch_5a
move-exception v1
:try_start_5b
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
:try_end_5e
.catchall {:try_start_5b .. :try_end_5e} :catchall_57
goto :goto_52
:catch_5f
move-exception v1
move-object v2, v0
move-object v3, v0
:goto_62
:try_start_62
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
:try_end_65
.catchall {:try_start_62 .. :try_end_65} :catchall_96
if-eqz v2, :cond_70
:try_start_67
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_6a
.catchall {:try_start_67 .. :try_end_6a} :catchall_57
move-result v1
if-eqz v1, :cond_70
:try_start_6d
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->release()V
:try_end_70
.catch Ljava/io/IOException; {:try_start_6d .. :try_end_70} :catch_75
.catchall {:try_start_6d .. :try_end_70} :catchall_57
:cond_70
:goto_70
:try_start_70
invoke-static {v3}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
monitor-exit p4
goto :goto_26
:catch_75
move-exception v1
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
goto :goto_70
:catchall_7a
move-exception v1
move-object v2, v0
move-object v3, v0
move-object v0, v1
:goto_7e
if-eqz v2, :cond_89
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_83
.catchall {:try_start_70 .. :try_end_83} :catchall_57
move-result v1
if-eqz v1, :cond_89
:try_start_86
invoke-virtual {v2}, Ljava/nio/channels/FileLock;->release()V
:try_end_89
.catch Ljava/io/IOException; {:try_start_86 .. :try_end_89} :catch_8d
.catchall {:try_start_86 .. :try_end_89} :catchall_57
:cond_89
:goto_89
:try_start_89
invoke-static {v3}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
throw v0
:catch_8d
move-exception v1
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
:try_end_91
.catchall {:try_start_89 .. :try_end_91} :catchall_57
goto :goto_89
:catchall_92
move-exception v1
move-object v2, v0
move-object v0, v1
goto :goto_7e
:catchall_96
move-exception v0
goto :goto_7e
:catch_98
move-exception v1
move-object v2, v0
goto :goto_62
:catch_9b
move-exception v1
goto :goto_62
.end method
.method private a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
.registers 10
const/4 v1, 0x0
monitor-enter p5
:try_start_2
new-instance v0, Ljava/io/File;
invoke-virtual {p1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;
move-result-object v2
invoke-direct {v0, v2, p4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-static {v0}, Lcom/xiaomi/push/kq;->c(Ljava/io/File;)Z
new-instance v2, Ljava/io/RandomAccessFile;
const-string v3, "rw"
invoke-direct {v2, v0, v3}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
:try_end_15
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_15} :catch_41
.catchall {:try_start_2 .. :try_end_15} :catchall_5a
:try_start_15
invoke-virtual {v2}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
move-result-object v0
invoke-virtual {v0}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
move-result-object v1
new-instance v0, Ljava/io/File;
invoke-virtual {p1}, Landroid/content/Context;->getFilesDir()Ljava/io/File;
move-result-object v3
invoke-direct {v0, v3, p3}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
invoke-static {v0, p2}, Lcom/xiaomi/push/kq;->a(Ljava/io/File;Ljava/lang/String;)V
:try_end_29
.catch Ljava/lang/Exception; {:try_start_15 .. :try_end_29} :catch_72
.catchall {:try_start_15 .. :try_end_29} :catchall_70
if-eqz v1, :cond_34
:try_start_2b
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_2e
.catchall {:try_start_2b .. :try_end_2e} :catchall_3e
move-result v0
if-eqz v0, :cond_34
:try_start_31
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
:try_end_34
.catch Ljava/io/IOException; {:try_start_31 .. :try_end_34} :catch_39
.catchall {:try_start_31 .. :try_end_34} :catchall_3e
:cond_34
:goto_34
:try_start_34
invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
:goto_37
monitor-exit p5
return-void
:catch_39
move-exception v0
invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
goto :goto_34
:catchall_3e
move-exception v0
monitor-exit p5
:try_end_40
.catchall {:try_start_34 .. :try_end_40} :catchall_3e
throw v0
:catch_41
move-exception v0
move-object v2, v1
:goto_43
:try_start_43
invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
:try_end_46
.catchall {:try_start_43 .. :try_end_46} :catchall_70
if-eqz v1, :cond_51
:try_start_48
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_4b
.catchall {:try_start_48 .. :try_end_4b} :catchall_3e
move-result v0
if-eqz v0, :cond_51
:try_start_4e
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
:try_end_51
.catch Ljava/io/IOException; {:try_start_4e .. :try_end_51} :catch_55
.catchall {:try_start_4e .. :try_end_51} :catchall_3e
:cond_51
:goto_51
:try_start_51
invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
goto :goto_37
:catch_55
move-exception v0
invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
goto :goto_51
:catchall_5a
move-exception v0
move-object v2, v1
:goto_5c
if-eqz v1, :cond_67
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
:try_end_61
.catchall {:try_start_51 .. :try_end_61} :catchall_3e
move-result v3
if-eqz v3, :cond_67
:try_start_64
invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
:try_end_67
.catch Ljava/io/IOException; {:try_start_64 .. :try_end_67} :catch_6b
.catchall {:try_start_64 .. :try_end_67} :catchall_3e
:cond_67
:goto_67
:try_start_67
invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V
throw v0
:catch_6b
move-exception v1
invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
:try_end_6f
.catchall {:try_start_67 .. :try_end_6f} :catchall_3e
goto :goto_67
:catchall_70
move-exception v0
goto :goto_5c
:catch_72
move-exception v0
goto :goto_43
.end method
# virtual methods
.method public a()Ljava/lang/String;
.registers 5
iget-object v0, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_16
iget-object v0, p0, Lcom/xiaomi/push/service/a;->i:Landroid/content/Context;
const-string v1, "mipush_region"
const-string v2, "mipush_region.lock"
iget-object v3, p0, Lcom/xiaomi/push/service/a;->a:Ljava/lang/Object;
invoke-direct {p0, v0, v1, v2, v3}, Lcom/xiaomi/push/service/a;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
:cond_16
iget-object v0, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
return-object v0
.end method
.method public a(Ljava/lang/String;)V
.registers 8
iget-object v0, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
invoke-static {p1, v0}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z
move-result v0
if-nez v0, :cond_18
iput-object p1, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
iget-object v1, p0, Lcom/xiaomi/push/service/a;->i:Landroid/content/Context;
iget-object v2, p0, Lcom/xiaomi/push/service/a;->g:Ljava/lang/String;
const-string v3, "mipush_region"
const-string v4, "mipush_region.lock"
iget-object v5, p0, Lcom/xiaomi/push/service/a;->a:Ljava/lang/Object;
move-object v0, p0
invoke-direct/range {v0 .. v5}, Lcom/xiaomi/push/service/a;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
:cond_18
return-void
.end method
.method public b()Ljava/lang/String;
.registers 5
iget-object v0, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_16
iget-object v0, p0, Lcom/xiaomi/push/service/a;->i:Landroid/content/Context;
const-string v1, "mipush_country_code"
const-string v2, "mipush_country_code.lock"
iget-object v3, p0, Lcom/xiaomi/push/service/a;->b:Ljava/lang/Object;
invoke-direct {p0, v0, v1, v2, v3}, Lcom/xiaomi/push/service/a;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
move-result-object v0
iput-object v0, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
:cond_16
iget-object v0, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
return-object v0
.end method
.method public b(Ljava/lang/String;)V
.registers 8
iget-object v0, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
invoke-static {p1, v0}, Landroid/text/TextUtils;->equals(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Z
move-result v0
if-nez v0, :cond_18
iput-object p1, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
iget-object v1, p0, Lcom/xiaomi/push/service/a;->i:Landroid/content/Context;
iget-object v2, p0, Lcom/xiaomi/push/service/a;->h:Ljava/lang/String;
const-string v3, "mipush_country_code"
const-string v4, "mipush_country_code.lock"
iget-object v5, p0, Lcom/xiaomi/push/service/a;->b:Ljava/lang/Object;
move-object v0, p0
invoke-direct/range {v0 .. v5}, Lcom/xiaomi/push/service/a;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V
:cond_18
return-void
.end method