282 lines
6.3 KiB
Smali
282 lines
6.3 KiB
Smali
.class public Lcom/moji/tool/processes/AndroidProcesses;
|
|
.super Ljava/lang/Object;
|
|
.source "AndroidProcesses.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/moji/tool/processes/AndroidProcesses$ProcessComparator;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static a:Z
|
|
|
|
|
|
# direct methods
|
|
.method constructor <init>()V
|
|
.locals 2
|
|
|
|
.line 322
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 323
|
|
new-instance v0, Ljava/lang/AssertionError;
|
|
|
|
const-string v1, "no instances"
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method public static a()Ljava/util/List;
|
|
.locals 9
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/List<",
|
|
"Lcom/moji/tool/processes/AndroidAppProcess;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 211
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
.line 212
|
|
new-instance v1, Ljava/io/File;
|
|
|
|
const-string v2, "/proc"
|
|
|
|
invoke-direct {v1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1}, Ljava/io/File;->listFiles()[Ljava/io/File;
|
|
|
|
move-result-object v1
|
|
|
|
.line 213
|
|
array-length v2, v1
|
|
|
|
const/4 v3, 0x0
|
|
|
|
const/4 v4, 0x0
|
|
|
|
:goto_0
|
|
if-ge v4, v2, :cond_1
|
|
|
|
aget-object v5, v1, v4
|
|
|
|
.line 214
|
|
invoke-virtual {v5}, Ljava/io/File;->isDirectory()Z
|
|
|
|
move-result v6
|
|
|
|
if-eqz v6, :cond_0
|
|
|
|
.line 217
|
|
:try_start_0
|
|
invoke-virtual {v5}, Ljava/io/File;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
invoke-static {v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
|
|
|
move-result v5
|
|
:try_end_0
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_1
|
|
|
|
.line 222
|
|
:try_start_1
|
|
new-instance v6, Lcom/moji/tool/processes/AndroidAppProcess;
|
|
|
|
invoke-direct {v6, v5}, Lcom/moji/tool/processes/AndroidAppProcess;-><init>(I)V
|
|
|
|
invoke-interface {v0, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
:try_end_1
|
|
.catch Lcom/moji/tool/processes/AndroidAppProcess$NotAndroidAppProcessException; {:try_start_1 .. :try_end_1} :catch_1
|
|
.catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_0
|
|
|
|
goto :goto_1
|
|
|
|
:catch_0
|
|
move-exception v6
|
|
|
|
const-string v7, "Error reading from /proc/%d."
|
|
|
|
const/4 v8, 0x1
|
|
|
|
.line 225
|
|
new-array v8, v8, [Ljava/lang/Object;
|
|
|
|
invoke-static {v5}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v5
|
|
|
|
aput-object v5, v8, v3
|
|
|
|
invoke-static {v6, v7, v8}, Lcom/moji/tool/processes/AndroidProcesses;->a(Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
|
|
|
|
:catch_1
|
|
:cond_0
|
|
:goto_1
|
|
add-int/lit8 v4, v4, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static a(Landroid/content/Context;)Ljava/util/List;
|
|
.locals 6
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Landroid/content/Context;",
|
|
")",
|
|
"Ljava/util/List<",
|
|
"Landroid/app/ActivityManager$RunningAppProcessInfo;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 307
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x16
|
|
|
|
if-lt v0, v1, :cond_1
|
|
|
|
.line 308
|
|
invoke-static {}, Lcom/moji/tool/processes/AndroidProcesses;->a()Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
.line 309
|
|
new-instance v0, Ljava/util/ArrayList;
|
|
|
|
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
|
|
|
|
.line 310
|
|
invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lcom/moji/tool/processes/AndroidAppProcess;
|
|
|
|
.line 311
|
|
new-instance v2, Landroid/app/ActivityManager$RunningAppProcessInfo;
|
|
|
|
iget-object v3, v1, Lcom/moji/tool/processes/AndroidAppProcess;->name:Ljava/lang/String;
|
|
|
|
iget v4, v1, Lcom/moji/tool/processes/AndroidAppProcess;->pid:I
|
|
|
|
const/4 v5, 0x0
|
|
|
|
invoke-direct {v2, v3, v4, v5}, Landroid/app/ActivityManager$RunningAppProcessInfo;-><init>(Ljava/lang/String;I[Ljava/lang/String;)V
|
|
|
|
.line 312
|
|
iget v1, v1, Lcom/moji/tool/processes/AndroidAppProcess;->uid:I
|
|
|
|
iput v1, v2, Landroid/app/ActivityManager$RunningAppProcessInfo;->uid:I
|
|
|
|
.line 314
|
|
invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-object v0
|
|
|
|
:cond_1
|
|
const-string v0, "activity"
|
|
|
|
.line 318
|
|
invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Landroid/app/ActivityManager;
|
|
|
|
.line 319
|
|
invoke-virtual {p0}, Landroid/app/ActivityManager;->getRunningAppProcesses()Ljava/util/List;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static varargs a(Ljava/lang/String;[Ljava/lang/Object;)V
|
|
.locals 2
|
|
|
|
.line 129
|
|
sget-boolean v0, Lcom/moji/tool/processes/AndroidProcesses;->a:Z
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const-string v0, "AndroidProcesses"
|
|
|
|
.line 130
|
|
array-length v1, p1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-static {p0, p1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
:goto_0
|
|
invoke-static {v0, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method public static varargs a(Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)V
|
|
.locals 2
|
|
|
|
.line 145
|
|
sget-boolean v0, Lcom/moji/tool/processes/AndroidProcesses;->a:Z
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const-string v0, "AndroidProcesses"
|
|
|
|
.line 146
|
|
array-length v1, p2
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
invoke-static {p1, p2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_0
|
|
invoke-static {v0, p1, p0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|