NetMirror.apk
Download file
package com.facebook.soloader;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Process;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import dalvik.system.BaseDexClassLoader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Stack;
import java.util.TreeSet;
/* JADX INFO: loaded from: classes.dex */
public final class SysUtil {
private static final class LollipopSysdeps {
private LollipopSysdeps() {
}
public static void fallocateIfSupported(FileDescriptor fileDescriptor, long j3) throws IOException {
int i3;
try {
Os.posix_fallocate(fileDescriptor, 0L, j3);
} catch (ErrnoException e4) {
if (e4.errno != OsConstants.EOPNOTSUPP && (i3 = e4.errno) != OsConstants.ENOSYS && i3 != OsConstants.EINVAL) {
throw new IOException(e4.toString(), e4);
}
}
}
public static String[] getSupportedAbis() {
String[] strArr = Build.SUPPORTED_ABIS;
TreeSet treeSet = new TreeSet();
try {
if (is64Bit()) {
treeSet.add("arm64-v8a");
treeSet.add("x86_64");
} else {
treeSet.add("armeabi-v7a");
treeSet.add("x86");
}
ArrayList arrayList = new ArrayList();
for (String str : strArr) {
if (treeSet.contains(str)) {
arrayList.add(str);
}
}
return (String[]) arrayList.toArray(new String[arrayList.size()]);
} catch (ErrnoException e4) {
p.b("SysUtil", String.format("Could not read /proc/self/exe. Falling back to default ABI list: %s. errno: %d Err msg: %s", Arrays.toString(strArr), Integer.valueOf(e4.errno), e4.getMessage()));
return Build.SUPPORTED_ABIS;
}
}
public static boolean is64Bit() {
return Os.readlink("/proc/self/exe").contains("64");
}
}
private static final class MarshmallowSysdeps {
private MarshmallowSysdeps() {
}
public static boolean a(Context context) {
return context != null && (context.getApplicationInfo().flags & 268435456) == 0;
}
public static boolean b(Context context, int i3) {
if (i3 == 2) {
return true;
}
return a(context);
}
public static String[] getSupportedAbis() {
String[] strArr = Build.SUPPORTED_ABIS;
TreeSet treeSet = new TreeSet();
if (is64Bit()) {
treeSet.add("arm64-v8a");
treeSet.add("x86_64");
} else {
treeSet.add("armeabi-v7a");
treeSet.add("x86");
}
ArrayList arrayList = new ArrayList();
for (String str : strArr) {
if (treeSet.contains(str)) {
arrayList.add(str);
}
}
return (String[]) arrayList.toArray(new String[arrayList.size()]);
}
public static boolean is64Bit() {
return Process.is64Bit();
}
}
static int a(RandomAccessFile randomAccessFile, InputStream inputStream, int i3, byte[] bArr) throws IOException {
int i4 = 0;
while (i4 < i3) {
int i5 = inputStream.read(bArr, 0, Math.min(bArr.length, i3 - i4));
if (i5 == -1) {
break;
}
randomAccessFile.write(bArr, 0, i5);
i4 += i5;
}
return i4;
}
public static void b(File file) throws IOException {
File parentFile = file.getParentFile();
if (parentFile != null && !parentFile.canWrite() && !parentFile.setWritable(true)) {
p.b("SysUtil", "Enable write permission failed: " + parentFile);
}
if (file.delete() || !file.exists()) {
return;
}
throw new IOException("Could not delete file " + file);
}
public static void c(File file) throws IOException {
Stack stack = new Stack();
stack.push(file);
ArrayList arrayList = new ArrayList();
while (!stack.isEmpty()) {
File file2 = (File) stack.pop();
if (file2.isDirectory()) {
arrayList.add(file2);
File[] fileArrListFiles = file2.listFiles();
if (fileArrListFiles != null) {
for (File file3 : fileArrListFiles) {
stack.push(file3);
}
}
} else {
b(file2);
}
}
for (int size = arrayList.size() - 1; size >= 0; size--) {
b((File) arrayList.get(size));
}
}
public static void d(FileDescriptor fileDescriptor, long j3) throws IOException {
LollipopSysdeps.fallocateIfSupported(fileDescriptor, j3);
}
public static int e(String[] strArr, String str) {
for (int i3 = 0; i3 < strArr.length; i3++) {
String str2 = strArr[i3];
if (str2 != null && str.equals(str2)) {
return i3;
}
}
return -1;
}
public static void f(File file) throws IOException {
Stack stack = new Stack();
stack.push(file);
while (!stack.isEmpty()) {
File file2 = (File) stack.pop();
if (file2.isDirectory()) {
File[] fileArrListFiles = file2.listFiles();
if (fileArrListFiles == null) {
throw new IOException("cannot list directory " + file2);
}
for (File file3 : fileArrListFiles) {
stack.push(file3);
}
} else if (file2.getPath().endsWith("_lock")) {
continue;
} else {
try {
RandomAccessFile randomAccessFile = new RandomAccessFile(file2, "r");
try {
randomAccessFile.getFD().sync();
randomAccessFile.close();
} catch (Throwable th) {
try {
randomAccessFile.close();
} catch (Throwable th2) {
th.addSuppressed(th2);
}
throw th;
}
} catch (IOException e4) {
p.b("SysUtil", "Syncing failed for " + file2 + ": " + e4.getMessage());
}
}
}
}
public static int g(Context context) {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null) {
try {
return packageManager.getPackageInfo(context.getPackageName(), 0).versionCode;
} catch (PackageManager.NameNotFoundException | RuntimeException unused) {
}
}
return 0;
}
public static String getClassLoaderLdLoadLibrary() {
ClassLoader classLoader = SoLoader.class.getClassLoader();
if (classLoader == null || (classLoader instanceof BaseDexClassLoader)) {
try {
return (String) BaseDexClassLoader.class.getMethod("getLdLibraryPath", new Class[0]).invoke((BaseDexClassLoader) classLoader, new Object[0]);
} catch (Exception e4) {
p.c("SysUtil", "Cannot call getLdLibraryPath", e4);
return null;
}
}
throw new IllegalStateException("ClassLoader " + classLoader.getClass().getName() + " should be of type BaseDexClassLoader");
}
public static Method getNativeLoadRuntimeMethod() {
if (Build.VERSION.SDK_INT > 27) {
return null;
}
try {
Method declaredMethod = Runtime.class.getDeclaredMethod("nativeLoad", String.class, ClassLoader.class, String.class);
declaredMethod.setAccessible(true);
return declaredMethod;
} catch (Exception e4) {
p.h("SysUtil", "Cannot get nativeLoad method", e4);
return null;
}
}
public static n h(File file) {
return n.a(file);
}
public static n i(File file, File file2) throws Throwable {
boolean z3;
try {
return h(file2);
} catch (FileNotFoundException e4) {
z3 = true;
try {
if (!file.setWritable(true)) {
throw e4;
}
n nVarH = h(file2);
if (!file.setWritable(false)) {
p.g("SysUtil", "error removing " + file.getCanonicalPath() + " write permission");
}
return nVarH;
} catch (Throwable th) {
th = th;
if (z3 && !file.setWritable(false)) {
p.g("SysUtil", "error removing " + file.getCanonicalPath() + " write permission");
}
throw th;
}
} catch (Throwable th2) {
th = th2;
z3 = false;
if (z3) {
p.g("SysUtil", "error removing " + file.getCanonicalPath() + " write permission");
}
throw th;
}
}
public static String[] j() {
return MarshmallowSysdeps.getSupportedAbis();
}
public static boolean k() {
return MarshmallowSysdeps.is64Bit();
}
public static boolean l(Context context, int i3) {
return MarshmallowSysdeps.b(context, i3);
}
public static void m(File file) throws IOException {
if (file.mkdirs() || file.isDirectory()) {
return;
}
throw new IOException("cannot mkdir: " + file);
}
}
⚠️ This content was hidden by an advertisement filtering extension in your browser. Please disable it and reload the page to access the decompiled content.
We only display one small text ad to keep this service free. Here's what it looks like:
Read the Docs for Business: You write the docs. We do the rest.
Try it today!Ad by EthicalAds
Download file