2021-12-17 21:59:34 +00:00
|
|
|
package b.f.m;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
import android.os.StrictMode;
|
|
|
|
import android.os.Trace;
|
|
|
|
import android.util.Log;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.c.a.a0.d;
|
|
|
|
import b.d.b.a.a;
|
2021-08-09 22:51:56 +00:00
|
|
|
import com.discord.widgets.chat.input.autocomplete.AutocompleteViewModel;
|
2021-07-24 02:37:17 +00:00
|
|
|
import com.facebook.soloader.Api18TraceUtils;
|
|
|
|
import com.facebook.soloader.SoLoader;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileInputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.Arrays;
|
|
|
|
/* compiled from: DirectorySoSource */
|
|
|
|
public class c extends l {
|
|
|
|
public final File a;
|
2021-12-17 21:59:34 +00:00
|
|
|
|
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
|
|
public final int f639b;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public c(File file, int i) {
|
|
|
|
this.a = file;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f639b = i;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.f.m.l
|
2021-07-24 02:37:17 +00:00
|
|
|
public int a(String str, int i, StrictMode.ThreadPolicy threadPolicy) throws IOException {
|
|
|
|
return c(str, i, this.a, threadPolicy);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int c(String str, int i, File file, StrictMode.ThreadPolicy threadPolicy) throws IOException {
|
|
|
|
File file2 = new File(file, str);
|
|
|
|
if (!file2.exists()) {
|
2021-11-05 06:48:17 +00:00
|
|
|
StringBuilder V = a.V(str, " not found on ");
|
|
|
|
V.append(file.getCanonicalPath());
|
|
|
|
Log.d("SoLoader", V.toString());
|
2021-07-24 02:37:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2021-11-05 06:48:17 +00:00
|
|
|
StringBuilder V2 = a.V(str, " found on ");
|
|
|
|
V2.append(file.getCanonicalPath());
|
|
|
|
Log.d("SoLoader", V2.toString());
|
2021-12-17 21:59:34 +00:00
|
|
|
if ((i & 1) == 0 || (this.f639b & 2) == 0) {
|
|
|
|
if ((this.f639b & 1) != 0) {
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean z2 = SoLoader.a;
|
|
|
|
if (z2) {
|
|
|
|
Api18TraceUtils.a("SoLoader.getElfDependencies[", file2.getName(), "]");
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
FileInputStream fileInputStream = new FileInputStream(file2);
|
|
|
|
try {
|
2021-11-05 06:48:17 +00:00
|
|
|
String[] i02 = d.i0(fileInputStream.getChannel());
|
2021-07-24 02:37:17 +00:00
|
|
|
if (z2) {
|
|
|
|
Trace.endSection();
|
|
|
|
}
|
2021-11-05 06:48:17 +00:00
|
|
|
StringBuilder R = a.R("Loading lib dependencies: ");
|
|
|
|
R.append(Arrays.toString(i02));
|
|
|
|
Log.d("SoLoader", R.toString());
|
|
|
|
for (String str2 : i02) {
|
2021-08-09 22:51:56 +00:00
|
|
|
if (!str2.startsWith(AutocompleteViewModel.COMMAND_DISCOVER_TOKEN)) {
|
2021-07-24 02:37:17 +00:00
|
|
|
SoLoader.d(str2, null, null, i | 1, threadPolicy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
fileInputStream.close();
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
|
|
|
if (SoLoader.a) {
|
|
|
|
Trace.endSection();
|
|
|
|
}
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Log.d("SoLoader", "Not resolving dependencies for " + str);
|
|
|
|
}
|
|
|
|
try {
|
2021-12-20 07:27:17 +00:00
|
|
|
((SoLoader.a) SoLoader.f2865b).b(file2.getAbsolutePath(), i);
|
2021-07-24 02:37:17 +00:00
|
|
|
return 1;
|
|
|
|
} catch (UnsatisfiedLinkError e) {
|
|
|
|
if (e.getMessage().contains("bad ELF magic")) {
|
|
|
|
Log.d("SoLoader", "Corrupted lib file detected");
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Log.d("SoLoader", str + " loaded implicitly");
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.f.m.l
|
2021-07-24 02:37:17 +00:00
|
|
|
public String toString() {
|
|
|
|
String str;
|
|
|
|
try {
|
|
|
|
str = String.valueOf(this.a.getCanonicalPath());
|
|
|
|
} catch (IOException unused) {
|
|
|
|
str = this.a.getName();
|
|
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
sb.append(getClass().getName());
|
|
|
|
sb.append("[root = ");
|
|
|
|
sb.append(str);
|
|
|
|
sb.append(" flags = ");
|
2021-12-17 21:59:34 +00:00
|
|
|
return a.z(sb, this.f639b, ']');
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|