408 lines
10 KiB
Smali
408 lines
10 KiB
Smali
.class public Lcom/facebook/soloader/c;
|
|
.super Lcom/facebook/soloader/i;
|
|
.source "DirectorySoSource.java"
|
|
|
|
|
|
# instance fields
|
|
.field protected final WG:Ljava/io/File;
|
|
|
|
.field protected final flags:I
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Ljava/io/File;I)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Lcom/facebook/soloader/i;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/facebook/soloader/c;->WG:Ljava/io/File;
|
|
|
|
iput p2, p0, Lcom/facebook/soloader/c;->flags:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private static a(Ljava/io/File;ILandroid/os/StrictMode$ThreadPolicy;)V
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
invoke-static {p0}, Lcom/facebook/soloader/c;->p(Ljava/io/File;)[Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
const-string v0, "SoLoader"
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, "Loading lib dependencies: "
|
|
|
|
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-static {p0}, Ljava/util/Arrays;->toString([Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v0, v1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
array-length v1, p0
|
|
|
|
if-ge v0, v1, :cond_1
|
|
|
|
aget-object v1, p0, v0
|
|
|
|
const-string v2, "/"
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_0
|
|
|
|
or-int/lit8 v2, p1, 0x1
|
|
|
|
invoke-static {v1, v2, p2}, Lcom/facebook/soloader/SoLoader;->b(Ljava/lang/String;ILandroid/os/StrictMode$ThreadPolicy;)V
|
|
|
|
:cond_0
|
|
add-int/lit8 v0, v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-void
|
|
.end method
|
|
|
|
.method private static p(Ljava/io/File;)[Ljava/lang/String;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
sget-boolean v0, Lcom/facebook/soloader/SoLoader;->WU:Z
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "SoLoader.getElfDependencies["
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0}, Ljava/io/File;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v1, "]"
|
|
|
|
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Lcom/facebook/soloader/Api18TraceUtils;->az(Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
:try_start_0
|
|
invoke-static {p0}, Lcom/facebook/soloader/g;->r(Ljava/io/File;)[Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
sget-boolean v0, Lcom/facebook/soloader/SoLoader;->WU:Z
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
invoke-static {}, Lcom/facebook/soloader/Api18TraceUtils;->endSection()V
|
|
|
|
:cond_1
|
|
return-object p0
|
|
|
|
:catchall_0
|
|
move-exception p0
|
|
|
|
sget-boolean v0, Lcom/facebook/soloader/SoLoader;->WU:Z
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
invoke-static {}, Lcom/facebook/soloader/Api18TraceUtils;->endSection()V
|
|
|
|
:cond_2
|
|
throw p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(Ljava/lang/String;ILandroid/os/StrictMode$ThreadPolicy;)I
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/facebook/soloader/c;->WG:Ljava/io/File;
|
|
|
|
invoke-virtual {p0, p1, p2, v0, p3}, Lcom/facebook/soloader/c;->a(Ljava/lang/String;ILjava/io/File;Landroid/os/StrictMode$ThreadPolicy;)I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method protected final a(Ljava/lang/String;ILjava/io/File;Landroid/os/StrictMode$ThreadPolicy;)I
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
new-instance v0, Ljava/io/File;
|
|
|
|
invoke-direct {v0, p3, p1}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->exists()Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
const-string p2, "SoLoader"
|
|
|
|
new-instance p4, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p4}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {p4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p1, " not found on "
|
|
|
|
invoke-virtual {p4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p4, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p2, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const-string v1, "SoLoader"
|
|
|
|
new-instance v2, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, " found on "
|
|
|
|
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-virtual {v2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-static {v1, p3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
and-int/lit8 p3, p2, 0x1
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
iget p3, p0, Lcom/facebook/soloader/c;->flags:I
|
|
|
|
const/4 v1, 0x2
|
|
|
|
and-int/2addr p3, v1
|
|
|
|
if-eqz p3, :cond_1
|
|
|
|
const-string p2, "SoLoader"
|
|
|
|
new-instance p3, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string p1, " loaded implicitly"
|
|
|
|
invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p2, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
return v1
|
|
|
|
:cond_1
|
|
iget p3, p0, Lcom/facebook/soloader/c;->flags:I
|
|
|
|
const/4 v1, 0x1
|
|
|
|
and-int/2addr p3, v1
|
|
|
|
if-eqz p3, :cond_2
|
|
|
|
invoke-static {v0, p2, p4}, Lcom/facebook/soloader/c;->a(Ljava/io/File;ILandroid/os/StrictMode$ThreadPolicy;)V
|
|
|
|
goto :goto_0
|
|
|
|
:cond_2
|
|
const-string p3, "SoLoader"
|
|
|
|
const-string p4, "Not resolving dependencies for "
|
|
|
|
invoke-static {p1}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p4, p1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-static {p3, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
:goto_0
|
|
:try_start_0
|
|
sget-object p1, Lcom/facebook/soloader/SoLoader;->WV:Lcom/facebook/soloader/h;
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;
|
|
|
|
move-result-object p3
|
|
|
|
invoke-interface {p1, p3, p2}, Lcom/facebook/soloader/h;->g(Ljava/lang/String;I)V
|
|
:try_end_0
|
|
.catch Ljava/lang/UnsatisfiedLinkError; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return v1
|
|
|
|
:catch_0
|
|
move-exception p1
|
|
|
|
invoke-virtual {p1}, Ljava/lang/UnsatisfiedLinkError;->getMessage()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
const-string p3, "bad ELF magic"
|
|
|
|
invoke-virtual {p2, p3}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result p2
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
const-string p1, "SoLoader"
|
|
|
|
const-string p2, "Corrupted lib file detected"
|
|
|
|
invoke-static {p1, p2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
|
|
|
|
const/4 p1, 0x3
|
|
|
|
return p1
|
|
|
|
:cond_3
|
|
throw p1
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 3
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/facebook/soloader/c;->WG:Ljava/io/File;
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->getCanonicalPath()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-static {v0}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
:try_end_0
|
|
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
:catch_0
|
|
iget-object v0, p0, Lcom/facebook/soloader/c;->WG:Ljava/io/File;
|
|
|
|
invoke-virtual {v0}, Ljava/io/File;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:goto_0
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String;
|
|
|
|
move-result-object v2
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v2, "[root = "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, " flags = "
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
iget v0, p0, Lcom/facebook/soloader/c;->flags:I
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
const/16 v0, 0x5d
|
|
|
|
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|