SuExec.smali
.class public Lcom/cleanmaster/hpsharelib/base/util/SuExec;
.super Ljava/lang/Object;
.source "SuExec.java"
# static fields
.field public static final ERROR_CHECK_ROOT_FAILED:I = -0x3e8
.field private static final bin_dirs:[Ljava/lang/String;
.field private static mInstance:Lcom/cleanmaster/hpsharelib/base/util/SuExec;
# direct methods
.method static constructor <clinit>()V
.registers 3
.prologue
.line 26
new-instance v0, Lcom/cleanmaster/hpsharelib/base/util/SuExec;
invoke-direct {v0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;-><init>()V
sput-object v0, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->mInstance:Lcom/cleanmaster/hpsharelib/base/util/SuExec;
.line 197
const/4 v0, 0x3
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
const-string v2, "/system/sbin/"
aput-object v2, v0, v1
const/4 v1, 0x1
const-string v2, "/system/xbin/"
aput-object v2, v0, v1
const/4 v1, 0x2
const-string v2, "/system/bin/"
aput-object v2, v0, v1
sput-object v0, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->bin_dirs:[Ljava/lang/String;
return-void
.end method
.method private constructor <init>()V
.registers 1
.prologue
.line 27
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static deleteFile(Ljava/lang/String;)Z
.registers 2
.prologue
.line 151
const/4 v0, 0x0
return v0
.end method
.method public static getField(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
.registers 5
.prologue
.line 98
.line 99
const/4 v0, 0x0
.line 101
:try_start_1
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/Class;->getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;
move-result-object v1
.line 102
const/4 v2, 0x1
invoke-virtual {v1, v2}, Ljava/lang/reflect/Field;->setAccessible(Z)V
.line 103
invoke-virtual {v1, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
:try_end_10
.catch Ljava/lang/NoSuchFieldException; {:try_start_1 .. :try_end_10} :catch_12
.catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_10} :catch_17
.catch Ljava/lang/IllegalAccessException; {:try_start_1 .. :try_end_10} :catch_1c
.catch Ljava/lang/NullPointerException; {:try_start_1 .. :try_end_10} :catch_21
move-result-object v0
.line 114
:goto_11
return-object v0
.line 104
:catch_12
move-exception v1
.line 105
invoke-virtual {v1}, Ljava/lang/NoSuchFieldException;->printStackTrace()V
goto :goto_11
.line 106
:catch_17
move-exception v1
.line 107
invoke-virtual {v1}, Ljava/lang/IllegalArgumentException;->printStackTrace()V
goto :goto_11
.line 108
:catch_1c
move-exception v1
.line 109
invoke-virtual {v1}, Ljava/lang/IllegalAccessException;->printStackTrace()V
goto :goto_11
.line 110
:catch_21
move-exception v1
.line 111
invoke-virtual {v1}, Ljava/lang/NullPointerException;->printStackTrace()V
goto :goto_11
.end method
.method public static declared-synchronized getInstance()Lcom/cleanmaster/hpsharelib/base/util/SuExec;
.registers 2
.prologue
.line 30
const-class v0, Lcom/cleanmaster/hpsharelib/base/util/SuExec;
monitor-enter v0
:try_start_3
sget-object v1, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->mInstance:Lcom/cleanmaster/hpsharelib/base/util/SuExec;
:try_end_5
.catchall {:try_start_3 .. :try_end_5} :catchall_7
monitor-exit v0
return-object v1
:catchall_7
move-exception v1
monitor-exit v0
throw v1
.end method
.method private isSuBinExecutive(Ljava/lang/String;)Z
.registers 5
.annotation build Landroid/annotation/TargetApi;
value = 0x9
.end annotation
.prologue
const/4 v0, 0x0
.line 182
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v1
if-nez v1, :cond_14
.line 183
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v2, 0x9
if-lt v1, v2, :cond_1a
.line 184
new-instance v1, Ljava/io/File;
invoke-direct {v1, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
.line 185
if-nez v1, :cond_15
.line 193
:cond_14
:goto_14
return v0
.line 187
:cond_15
invoke-virtual {v1}, Ljava/io/File;->canExecute()Z
move-result v0
goto :goto_14
.line 191
:cond_1a
const/4 v0, 0x1
goto :goto_14
.end method
.method public static isSuVersionTooLow()Z
.registers 1
.prologue
.line 277
const/4 v0, 0x0
return v0
.end method
.method public static notifyUserSuTooLow()V
.registers 3
.prologue
.line 281
invoke-static {}, Lcom/cleanmaster/hpsharelib/base/util/HostHelper;->getAppContext()Landroid/content/Context;
move-result-object v0
.line 282
sget v1, Lcom/cleanmaster/hpsharelib/R$string;->rt_tag_notify_user_su_too_low:I
invoke-virtual {v0, v1}, Landroid/content/Context;->getString(I)Ljava/lang/String;
move-result-object v1
const/4 v2, 0x1
invoke-static {v0, v1, v2}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v0
invoke-virtual {v0}, Landroid/widget/Toast;->show()V
.line 283
return-void
.end method
.method private xGetCmdPath(Ljava/lang/String;)Ljava/lang/String;
.registers 5
.prologue
.line 202
const/16 v0, 0x2f
invoke-virtual {p1, v0}, Ljava/lang/String;->indexOf(I)I
move-result v0
const/4 v1, -0x1
if-eq v0, v1, :cond_a
.line 216
:goto_9
return-object p1
.line 205
:cond_a
const/4 v0, 0x0
:goto_b
sget-object v1, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->bin_dirs:[Ljava/lang/String;
array-length v1, v1
if-ge v0, v1, :cond_39
.line 207
:try_start_10
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
sget-object v2, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->bin_dirs:[Ljava/lang/String;
aget-object v2, v2, v0
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v1
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v1
.line 208
new-instance v2, Ljava/io/File;
invoke-direct {v2, v1}, Ljava/io/File;-><init>(Ljava/lang/String;)V
invoke-virtual {v2}, Ljava/io/File;->exists()Z
:try_end_2d
.catch Ljava/lang/Exception; {:try_start_10 .. :try_end_2d} :catch_32
move-result v2
if-eqz v2, :cond_36
move-object p1, v1
.line 209
goto :goto_9
.line 211
:catch_32
move-exception v1
.line 212
invoke-virtual {v1}, Ljava/lang/Exception;->printStackTrace()V
.line 205
:cond_36
add-int/lit8 v0, v0, 0x1
goto :goto_b
.line 216
:cond_39
const/4 p1, 0x0
goto :goto_9
.end method
# virtual methods
.method public AsyncExecCmd(Ljava/lang/String;)Z
.registers 4
.prologue
const/4 v1, 0x0
.line 135
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_7
.line 147
:cond_7
return v1
.end method
.method public CheckMarkInProcMaps(ILjava/lang/String;)Z
.registers 5
.prologue
const/4 v1, 0x0
.line 80
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_7
.line 88
:cond_7
return v1
.end method
.method public EnableComponent(Landroid/content/ComponentName;Z)V
.registers 4
.prologue
.line 260
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-eqz v0, :cond_6
.line 269
:cond_6
return-void
.end method
.method public GetPidByName(Ljava/lang/String;)I
.registers 4
.prologue
const/4 v1, -0x1
.line 123
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_7
.line 130
:cond_7
return v1
.end method
.method public checkRoot()Z
.registers 2
.prologue
.line 118
const/4 v0, 0x0
return v0
.end method
.method public deleteFiles(Ljava/lang/String;)V
.registers 3
.prologue
.line 67
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_6
.line 68
:cond_6
return-void
.end method
.method public deleteFilesLeftFoder(Ljava/lang/String;)Z
.registers 4
.prologue
const/4 v1, 0x0
.line 51
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-nez v0, :cond_d
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_d
.line 63
:cond_d
return v1
.end method
.method public enterRoot()V
.registers 1
.prologue
.line 35
return-void
.end method
.method public execCmd(Ljava/lang/String;)V
.registers 2
.prologue
.line 177
return-void
.end method
.method public execrc(Ljava/lang/String;)V
.registers 3
.prologue
.line 77
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_6
.line 78
:cond_6
return-void
.end method
.method public execsh(Ljava/lang/String;Ljava/util/ArrayList;)I
.registers 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
"Ljava/util/ArrayList",
"<",
"Ljava/lang/String;",
">;)I"
}
.end annotation
.prologue
const/16 v1, -0x3e8
.line 227
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_9
.line 241
:cond_8
:goto_8
return v1
.line 230
:cond_9
if-nez p2, :cond_8
.line 231
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
goto :goto_8
.end method
.method public forceStopPackage(Ljava/lang/String;)Z
.registers 4
.prologue
const/4 v1, 0x0
.line 245
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_7
.line 255
:cond_7
return v1
.end method
.method public getPathFileSize(Ljava/lang/String;)J
.registers 6
.prologue
const-wide/16 v2, 0x0
.line 38
invoke-virtual {p0}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->checkRoot()Z
move-result v0
if-nez v0, :cond_8
.line 47
:cond_8
return-wide v2
.end method
.method public isFileExist(Ljava/lang/String;)Z
.registers 3
.prologue
.line 72
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_8
const/4 v0, 0x0
.line 73
:goto_7
return v0
:cond_8
const/4 v0, 0x1
goto :goto_7
.end method
.method public isMobileRoot()Z
.registers 3
.prologue
const/4 v0, 0x0
.line 155
const-string/jumbo v1, "su"
invoke-direct {p0, v1}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->xGetCmdPath(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
.line 156
if-eqz v1, :cond_11
.line 158
invoke-direct {p0, v1}, Lcom/cleanmaster/hpsharelib/base/util/SuExec;->isSuBinExecutive(Ljava/lang/String;)Z
move-result v1
.line 159
if-eqz v1, :cond_11
.line 166
const/4 v0, 0x1
.line 172
:cond_11
return v0
.end method