wr.smali

.class public final Ldxoptimizer/wr;
.super Ljava/lang/Object;
.source "EventHelper.java"


# static fields
.field public static final a:Ljava/util/TimeZone;

.field public static final b:Ljava/lang/Long;

.field public static final c:Ljava/lang/Long;

.field private static d:I


# direct methods
.method static constructor <clinit>()V
    .registers 2

    .prologue
    .line 34
    const-string v0, "GMT+8"

    invoke-static {v0}, Ljava/util/TimeZone;->getTimeZone(Ljava/lang/String;)Ljava/util/TimeZone;

    move-result-object v0

    sput-object v0, Ldxoptimizer/wr;->a:Ljava/util/TimeZone;

    .line 41
    const-wide/32 v0, 0x1b7740

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

    move-result-object v0

    sput-object v0, Ldxoptimizer/wr;->b:Ljava/lang/Long;

    .line 43
    const-wide/32 v0, 0xdbba00

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

    move-result-object v0

    sput-object v0, Ldxoptimizer/wr;->c:Ljava/lang/Long;

    .line 54
    const/4 v0, -0x1

    sput v0, Ldxoptimizer/wr;->d:I

    return-void
.end method

.method public static a(J)J
    .registers 4

    .prologue
    .line 57
    const-wide/16 v0, 0x3e8

    div-long v0, p0, v0

    return-wide v0
.end method

