af.smali

.class public final Lcom/baidu/techain/af/af;
.super Ljava/lang/Object;


# direct methods
.method public static a(Landroid/content/Context;)Ljava/lang/String;
    .registers 5

    invoke-static {p0}, Lcom/baidu/techain/af/ai;->a(Landroid/content/Context;)Lcom/baidu/techain/af/ai;

    move-result-object v0

    const-string v1, "sp_client_report_status"

    const-string v2, "sp_client_report_key"

    const-string v3, ""

    invoke-virtual {v0, v1, v2, v3}, Lcom/baidu/techain/af/ai;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_25

    const/16 v0, 0x14

    invoke-static {v0}, Lcom/baidu/techain/af/y;->a(I)Ljava/lang/String;

    move-result-object v0

    invoke-static {p0}, Lcom/baidu/techain/af/ai;->a(Landroid/content/Context;)Lcom/baidu/techain/af/ai;

    move-result-object v1

    const-string v2, "sp_client_report_status"

    const-string v3, "sp_client_report_key"

    invoke-virtual {v1, v2, v3, v0}, Lcom/baidu/techain/af/ai;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V

    :cond_25
    return-object v0
.end method

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

    move-object/from16 v0, p0

    move-object/from16 v1, p2

    invoke-virtual {v0, v1}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v8

    if-eqz v8, :cond_22

    invoke-virtual {v8}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_13

    invoke-virtual {v8}, Ljava/io/File;->mkdirs()Z

    :cond_13
    invoke-virtual/range {p0 .. p1}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v2

    if-eqz v2, :cond_22

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

    move-result v3

    if-nez v3, :cond_23

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

    :cond_22
    return-void

    :cond_23
    new-instance v3, Lcom/baidu/techain/af/ag;

    invoke-direct {v3}, Lcom/baidu/techain/af/ag;-><init>()V

    invoke-virtual {v2, v3}, Ljava/io/File;->listFiles(Ljava/io/FilenameFilter;)[Ljava/io/File;

    move-result-object v9

    if-eqz v9, :cond_22

    array-length v2, v9

    if-lez v2, :cond_22

    const/4 v6, 0x0

    const/4 v4, 0x0

    const/4 v3, 0x0

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v10

    array-length v12, v9

    const/4 v2, 0x0

    move v7, v2

    :goto_3b
    if-ge v7, v12, :cond_22

    aget-object v13, v9, v7

    if-eqz v13, :cond_4b

    :try_start_41
    invoke-virtual {v13}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
    :try_end_48
    .catch Ljava/lang/Exception; {:try_start_41 .. :try_end_48} :catch_140
    .catchall {:try_start_41 .. :try_end_48} :catchall_132

    move-result v2

    if-eqz v2, :cond_6d

    :cond_4b
    if-eqz v4, :cond_56

    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->isValid()Z

    move-result v2

    if-eqz v2, :cond_56

    :try_start_53
    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->release()V
    :try_end_56
    .catch Ljava/io/IOException; {:try_start_53 .. :try_end_56} :catch_68

    :cond_56
    :goto_56
    invoke-static {v6}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    if-eqz v3, :cond_151

    invoke-virtual {v3}, Ljava/io/File;->delete()Z

    move-object v2, v3

    move-object v3, v4

    move-object v4, v6

    :cond_61
    :goto_61
    add-int/lit8 v5, v7, 0x1

    move v7, v5

    move-object v6, v4

    move-object v4, v3

    move-object v3, v2

    goto :goto_3b

    :catch_68
    move-exception v2

    invoke-static {v2}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V

    goto :goto_56

    :cond_6d
    :try_start_6d
    new-instance v2, Ljava/io/File;

    new-instance v5, Ljava/lang/StringBuilder;

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

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

    move-result-object v14

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

    move-result-object v5

    const-string v14, ".lock"

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

    move-result-object v5

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

    move-result-object v5

    invoke-direct {v2, v5}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    :try_end_89
    .catch Ljava/lang/Exception; {:try_start_6d .. :try_end_89} :catch_140
    .catchall {:try_start_6d .. :try_end_89} :catchall_132

    :try_start_89
    invoke-static {v2}, Lcom/baidu/techain/af/ke;->c(Ljava/io/File;)Z

    new-instance v5, Ljava/io/RandomAccessFile;

    const-string v3, "rw"

    invoke-direct {v5, v2, v3}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
    :try_end_93
    .catch Ljava/lang/Exception; {:try_start_89 .. :try_end_93} :catch_146
    .catchall {:try_start_89 .. :try_end_93} :catchall_135

    :try_start_93
    invoke-virtual {v5}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v3

    invoke-virtual {v3}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
    :try_end_9a
    .catch Ljava/lang/Exception; {:try_start_93 .. :try_end_9a} :catch_14b
    .catchall {:try_start_93 .. :try_end_9a} :catchall_13b

    move-result-object v3

    :try_start_9b
    invoke-virtual {v8}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v4

    new-instance v6, Ljava/lang/StringBuilder;

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

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

    move-result-object v4

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

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

    move-result-object v4

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

    move-result-object v6

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

    move-result-object v4

    invoke-virtual {v4, v10, v11}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v4

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

    move-result-object v4

    new-instance v6, Ljava/io/File;

    invoke-direct {v6, v4}, Ljava/io/File;-><init>(Ljava/lang/String;)V
    :try_end_c3
    .catch Ljava/lang/Exception; {:try_start_9b .. :try_end_c3} :catch_e7
    .catchall {:try_start_9b .. :try_end_c3} :catchall_10d

    :try_start_c3
    invoke-static {v13, v6}, Lcom/baidu/techain/af/ke;->b(Ljava/io/File;Ljava/io/File;)V
    :try_end_c6
    .catch Ljava/io/IOException; {:try_start_c3 .. :try_end_c6} :catch_dc
    .catch Ljava/lang/Exception; {:try_start_c3 .. :try_end_c6} :catch_e7
    .catchall {:try_start_c3 .. :try_end_c6} :catchall_10d

    :goto_c6
    :try_start_c6
    invoke-virtual {v13}, Ljava/io/File;->delete()Z
    :try_end_c9
    .catch Ljava/lang/Exception; {:try_start_c6 .. :try_end_c9} :catch_e7
    .catchall {:try_start_c6 .. :try_end_c9} :catchall_10d

    if-eqz v3, :cond_d4

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

    move-result v4

    if-eqz v4, :cond_d4

    :try_start_d1
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->release()V
    :try_end_d4
    .catch Ljava/io/IOException; {:try_start_d1 .. :try_end_d4} :catch_103

    :cond_d4
    :goto_d4
    invoke-static {v5}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

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

    move-object v4, v5

    goto :goto_61

    :catch_dc
    move-exception v4

    :try_start_dd
    invoke-virtual {v4}, Ljava/io/IOException;->printStackTrace()V

    invoke-virtual {v13}, Ljava/io/File;->delete()Z

    invoke-virtual {v6}, Ljava/io/File;->delete()Z
    :try_end_e6
    .catch Ljava/lang/Exception; {:try_start_dd .. :try_end_e6} :catch_e7
    .catchall {:try_start_dd .. :try_end_e6} :catchall_10d

    goto :goto_c6

    :catch_e7
    move-exception v4

    move-object v15, v4

    move-object v4, v5

    move-object v5, v15

    :goto_eb
    :try_start_eb
    invoke-static {v5}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V
    :try_end_ee
    .catchall {:try_start_eb .. :try_end_ee} :catchall_12b

    if-eqz v3, :cond_f9

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

    move-result v5

    if-eqz v5, :cond_f9

    :try_start_f6
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->release()V
    :try_end_f9
    .catch Ljava/io/IOException; {:try_start_f6 .. :try_end_f9} :catch_108

    :cond_f9
    :goto_f9
    invoke-static {v4}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    if-eqz v2, :cond_61

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

    goto/16 :goto_61

    :catch_103
    move-exception v4

    invoke-static {v4}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V

    goto :goto_d4

    :catch_108
    move-exception v5

    invoke-static {v5}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V

    goto :goto_f9

    :catchall_10d
    move-exception v4

    move-object v15, v4

    move-object v4, v3

    move-object v3, v2

    move-object v2, v15

    :goto_112
    if-eqz v4, :cond_11d

    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->isValid()Z

    move-result v6

    if-eqz v6, :cond_11d

    :try_start_11a
    invoke-virtual {v4}, Ljava/nio/channels/FileLock;->release()V
    :try_end_11d
    .catch Ljava/io/IOException; {:try_start_11a .. :try_end_11d} :catch_126

    :cond_11d
    :goto_11d
    invoke-static {v5}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    if-eqz v3, :cond_125

    invoke-virtual {v3}, Ljava/io/File;->delete()Z

    :cond_125
    throw v2

    :catch_126
    move-exception v4

    invoke-static {v4}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V

    goto :goto_11d

    :catchall_12b
    move-exception v5

    move-object v15, v5

    move-object v5, v4

    move-object v4, v3

    move-object v3, v2

    move-object v2, v15

    goto :goto_112

    :catchall_132
    move-exception v2

    move-object v5, v6

    goto :goto_112

    :catchall_135
    move-exception v3

    move-object v5, v6

    move-object v15, v2

    move-object v2, v3

    move-object v3, v15

    goto :goto_112

    :catchall_13b
    move-exception v3

    move-object v15, v3

    move-object v3, v2

    move-object v2, v15

    goto :goto_112

    :catch_140
    move-exception v2

    move-object v5, v2

    move-object v2, v3

    move-object v3, v4

    move-object v4, v6

    goto :goto_eb

    :catch_146
    move-exception v3

    move-object v5, v3

    move-object v3, v4

    move-object v4, v6

    goto :goto_eb

    :catch_14b
    move-exception v3

    move-object v15, v3

    move-object v3, v4

    move-object v4, v5

    move-object v5, v15

    goto :goto_eb

    :cond_151
    move-object v2, v3

    move-object v3, v4

    move-object v4, v6

    goto/16 :goto_61
.end method

.method public static a(Landroid/content/Context;Ljava/util/List;)V
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 0
    if-eqz p1, :cond_8

    invoke-interface {p1}, Ljava/util/List;->size()I

    move-result v0

    if-gtz v0, :cond_9

    :cond_8
    return-void

    :cond_9
    invoke-static {p0}, Lcom/baidu/techain/af/af;->b(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_8

    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    :cond_13
    :goto_13
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_8

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/String;

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v2

    if-nez v2, :cond_13

    .line 1000
    new-instance v2, Landroid/content/Intent;

    const-string v3, "com.xiaomi.xmsf.push.XMSF_UPLOAD_ACTIVE"

    invoke-direct {v2, v3}, Landroid/content/Intent;-><init>(Ljava/lang/String;)V

    const-string v3, "pkgname"

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

    move-result-object v4

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v3, "category"

    const-string v4, "category_client_report_data"

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v3, "name"

    const-string v4, "quality_support"

    invoke-virtual {v2, v3, v4}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v3, "data"

    invoke-virtual {v2, v3, v0}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Ljava/lang/String;)Landroid/content/Intent;

    const-string v0, "com.xiaomi.xmsf.permission.USE_XMSF_UPLOAD"

    invoke-virtual {p0, v2, v0}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;Ljava/lang/String;)V

    goto :goto_13
