TikTok.apk(点击下载) / C37072EhB.java


package X;

import android.content.ClipboardManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Environmenu;
import android.os.Handler;
import android.os.Looper;
import android.os.Parcel;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Pair;
import android.view.Display;
import android.view.WindowManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.abmock.SettingsManager;
import com.facebook.GraphRequest;
import com.facebook.m;
import com.ss.android.ugc.effectmanager.common.utils.FileUtils;
import com.swift.sandhook.utils.FileUtils;
import i.am.jaggu;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

/* renamed from: X.EhB  reason: case insensitive filesystem */
public final class C37072EhB {
    public static int LIZ;
    public static long LIZIZ = -1;
    public static long LIZJ = -1;
    public static long LIZLLL = -1;
    public static String LJ = "";
    public static String LJFF = "";
    public static String LJI = "NoCarrier";

    static {
        Covode.recordClassIndex(35347);
    }

    /* JADX WARNING: Removed duplicated region for block: B:18:0x0031  */
    public static int LIZ(InputStream inputStream, OutputStream outputStream) {
        Throwable th;
        try {
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
            try {
                byte[] bArr = new byte[FileUtils.BUFFER_SIZE];
                int i2 = 0;
                while (true) {
                    int read = bufferedInputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    outputStream.write(bArr, 0, read);
                    i2 += read;
                }
                bufferedInputStream.close();
                if (inputStream != null) {
                    inputStream.close();
                }
                return i2;
            } catch (Throwable th2) {
                th = th2;
                if (bufferedInputStream != null) {
                    bufferedInputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                throw th;
            }
        } catch (Throwable th3) {
            th = th3;
            if (inputStream != null) {
            }
            throw th;
        }
    }

    public static long LIZ(double d) {
        return Math.round(d / 1.073741824E9d);
    }

    public static PackageInfo LIZ(PackageManager packageManager, String str) {
        Context LIZ2 = AnonymousClass0WE.LJJI.LIZ();
        if (C16420l5.LJIIIZ) {
            TextUtils.equals(str, LIZ2.getPackageName());
        }
        if (!C16420l5.LJIIIZ || !TextUtils.equals(str, LIZ2.getPackageName())) {
            if (C16420l5.LJIIIZ) {
                TextUtils.equals(str, LIZ2.getPackageName());
            }
            if (C16420l5.LJIIIZ) {
                TextUtils.equals(str, LIZ2.getPackageName());
            }
            return packageManager.getPackageInfo(str, 0);
        }
        if (C16420l5.LIZLLL == null) {
            C16420l5.LIZLLL = packageManager.getPackageInfo(str, 0);
        }
        return C16420l5.LIZLLL;
    }

    public static Uri LIZ(String str, String str2, Bundle bundle) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme("https");
        builder.authority(str);
        builder.path(str2);
        if (bundle != null) {
            for (String str3 : bundle.keySet()) {
                Object LIZ2 = LIZ(bundle, str3);
                if (LIZ2 instanceof String) {
                    builder.appendQueryParameter(str3, (String) LIZ2);
                }
            }
        }
        return builder.build();
    }

    public static Object LIZ(Bundle bundle, String str) {
        try {
            return bundle.get(str);
        } catch (Exception | OutOfMemoryError unused) {
            return null;
        }
    }