.method public static a()Ljava/lang/String;
    .registers 1

    .prologue
    .line 66
    const-string v0, "/system/dxversion"

    invoke-static {v0}, Ldxoptimizer/wr;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static a(Landroid/content/Context;)Z
    .registers 11

    .prologue
    const/4 v5, 0x1

    const/4 v6, -0x1

    const-wide/16 v2, 0x0

    const/4 v4, 0x0

    .line 184
    invoke-static {p0}, Ldxoptimizer/xa;->a(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_18

    .line 185
    sget-boolean v0, Ldxoptimizer/xa;->c:Z

    if-eqz v0, :cond_16

    .line 186
    const-string v0, "stat.EventHelper"

    const-string v1, "Can\'t report because network is not connected!"

    invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_16
    move v0, v4

    .line 249
    :goto_17
    return v0

    .line 191
    :cond_18
    sget v0, Ldxoptimizer/wr;->d:I

    if-ne v0, v6, :cond_26

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

    move-result-object v0

    invoke-static {p0, v0}, Ldxoptimizer/xc;->b(Landroid/content/Context;Ljava/lang/String;)I

    move-result v0

    sput v0, Ldxoptimizer/wr;->d:I

    .line 195
    :cond_26
    invoke-static {p0}, Ldxoptimizer/xa;->e(Landroid/content/Context;)I

    move-result v0

    .line 196
    if-nez v0, :cond_93

    sget v1, Ldxoptimizer/wr;->d:I

    if-eq v1, v6, :cond_93

    .line 197
    sget v0, Ldxoptimizer/wr;->d:I

    invoke-static {p0, v0}, Ldxoptimizer/xa;->b(Landroid/content/Context;I)V

    .line 208
    :cond_35
    :goto_35
    invoke-static {p0}, Ldxoptimizer/xa;->b(Landroid/content/Context;)I

    move-result v0

    .line 210
    if-ne v0, v5, :cond_b0

    .line 211
    const-wide/32 v0, 0xea60

    .line 216
    :goto_3e
    invoke-static {v2, v3}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    .line 218
    invoke-static {p0, v4}, Ldxoptimizer/xa;->a(Landroid/content/Context;I)Z

    move-result v6

    if-eqz v6, :cond_b9

    .line 219
    const-string v6, "mb"

    invoke-static {p0, v6}, Ldxoptimizer/xa;->a(Landroid/content/Context;Ljava/lang/String;)J

    move-result-wide v6

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

    move-result-object v6

    .line 224
    cmp-long v2, v0, v2

    if-nez v2, :cond_5b

    .line 225
    sget-object v0, Ldxoptimizer/wr;->c:Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    .line 229
    :cond_5b
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    invoke-virtual {v6}, Ljava/lang/Long;->longValue()J

    move-result-wide v8

    sub-long/2addr v2, v8

    cmp-long v2, v2, v0

    if-lez v2, :cond_b7

    move v2, v5

    .line 230
    :goto_69
    if-nez v2, :cond_111

    sget-boolean v3, Ldxoptimizer/xa;->c:Z

    if-eqz v3, :cond_111

    .line 231
    const-string v3, "stat.EventHelper"

    new-instance v4, Ljava/lang/StringBuilder;

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

    const-string v5, "Can\'t report because mobile network need interval "

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

    move-result-object v4

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

    move-result-object v0

    const-string v1, " between reports!While last report time is "

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

    move-result-object v0

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

    move-result-object v0

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

    move-result-object v0

    invoke-static {v3, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    move v0, v2

    goto :goto_17

    .line 198
    :cond_93
    if-eqz v0, :cond_35

    sget v1, Ldxoptimizer/wr;->d:I

    if-eq v1, v6, :cond_35

    .line 199
    sget v1, Ldxoptimizer/wr;->d:I

    if-eq v0, v1, :cond_35

    .line 200
    sget v0, Ldxoptimizer/wr;->d:I

    invoke-static {p0, v0}, Ldxoptimizer/xa;->b(Landroid/content/Context;I)V

    .line 201
    const-string v0, "mb"

    invoke-static {p0, v0}, Ldxoptimizer/xa;->c(Landroid/content/Context;Ljava/lang/String;)V

    .line 202
    const-string v0, "wf"

    invoke-static {p0, v0}, Ldxoptimizer/xa;->c(Landroid/content/Context;Ljava/lang/String;)V

    .line 203
    invoke-static {p0}, Ldxoptimizer/xa;->d(Landroid/content/Context;)V

    goto :goto_35

    .line 212
    :cond_b0
    const/4 v1, 0x2

    if-ne v0, v1, :cond_116

    .line 213
    const-wide/32 v0, 0x927c0

    goto :goto_3e

    :cond_b7
    move v2, v4

    .line 229
    goto :goto_69

    .line 235
    :cond_b9
    const-string v6, "wf"

    invoke-static {p0, v6}, Ldxoptimizer/xa;->a(Landroid/content/Context;Ljava/lang/String;)J

    move-result-wide v6

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

    move-result-object v6

    .line 240
    cmp-long v2, v0, v2

    if-nez v2, :cond_cd

    .line 241
    sget-object v0, Ldxoptimizer/wr;->b:Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    .line 243
    :cond_cd
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    invoke-virtual {v6}, Ljava/lang/Long;->longValue()J

    move-result-wide v8

    sub-long/2addr v2, v8

    cmp-long v2, v2, v0

    if-lez v2, :cond_114

    move v2, v5

    .line 244
    :goto_db
    if-nez v2, :cond_111

    sget-boolean v3, Ldxoptimizer/xa;->c:Z

    if-eqz v3, :cond_111

    .line 245
    const-string v3, "stat.EventHelper"

    new-instance v4, Ljava/lang/StringBuilder;

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

    const-string v5, "Can\'t report because wifi network need interval "

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

    move-result-object v4

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

    move-result-object v0

    const-string v1, " between reports!While last report time is "

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

    move-result-object v0

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

    move-result-object v0

    const-string v1, " currentTime is"

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

    move-result-object v0

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

    move-result-wide v4

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

    move-result-object v0

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

    move-result-object v0

    .line 245
    invoke-static {v3, v0}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    :cond_111
    move v0, v2

    goto/16 :goto_17

    :cond_114
    move v2, v4

    .line 243
    goto :goto_db

    :cond_116
    move-wide v0, v2

    goto/16 :goto_3e
.end method

.method public static a(Ljava/lang/String;)[B
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 114
    new-instance v0, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V

    .line 116
    new-instance v1, Ljava/util/zip/GZIPOutputStream;

    invoke-direct {v1, v0}, Ljava/util/zip/GZIPOutputStream;-><init>(Ljava/io/OutputStream;)V

    .line 118
    new-instance v2, Ljava/io/BufferedWriter;

    new-instance v3, Ljava/io/OutputStreamWriter;

    const-string v4, "UTF-8"

    invoke-direct {v3, v1, v4}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/lang/String;)V

    invoke-direct {v2, v3}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V

    .line 120
    invoke-virtual {v2, p0}, Ljava/io/BufferedWriter;->write(Ljava/lang/String;)V

    .line 122
    invoke-virtual {v2}, Ljava/io/BufferedWriter;->flush()V

    .line 124
    invoke-virtual {v2}, Ljava/io/BufferedWriter;->close()V

    .line 126
    invoke-virtual {v1}, Ljava/util/zip/GZIPOutputStream;->finish()V

    .line 128
    invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B

    move-result-object v0

    return-object v0
.end method

.method public static b(J)J
    .registers 6

    .prologue
    .line 61
    sget-object v0, Ldxoptimizer/wr;->a:Ljava/util/TimeZone;

    invoke-virtual {v0, p0, p1}, Ljava/util/TimeZone;->getOffset(J)I

    move-result v0

    .line 62
    int-to-long v0, v0

    add-long/2addr v0, p0

    const-wide/32 v2, 0x5265c00

    div-long/2addr v0, v2

    return-wide v0
.end method

.method public static b(Ljava/lang/String;)Ljava/lang/String;
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .prologue
    .line 132
    new-instance v0, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V

    .line 134
    new-instance v1, Ljava/util/zip/GZIPOutputStream;

    invoke-direct {v1, v0}, Ljava/util/zip/GZIPOutputStream;-><init>(Ljava/io/OutputStream;)V

    .line 136
    new-instance v2, Ljava/io/BufferedWriter;

    new-instance v3, Ljava/io/OutputStreamWriter;

    const-string v4, "ISO-8859-1"

    invoke-direct {v3, v1, v4}, Ljava/io/OutputStreamWriter;-><init>(Ljava/io/OutputStream;Ljava/lang/String;)V

    invoke-direct {v2, v3}, Ljava/io/BufferedWriter;-><init>(Ljava/io/Writer;)V

    .line 139
    invoke-virtual {v2, p0}, Ljava/io/BufferedWriter;->write(Ljava/lang/String;)V

    .line 141
    invoke-virtual {v2}, Ljava/io/BufferedWriter;->flush()V

    .line 143
    invoke-virtual {v2}, Ljava/io/BufferedWriter;->close()V

    .line 145
    invoke-virtual {v1}, Ljava/util/zip/GZIPOutputStream;->finish()V

    .line 147
    const-string v1, "ISO-8859-1"

    invoke-virtual {v0, v1}, Ljava/io/ByteArrayOutputStream;->toString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static b(Landroid/content/Context;)V
    .registers 2

    .prologue
    .line 253
    const/4 v0, 0x0

    invoke-static {p0, v0}, Ldxoptimizer/xa;->a(Landroid/content/Context;I)Z

    move-result v0

    if-eqz v0, :cond_10

    .line 254
    const-string v0, "mb"

    invoke-static {p0, v0}, Ldxoptimizer/xa;->b(Landroid/content/Context;Ljava/lang/String;)V

    .line 258
    :goto_c
    invoke-static {p0}, Ldxoptimizer/xa;->c(Landroid/content/Context;)V

    .line 259
    return-void

    .line 256
    :cond_10
    const-string v0, "wf"

    invoke-static {p0, v0}, Ldxoptimizer/xa;->b(Landroid/content/Context;Ljava/lang/String;)V

    goto :goto_c
.end method

.method private static c(Ljava/lang/String;)Ljava/lang/String;
    .registers 6

    .prologue
    .line 151
    const/4 v0, 0x0

    .line 153
    :try_start_1
    new-instance v2, Ljava/io/FileReader;

    new-instance v1, Ljava/io/File;

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

    invoke-direct {v2, v1}, Ljava/io/FileReader;-><init>(Ljava/io/File;)V

    .line 154
    new-instance v1, Ljava/io/BufferedReader;

    invoke-direct {v1, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
    :try_end_10
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_10} :catch_b0
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_10} :catch_6e
    .catchall {:try_start_1 .. :try_end_10} :catchall_90

    .line 155
    :try_start_10
    new-instance v0, Ljava/lang/StringBuilder;

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

    .line 157
    :goto_15
    invoke-virtual {v1}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_4a

    .line 158
    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 159
    const-string v2, "\n"

    invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_23
    .catch Ljava/io/FileNotFoundException; {:try_start_10 .. :try_end_23} :catch_24
    .catch Ljava/io/IOException; {:try_start_10 .. :try_end_23} :catch_ae
    .catchall {:try_start_10 .. :try_end_23} :catchall_a7

    goto :goto_15

    .line 162
    :catch_24
    move-exception v0

    move-object v0, v1

    .line 163
    :goto_26
    :try_start_26
    sget-boolean v1, Ldxoptimizer/xa;->d:Z

    if-eqz v1, :cond_42

    .line 164
    const-string v1, "stat.EventHelper"

    new-instance v2, Ljava/lang/StringBuilder;

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

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

    move-result-object v2

    const-string v3, " FileNotFoundException."

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

    move-result-object v2

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

    move-result-object v2

    invoke-static {v1, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
    :try_end_42
    .catchall {:try_start_26 .. :try_end_42} :catchall_a9

    .line 171
    :cond_42
    if-eqz v0, :cond_47

    .line 173
    :try_start_44
    invoke-virtual {v0}, Ljava/io/BufferedReader;->close()V
    :try_end_47
    .catch Ljava/io/IOException; {:try_start_44 .. :try_end_47} :catch_61

    .line 180
    :cond_47
    :goto_47
    const-string v0, ""

    :cond_49
    :goto_49
    return-object v0

    .line 161
    :cond_4a
    :try_start_4a
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
    :try_end_4d
    .catch Ljava/io/FileNotFoundException; {:try_start_4a .. :try_end_4d} :catch_24
    .catch Ljava/io/IOException; {:try_start_4a .. :try_end_4d} :catch_ae
    .catchall {:try_start_4a .. :try_end_4d} :catchall_a7

    move-result-object v0

    .line 171
    if-eqz v1, :cond_49

    .line 173
    :try_start_50
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
    :try_end_53
    .catch Ljava/io/IOException; {:try_start_50 .. :try_end_53} :catch_54

    goto :goto_49

    .line 174
    :catch_54
    move-exception v1

    .line 175
    sget-boolean v2, Ldxoptimizer/xa;->d:Z

    if-eqz v2, :cond_49

    .line 176
    const-string v2, "stat.EventHelper"

    const-string v3, "IOException."

    invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_49

    .line 174
    :catch_61
    move-exception v0

    .line 175
    sget-boolean v1, Ldxoptimizer/xa;->d:Z

    if-eqz v1, :cond_47

    .line 176
    const-string v1, "stat.EventHelper"

    const-string v2, "IOException."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_47

    .line 166
    :catch_6e
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    .line 167
    :goto_72
    :try_start_72
    sget-boolean v2, Ldxoptimizer/xa;->d:Z

    if-eqz v2, :cond_7d

    .line 168
    const-string v2, "stat.EventHelper"

    const-string v3, "IOException."

    invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_7d
    .catchall {:try_start_72 .. :try_end_7d} :catchall_a7

    .line 171
    :cond_7d
    if-eqz v1, :cond_47

    .line 173
    :try_start_7f
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
    :try_end_82
    .catch Ljava/io/IOException; {:try_start_7f .. :try_end_82} :catch_83

    goto :goto_47

    .line 174
    :catch_83
    move-exception v0

    .line 175
    sget-boolean v1, Ldxoptimizer/xa;->d:Z

    if-eqz v1, :cond_47

    .line 176
    const-string v1, "stat.EventHelper"

    const-string v2, "IOException."

    invoke-static {v1, v2, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_47

    .line 171
    :catchall_90
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    :goto_94
    if-eqz v1, :cond_99

    .line 173
    :try_start_96
    invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
    :try_end_99
    .catch Ljava/io/IOException; {:try_start_96 .. :try_end_99} :catch_9a

    .line 178
    :cond_99
    :goto_99
    throw v0

    .line 174
    :catch_9a
    move-exception v1

    .line 175
    sget-boolean v2, Ldxoptimizer/xa;->d:Z

    if-eqz v2, :cond_99

    .line 176
    const-string v2, "stat.EventHelper"

    const-string v3, "IOException."

    invoke-static {v2, v3, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_99

    .line 171
    :catchall_a7
    move-exception v0

    goto :goto_94

    :catchall_a9
    move-exception v1

    move-object v4, v1

    move-object v1, v0

    move-object v0, v4

    goto :goto_94

    .line 166
    :catch_ae
    move-exception v0

    goto :goto_72

    .line 162
    :catch_b0
    move-exception v1

    goto/16 :goto_26
.end method