a.smali

.class public Lbm/a;
.super Ljava/lang/Object;
.source "DeviceInfo.java"


# static fields
.field public static a:J = -0x64L


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

    const/16 v0, -0x64

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    new-instance v0, Lbm/a$a;

    invoke-direct {v0}, Lbm/a$a;-><init>()V

    return-void
.end method

.method public constructor <init>()V
    .registers 1

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

    return-void
.end method

.method public static a(Ljava/lang/String;Ljava/io/FileInputStream;)I
    .registers 8

    const/16 v0, 0x400

    new-array v0, v0, [B

    :try_start_4
    invoke-virtual {p1, v0}, Ljava/io/FileInputStream;->read([B)I

    move-result p1

    const/4 v1, 0x0

    :goto_9
    if-ge v1, p1, :cond_3a

    aget-byte v2, v0, v1

    const/16 v3, 0xa

    if-eq v2, v3, :cond_13

    if-nez v1, :cond_37

    :cond_13
    aget-byte v2, v0, v1

    if-ne v2, v3, :cond_19

    add-int/lit8 v1, v1, 0x1

    :cond_19
    move v2, v1

    :goto_1a
    if-ge v2, p1, :cond_37

    sub-int v3, v2, v1

    aget-byte v4, v0, v2

    invoke-virtual {p0, v3}, Ljava/lang/String;->charAt(I)C

    move-result v5

    if-eq v4, v5, :cond_27

    goto :goto_37

    :cond_27
    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v4

    add-int/lit8 v4, v4, -0x1

    if-ne v3, v4, :cond_34

    invoke-static {v0, v2}, Lbm/a;->a([BI)I

    move-result p0
    :try_end_33
    .catch Ljava/io/IOException; {:try_start_4 .. :try_end_33} :catch_3a
    .catch Ljava/lang/NumberFormatException; {:try_start_4 .. :try_end_33} :catch_3a

    return p0

    :cond_34
    add-int/lit8 v2, v2, 0x1

    goto :goto_1a

    :cond_37
    :goto_37
    add-int/lit8 v1, v1, 0x1

    goto :goto_9

    :catch_3a
    :cond_3a
    const/4 p0, -0x1

    return p0
.end method

.method public static a([BI)I
    .registers 5

    :goto_0
    array-length v0, p0

    if-ge p1, v0, :cond_30

    aget-byte v0, p0, p1

    const/16 v1, 0xa

    if-eq v0, v1, :cond_30

    aget-byte v0, p0, p1

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

    move-result v0

    if-eqz v0, :cond_2d

    add-int/lit8 v0, p1, 0x1

    :goto_13
    array-length v1, p0

    if-ge v0, v1, :cond_21

    aget-byte v1, p0, v0

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

    move-result v1

    if-eqz v1, :cond_21

    add-int/lit8 v0, v0, 0x1

    goto :goto_13

    :cond_21
    new-instance v1, Ljava/lang/String;

    const/4 v2, 0x0

    sub-int/2addr v0, p1

    invoke-direct {v1, p0, v2, p1, v0}, Ljava/lang/String;-><init>([BIII)V

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

    move-result p0

    return p0

    :cond_2d
    add-int/lit8 p1, p1, 0x1

    goto :goto_0

    :cond_30
    const/4 p0, -0x1

    return p0
.end method

.method public static a(Landroid/content/Context;)J
    .registers 9
    .annotation build Landroid/annotation/TargetApi;
        value = 0x10
    .end annotation

    sget-wide v0, Lbm/a;->a:J

    const-wide/16 v2, -0x1

    cmp-long v4, v0, v2

    if-nez v4, :cond_9

    return-wide v0

    :cond_9
    const-wide/16 v4, -0x64

    cmp-long v6, v0, v4

    if-nez v6, :cond_53

    const-class v0, Lbm/a;

    monitor-enter v0

    :try_start_12
    sget v1, Landroid/os/Build$VERSION;->SDK_INT:I

    const/16 v4, 0x10

    if-lt v1, v4, :cond_2d

    new-instance v1, Landroid/app/ActivityManager$MemoryInfo;

    invoke-direct {v1}, Landroid/app/ActivityManager$MemoryInfo;-><init>()V

    const-string v4, "activity"

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

    move-result-object p0

    check-cast p0, Landroid/app/ActivityManager;

    invoke-virtual {p0, v1}, Landroid/app/ActivityManager;->getMemoryInfo(Landroid/app/ActivityManager$MemoryInfo;)V

    iget-wide v4, v1, Landroid/app/ActivityManager$MemoryInfo;->totalMem:J

    sput-wide v4, Lbm/a;->a:J
    :try_end_2c
    .catchall {:try_start_12 .. :try_end_2c} :catchall_4c

    goto :goto_4e

    :cond_2d
    :try_start_2d
    new-instance p0, Ljava/io/FileInputStream;

    const-string v1, "/proc/meminfo"

    invoke-direct {p0, v1}, Ljava/io/FileInputStream;-><init>(Ljava/lang/String;)V
    :try_end_34
    .catch Ljava/io/IOException; {:try_start_2d .. :try_end_34} :catch_48
    .catchall {:try_start_2d .. :try_end_34} :catchall_4c

    :try_start_34
    const-string v1, "MemTotal"

    invoke-static {v1, p0}, Lbm/a;->a(Ljava/lang/String;Ljava/io/FileInputStream;)I

    move-result v1
    :try_end_3a
    .catchall {:try_start_34 .. :try_end_3a} :catchall_43

    int-to-long v4, v1

    const-wide/16 v6, 0x400

    mul-long v4, v4, v6

    :try_start_3f
    invoke-virtual {p0}, Ljava/io/FileInputStream;->close()V
    :try_end_42
    .catchall {:try_start_3f .. :try_end_42} :catchall_49

    goto :goto_49

    :catchall_43
    move-exception v1

    :try_start_44
    invoke-virtual {p0}, Ljava/io/FileInputStream;->close()V
    :try_end_47
    .catchall {:try_start_44 .. :try_end_47} :catchall_47

    :catchall_47
    :try_start_47
    throw v1
    :try_end_48
    .catch Ljava/io/IOException; {:try_start_47 .. :try_end_48} :catch_48
    .catchall {:try_start_47 .. :try_end_48} :catchall_4c

    :catch_48
    move-wide v4, v2

    :catchall_49
    :goto_49
    :try_start_49
    sput-wide v4, Lbm/a;->a:J
    :try_end_4b
    .catchall {:try_start_49 .. :try_end_4b} :catchall_4c

    goto :goto_4e

    :catchall_4c
    :try_start_4c
    sput-wide v2, Lbm/a;->a:J

    :goto_4e
    monitor-exit v0

    goto :goto_53

    :catchall_50
    move-exception p0

    monitor-exit v0
    :try_end_52
    .catchall {:try_start_4c .. :try_end_52} :catchall_50

    throw p0

    :cond_53
    :goto_53
    sget-wide v0, Lbm/a;->a:J

    return-wide v0
.end method