.end method

.method public static a(Landroid/content/Context;Ljava/lang/String;)Z
    .registers 8

    .prologue
    const/4 v0, 0x0

    .line 0
    new-instance v2, Ljava/io/File;

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

    const/4 v1, 0x1

    invoke-static {p0}, Lcom/baidu/techain/ad/b;->a(Landroid/content/Context;)Lcom/baidu/techain/ad/b;

    move-result-object v3

    invoke-virtual {v3}, Lcom/baidu/techain/ad/b;->a()Lcom/baidu/techain/ab/a;

    move-result-object v3

    .line 2000
    iget-wide v4, v3, Lcom/baidu/techain/ab/a;->d:J

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

    move-result v3

    if-eqz v3, :cond_25

    :try_start_17
    invoke-virtual {v2}, Ljava/io/File;->length()J
    :try_end_1a
    .catch Ljava/lang/Exception; {:try_start_17 .. :try_end_1a} :catch_20

    move-result-wide v2

    cmp-long v2, v2, v4

    if-lez v2, :cond_28

    :goto_1f
    return v0

    :catch_20
    move-exception v1

    invoke-static {v1}, Lcom/baidu/techain/aa/c;->a(Ljava/lang/Throwable;)V

    goto :goto_1f

    :cond_25
    invoke-static {v2}, Lcom/baidu/techain/af/ke;->c(Ljava/io/File;)Z

    :cond_28
    move v0, v1

    goto :goto_1f
