cr$c.smali

.class Lcom/tendcloud/tenddata/cr$c;
.super Ljava/lang/Object;
.source "td"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/tendcloud/tenddata/cr;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "c"
.end annotation


# instance fields
.field private callback:Lcom/tendcloud/tenddata/cs;

.field private features:Lcom/tendcloud/tenddata/a;

.field private mFolderPath:Ljava/lang/String;

.field private final mOperation:Lcom/tendcloud/tenddata/cq;

.field private final opm:Lcom/tendcloud/tenddata/cr;

.field final synthetic this$0:Lcom/tendcloud/tenddata/cr;


# direct methods
.method private constructor <init>(Lcom/tendcloud/tenddata/cr;Lcom/tendcloud/tenddata/cq;Lcom/tendcloud/tenddata/by;Lcom/tendcloud/tenddata/cr;)V
    .registers 6

    .line 2
    iput-object p1, p0, Lcom/tendcloud/tenddata/cr$c;->this$0:Lcom/tendcloud/tenddata/cr;

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

    .line 3
    sget-object p1, Lcom/tendcloud/tenddata/ab;->g:Landroid/content/Context;

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

    move-result-object p1

    .line 4
    iput-object p4, p0, Lcom/tendcloud/tenddata/cr$c;->opm:Lcom/tendcloud/tenddata/cr;

    .line 5
    new-instance p4, Ljava/lang/StringBuilder;

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

    invoke-virtual {p1}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object v0

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

    sget-object v0, Ljava/io/File;->separator:Ljava/lang/String;

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

    iget-object v0, p3, Lcom/tendcloud/tenddata/by;->a:Lcom/tendcloud/tenddata/a;

    invoke-virtual {v0}, Lcom/tendcloud/tenddata/a;->getDataFolder()Ljava/lang/String;

    move-result-object v0

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

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

    move-result-object p4

    iput-object p4, p0, Lcom/tendcloud/tenddata/cr$c;->mFolderPath:Ljava/lang/String;

    .line 6
    new-instance p4, Ljava/lang/StringBuilder;

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

    invoke-virtual {p1}, Ljava/io/File;->toString()Ljava/lang/String;

    move-result-object p1

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

    sget-object p1, Ljava/io/File;->separator:Ljava/lang/String;

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

    iget-object p1, p3, Lcom/tendcloud/tenddata/by;->a:Lcom/tendcloud/tenddata/a;

    invoke-virtual {p1}, Lcom/tendcloud/tenddata/a;->getRootFolder()Ljava/lang/String;

    move-result-object p1

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

    sget-object p1, Ljava/io/File;->separator:Ljava/lang/String;

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

    iget-object p1, p3, Lcom/tendcloud/tenddata/by;->a:Lcom/tendcloud/tenddata/a;

    .line 7
    invoke-virtual {p1}, Lcom/tendcloud/tenddata/a;->getDataFolder()Ljava/lang/String;

    move-result-object p1

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

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

    move-result-object p1

    iput-object p1, p0, Lcom/tendcloud/tenddata/cr$c;->mFolderPath:Ljava/lang/String;

    .line 8
    iput-object p2, p0, Lcom/tendcloud/tenddata/cr$c;->mOperation:Lcom/tendcloud/tenddata/cq;

    .line 9
    iget-object p1, p3, Lcom/tendcloud/tenddata/by;->f:Lcom/tendcloud/tenddata/cs;

    iput-object p1, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    .line 10
    iget-object p1, p3, Lcom/tendcloud/tenddata/by;->a:Lcom/tendcloud/tenddata/a;

    iput-object p1, p0, Lcom/tendcloud/tenddata/cr$c;->features:Lcom/tendcloud/tenddata/a;

    return-void
.end method

.method synthetic constructor <init>(Lcom/tendcloud/tenddata/cr;Lcom/tendcloud/tenddata/cq;Lcom/tendcloud/tenddata/by;Lcom/tendcloud/tenddata/cr;Lcom/tendcloud/tenddata/cr$1;)V
    .registers 6

    .line 1
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/tendcloud/tenddata/cr$c;-><init>(Lcom/tendcloud/tenddata/cr;Lcom/tendcloud/tenddata/cq;Lcom/tendcloud/tenddata/by;Lcom/tendcloud/tenddata/cr;)V

    return-void
