CpuTool.smali
.class public Lcom/sdk/orion/ui/baselibrary/utils/CpuTool;
.super Ljava/lang/Object;
# static fields
.field private static final KCPU_INFO_CUR_FREQ_FILE_PATH:Ljava/lang/String; = "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
.field private static final KCPU_INFO_MAX_FREQ_FILE_PATH:Ljava/lang/String; = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
.field private static final KCPU_INFO_MIN_FREQ_FILE_PATH:Ljava/lang/String; = "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getCpuCoresNum()I
.registers 2
const-string/jumbo v0, "cpu[0-9]"
:try_start_3
new-instance v0, Ljava/io/File;
const-string/jumbo v1, "/sys/devices/system/cpu/"
invoke-direct {v0, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
new-instance v1, Lcom/sdk/orion/ui/baselibrary/utils/CpuTool$1CpuFilter;
invoke-direct {v1}, Lcom/sdk/orion/ui/baselibrary/utils/CpuTool$1CpuFilter;-><init>()V
invoke-virtual {v0, v1}, Ljava/io/File;->listFiles(Ljava/io/FileFilter;)[Ljava/io/File;
move-result-object v0
array-length v0, v0
:try_end_15
.catch Ljava/lang/Exception; {:try_start_3 .. :try_end_15} :catch_16
:goto_15
return v0
:catch_16
move-exception v0
const/4 v0, 0x1
goto :goto_15
.end method
.method public static getCpuName()Ljava/lang/String;
.registers 6
const/4 v0, 0x0
:try_start_1
new-instance v3, Ljava/io/FileReader;
const-string/jumbo v1, "/proc/cpuinfo"
invoke-direct {v3, v1}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
:try_end_9
.catch Ljava/lang/Exception; {:try_start_1 .. :try_end_9} :catch_34
.catchall {:try_start_1 .. :try_end_9} :catchall_4a
:try_start_9
new-instance v2, Ljava/io/BufferedReader;
invoke-direct {v2, v3}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_e
.catch Ljava/lang/Exception; {:try_start_9 .. :try_end_e} :catch_64
.catchall {:try_start_9 .. :try_end_e} :catchall_5e
:try_start_e
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object v1
const-string/jumbo v4, ":\\s+"
const/4 v5, 0x2
invoke-virtual {v1, v4, v5}, Ljava/lang/String;->split(Ljava/lang/String;I)[Ljava/lang/String;
move-result-object v4
const/4 v1, 0x0
:goto_1b
array-length v5, v4
if-ge v1, v5, :cond_21
add-int/lit8 v1, v1, 0x1
goto :goto_1b
:cond_21
const/4 v1, 0x1
aget-object v0, v4, v1
:try_end_24
.catch Ljava/lang/Exception; {:try_start_e .. :try_end_24} :catch_67
.catchall {:try_start_e .. :try_end_24} :catchall_62
if-eqz v3, :cond_29
:try_start_26
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_29
if-eqz v2, :cond_2e
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_2e
.catch Ljava/lang/Exception; {:try_start_26 .. :try_end_2e} :catch_2f
:cond_2e
:goto_2e
return-object v0
:catch_2f
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_2e
:catch_34
move-exception v1
move-object v2, v0
move-object v3, v0
:goto_37
:try_start_37
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
:try_end_3a
.catchall {:try_start_37 .. :try_end_3a} :catchall_62
if-eqz v3, :cond_3f
:try_start_3c
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_3f
if-eqz v2, :cond_2e
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_44
.catch Ljava/lang/Exception; {:try_start_3c .. :try_end_44} :catch_45
goto :goto_2e
:catch_45
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_2e
:catchall_4a
move-exception v1
move-object v2, v0
move-object v3, v0
move-object v0, v1
:goto_4e
if-eqz v3, :cond_53
:try_start_50
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_53
if-eqz v2, :cond_58
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_58
.catch Ljava/lang/Exception; {:try_start_50 .. :try_end_58} :catch_59
:cond_58
:goto_58
throw v0
:catch_59
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_58
:catchall_5e
move-exception v1
move-object v2, v0
move-object v0, v1
goto :goto_4e
:catchall_62
move-exception v0
goto :goto_4e
:catch_64
move-exception v1
move-object v2, v0
goto :goto_37
:catch_67
move-exception v1
goto :goto_37
.end method
.method public static getCurCpuFreq()I
.registers 5
const/4 v3, 0x0
const/4 v0, 0x0
:try_start_2
new-instance v4, Ljava/io/FileReader;
const-string/jumbo v1, "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
invoke-direct {v4, v1}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
:try_end_a
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_a} :catch_2b
.catchall {:try_start_2 .. :try_end_a} :catchall_40
:try_start_a
new-instance v2, Ljava/io/BufferedReader;
invoke-direct {v2, v4}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_f
.catch Ljava/lang/Exception; {:try_start_a .. :try_end_f} :catch_5b
.catchall {:try_start_a .. :try_end_f} :catchall_52
:try_start_f
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
:try_end_1a
.catch Ljava/lang/Exception; {:try_start_f .. :try_end_1a} :catch_5f
.catchall {:try_start_f .. :try_end_1a} :catchall_54
move-result v0
if-eqz v4, :cond_20
:try_start_1d
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_20
if-eqz v2, :cond_25
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_25
.catch Ljava/lang/Exception; {:try_start_1d .. :try_end_25} :catch_26
:cond_25
:goto_25
return v0
:catch_26
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_25
:catch_2b
move-exception v1
move-object v2, v3
:goto_2d
:try_start_2d
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
:try_end_30
.catchall {:try_start_2d .. :try_end_30} :catchall_57
if-eqz v3, :cond_35
:try_start_32
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_35
if-eqz v2, :cond_25
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_3a
.catch Ljava/lang/Exception; {:try_start_32 .. :try_end_3a} :catch_3b
goto :goto_25
:catch_3b
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_25
:catchall_40
move-exception v0
move-object v4, v3
:goto_42
if-eqz v4, :cond_47
:try_start_44
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_47
if-eqz v3, :cond_4c
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_4c
.catch Ljava/lang/Exception; {:try_start_44 .. :try_end_4c} :catch_4d
:cond_4c
:goto_4c
throw v0
:catch_4d
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_4c
:catchall_52
move-exception v0
goto :goto_42
:catchall_54
move-exception v0
move-object v3, v2
goto :goto_42
:catchall_57
move-exception v0
move-object v4, v3
move-object v3, v2
goto :goto_42
:catch_5b
move-exception v1
move-object v2, v3
move-object v3, v4
goto :goto_2d
:catch_5f
move-exception v1
move-object v3, v4
goto :goto_2d
.end method
.method public static getMaxCpuFreq()I
.registers 5
const/4 v3, 0x0
const/4 v0, 0x0
:try_start_2
new-instance v4, Ljava/io/FileReader;
const-string/jumbo v1, "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq"
invoke-direct {v4, v1}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
:try_end_a
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_a} :catch_2d
.catchall {:try_start_2 .. :try_end_a} :catchall_42
:try_start_a
new-instance v2, Ljava/io/BufferedReader;
invoke-direct {v2, v4}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_f
.catch Ljava/lang/Exception; {:try_start_a .. :try_end_f} :catch_5d
.catchall {:try_start_a .. :try_end_f} :catchall_54
:try_start_f
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object v1
if-eqz v1, :cond_1d
invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
:try_end_1c
.catch Ljava/lang/Exception; {:try_start_f .. :try_end_1c} :catch_61
.catchall {:try_start_f .. :try_end_1c} :catchall_56
move-result v0
:cond_1d
if-eqz v4, :cond_22
:try_start_1f
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_22
if-eqz v2, :cond_27
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_27
.catch Ljava/lang/Exception; {:try_start_1f .. :try_end_27} :catch_28
:cond_27
:goto_27
return v0
:catch_28
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_27
:catch_2d
move-exception v1
move-object v2, v3
:goto_2f
:try_start_2f
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
:try_end_32
.catchall {:try_start_2f .. :try_end_32} :catchall_59
if-eqz v3, :cond_37
:try_start_34
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_37
if-eqz v2, :cond_27
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_3c
.catch Ljava/lang/Exception; {:try_start_34 .. :try_end_3c} :catch_3d
goto :goto_27
:catch_3d
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_27
:catchall_42
move-exception v0
move-object v4, v3
:goto_44
if-eqz v4, :cond_49
:try_start_46
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_49
if-eqz v3, :cond_4e
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_4e
.catch Ljava/lang/Exception; {:try_start_46 .. :try_end_4e} :catch_4f
:cond_4e
:goto_4e
throw v0
:catch_4f
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_4e
:catchall_54
move-exception v0
goto :goto_44
:catchall_56
move-exception v0
move-object v3, v2
goto :goto_44
:catchall_59
move-exception v0
move-object v4, v3
move-object v3, v2
goto :goto_44
:catch_5d
move-exception v1
move-object v2, v3
move-object v3, v4
goto :goto_2f
:catch_61
move-exception v1
move-object v3, v4
goto :goto_2f
.end method
.method public static getMinCpuFreq()I
.registers 5
const/4 v3, 0x0
const/4 v0, 0x0
:try_start_2
new-instance v4, Ljava/io/FileReader;
const-string/jumbo v1, "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq"
invoke-direct {v4, v1}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
:try_end_a
.catch Ljava/lang/Exception; {:try_start_2 .. :try_end_a} :catch_2b
.catchall {:try_start_2 .. :try_end_a} :catchall_40
:try_start_a
new-instance v2, Ljava/io/BufferedReader;
invoke-direct {v2, v4}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_f
.catch Ljava/lang/Exception; {:try_start_a .. :try_end_f} :catch_5b
.catchall {:try_start_a .. :try_end_f} :catchall_52
:try_start_f
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;
move-result-object v1
invoke-static {v1}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
:try_end_1a
.catch Ljava/lang/Exception; {:try_start_f .. :try_end_1a} :catch_5f
.catchall {:try_start_f .. :try_end_1a} :catchall_54
move-result v0
if-eqz v4, :cond_20
:try_start_1d
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_20
if-eqz v2, :cond_25
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_25
.catch Ljava/lang/Exception; {:try_start_1d .. :try_end_25} :catch_26
:cond_25
:goto_25
return v0
:catch_26
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_25
:catch_2b
move-exception v1
move-object v2, v3
:goto_2d
:try_start_2d
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
:try_end_30
.catchall {:try_start_2d .. :try_end_30} :catchall_57
if-eqz v3, :cond_35
:try_start_32
invoke-virtual {v3}, Ljava/io/FileReader;->close()V
:cond_35
if-eqz v2, :cond_25
invoke-virtual {v2}, Ljava/io/BufferedReader;->close()V
:try_end_3a
.catch Ljava/lang/Exception; {:try_start_32 .. :try_end_3a} :catch_3b
goto :goto_25
:catch_3b
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_25
:catchall_40
move-exception v0
move-object v4, v3
:goto_42
if-eqz v4, :cond_47
:try_start_44
invoke-virtual {v4}, Ljava/io/FileReader;->close()V
:cond_47
if-eqz v3, :cond_4c
invoke-virtual {v3}, Ljava/io/BufferedReader;->close()V
:try_end_4c
.catch Ljava/lang/Exception; {:try_start_44 .. :try_end_4c} :catch_4d
:cond_4c
:goto_4c
throw v0
:catch_4d
move-exception v1
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
goto :goto_4c
:catchall_52
move-exception v0
goto :goto_42
:catchall_54
move-exception v0
move-object v3, v2
goto :goto_42
:catchall_57
move-exception v0
move-object v4, v3
move-object v3, v2
goto :goto_42
:catch_5b
move-exception v1
move-object v2, v3
move-object v3, v4
goto :goto_2d
:catch_5f
move-exception v1
move-object v3, v4
goto :goto_2d
.end method
.method public static isHighEndCPU()Z
.registers 4
invoke-static {}, Lcom/sdk/orion/ui/baselibrary/utils/CpuTool;->getCpuCoresNum()I
move-result v0
invoke-static {}, Lcom/sdk/orion/ui/baselibrary/utils/CpuTool;->getMaxCpuFreq()I
move-result v1
const/4 v2, 0x2
const v3, 0xf4240
if-lt v0, v2, :cond_12
if-lt v1, v3, :cond_12
const/4 v0, 0x1
:goto_11
return v0
:cond_12
const/4 v0, 0x0
goto :goto_11
.end method