    public static Object LIZ(Object obj, Method method, Object... objArr) {
        try {
            Pair<Boolean, Object> LIZ2 = AnonymousClass0UU.LIZ(method, new Object[]{obj, objArr}, 110000, "java.lang.Object", true, "com_facebook_internal_Utility_java_lang_reflect_Method_invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
            if (((Boolean) LIZ2.first).booleanValue()) {
                return LIZ2.second;
            }
            Object invoke = method.invoke(obj, objArr);
            AnonymousClass0UU.LIZ(invoke, method, new Object[]{obj, objArr}, "com_facebook_internal_Utility_java_lang_reflect_Method_invoke(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
            return invoke;
        } catch (IllegalAccessException | InvocationTargetException unused) {
            return null;
        }
    }

    public static Object LIZ(JSONObject jSONObject, String str, String str2) {
        Object opt = jSONObject.opt(str);
        if (opt != null && (opt instanceof String)) {
            opt = new JSONTokener((String) opt).nextValue();
        }
        if (opt == null || (opt instanceof JSONObject) || (opt instanceof JSONArray)) {
            return opt;
        }
        if (str2 != null) {
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.putOpt(str2, opt);
            return jSONObject2;
        }
        throw new C36932Eev("Got an unexpected non-JSON object.");
    }

    public static String LIZ() {
        C37077EhG.LIZ();
        Context context = m.LJI;
        if (context == null) {
            return null;
        }
        try {
            return LIZ(context.getPackageManager(), context.getPackageName()).versionName;
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    public static String LIZ(Context context) {
        C37077EhG.LIZ((Object) context, "context");
        m.LIZ(context);
        C37077EhG.LIZ();
        return m.LIZ;
    }

    public static String LIZ(Uri uri) {
        if (uri == null) {
            return null;
        }
        return uri.toString();
    }

    public static String LIZ(InputStream inputStream) {
        BufferedInputStream bufferedInputStream;
        InputStreamReader inputStreamReader;
        Throwable th;
        try {
            bufferedInputStream = new BufferedInputStream(inputStream);
            try {
                inputStreamReader = new InputStreamReader(bufferedInputStream);
                try {
                    StringBuilder sb = new StringBuilder();
                    char[] cArr = new char[FileUtils.FileMode.MODE_ISUID];
                    while (true) {
                        int read = inputStreamReader.read(cArr);
                        if (read != -1) {
                            sb.append(cArr, 0, read);
                        } else {
                            String sb2 = sb.toString();
                            LIZ((Closeable) bufferedInputStream);
                            LIZ(inputStreamReader);
                            return sb2;
                        }
                    }
                } catch (Throwable th2) {
                    th = th2;
                    LIZ((Closeable) bufferedInputStream);
                    LIZ(inputStreamReader);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inputStreamReader = null;
                LIZ((Closeable) bufferedInputStream);
                LIZ(inputStreamReader);
                throw th;
            }
        } catch (Throwable th4) {
            th = th4;
            bufferedInputStream = null;
            inputStreamReader = null;
            LIZ((Closeable) bufferedInputStream);
            LIZ(inputStreamReader);
            throw th;
        }
    }

    public static String LIZ(String str, String str2) {
        return LIZ(str) ? str2 : str;
    }

    public static String LIZ(String str, byte[] bArr) {
        try {
            MessageDigest instance = MessageDigest.getInstance(str);
            instance.update(bArr);
            byte[] digest = instance.digest();
            StringBuilder sb = new StringBuilder();
            for (byte b : digest) {
                sb.append(Integer.toHexString((b >> 4) & 15));
                sb.append(Integer.toHexString((b >> 0) & 15));
            }
            return sb.toString();
        } catch (NoSuchAlgorithmException unused) {
            return null;
        }
    }

    public static String LIZ(Map<String, String> map) {
        if (map.isEmpty()) {
            return "";
        }
        try {
            JSONObject jSONObject = new JSONObject();
            for (Map.Entry<String, String> entry : map.entrySet()) {
                jSONObject.put(entry.getKey(), entry.getValue());
            }
            return jSONObject.toString();
        } catch (JSONException unused) {
            return "";
        }
    }

    public static Method LIZ(Class<?> cls, String str, Class<?>... clsArr) {
        try {
            return cls.getMethod(str, clsArr);
        } catch (NoSuchMethodException unused) {
            return null;
        }
    }

    public static Method LIZ(String str, String str2, Class<?>... clsArr) {
        try {
            return LIZ(Class.forName(str), str2, clsArr);
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    public static Date LIZ(Bundle bundle, String str, Date date) {
        long parseLong;
        if (bundle == null) {
            return null;
        }
        Object LIZ2 = LIZ(bundle, str);
        if (LIZ2 instanceof Long) {
            parseLong = ((Long) LIZ2).longValue();
        } else if (!(LIZ2 instanceof String)) {
            return null;
        } else {
            try {
                parseLong = Long.parseLong((String) LIZ2);
            } catch (NumberFormatException unused) {
                return null;
            }
        }
        return parseLong == 0 ? new Date(Long.MAX_VALUE) : new Date(date.getTime() + (parseLong * 1000));
    }

    public static <T, K> List<K> LIZ(List<T> list, AbstractC37076EhF<T, K> ehF) {
        if (list == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (T t : list) {
            K LIZ2 = ehF.LIZ(t);
            if (LIZ2 != null) {
                arrayList.add(LIZ2);
            }
        }
        if (arrayList.size() == 0) {
            return null;
        }
        return arrayList;
    }

    public static List<String> LIZ(JSONArray jSONArray) {
        try {
            ArrayList arrayList = new ArrayList();
            for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                arrayList.add(jSONArray.getString(i2));
            }
            return arrayList;
        } catch (JSONException unused) {
            return new ArrayList();
        }
    }

    public static <T> List<T> LIZ(T... tArr) {
        ArrayList arrayList = new ArrayList();
        int i2 = 0;
        do {
            T t = tArr[i2];
            if (t != null) {
                arrayList.add(t);
            }
            i2++;
        } while (i2 < 2);
        return arrayList;
    }

    public static Map<String, String> LIZ(Parcel parcel) {
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        for (int i2 = 0; i2 < readInt; i2++) {
            hashMap.put(parcel.readString(), parcel.readString());
        }
        return hashMap;
    }

    public static Map<String, String> LIZ(JSONObject jSONObject) {
        HashMap hashMap = new HashMap();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            String optString = jSONObject.optString(next);
            if (optString != null) {
                hashMap.put(next, optString);
            }
        }
        return hashMap;
    }

    public static void LIZ(Context context, String str) {
        String cookie;
        CookieSyncManager.createInstance(context).sync();
        CookieManager instance = CookieManager.getInstance();
        String cookie2 = instance.getCookie(str);
        if (cookie2 != null) {
            for (String str2 : cookie2.split(";")) {
                String[] split = str2.split("=");
                if (split.length > 0) {
                    instance.setCookie(str, split[0].trim() + "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;");
                    if (C11450d4.LIZ(AnonymousClass0WN.LIZ()) && C37086EhP.LIZJ.LIZ() && (cookie = CookieManager.getInstance().getCookie(C96423qp.LIZIZ.LIZ())) != null && !TextUtils.equals(cookie, C96423qp.LIZIZ.LIZIZ())) {
                        C96423qp r1 = C96423qp.LIZIZ;
                        r1.LIZ(r1.LIZ(), cookie);
                    }
                }
            }
            instance.removeExpiredCookie();
        }
    }

    public static void LIZ(Bundle bundle, String str, Uri uri) {
        if (uri != null) {
            LIZ(bundle, str, uri.toString());
        }
    }

    public static void LIZ(Bundle bundle, String str, String str2) {
        if (!LIZ(str2)) {
            bundle.putString(str, str2);
        }
    }

    public static void LIZ(Parcel parcel, Map<String, String> map) {
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            parcel.writeString(entry.getKey());
            parcel.writeString(entry.getValue());
        }
    }

    public static void LIZ(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException unused) {
            }
        }
    }

    public static void LIZ(File file) {
        File[] listFiles;
        if (file.exists()) {
            if (file.isDirectory() && (listFiles = file.listFiles()) != null) {
                for (File file2 : listFiles) {
                    LIZ(file2);
                }
            }
            LIZIZ(file);
        }
    }

    public static void LIZ(Runnable runnable) {
        try {
            m.LIZJ().execute(runnable);
        } catch (Exception unused) {
        }
    }

    public static void LIZ(String str, AbstractC37075EhE ehE) {
        JSONObject LIZ2 = C37050Egp.LIZ(str);
        if (LIZ2 != null) {
            ehE.LIZ(LIZ2);
            return;
        }
        C37073EhC ehC = new C37073EhC(ehE, str);
        GraphRequest LJFF2 = LJFF(str);
        LJFF2.LIZ((AbstractC36997Efy) ehC);
        LJFF2.LIZ();
    }

    public static void LIZ(URLConnection uRLConnection) {
        if (uRLConnection != null && (uRLConnection instanceof HttpURLConnection)) {
            ((HttpURLConnection) uRLConnection).disconnect();
        }
    }

    public static void LIZ(JSONObject jSONObject, C37078EhH ehH, String str, boolean z) {
        jSONObject.put("anon_id", str);
        jSONObject.put("application_tracking_enabled", !z);
        jSONObject.put("advertiser_id_collection_enabled", C36998Efz.LIZJ());
        if (ehH != null) {
            if (ehH.LIZ != null) {
                jSONObject.put("attribution", ehH.LIZ);
            }
            if (ehH.LIZ() != null) {
                jSONObject.put("advertiser_id", ehH.LIZ());
                jSONObject.put("advertiser_tracking_enabled", !ehH.LIZJ);
            }
            if (!ehH.LIZJ) {
                String LIZ2 = C36907EeW.LIZ();
                if (!LIZ2.isEmpty()) {
                    jSONObject.put("ud", LIZ2);
                }
            }
            if (ehH.LIZIZ != null) {
                jSONObject.put("installer_package", ehH.LIZIZ);
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:18:0x007c A[Catch:{ Exception -> 0x0090 }] */
    public static void LIZ(JSONObject jSONObject, Context context) {
        int i2;
        String str;
        Locale locale;
        int i3;
        WindowManager windowManager;
        JSONArray jSONArray = new JSONArray();
        jSONArray.put("a2");
        LJI(context);
        String packageName = context.getPackageName();
        try {
            PackageInfo LIZ2 = LIZ(context.getPackageManager(), packageName);
            i2 = LIZ2.versionCode;
            try {
                str = LIZ2.versionName;
            } catch (PackageManager.NameNotFoundException unused) {
            }
        } catch (PackageManager.NameNotFoundException unused2) {
            i2 = -1;
            str = "";
            jSONArray.put(packageName);
            jSONArray.put(i2);
            jSONArray.put(str);
            jSONArray.put(Build.VERSION.RELEASE);
            jSONArray.put(Build.MODEL);
            locale = context.getResources().getConfiguration().locale;
            jSONArray.put(locale.getLanguage() + "_" + locale.getCountry());
            jSONArray.put(LJ);
            jSONArray.put(LJI);
            double d = 0.0d;
            int i4 = 0;
            windowManager = (WindowManager) LIZIZ(context, "window");
            if (windowManager != null) {
            }
            i3 = 0;
            jSONArray.put(i4);
            jSONArray.put(i3);
            jSONArray.put(new DecimalFormat("#.##").format(d));
            jSONArray.put(LJII());
            jSONArray.put(LIZJ);
            jSONArray.put(LIZLLL);
            jSONArray.put(LJFF);
            jSONObject.put("extinfo", jSONArray.toString());
        }
        jSONArray.put(packageName);
        jSONArray.put(i2);
        jSONArray.put(str);
        jSONArray.put(Build.VERSION.RELEASE);
        jSONArray.put(Build.MODEL);
        try {
            locale = context.getResources().getConfiguration().locale;
        } catch (Exception unused3) {
            locale = Locale.getDefault();
        }
        jSONArray.put(locale.getLanguage() + "_" + locale.getCountry());
        jSONArray.put(LJ);
        jSONArray.put(LJI);
        double d2 = 0.0d;
        int i42 = 0;
        try {
            windowManager = (WindowManager) LIZIZ(context, "window");
            if (windowManager != null) {
                Display defaultDisplay = windowManager.getDefaultDisplay();
                DisplayMetrics displayMetrics = new DisplayMetrics();
                defaultDisplay.getMetrics(displayMetrics);
                i42 = displayMetrics.widthPixels;
                i3 = displayMetrics.heightPixels;
                try {
                    d2 = (double) displayMetrics.density;
                } catch (Exception unused4) {
                }
                jSONArray.put(i42);
                jSONArray.put(i3);
                jSONArray.put(new DecimalFormat("#.##").format(d2));
                jSONArray.put(LJII());
                jSONArray.put(LIZJ);
                jSONArray.put(LIZLLL);
                jSONArray.put(LJFF);
                jSONObject.put("extinfo", jSONArray.toString());
            }
        } catch (Exception unused5) {
        }
        i3 = 0;
        jSONArray.put(i42);
        jSONArray.put(i3);
        jSONArray.put(new DecimalFormat("#.##").format(d2));
        jSONArray.put(LJII());
        jSONArray.put(LIZJ);
        jSONArray.put(LIZLLL);
        jSONArray.put(LJFF);
        jSONObject.put("extinfo", jSONArray.toString());
    }

    public static boolean LIZ(Bundle bundle, String str, Object obj) {
        if (obj == null) {
            bundle.remove(str);
            return true;
        } else if (obj instanceof Boolean) {
            bundle.putBoolean(str, ((Boolean) obj).booleanValue());
            return true;
        } else if (obj instanceof boolean[]) {
            bundle.putBooleanArray(str, (boolean[]) obj);
            return true;
        } else if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
            return true;
        } else if (obj instanceof double[]) {
            bundle.putDoubleArray(str, (double[]) obj);
            return true;
        } else if (obj instanceof Integer) {
            bundle.putInt(str, ((Integer) obj).intValue());
            return true;
        } else if (obj instanceof int[]) {
            bundle.putIntArray(str, (int[]) obj);
            return true;
        } else if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
            return true;
        } else if (obj instanceof long[]) {
            bundle.putLongArray(str, (long[]) obj);
            return true;
        } else if (obj instanceof String) {
            bundle.putString(str, (String) obj);
            return true;
        } else if (obj instanceof JSONArray) {
            bundle.putString(str, obj.toString());
            return true;
        } else if (!(obj instanceof JSONObject)) {
            return false;
        } else {
            bundle.putString(str, obj.toString());
            return true;
        }
    }

    public static <T> boolean LIZ(T t, T t2) {
        return t == null ? t2 == null : t.equals(t2);
    }

    public static boolean LIZ(String str) {
        return str == null || str.length() == 0;
    }

    public static <T> boolean LIZ(Collection<T> collection) {
        return collection == null || collection.size() == 0;
    }

    public static Object LIZIZ(Context context, String str) {
        Object obj;
        if (Build.VERSION.SDK_INT > 27 || !"clipboard".equals(str)) {
            if (!C16520lF.LIZIZ && "connectivity".equals(str)) {
                try {
                    new AnonymousClass1ME().LIZ();
                    C16520lF.LIZIZ = true;
                    obj = context.getSystemService(str);
                } catch (Throwable unused) {
                }
            }
            obj = context.getSystemService(str);
        } else if (C16520lF.LIZ) {
            synchronized (ClipboardManager.class) {
                try {
                    obj = context.getSystemService(str);
                    if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
                        try {
                            Field declaredField = ClipboardManager.class.getDeclaredField("mHandler");
                            declaredField.setAccessible(true);
                            declaredField.set(obj, new HandlerC16510lE((Handler) declaredField.get(obj)));
                        } catch (Exception e) {
                            AnonymousClass0O2.LIZ(e, "ClipboardManager Handler Reflect Fail");
                        }
                    }
                    C16520lF.LIZ = false;
                } finally {
                }
            }
        } else {
            obj = context.getSystemService(str);
        }
        return obj;
    }

    public static String LIZIZ() {
        return new BigInteger(100, new Random()).toString(32);
    }

    public static String LIZIZ(String str) {
        if (str == null) {
            return null;
        }
        return LIZIZ("SHA-256", str);
    }

    public static String LIZIZ(String str, String str2) {
        return LIZ(str, str2.getBytes());
    }

    public static List<String> LIZIZ(JSONArray jSONArray) {
        ArrayList arrayList = new ArrayList();
        for (int i2 = 0; i2 < jSONArray.length(); i2++) {
            arrayList.add(jSONArray.getString(i2));
        }
        return arrayList;
    }

    public static void LIZIZ(Context context) {
        LIZ(context, "facebook.com");
        LIZ(context, ".facebook.com");
        LIZ(context, "https://facebook.com");
        LIZ(context, "https://.facebook.com");
    }

    public static boolean LIZIZ(Uri uri) {
        if (uri != null) {
            return "http".equalsIgnoreCase(uri.getScheme()) || "https".equalsIgnoreCase(uri.getScheme()) || "fbstaging".equalsIgnoreCase(uri.getScheme());
        }
        return false;
    }

    public static boolean LIZIZ(File file) {
        try {
            C14490hy r3 = C12270eO.LIZ() ? (C14490hy) SettingsManager.LIZ().LIZ("storage_intercepter_key", C14490hy.class, AbstractC14530i2.LIZ) : AbstractC14530i2.LIZ;
            if (C14510i0.LIZ(file.getAbsolutePath(), r3)) {
                C14510i0.LIZ(file, new RuntimeException(), "exception_delete_log", C14510i0.LIZ(r3));
            }
            if (C14510i0.LIZJ(file.getAbsolutePath(), r3)) {
                C14510i0.LIZ(file, new RuntimeException(), "exception_handle", C14510i0.LIZ(r3));
                return false;
            }
        } catch (Throwable unused) {
        }
        return file.delete();
    }

    public static Bundle LIZJ(String str) {
        Bundle bundle = new Bundle();
        if (!LIZ(str)) {
            for (String str2 : str.split("&")) {
                String[] split = str2.split("=");
                try {
                    if (split.length == 2) {
                        bundle.putString(URLDecoder.decode(split[0], "UTF-8"), URLDecoder.decode(split[1], "UTF-8"));
                    } else if (split.length == 1) {
                        bundle.putString(URLDecoder.decode(split[0], "UTF-8"), "");
                    }
                } catch (UnsupportedEncodingException unused) {
                }
            }
        }
        return bundle;
    }

    public static String LIZJ(Context context) {
        return context == null ? "null" : context == LJFF(context) ? Environmenu.MEDIA_UNKNOWN : context.getClass().getSimpleName();
    }

    public static Locale LIZJ() {
        try {
            C37077EhG.LIZ();
            return m.LJI.getResources().getConfiguration().locale;
        } catch (Exception unused) {
            return null;
        }
    }

    public static Set<String> LIZJ(JSONArray jSONArray) {
        HashSet hashSet = new HashSet();
        for (int i2 = 0; i2 < jSONArray.length(); i2++) {
            hashSet.add(jSONArray.getString(i2));
        }
        return hashSet;
    }

    public static boolean LIZJ(Uri uri) {
        return uri != null && "content".equalsIgnoreCase(uri.getScheme());
    }

    public static Locale LIZLLL() {
        Locale LIZJ2 = LIZJ();
        return LIZJ2 != null ? LIZJ2 : Locale.getDefault();
    }

    public static void LIZLLL(String str) {
        if (m.LJ) {
            LIZ(str);
        }
    }

    public static boolean LIZLLL(Context context) {
        return Build.VERSION.SDK_INT >= 27 ? context.getPackageManager().hasSystemFeature("android.hardware.type.pc") : Build.DEVICE != null && Build.DEVICE.matches(".+_cheets|cheets_.+");
    }

    public static boolean LIZLLL(Uri uri) {
        return uri != null && "file".equalsIgnoreCase(uri.getScheme());
    }

    public static long LJ(Uri uri) {
        Cursor cursor;
        Cursor cursor2 = null;
        try {
            C37077EhG.LIZ();
            ContentResolver contentResolver = m.LJI.getContentResolver();
            Pair<Boolean, Object> LIZ2 = AnonymousClass0UU.LIZ(contentResolver, new Object[]{uri, cursor2, cursor2, cursor2, cursor2}, 240004, "android.database.Cursor", false, null);
            if (((Boolean) LIZ2.first).booleanValue()) {
                cursor = (Cursor) LIZ2.second;
            } else {
                Cursor query = contentResolver.query(uri, null, null, null, null);
                AnonymousClass0UU.LIZ(query, contentResolver, new Object[]{uri, cursor2, cursor2, cursor2, cursor2}, 240004, "com_facebook_internal_Utility_android_content_ContentResolver_query(Landroid/content/ContentResolver;Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;");
                cursor = query;
            }
            int columnIndex = cursor2.getColumnIndex("_size");
            cursor2.moveToFirst();
            return cursor2.getLong(columnIndex);
        } finally {
            if (cursor2 != null) {
                cursor2.close();
            }
        }
    }

    public static String LJ(Context context) {
        try {
            C37077EhG.LIZ();
            String str = m.LIZIZ;
            if (str != null) {
                return str;
            }
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            int i2 = applicationInfo.labelRes;
            return i2 == 0 ? applicationInfo.nonLocalizedLabel.toString() : context.getString(i2);
        } catch (Exception unused) {
            return "";
        }
    }

    public static Map<String, String> LJ(String str) {
        if (str.isEmpty()) {
            return new HashMap();
        }
        try {
            HashMap hashMap = new HashMap();
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                hashMap.put(next, jSONObject.getString(next));
            }
            return hashMap;
        } catch (JSONException unused) {
            return new HashMap();
        }
    }

    public static boolean LJ() {
        List<ResolveInfo> queryIntentActivities;
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            C37077EhG.LIZ();
            intent.setData(Uri.parse(AnonymousClass0EJ.LIZ("fb%s://applinks", new Object[]{m.LIZ})));
            C37077EhG.LIZ();
            Context context = m.LJI;
            PackageManager packageManager = context.getPackageManager();
            String packageName = context.getPackageName();
            Pair<Boolean, Object> LIZ2 = AnonymousClass0UU.LIZ(packageManager, new Object[]{intent, 65536}, 101311, "java.util.List", false, null);
            if (((Boolean) LIZ2.first).booleanValue()) {
                queryIntentActivities = (List) LIZ2.second;
            } else {
                queryIntentActivities = packageManager.queryIntentActivities(intent, 65536);
                AnonymousClass0UU.LIZ(queryIntentActivities, packageManager, new Object[]{intent, 65536}, 101311, "com_facebook_internal_Utility_android_content_pm_PackageManager_queryIntentActivities(Landroid/content/pm/PackageManager;Landroid/content/Intent;I)Ljava/util/List;");
            }
            for (ResolveInfo resolveInfo : queryIntentActivities) {
                if (packageName.equals(resolveInfo.activityInfo.packageName)) {
                    return true;
                }
            }
        } catch (Exception unused) {
        }
        return false;
    }

    public static Context LJFF(Context context) {
        Context applicationContext = context.getApplicationContext();
        return (C16360kz.LIZJ && applicationContext == null) ? C16360kz.LIZ : applicationContext;
    }

    public static GraphRequest LJFF(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fields", "id,name,first_name,middle_name,last_name");
        bundle.putString("access_token", str);
        return new GraphRequest(null, "me", bundle, EnumC37251Ek4.GET, null);
    }

    public static JSONObject LJFF() {
        if (C36912Eeb.LIZ(C37072EhB.class)) {
            return null;
        }
        try {
            C37077EhG.LIZ();
            String string = C13630ga.LIZ(m.LJI, "com.facebook.sdk.DataProcessingOptions", 0).getString("data_processing_options", null);
            if (string != null) {
                try {
                    return new JSONObject(string);
                } catch (JSONException unused) {
                }
            }
            return null;
        } catch (Throwable th) {
            C36912Eeb.LIZ(th, C37072EhB.class);
            return null;
        }
    }

    public static void LJI(Context context) {
        if (LIZIZ == -1 || System.currentTimeMillis() - LIZIZ >= 1800000) {
            LIZIZ = System.currentTimeMillis();
            LJIIIIZZ();
            LJII(context);
            LJIIJJI();
            LJIIJ();
        }
    }

    public static boolean LJI() {
        if (C36912Eeb.LIZ(C37072EhB.class)) {
            return false;
        }
        try {
            JSONObject LJFF2 = LJFF();
            if (LJFF2 == null) {
                return false;
            }
            try {
                JSONArray jSONArray = LJFF2.getJSONArray("data_processing_options");
                for (int i2 = 0; i2 < jSONArray.length(); i2++) {
                    if (jSONArray.getString(i2).toLowerCase().equals("ldu")) {
                        return true;
                    }
                }
            } catch (Exception unused) {
            }
            return false;
        } catch (Throwable th) {
            C36912Eeb.LIZ(th, C37072EhB.class);
            return false;
        }
    }

    public static int LJII() {
        int i2 = LIZ;
        if (i2 > 0) {
            return i2;
        }
        try {
            File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new C37074EhD());
            if (listFiles != null) {
                LIZ = listFiles.length;
            }
        } catch (Exception unused) {
        }
        if (LIZ <= 0) {
            LIZ = Math.max(Runtime.getRuntime().availableProcessors(), 1);
        }
        return LIZ;
    }

    public static void LJII(Context context) {
        if (LJI.equals("NoCarrier")) {
            try {
                TelephonyManager telephonyManager = (TelephonyManager) LIZIZ(context, "phone");
                LJI = jaggu.regions.gon();
            } catch (Exception unused) {
            }
        }
    }

    public static void LJIIIIZZ() {
        try {
            TimeZone timeZone = TimeZone.getDefault();
            LJ = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
            LJFF = timeZone.getID();
        } catch (AssertionError | Exception unused) {
        }
    }

    public static boolean LJIIIZ() {
        return Environmenu.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
    }

    public static void LJIIJ() {
        try {
            if (LJIIIZ()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                LIZLLL = ((long) statFs.getAvailableBlocks()) * ((long) statFs.getBlockSize());
            }
            LIZLLL = LIZ((double) LIZLLL);
        } catch (Exception unused) {
        }
    }

    public static void LJIIJJI() {
        try {
            if (LJIIIZ()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                LIZJ = ((long) statFs.getBlockCount()) * ((long) statFs.getBlockSize());
            }
            LIZJ = LIZ((double) LIZJ);
        } catch (Exception unused) {
        }
    }
}