.end method


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

    const/4 v0, 0x0

    .line 1
    :try_start_1
    iget-object v1, p0, Lcom/tendcloud/tenddata/cr$c;->opm:Lcom/tendcloud/tenddata/cr;

    monitor-enter v1
    :try_end_4
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_4} :catch_b8
    .catchall {:try_start_1 .. :try_end_4} :catchall_b3

    .line 2
    :try_start_4
    new-instance v2, Ljava/io/File;

    iget-object v3, p0, Lcom/tendcloud/tenddata/cr$c;->mFolderPath:Ljava/lang/String;

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

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

    move-result v3

    if-nez v3, :cond_1f

    invoke-virtual {v2}, Ljava/io/File;->isDirectory()Z

    move-result v3

    if-nez v3, :cond_1f

    .line 4
    invoke-virtual {v2}, Ljava/io/File;->mkdirs()Z

    move-result v3

    if-nez v3, :cond_1f

    .line 5
    monitor-exit v1

    return-void

    .line 6
    :cond_1f
    iget-object v3, p0, Lcom/tendcloud/tenddata/cr$c;->this$0:Lcom/tendcloud/tenddata/cr;

    iget-object v4, p0, Lcom/tendcloud/tenddata/cr$c;->features:Lcom/tendcloud/tenddata/a;

    invoke-static {v3, v2, v4}, Lcom/tendcloud/tenddata/cr;->a(Lcom/tendcloud/tenddata/cr;Ljava/io/File;Lcom/tendcloud/tenddata/a;)V

    .line 7
    new-instance v2, Ljava/lang/StringBuilder;

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

    iget-object v3, p0, Lcom/tendcloud/tenddata/cr$c;->mFolderPath:Ljava/lang/String;

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

    sget-object v3, Ljava/io/File;->separator:Ljava/lang/String;

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

    iget-object v3, p0, Lcom/tendcloud/tenddata/cr$c;->mOperation:Lcom/tendcloud/tenddata/cq;

    invoke-virtual {v3}, Lcom/tendcloud/tenddata/cq;->b()Ljava/lang/String;

    move-result-object v3

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

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

    move-result-object v2

    .line 8
    new-instance v3, Ljava/io/File;

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

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

    move-result v2

    if-nez v2, :cond_55

    .line 10
    invoke-virtual {v3}, Ljava/io/File;->createNewFile()Z

    move-result v2

    if-nez v2, :cond_55

    .line 11
    monitor-exit v1

    return-void

    .line 12
    :cond_55
    new-instance v2, Ljava/io/RandomAccessFile;

    const-string v4, "rw"

    invoke-direct {v2, v3, v4}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
    :try_end_5c
    .catchall {:try_start_4 .. :try_end_5c} :catchall_aa

    .line 13
    :try_start_5c
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v3

    invoke-virtual {v3}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;

    move-result-object v3
    :try_end_64
    .catchall {:try_start_5c .. :try_end_64} :catchall_a4

    const-wide/16 v4, 0x1

    .line 14
    :try_start_66
    invoke-virtual {v2, v4, v5}, Ljava/io/RandomAccessFile;->seek(J)V

    .line 15
    iget-object v4, p0, Lcom/tendcloud/tenddata/cr$c;->mOperation:Lcom/tendcloud/tenddata/cq;

    invoke-virtual {v4}, Lcom/tendcloud/tenddata/cq;->d()I

    move-result v4

    invoke-virtual {v2, v4}, Ljava/io/RandomAccessFile;->writeInt(I)V

    .line 16
    iget-object v4, p0, Lcom/tendcloud/tenddata/cr$c;->mOperation:Lcom/tendcloud/tenddata/cq;

    invoke-virtual {v4}, Lcom/tendcloud/tenddata/cq;->e()I

    move-result v4

    invoke-virtual {v2, v4}, Ljava/io/RandomAccessFile;->writeInt(I)V

    .line 17
    iget-object v4, p0, Lcom/tendcloud/tenddata/cr$c;->mOperation:Lcom/tendcloud/tenddata/cq;

    invoke-virtual {v4}, Lcom/tendcloud/tenddata/cq;->c()[B

    move-result-object v4

    invoke-virtual {v2, v4}, Ljava/io/RandomAccessFile;->write([B)V

    .line 18
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->getFD()Ljava/io/FileDescriptor;

    move-result-object v4

    invoke-virtual {v4}, Ljava/io/FileDescriptor;->sync()V

    .line 19
    monitor-exit v1
    :try_end_8c
    .catchall {:try_start_66 .. :try_end_8c} :catchall_9e

    if-eqz v3, :cond_91

    .line 20
    :try_start_8e
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->release()V

    .line 21
    :cond_91
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V

    .line 22
    iget-object v0, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    if-eqz v0, :cond_d8

    .line 23
    :goto_98
    iget-object v0, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    invoke-interface {v0}, Lcom/tendcloud/tenddata/cs;->onStoreSuccess()V
    :try_end_9d
    .catch Ljava/lang/Throwable; {:try_start_8e .. :try_end_9d} :catch_d8

    goto :goto_d8

    :catchall_9e
    move-exception v4

    move-object v6, v3

    move-object v3, v2

    move-object v2, v4

    move-object v4, v6

    goto :goto_ad

    :catchall_a4
    move-exception v3

    move-object v4, v0

    move-object v6, v3

    move-object v3, v2

    move-object v2, v6

    goto :goto_ad

    :catchall_aa
    move-exception v2

    move-object v3, v0

    move-object v4, v3

    .line 24
    :goto_ad
    :try_start_ad
    monitor-exit v1
    :try_end_ae
    .catchall {:try_start_ad .. :try_end_ae} :catchall_b1

    :try_start_ae
    throw v2
    :try_end_af
    .catch Ljava/lang/Throwable; {:try_start_ae .. :try_end_af} :catch_af
    .catchall {:try_start_ae .. :try_end_af} :catchall_d9

    :catch_af
    move-exception v1

    goto :goto_bb

    :catchall_b1
    move-exception v2

    goto :goto_ad

    :catchall_b3
    move-exception v1

    move-object v3, v0

    move-object v4, v3

    move-object v0, v1

    goto :goto_da

    :catch_b8
    move-exception v1

    move-object v3, v0

    move-object v4, v3

    .line 25
    :goto_bb
    :try_start_bb
    iget-object v2, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    if-eqz v2, :cond_c6

    .line 26
    iget-object v2, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    invoke-interface {v2}, Lcom/tendcloud/tenddata/cs;->onStoreFailed()V

    .line 27
    iput-object v0, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    .line 28
    :cond_c6
    invoke-static {v1}, Lcom/tendcloud/tenddata/bq;->postSDKError(Ljava/lang/Throwable;)V
    :try_end_c9
    .catchall {:try_start_bb .. :try_end_c9} :catchall_d9

    if-eqz v4, :cond_ce

    .line 29
    :try_start_cb
    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->release()V

    :cond_ce
    if-eqz v3, :cond_d8

    .line 30
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V

    .line 31
    iget-object v0, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;
    :try_end_d5
    .catch Ljava/lang/Throwable; {:try_start_cb .. :try_end_d5} :catch_d8

    if-eqz v0, :cond_d8

    goto :goto_98

    :catch_d8
    :cond_d8
    :goto_d8
    return-void

    :catchall_d9
    move-exception v0

    :goto_da
    if-eqz v4, :cond_df

    .line 32
    :try_start_dc
    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->release()V

    :cond_df
    if-eqz v3, :cond_ed

    .line 33
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V

    .line 34
    iget-object v1, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    if-eqz v1, :cond_ed

    .line 35
    iget-object v1, p0, Lcom/tendcloud/tenddata/cr$c;->callback:Lcom/tendcloud/tenddata/cs;

    invoke-interface {v1}, Lcom/tendcloud/tenddata/cs;->onStoreSuccess()V
    :try_end_ed
    .catch Ljava/lang/Throwable; {:try_start_dc .. :try_end_ed} :catch_ed

    .line 36
    :catch_ed
    :cond_ed
    goto :goto_ef

    :goto_ee
    throw v0

    :goto_ef
    goto :goto_ee
.end method