.end method

.method public static a(Ljava/lang/String;)[B
    .registers 4
    .annotation build Landroid/annotation/TargetApi;
        value = 0x9
    .end annotation

    invoke-static {p0}, Lcom/baidu/techain/af/v;->a(Ljava/lang/String;)[B

    move-result-object v0

    const/16 v1, 0x10

    invoke-static {v0, v1}, Ljava/util/Arrays;->copyOf([BI)[B

    move-result-object v0

    const/4 v1, 0x0

    const/16 v2, 0x44

    aput-byte v2, v0, v1

    const/16 v1, 0xf

    const/16 v2, 0x54

    aput-byte v2, v0, v1

    return-object v0
.end method

.method private static b(Landroid/content/Context;)Z
    .registers 5

    const/4 v0, 0x0

    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v1

    invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v1

    :try_start_9
    const-string v2, "com.xiaomi.xmsf"

    const/4 v3, 0x0

    invoke-virtual {v1, v2, v3}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object v1

    iget v1, v1, Landroid/content/pm/PackageInfo;->versionCode:I
    :try_end_12
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_9 .. :try_end_12} :catch_18

    const/16 v2, 0x6c

    if-lt v1, v2, :cond_17

    const/4 v0, 0x1

    :cond_17
    :goto_17
    return v0

    :catch_18
    move-exception v1

    invoke-virtual {v1}, Landroid/content/pm/PackageManager$NameNotFoundException;->printStackTrace()V

    goto :goto_17
.end method

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

    invoke-virtual {p0, p1}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    if-eqz v0, :cond_10

    new-instance v1, Lcom/baidu/techain/af/ah;

    invoke-direct {v1}, Lcom/baidu/techain/af/ah;-><init>()V

    invoke-virtual {v0, v1}, Ljava/io/File;->listFiles(Ljava/io/FilenameFilter;)[Ljava/io/File;

    move-result-object v0

    :goto_f
    return-object v0

    :cond_10
    const/4 v0, 0x0

    goto :goto_f
.end method