ah.smali

.class final Lcom/xiaomi/push/service/ah;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic a:Landroid/content/Context;

.field final synthetic b:Lcom/xiaomi/push/io;


# direct methods
.method constructor <init>(Landroid/content/Context;Lcom/xiaomi/push/io;)V
    .registers 3

    iput-object p1, p0, Lcom/xiaomi/push/service/ah;->a:Landroid/content/Context;

    iput-object p2, p0, Lcom/xiaomi/push/service/ah;->b:Lcom/xiaomi/push/io;

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

    return-void
.end method


# virtual methods
.method public run()V
    .registers 6

    const/4 v1, 0x0

    sget-object v3, Lcom/xiaomi/push/service/ag;->a:Ljava/lang/Object;

    monitor-enter v3

    :try_start_4
    new-instance v0, Ljava/io/File;

    iget-object v2, p0, Lcom/xiaomi/push/service/ah;->a:Landroid/content/Context;

    invoke-virtual {v2}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

    move-result-object v2

    const-string v4, "tiny_data.lock"

    invoke-direct {v0, v2, v4}, 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 v4, "rw"

    invoke-direct {v2, v0, v4}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
    :try_end_1b
    .catch Ljava/lang/Exception; {:try_start_4 .. :try_end_1b} :catch_42
    .catchall {:try_start_4 .. :try_end_1b} :catchall_5b

    :try_start_1b
    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

    iget-object v0, p0, Lcom/xiaomi/push/service/ah;->a:Landroid/content/Context;

    iget-object v4, p0, Lcom/xiaomi/push/service/ah;->b:Lcom/xiaomi/push/io;

    invoke-static {v0, v4}, Lcom/xiaomi/push/service/ag;->b(Landroid/content/Context;Lcom/xiaomi/push/io;)V
    :try_end_2a
    .catch Ljava/lang/Exception; {:try_start_1b .. :try_end_2a} :catch_73
    .catchall {:try_start_1b .. :try_end_2a} :catchall_71

    if-eqz v1, :cond_35

    :try_start_2c
    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_2f
    .catchall {:try_start_2c .. :try_end_2f} :catchall_3f

    move-result v0

    if-eqz v0, :cond_35

    :try_start_32
    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
    :try_end_35
    .catch Ljava/io/IOException; {:try_start_32 .. :try_end_35} :catch_3a
    .catchall {:try_start_32 .. :try_end_35} :catchall_3f

    :cond_35
    :goto_35
    :try_start_35
    invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V

    :goto_38
    monitor-exit v3

    return-void

    :catch_3a
    move-exception v0

    invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V

    goto :goto_35

    :catchall_3f
    move-exception v0

    monitor-exit v3
    :try_end_41
    .catchall {:try_start_35 .. :try_end_41} :catchall_3f

    throw v0

    :catch_42
    move-exception v0

    move-object v2, v1

    :goto_44
    :try_start_44
    invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
    :try_end_47
    .catchall {:try_start_44 .. :try_end_47} :catchall_71

    if-eqz v1, :cond_52

    :try_start_49
    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_4c
    .catchall {:try_start_49 .. :try_end_4c} :catchall_3f

    move-result v0

    if-eqz v0, :cond_52

    :try_start_4f
    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
    :try_end_52
    .catch Ljava/io/IOException; {:try_start_4f .. :try_end_52} :catch_56
    .catchall {:try_start_4f .. :try_end_52} :catchall_3f

    :cond_52
    :goto_52
    :try_start_52
    invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V

    goto :goto_38

    :catch_56
    move-exception v0

    invoke-static {v0}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V

    goto :goto_52

    :catchall_5b
    move-exception v0

    move-object v2, v1

    :goto_5d
    if-eqz v1, :cond_68

    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_62
    .catchall {:try_start_52 .. :try_end_62} :catchall_3f

    move-result v4

    if-eqz v4, :cond_68

    :try_start_65
    invoke-virtual {v1}, Ljava/nio/channels/FileLock;->release()V
    :try_end_68
    .catch Ljava/io/IOException; {:try_start_65 .. :try_end_68} :catch_6c
    .catchall {:try_start_65 .. :try_end_68} :catchall_3f

    :cond_68
    :goto_68
    :try_start_68
    invoke-static {v2}, Lcom/xiaomi/push/kq;->a(Ljava/io/Closeable;)V

    throw v0

    :catch_6c
    move-exception v1

    invoke-static {v1}, Lcom/xiaomi/a/a/a/c;->a(Ljava/lang/Throwable;)V
    :try_end_70
    .catchall {:try_start_68 .. :try_end_70} :catchall_3f

    goto :goto_68

    :catchall_71
    move-exception v0

    goto :goto_5d

    :catch_73
    move-exception v0

    goto :goto_44
.end method