小红书.apk(点击下载) / a.java


package q23;

import android.os.Build;
import android.os.Environment;
import android.text.TextUtils;
import android.util.Log;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.lang.reflect.Field;

/* compiled from: DeviceUtils */
public class a {

    /* renamed from: a  reason: collision with root package name */
    public static EnumC1888a f120415a = EnumC1888a.Unknown;

    /* renamed from: q23.a$a  reason: collision with other inner class name */
    /* compiled from: DeviceUtils */
    public enum EnumC1888a {
        Unknown,
        ARM,
        X86,
        MIPS,
        ARM64
    }

    /* JADX WARNING: Removed duplicated region for block: B:37:0x0084 A[SYNTHETIC, Splitter:B:37:0x0084] */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x0090 A[SYNTHETIC, Splitter:B:43:0x0090] */
    /* JADX WARNING: Removed duplicated region for block: B:47:0x0098 A[SYNTHETIC, Splitter:B:47:0x0098] */
    public static synchronized EnumC1888a a() {
        Throwable th3;
        FileNotFoundException e14;
        IOException e15;
        synchronized (a.class) {
            byte[] bArr = new byte[20];
            File file = new File(Environment.getRootDirectory(), "lib/libc.so");
            if (file.canRead()) {
                RandomAccessFile randomAccessFile = null;
                try {
                    RandomAccessFile randomAccessFile2 = new RandomAccessFile(file, "r");
                    try {
                        randomAccessFile2.readFully(bArr);
                        int i10 = bArr[18] | (bArr[19] << 8);
                        if (i10 == 3) {
                            f120415a = EnumC1888a.X86;
                        } else if (i10 == 8) {
                            f120415a = EnumC1888a.MIPS;
                        } else if (i10 == 40) {
                            f120415a = EnumC1888a.ARM;
                        } else if (i10 != 183) {
                            Log.e("NativeBitmapFactory", "libc.so is unknown arch: " + Integer.toHexString(i10));
                        } else {
                            f120415a = EnumC1888a.ARM64;
                        }
                        try {
                            randomAccessFile2.close();
                        } catch (IOException e16) {
                            e = e16;
                        }
                    } catch (FileNotFoundException e17) {
                        e14 = e17;
                        randomAccessFile = randomAccessFile2;
                        e14.printStackTrace();
                        if (randomAccessFile != null) {
                            try {
                                randomAccessFile.close();
                            } catch (IOException e18) {
                                e = e18;
                            }
                        }
                        return f120415a;
                    } catch (IOException e19) {
                        e15 = e19;
                        randomAccessFile = randomAccessFile2;
                        try {
                            e15.printStackTrace();
                            if (randomAccessFile != null) {
                                try {
                                    randomAccessFile.close();
                                } catch (IOException e24) {
                                    e = e24;
                                }
                            }
                            return f120415a;
                        } catch (Throwable th4) {
                            th3 = th4;
                            if (randomAccessFile != null) {
                            }
                            throw th3;
                        }
                    } catch (Throwable th5) {
                        th3 = th5;
                        randomAccessFile = randomAccessFile2;
                        if (randomAccessFile != null) {
                            try {
                                randomAccessFile.close();
                            } catch (IOException e25) {
                                e25.printStackTrace();
                            }
                        }
                        throw th3;
                    }
                } catch (FileNotFoundException e26) {
                    e14 = e26;
                    e14.printStackTrace();
                    if (randomAccessFile != null) {
                    }
                    return f120415a;
                } catch (IOException e27) {
                    e15 = e27;
                    e15.printStackTrace();
                    if (randomAccessFile != null) {
                    }
                    return f120415a;
                }
            }
        }
        return f120415a;
        e.printStackTrace();
        return f120415a;
    }

    public static String b() {
        return Build.CPU_ABI;
    }

    public static String c() {
        try {
            Field declaredField = Build.class.getDeclaredField("CPU_ABI2");
            if (declaredField == null) {
                return null;
            }
            Object obj = declaredField.get(null);
            if (!(obj instanceof String)) {
                return null;
            }
            return (String) obj;
        } catch (Exception unused) {
            return null;
        }
    }

    public static boolean d() {
        return Build.MANUFACTURER.equalsIgnoreCase("MagicBox") && Build.PRODUCT.equalsIgnoreCase("MagicBox");
    }

    public static boolean e() {
        return Build.MANUFACTURER.equalsIgnoreCase("Xiaomi") && Build.PRODUCT.equalsIgnoreCase("dredd");
    }

    public static boolean f() {
        return e() || d();
    }

    public static boolean g() {
        return (i("armeabi-v7a") || i("armeabi") || i("arm64-v8a")) && EnumC1888a.ARM.equals(a());
    }

    public static boolean h() {
        return i("x86") || EnumC1888a.X86.equals(a());
    }

    public static boolean i(String str) {
        String b14 = b();
        if (!TextUtils.isEmpty(b14) && b14.equalsIgnoreCase(str)) {
            return true;
        }
        if (TextUtils.isEmpty(c()) || !b14.equalsIgnoreCase(str)) {
            return false;
        }
        return true;
    }
}