apkfuckery/com.discord/smali/com/facebook/soloader/SysUtil.smali

358 lines
6.9 KiB
Smali
Raw Normal View History

2019-02-06 20:30:57 +00:00
.class public final Lcom/facebook/soloader/SysUtil;
.super Ljava/lang/Object;
.source "SysUtil.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/facebook/soloader/SysUtil$LollipopSysdeps;
}
.end annotation
# direct methods
.method static a(Ljava/io/RandomAccessFile;Ljava/io/InputStream;[B)I
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
const/4 v0, 0x0
const/4 v1, 0x0
:goto_0
const v2, 0x7fffffff
if-ge v1, v2, :cond_0
const v3, 0x8000
sub-int/2addr v2, v1
invoke-static {v3, v2}, Ljava/lang/Math;->min(II)I
move-result v2
invoke-virtual {p1, p2, v0, v2}, Ljava/io/InputStream;->read([BII)I
move-result v2
const/4 v3, -0x1
if-eq v2, v3, :cond_0
invoke-virtual {p0, p2, v0, v2}, Ljava/io/RandomAccessFile;->write([BII)V
add-int/2addr v1, v2
goto :goto_0
:cond_0
return v1
.end method
.method public static a([Ljava/lang/String;Ljava/lang/String;)I
.locals 2
const/4 v0, 0x0
:goto_0
array-length v1, p0
if-ge v0, v1, :cond_1
aget-object v1, p0, v0
if-eqz v1, :cond_0
aget-object v1, p0, v0
invoke-virtual {p1, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v1
if-eqz v1, :cond_0
return v0
:cond_0
add-int/lit8 v0, v0, 0x1
goto :goto_0
:cond_1
const/4 p0, -0x1
return p0
.end method
.method public static getSupportedAbis()[Ljava/lang/String;
.locals 3
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v1, 0x15
if-ge v0, v1, :cond_0
const/4 v0, 0x2
new-array v0, v0, [Ljava/lang/String;
const/4 v1, 0x0
sget-object v2, Landroid/os/Build;->CPU_ABI:Ljava/lang/String;
aput-object v2, v0, v1
const/4 v1, 0x1
sget-object v2, Landroid/os/Build;->CPU_ABI2:Ljava/lang/String;
aput-object v2, v0, v1
return-object v0
:cond_0
invoke-static {}, Lcom/facebook/soloader/SysUtil$LollipopSysdeps;->getSupportedAbis()[Ljava/lang/String;
move-result-object v0
return-object v0
.end method
.method public static s(Ljava/io/File;)V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
invoke-virtual {p0}, Ljava/io/File;->isDirectory()Z
move-result v0
if-eqz v0, :cond_1
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
move-result-object v0
if-nez v0, :cond_0
return-void
:cond_0
array-length v1, v0
const/4 v2, 0x0
:goto_0
if-ge v2, v1, :cond_1
aget-object v3, v0, v2
invoke-static {v3}, Lcom/facebook/soloader/SysUtil;->s(Ljava/io/File;)V
add-int/lit8 v2, v2, 0x1
goto :goto_0
:cond_1
invoke-virtual {p0}, Ljava/io/File;->delete()Z
move-result v0
if-nez v0, :cond_3
invoke-virtual {p0}, Ljava/io/File;->exists()Z
move-result v0
if-nez v0, :cond_2
goto :goto_1
:cond_2
new-instance v0, Ljava/io/IOException;
invoke-static {p0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p0
const-string v1, "could not delete: "
invoke-virtual {v1, p0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:cond_3
:goto_1
return-void
.end method
.method static t(Ljava/io/File;)V
.locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
invoke-virtual {p0}, Ljava/io/File;->isDirectory()Z
move-result v0
if-eqz v0, :cond_2
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
move-result-object v0
if-eqz v0, :cond_1
const/4 p0, 0x0
:goto_0
array-length v1, v0
if-ge p0, v1, :cond_0
aget-object v1, v0, p0
invoke-static {v1}, Lcom/facebook/soloader/SysUtil;->t(Ljava/io/File;)V
add-int/lit8 p0, p0, 0x1
goto :goto_0
:cond_0
return-void
:cond_1
new-instance v0, Ljava/io/IOException;
invoke-static {p0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object p0
const-string v1, "cannot list directory "
invoke-virtual {v1, p0}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:cond_2
invoke-virtual {p0}, Ljava/io/File;->getPath()Ljava/lang/String;
move-result-object v0
const-string v1, "_lock"
invoke-virtual {v0, v1}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
move-result v0
if-nez v0, :cond_4
new-instance v0, Ljava/io/RandomAccessFile;
const-string v1, "r"
invoke-direct {v0, p0, v1}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
const/4 p0, 0x0
:try_start_0
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->getFD()Ljava/io/FileDescriptor;
move-result-object v1
invoke-virtual {v1}, Ljava/io/FileDescriptor;->sync()V
:try_end_0
.catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
return-void
:catchall_0
move-exception v1
goto :goto_1
:catch_0
move-exception p0
:try_start_1
throw p0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
:goto_1
if-eqz p0, :cond_3
:try_start_2
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
:try_end_2
.catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_1
goto :goto_2
:cond_3
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
:catch_1
:goto_2
throw v1
:cond_4
return-void
.end method
.method public static y(Landroid/content/Context;)I
.locals 2
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v0
const/4 v1, 0x0
if-eqz v0, :cond_0
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object p0
invoke-virtual {v0, p0, v1}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object p0
iget p0, p0, Landroid/content/pm/PackageInfo;->versionCode:I
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0
return p0
:catch_0
:cond_0
return v1
.end method