CPUFeatures.smali
.class public Lcom/polly/mobile/util/CPUFeatures;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field private static a:I = 0x0
.field private static b:I = -0x1
# direct methods
.method static constructor <clinit>()V
.registers 0
return-void
.end method
.method public constructor <init>()V
.registers 1
.line 10
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static a()I
.registers 1
.line 13
invoke-static {}, Lcom/polly/mobile/util/CPUFeatures;->getCpuArchitecture()I
move-result v0
return v0
.end method
.method private static a(Ljava/lang/String;)I
.registers 5
const-string v0, "yy-media"
const/4 v1, 0x0
.line 87
:try_start_3
new-instance v2, Ljava/io/BufferedReader;
new-instance v3, Ljava/io/FileReader;
invoke-direct {v3, p0}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
invoke-direct {v2, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_d
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_d} :catch_1f
.catchall {:try_start_3 .. :try_end_d} :catchall_1d
.line 88
:try_start_d
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object p0
:try_end_11
.catch Ljava/io/IOException; {:try_start_d .. :try_end_11} :catch_1a
.catchall {:try_start_d .. :try_end_11} :catchall_17
.line 94
:try_start_11
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_14
.catch Ljava/io/IOException; {:try_start_11 .. :try_end_14} :catch_15
goto :goto_2c
:catch_15
nop
goto :goto_2c
:catchall_17
move-exception p0
move-object v1, v2
goto :goto_4b
:catch_1a
move-exception p0
move-object v1, v2
goto :goto_20
:catchall_1d
move-exception p0
goto :goto_4b
:catch_1f
move-exception p0
:goto_20
:try_start_20
const-string v2, "fail to read max freq"
.line 90
invoke-static {v0, v2, p0}, Lcom/polly/mobile/util/f;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_25
.catchall {:try_start_20 .. :try_end_25} :catchall_1d
if-eqz v1, :cond_2a
.line 94
:try_start_27
invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
:try_end_2a
.catch Ljava/io/IOException; {:try_start_27 .. :try_end_2a} :catch_2a
:catch_2a
:cond_2a
const-string p0, ""
:goto_2c
const/4 v1, -0x1
const-string v2, "^[-\\+]?[\\d]*$"
.line 102
invoke-static {v2}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
move-result-object v2
if-eqz p0, :cond_4a
.line 103
invoke-virtual {v2, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
move-result-object v2
invoke-virtual {v2}, Ljava/util/regex/Matcher;->matches()Z
move-result v2
if-eqz v2, :cond_4a
.line 105
:try_start_3f
invoke-static {p0}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
move-result v1
:try_end_43
.catch Ljava/lang/NumberFormatException; {:try_start_3f .. :try_end_43} :catch_44
goto :goto_4a
:catch_44
move-exception p0
const-string v2, "fail to parse max freq"
.line 107
invoke-static {v0, v2, p0}, Lcom/polly/mobile/util/f;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:cond_4a
:goto_4a
return v1
:goto_4b
if-eqz v1, :cond_50
.line 94
:try_start_4d
invoke-virtual {v1}, Ljava/io/BufferedReader;->close()V
:try_end_50
.catch Ljava/io/IOException; {:try_start_4d .. :try_end_50} :catch_50
.line 97
:catch_50
:cond_50
throw p0
.end method
.method public static b()I
.registers 4
.line 23
sget v0, Lcom/polly/mobile/util/CPUFeatures;->a:I
if-lez v0, :cond_5
return v0
:cond_5
const/4 v0, 0x1
.line 41
:try_start_6
new-instance v1, Ljava/io/File;
const-string v2, "/sys/devices/system/cpu/"
invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 43
new-instance v2, Lcom/polly/mobile/util/CPUFeatures$a;
invoke-direct {v2}, Lcom/polly/mobile/util/CPUFeatures$a;-><init>()V
invoke-virtual {v1, v2}, Ljava/io/File;->listFiles(Ljava/io/FileFilter;)[Ljava/io/File;
move-result-object v1
.line 45
array-length v0, v1
if-lez v0, :cond_29
.line 47
sput v0, Lcom/polly/mobile/util/CPUFeatures;->a:I
:try_end_1b
.catch Ljava/lang/Exception; {:try_start_6 .. :try_end_1b} :catch_1c
goto :goto_29
:catch_1c
move-exception v1
const-string v2, "yy-media"
const-string v3, "fail to read cpu core"
.line 50
invoke-static {v2, v3, v1}, Lcom/polly/mobile/util/f;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 52
sget v1, Lcom/polly/mobile/util/CPUFeatures;->a:I
if-lez v1, :cond_29
move v0, v1
:cond_29
:goto_29
return v0
.end method
.method public static c()I
.registers 5
.line 62
sget v0, Lcom/polly/mobile/util/CPUFeatures;->b:I
if-lez v0, :cond_5
return v0
.line 65
:cond_5
invoke-static {}, Lcom/polly/mobile/util/CPUFeatures;->b()I
move-result v0
const/4 v1, -0x1
if-lez v0, :cond_2c
const/4 v2, 0x0
:goto_d
if-ge v2, v0, :cond_32
.line 69
new-instance v3, Ljava/lang/StringBuilder;
const-string v4, "/sys/devices/system/cpu/cpu"
invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
const-string v4, "/cpufreq/cpuinfo_max_freq"
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v3}, Lcom/polly/mobile/util/CPUFeatures;->a(Ljava/lang/String;)I
move-result v3
if-le v3, v1, :cond_29
move v1, v3
:cond_29
add-int/lit8 v2, v2, 0x1
goto :goto_d
:cond_2c
const-string v0, "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
.line 75
invoke-static {v0}, Lcom/polly/mobile/util/CPUFeatures;->a(Ljava/lang/String;)I
move-result v1
.line 77
:cond_32
sget v0, Lcom/polly/mobile/util/CPUFeatures;->b:I
if-le v1, v0, :cond_38
.line 78
sput v1, Lcom/polly/mobile/util/CPUFeatures;->b:I
.line 80
:cond_38
sget v0, Lcom/polly/mobile/util/CPUFeatures;->b:I
return v0
.end method
.method private static native getCpuArchitecture()I
.end method
.method private static native isVFPSupported()Z
.end method