b.smali

.class public final Lcom/proxy/ad/h/b;
.super Ljava/lang/Object;


# static fields
.field private static a:Z = false

.field private static b:Z = false

.field private static c:I = 0x1

.field private static d:J = 0x0L

.field private static e:Z = false


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

    return-void
.end method

.method public static a()I
    .registers 3

    sget-boolean v0, Lcom/proxy/ad/h/b;->a:Z

    const/4 v1, 0x1

    if-eqz v0, :cond_1f

    invoke-static {}, Lcom/proxy/ad/f/b;->a()Z

    move-result v0

    if-eqz v0, :cond_1c

    sget-boolean v0, Lcom/proxy/ad/h/b;->e:Z

    if-nez v0, :cond_1c

    invoke-static {}, Lcom/proxy/ad/f/a;->C()I

    move-result v0

    if-gtz v0, :cond_1c

    sput-boolean v1, Lcom/proxy/ad/h/b;->e:Z

    sget v0, Lcom/proxy/ad/h/b;->c:I

    invoke-static {v0}, Lcom/proxy/ad/f/a;->e(I)V

    :cond_1c
    sget v0, Lcom/proxy/ad/h/b;->c:I

    return v0

    :cond_1f
    invoke-static {}, Lcom/proxy/ad/f/b;->a()Z

    move-result v0

    if-eqz v0, :cond_30

    invoke-static {}, Lcom/proxy/ad/f/a;->C()I

    move-result v0

    sput v0, Lcom/proxy/ad/h/b;->c:I

    if-eqz v0, :cond_30

    sput-boolean v1, Lcom/proxy/ad/h/b;->a:Z

    return v0

    :cond_30
    :try_start_30
    new-instance v0, Ljava/io/File;

    const-string v2, "/sys/devices/system/cpu/"

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

    new-instance v2, Lcom/proxy/ad/h/b$a;

    invoke-direct {v2}, Lcom/proxy/ad/h/b$a;-><init>()V

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

    move-result-object v0

    array-length v0, v0

    sput v0, Lcom/proxy/ad/h/b;->c:I
    :try_end_43
    .catchall {:try_start_30 .. :try_end_43} :catchall_44

    goto :goto_45

    :catchall_44
    nop

    :goto_45
    sget v0, Lcom/proxy/ad/h/b;->c:I

    if-gt v0, v1, :cond_53

    invoke-static {}, Ljava/lang/Runtime;->getRuntime()Ljava/lang/Runtime;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Runtime;->availableProcessors()I

    move-result v0

    sput v0, Lcom/proxy/ad/h/b;->c:I

    :cond_53
    sput-boolean v1, Lcom/proxy/ad/h/b;->a:Z

    invoke-static {}, Lcom/proxy/ad/f/b;->a()Z

    move-result v0

    if-eqz v0, :cond_60

    sget v0, Lcom/proxy/ad/h/b;->c:I

    invoke-static {v0}, Lcom/proxy/ad/f/a;->e(I)V

    :cond_60
    sget v0, Lcom/proxy/ad/h/b;->c:I

    return v0
.end method

