a$b.smali

.class Lcom/ss/android/downloadlib/a$b;
.super Ljava/lang/Object;
.source "AdDownloadCompletedEventHandlerImpl.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/ss/android/downloadlib/a;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "b"
.end annotation


# instance fields
.field private a:J

.field private b:I

.field private c:J

.field private d:I

.field private e:J


# direct methods
.method private constructor <init>(JIJI)V
    .registers 7

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

    .line 240
    iput-wide p1, p0, Lcom/ss/android/downloadlib/a$b;->a:J

    .line 241
    iput p3, p0, Lcom/ss/android/downloadlib/a$b;->b:I

    .line 242
    iput-wide p4, p0, Lcom/ss/android/downloadlib/a$b;->c:J

    .line 243
    iput p6, p0, Lcom/ss/android/downloadlib/a$b;->d:I

    .line 244
    return-void
.end method

.method synthetic constructor <init>(JIJILcom/ss/android/downloadlib/b;)V
    .registers 8

    .prologue
    .line 232
    invoke-direct/range {p0 .. p6}, Lcom/ss/android/downloadlib/a$b;-><init>(JIJI)V

    return-void
.end method

.method private a(ZLcom/ss/android/downloadad/a/b/a;Lcom/ss/android/socialbase/downloader/g/c;ZLorg/json/JSONObject;)I
    .registers 14

    .prologue
    const/16 v0, 0x7d0

    const/4 v1, 0x1

    .line 320
    invoke-virtual {p3}, Lcom/ss/android/socialbase/downloader/g/c;->g()I

    move-result v2

    invoke-static {v2}, Lcom/ss/android/socialbase/downloader/k/a;->a(I)Lcom/ss/android/socialbase/downloader/k/a;

    move-result-object v2

    .line 322
    const-string v3, "install_failed_check_ttmd5"

    invoke-virtual {v2, v3, v1}, Lcom/ss/android/socialbase/downloader/k/a;->a(Ljava/lang/String;I)I

    move-result v3

    if-ne v3, v1, :cond_25

    .line 323
    invoke-virtual {p3}, Lcom/ss/android/socialbase/downloader/g/c;->bi()I

    move-result v3

    .line 325
    :try_start_17
    const-string v4, "ttmd5_status"

    invoke-virtual {p5, v4, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
    :try_end_1c
    .catch Ljava/lang/Throwable; {:try_start_17 .. :try_end_1c} :catch_96

    .line 329
    :goto_1c
    invoke-static {v3}, Lcom/ss/android/socialbase/downloader/m/d;->a(I)Z

    move-result v3

    if-nez v3, :cond_25

    .line 330
    const/16 v0, 0x7d5

    .line 369
    :cond_24
    :goto_24
    return v0

    .line 334
    :cond_25
    iget v3, p0, Lcom/ss/android/downloadlib/a$b;->d:I

    if-eq v3, v0, :cond_2c

    .line 335
    iget v0, p0, Lcom/ss/android/downloadlib/a$b;->d:I

    goto :goto_24

    .line 338
    :cond_2c
    const-string v3, "install_failed_check_signature"

    invoke-virtual {v2, v3, v1}, Lcom/ss/android/socialbase/downloader/k/a;->a(Ljava/lang/String;I)I

    move-result v2

    if-ne v2, v1, :cond_63

    .line 339
    invoke-static {}, Lcom/ss/android/downloadlib/a/x;->a()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {p2}, Lcom/ss/android/downloadad/a/b/a;->m()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Lcom/ss/android/downloadlib/f/l;->d(Landroid/content/Context;Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_63

    .line 340
    invoke-static {}, Lcom/ss/android/downloadlib/a/x;->a()Landroid/content/Context;

    move-result-object v2

    invoke-virtual {p2}, Lcom/ss/android/downloadad/a/b/a;->m()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Lcom/ss/android/downloadlib/f/l;->g(Landroid/content/Context;Ljava/lang/String;)[Landroid/content/pm/Signature;

    move-result-object v2

    .line 341
    invoke-static {}, Lcom/ss/android/downloadlib/a/x;->a()Landroid/content/Context;

    move-result-object v3

    invoke-virtual {p3}, Lcom/ss/android/socialbase/downloader/g/c;->n()Ljava/lang/String;

    move-result-object v4

    invoke-static {v3, v4}, Lcom/ss/android/downloadlib/f/l;->h(Landroid/content/Context;Ljava/lang/String;)[Landroid/content/pm/Signature;

    move-result-object v3

    .line 342
    invoke-static {v3, v2}, Lcom/ss/android/downloadlib/f/l;->a([Landroid/content/pm/Signature;[Landroid/content/pm/Signature;)Z

    move-result v2

    if-nez v2, :cond_63

    .line 343
    const/16 v0, 0x7d6

    goto :goto_24

    .line 348
    :cond_63
    if-nez p1, :cond_68

    .line 350
    const/16 v0, 0x7d2

    goto :goto_24

    .line 353
    :cond_68
    iget-wide v2, p0, Lcom/ss/android/downloadlib/a$b;->e:J

    iget-wide v4, p0, Lcom/ss/android/downloadlib/a$b;->c:J

    cmp-long v2, v2, v4

    if-lez v2, :cond_24

    .line 356
    :try_start_70
    const-string v0, "install_time"

    iget-wide v2, p0, Lcom/ss/android/downloadlib/a$b;->e:J

    iget-wide v4, p0, Lcom/ss/android/downloadlib/a$b;->c:J

    sub-long/2addr v2, v4

    invoke-virtual {p5, v0, v2, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    .line 358
    const-string v2, "install_again"

    invoke-virtual {p2}, Lcom/ss/android/downloadad/a/b/a;->f()J

    move-result-wide v4

    iget-wide v6, p0, Lcom/ss/android/downloadlib/a$b;->c:J

    cmp-long v0, v4, v6

    if-lez v0, :cond_8f

    move v0, v1

    :goto_87
    invoke-virtual {p5, v2, v0}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
    :try_end_8a
    .catch Ljava/lang/Throwable; {:try_start_70 .. :try_end_8a} :catch_94

    .line 362
    :goto_8a
    if-nez p4, :cond_91

    .line 363
    const/16 v0, 0x7d3

    goto :goto_24

    .line 358
    :cond_8f
    const/4 v0, 0x0

    goto :goto_87

    .line 365
    :cond_91
    const/16 v0, 0x7d4

    goto :goto_24

    .line 359
    :catch_94
    move-exception v0

    goto :goto_8a

    .line 326
    :catch_96
    move-exception v4

    goto :goto_1c
.end method

.method static synthetic a(Lcom/ss/android/downloadlib/a$b;)V
    .registers 1

    .prologue
    .line 232
    invoke-direct {p0}, Lcom/ss/android/downloadlib/a$b;->b()V

    return-void
.end method

.method private b()V
    .registers 3

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

    move-result-wide v0

    iput-wide v0, p0, Lcom/ss/android/downloadlib/a$b;->e:J

    .line 248
    return-void
.end method


# virtual methods
.method a()Z
    .registers 21

    .prologue
    .line 267
    invoke-static {}, Lcom/ss/android/downloadlib/a/b/e;->a()Lcom/ss/android/downloadlib/a/b/e;

    move-result-object v2

    move-object/from16 v0, p0

    iget-wide v4, v0, Lcom/ss/android/downloadlib/a$b;->a:J

    invoke-virtual {v2, v4, v5}, Lcom/ss/android/downloadlib/a/b/e;->d(J)Lcom/ss/android/downloadad/a/b/a;

    move-result-object v4

    .line 268
    if-eqz v4, :cond_1c

    invoke-static {v4}, Lcom/ss/android/downloadlib/f/l;->b(Lcom/ss/android/downloadad/a/b/a;)Z

    move-result v2

    if-nez v2, :cond_1c

    iget-object v2, v4, Lcom/ss/android/downloadad/a/b/a;->a:Ljava/util/concurrent/atomic/AtomicBoolean;

    invoke-virtual {v2}, Ljava/util/concurrent/atomic/AtomicBoolean;->get()Z

    move-result v2

    if-eqz v2, :cond_1e

    .line 269
    :cond_1c
    const/4 v2, 0x0

    .line 312
    :goto_1d
    return v2

    .line 271
    :cond_1e
    invoke-static {}, Lcom/ss/android/downloadlib/a/x;->a()Landroid/content/Context;

    move-result-object v2

    invoke-static {v2}, Lcom/ss/android/socialbase/downloader/downloader/r;->a(Landroid/content/Context;)Lcom/ss/android/socialbase/downloader/downloader/r;

    move-result-object v2

    invoke-virtual {v4}, Lcom/ss/android/downloadad/a/b/a;->t()I

    move-result v3

    invoke-virtual {v2, v3}, Lcom/ss/android/socialbase/downloader/downloader/r;->h(I)Lcom/ss/android/socialbase/downloader/g/c;

    move-result-object v5

    .line 272
    if-nez v5, :cond_32

    .line 273
    const/4 v2, 0x0

    goto :goto_1d

    .line 276
    :cond_32
    invoke-virtual {v4}, Lcom/ss/android/downloadad/a/b/a;->B()J

    move-result-wide v8

    .line 277
    invoke-static {}, Landroid/os/Environment;->getDataDirectory()Ljava/io/File;

    move-result-object v2

    invoke-static {v2}, Lcom/ss/android/downloadlib/f/l;->b(Ljava/io/File;)J

    move-result-wide v10

    .line 278
    const-wide/32 v2, 0x1f400000

    const-wide/16 v6, 0xa

    div-long v6, v10, v6

    invoke-static {v2, v3, v6, v7}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v6

    .line 279
    invoke-virtual {v5}, Lcom/ss/android/socialbase/downloader/g/c;->am()J

    move-result-wide v12

    .line 281
    const/4 v3, 0x1

    .line 283
    const-wide/16 v14, -0x1

    cmp-long v2, v8, v14

    if-lez v2, :cond_6a

    const-wide/16 v14, -0x1

    cmp-long v2, v12, v14

    if-lez v2, :cond_6a

    long-to-double v14, v8

    long-to-double v6, v6

    long-to-double v0, v12

    move-wide/from16 v16, v0

    const-wide/high16 v18, 0x4004000000000000L    # 2.5

    mul-double v16, v16, v18

    add-double v6, v6, v16

    cmpg-double v2, v14, v6

    if-gez v2, :cond_6a

    .line 284
    const/4 v3, 0x0

    .line 287
    :cond_6a
    invoke-static {}, Lcom/ss/android/downloadlib/a/x;->a()Landroid/content/Context;

    move-result-object v2

    invoke-static {v2}, Lcom/ss/android/socialbase/appdownloader/g;->a(Landroid/content/Context;)Z

    move-result v6

    .line 289
    new-instance v7, Lorg/json/JSONObject;

    invoke-direct {v7}, Lorg/json/JSONObject;-><init>()V

    move-object/from16 v2, p0

    .line 290
    invoke-direct/range {v2 .. v7}, Lcom/ss/android/downloadlib/a$b;->a(ZLcom/ss/android/downloadad/a/b/a;Lcom/ss/android/socialbase/downloader/g/c;ZLorg/json/JSONObject;)I

    move-result v2

    move-object/from16 v0, p0

    iput v2, v0, Lcom/ss/android/downloadlib/a$b;->d:I

    .line 293
    :try_start_81
    const-string v2, "fail_status"

    move-object/from16 v0, p0

    iget v5, v0, Lcom/ss/android/downloadlib/a$b;->d:I

    invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    invoke-virtual {v7, v2, v5}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 294
    const-string v2, "available_space"

    const-wide/32 v14, 0x100000

    div-long v14, v8, v14

    invoke-static {v14, v15}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v5

    invoke-virtual {v7, v2, v5}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 295
    const-string v2, "total_space"

    const-wide/32 v14, 0x100000

    div-long/2addr v10, v14

    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v5

    invoke-virtual {v7, v2, v5}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 296
    const-wide/16 v10, 0x0

    cmp-long v2, v12, v10

    if-lez v2, :cond_bd

    .line 297
    const-string v2, "package_size"

    const-wide/32 v10, 0x100000

    div-long v10, v12, v10

    invoke-static {v10, v11}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v5

    invoke-virtual {v7, v2, v5}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 299
    :cond_bd
    const-string v5, "space_enough"

    if-eqz v3, :cond_101

    const/4 v2, 0x1

    :goto_c2
    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v7, v5, v2}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 300
    const-wide/16 v2, 0x0

    cmp-long v2, v8, v2

    if-lez v2, :cond_dd

    const-wide/16 v2, 0x0

    cmp-long v2, v12, v2

    if-lez v2, :cond_dd

    .line 301
    const-string v2, "available_space_ratio"

    long-to-double v8, v8

    long-to-double v10, v12

    div-double/2addr v8, v10

    invoke-virtual {v7, v2, v8, v9}, Lorg/json/JSONObject;->put(Ljava/lang/String;D)Lorg/json/JSONObject;

    .line 305
    :cond_dd
    const-string v3, "permission_unknown_source_install"

    if-eqz v6, :cond_103

    const/4 v2, 0x1

    :goto_e2
    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    invoke-virtual {v7, v3, v2}, Lorg/json/JSONObject;->putOpt(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    .line 307
    const-string v3, "is_update_download"

    invoke-virtual {v4}, Lcom/ss/android/downloadad/a/b/a;->I()Z

    move-result v2

    if-eqz v2, :cond_105

    const/4 v2, 0x1

    :goto_f2
    invoke-virtual {v7, v3, v2}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
    :try_end_f5
    .catch Ljava/lang/Exception; {:try_start_81 .. :try_end_f5} :catch_107

    .line 311
    :goto_f5
    invoke-static {}, Lcom/ss/android/downloadlib/e/a;->a()Lcom/ss/android/downloadlib/e/a;

    move-result-object v2

    const-string v3, "install_failed"

    invoke-virtual {v2, v3, v7, v4}, Lcom/ss/android/downloadlib/e/a;->a(Ljava/lang/String;Lorg/json/JSONObject;Lcom/ss/android/downloadad/a/b/a;)V

    .line 312
    const/4 v2, 0x1

    goto/16 :goto_1d

    .line 299
    :cond_101
    const/4 v2, 0x2

    goto :goto_c2

    .line 305
    :cond_103
    const/4 v2, 0x2

    goto :goto_e2

    .line 307
    :cond_105
    const/4 v2, 0x2

    goto :goto_f2

    .line 308
    :catch_107
    move-exception v2

    .line 309
    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_f5
.end method

.method public run()V
    .registers 5

    .prologue
    .line 253
    :try_start_0
    invoke-virtual {p0}, Lcom/ss/android/downloadlib/a$b;->a()Z

    move-result v0

    .line 254
    if-eqz v0, :cond_11

    .line 255
    invoke-static {}, Lcom/ss/android/downloadlib/a;->a()Lcom/ss/android/downloadlib/a;

    move-result-object v0

    iget-wide v2, p0, Lcom/ss/android/downloadlib/a$b;->a:J

    iget v1, p0, Lcom/ss/android/downloadlib/a$b;->b:I

    invoke-virtual {v0, v2, v3, v1}, Lcom/ss/android/downloadlib/a;->a(JI)V
    :try_end_11
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_11} :catch_12

    .line 260
    :cond_11
    :goto_11
    return-void

    .line 257
    :catch_12
    move-exception v0

    .line 258
    invoke-virtual {v0}, Ljava/lang/Throwable;->printStackTrace()V

    goto :goto_11
.end method