591 lines
12 KiB
Smali
591 lines
12 KiB
Smali
.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
|
|
|
|
|
|
# static fields
|
|
.field private static final APK_SIGNATURE_VERSION:B = 0x1t
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 33
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static copyBytes(Ljava/io/RandomAccessFile;Ljava/io/InputStream;I[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
|
|
if-ge v1, p2, :cond_0
|
|
|
|
.line 164
|
|
array-length v2, p3
|
|
|
|
sub-int v3, p2, v1
|
|
|
|
.line 168
|
|
invoke-static {v2, v3}, Ljava/lang/Math;->min(II)I
|
|
|
|
move-result v2
|
|
|
|
.line 165
|
|
invoke-virtual {p1, p3, v0, v2}, Ljava/io/InputStream;->read([BII)I
|
|
|
|
move-result v2
|
|
|
|
const/4 v3, -0x1
|
|
|
|
if-eq v2, v3, :cond_0
|
|
|
|
.line 169
|
|
invoke-virtual {p0, p3, 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 deleteOrThrow(Ljava/io/File;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 55
|
|
invoke-virtual {p0}, Ljava/io/File;->delete()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 56
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "could not delete file "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static dumbDeleteRecursive(Ljava/io/File;)V
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 98
|
|
invoke-virtual {p0}, Ljava/io/File;->isDirectory()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 99
|
|
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
return-void
|
|
|
|
.line 104
|
|
:cond_0
|
|
array-length v1, v0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
:goto_0
|
|
if-ge v2, v1, :cond_1
|
|
|
|
aget-object v3, v0, v2
|
|
|
|
.line 105
|
|
invoke-static {v3}, Lcom/facebook/soloader/SysUtil;->dumbDeleteRecursive(Ljava/io/File;)V
|
|
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.line 109
|
|
:cond_1
|
|
invoke-virtual {p0}, Ljava/io/File;->delete()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_2
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 110
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "could not delete: "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_2
|
|
return-void
|
|
.end method
|
|
|
|
.method public static fallocateIfSupported(Ljava/io/FileDescriptor;J)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 83
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-lt v0, v1, :cond_0
|
|
|
|
.line 84
|
|
invoke-static {p0, p1, p2}, Lcom/facebook/soloader/SysUtil$LollipopSysdeps;->fallocateIfSupported(Ljava/io/FileDescriptor;J)V
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public static findAbiScore([Ljava/lang/String;Ljava/lang/String;)I
|
|
.locals 2
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 45
|
|
:goto_0
|
|
array-length v1, p0
|
|
|
|
if-ge v0, v1, :cond_1
|
|
|
|
.line 46
|
|
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 static fsyncRecursive(Ljava/io/File;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 176
|
|
invoke-virtual {p0}, Ljava/io/File;->isDirectory()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 177
|
|
invoke-virtual {p0}, Ljava/io/File;->listFiles()[Ljava/io/File;
|
|
|
|
move-result-object v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 179
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "cannot list directory "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
.line 181
|
|
:goto_0
|
|
array-length v1, v0
|
|
|
|
if-ge p0, v1, :cond_3
|
|
|
|
.line 182
|
|
aget-object v1, v0, p0
|
|
|
|
invoke-static {v1}, Lcom/facebook/soloader/SysUtil;->fsyncRecursive(Ljava/io/File;)V
|
|
|
|
add-int/lit8 p0, p0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.line 184
|
|
:cond_1
|
|
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-eqz v0, :cond_2
|
|
|
|
goto :goto_1
|
|
|
|
.line 188
|
|
:cond_2
|
|
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
|
|
|
|
.line 189
|
|
: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
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
.line 190
|
|
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
|
|
|
|
:cond_3
|
|
:goto_1
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
goto :goto_2
|
|
|
|
:catch_0
|
|
move-exception p0
|
|
|
|
.line 188
|
|
:try_start_1
|
|
throw p0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
:goto_2
|
|
if-eqz v0, :cond_5
|
|
|
|
if-eqz p0, :cond_4
|
|
|
|
.line 190
|
|
: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_3
|
|
|
|
:catch_1
|
|
move-exception v0
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/Throwable;->addSuppressed(Ljava/lang/Throwable;)V
|
|
|
|
goto :goto_3
|
|
|
|
:cond_4
|
|
invoke-virtual {v0}, Ljava/io/RandomAccessFile;->close()V
|
|
|
|
:cond_5
|
|
:goto_3
|
|
throw v1
|
|
.end method
|
|
|
|
.method public static getAppVersionCode(Landroid/content/Context;)I
|
|
.locals 2
|
|
|
|
.line 209
|
|
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 212
|
|
: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
|
|
|
|
.line 213
|
|
iget p0, p0, Landroid/content/pm/PackageInfo;->versionCode:I
|
|
|
|
invoke-static {}, Lru/vtosters/lite/utils/Preferences;->VKVersionBuild()I
|
|
|
|
move-result p0
|
|
|
|
: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
|
|
|
|
.method public static getSupportedAbis()[Ljava/lang/String;
|
|
.locals 3
|
|
|
|
.line 68
|
|
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
|
|
|
|
const/16 v1, 0x15
|
|
|
|
if-ge v0, v1, :cond_0
|
|
|
|
const/4 v0, 0x2
|
|
|
|
.line 69
|
|
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
|
|
|
|
.line 71
|
|
: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 makeApkDepBlock(Ljava/io/File;Landroid/content/Context;)[B
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 195
|
|
invoke-virtual {p0}, Ljava/io/File;->getCanonicalFile()Ljava/io/File;
|
|
|
|
move-result-object p0
|
|
|
|
.line 196
|
|
invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;
|
|
|
|
move-result-object v0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
.line 198
|
|
:try_start_0
|
|
invoke-virtual {v0, v1}, Landroid/os/Parcel;->writeByte(B)V
|
|
|
|
.line 199
|
|
invoke-virtual {p0}, Ljava/io/File;->getPath()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V
|
|
|
|
.line 200
|
|
invoke-virtual {p0}, Ljava/io/File;->lastModified()J
|
|
|
|
move-result-wide v1
|
|
|
|
invoke-virtual {v0, v1, v2}, Landroid/os/Parcel;->writeLong(J)V
|
|
|
|
.line 201
|
|
invoke-static {p1}, Lcom/facebook/soloader/SysUtil;->getAppVersionCode(Landroid/content/Context;)I
|
|
|
|
move-result p0
|
|
|
|
invoke-virtual {v0, p0}, Landroid/os/Parcel;->writeInt(I)V
|
|
|
|
.line 202
|
|
invoke-virtual {v0}, Landroid/os/Parcel;->marshall()[B
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
.line 204
|
|
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
|
|
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V
|
|
|
|
.line 205
|
|
throw p0
|
|
.end method
|
|
|
|
.method static mkdirOrThrow(Ljava/io/File;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
.line 145
|
|
invoke-virtual {p0}, Ljava/io/File;->mkdirs()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->isDirectory()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 146
|
|
new-instance v0, Ljava/io/IOException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "cannot mkdir: "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|