.method public static b()J
    .registers 13

    sget-boolean v0, Lcom/proxy/ad/h/b;->b:Z

    const-wide/16 v1, 0x0

    if-eqz v0, :cond_d

    sget-wide v3, Lcom/proxy/ad/h/b;->d:J

    cmp-long v0, v3, v1

    if-eqz v0, :cond_d

    return-wide v3

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

    move-result-object v0

    const-string v3, "sp_cpu_max_freq"

    const-string v4, "sp_ads"

    const/4 v5, 0x1

    invoke-static {v4, v3, v0, v5}, Lcom/proxy/ad/f/b;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Long;

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

    move-result-wide v6

    sput-wide v6, Lcom/proxy/ad/h/b;->d:J

    cmp-long v0, v6, v1

    if-eqz v0, :cond_29

    sput-boolean v5, Lcom/proxy/ad/h/b;->b:Z

    return-wide v6

    :cond_29
    const/4 v0, -0x1

    const/4 v1, 0x0

    const/4 v2, 0x0

    const/4 v6, -0x1

    :goto_2d
    :try_start_2d
    invoke-static {}, Lcom/proxy/ad/h/b;->a()I

    move-result v7

    if-ge v2, v7, :cond_94

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "/sys/devices/system/cpu/cpu"

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

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

    const-string v8, "/cpufreq/cpuinfo_max_freq"

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

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

    move-result-object v7

    new-instance v8, Ljava/io/File;

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

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

    move-result v7

    if-eqz v7, :cond_91

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

    move-result v7

    if-eqz v7, :cond_91

    const/16 v7, 0x80

    new-array v9, v7, [B

    new-instance v10, Ljava/io/FileInputStream;

    invoke-direct {v10, v8}, Ljava/io/FileInputStream;-><init>(Ljava/io/File;)V
    :try_end_60
    .catch Ljava/lang/Exception; {:try_start_2d .. :try_end_60} :catch_ef

    :try_start_60
    invoke-virtual {v10, v9}, Ljava/io/FileInputStream;->read([B)I

    const/4 v8, 0x0

    :goto_64
    aget-byte v11, v9, v8

    invoke-static {v11}, Ljava/lang/Character;->isDigit(I)Z

    move-result v11

    if-eqz v11, :cond_71

    if-ge v8, v7, :cond_71

    add-int/lit8 v8, v8, 0x1

    goto :goto_64

    :cond_71
    new-instance v7, Ljava/lang/String;

    invoke-direct {v7, v9, v1, v8}, Ljava/lang/String;-><init>([BII)V

    invoke-static {v7}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v7

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

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/Integer;->intValue()I

    move-result v8

    if-le v8, v6, :cond_88

    invoke-virtual {v7}, Ljava/lang/Integer;->intValue()I

    move-result v6
    :try_end_88
    .catch Ljava/lang/NumberFormatException; {:try_start_60 .. :try_end_88} :catch_88
    .catchall {:try_start_60 .. :try_end_88} :catchall_8c

    :catch_88
    :cond_88
    :try_start_88
    invoke-virtual {v10}, Ljava/io/FileInputStream;->close()V

    goto :goto_91

    :catchall_8c
    move-exception v1

    invoke-virtual {v10}, Ljava/io/FileInputStream;->close()V

    throw v1

    :cond_91
    :goto_91
    add-int/lit8 v2, v2, 0x1

    goto :goto_2d

    :cond_94
    if-ne v6, v0, :cond_ee

    new-instance v2, Ljava/io/FileReader;

    const-string v7, "/proc/cpuinfo"

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

    new-instance v7, Ljava/io/BufferedReader;

    invoke-direct {v7, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
    :try_end_a2
    .catch Ljava/lang/Exception; {:try_start_88 .. :try_end_a2} :catch_ef

    :cond_a2
    :goto_a2
    :try_start_a2
    invoke-virtual {v7}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v8

    if-eqz v8, :cond_df

    const-string v9, ":"

    const/4 v10, 0x2

    invoke-virtual {v8, v9, v10}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;

    move-result-object v8

    const-string v9, "cpu MHz"

    aget-object v10, v8, v1

    const-string v11, "[\\t\\n\\r]"

    const-string v12, ""

    invoke-virtual {v10, v11, v12}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v9

    if-eqz v9, :cond_a2

    aget-object v9, v8, v5

    const-string v10, "."

    invoke-virtual {v9, v10}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v9

    if-eqz v9, :cond_d3

    aget-object v8, v8, v5

    invoke-static {v8}, Ljava/lang/Double;->parseDouble(Ljava/lang/String;)D

    move-result-wide v8

    double-to-int v8, v8

    goto :goto_d9

    :cond_d3
    aget-object v8, v8, v5

    invoke-static {v8}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I

    move-result v8
    :try_end_d9
    .catch Ljava/lang/Exception; {:try_start_a2 .. :try_end_d9} :catch_df
    .catchall {:try_start_a2 .. :try_end_d9} :catchall_e6

    :goto_d9
    mul-int/lit16 v8, v8, 0x3e8

    if-le v8, v6, :cond_a2

    move v6, v8

    goto :goto_a2

    :catch_df
    :cond_df
    :try_start_df
    invoke-virtual {v2}, Ljava/io/FileReader;->close()V

    invoke-virtual {v7}, Ljava/io/BufferedReader;->close()V

    goto :goto_ee

    :catchall_e6
    move-exception v1

    invoke-virtual {v2}, Ljava/io/FileReader;->close()V

    invoke-virtual {v7}, Ljava/io/BufferedReader;->close()V

    throw v1
    :try_end_ee
    .catch Ljava/lang/Exception; {:try_start_df .. :try_end_ee} :catch_ef

    :cond_ee
    :goto_ee
    move v0, v6

    :catch_ef
    sput-boolean v5, Lcom/proxy/ad/h/b;->b:Z

    div-int/lit16 v0, v0, 0x3e8

    int-to-long v0, v0

    sput-wide v0, Lcom/proxy/ad/h/b;->d:J

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

    move-result-object v0

    invoke-static {v4, v3, v0, v5}, Lcom/proxy/ad/f/b;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;I)V

    sget-wide v0, Lcom/proxy/ad/h/b;->d:J

    return-wide v0
.end method