APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Microless
版本号:1.9
包名称:com.itplus.microless

MD5 校验值:76664d4beb7b8d8b1df7e59ba4c77a12

反编译源代码说明

k0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package t2;

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.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcel;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.autofill.AutofillManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import e2.j0;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
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.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
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.Objects;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import t2.k0;
import t2.n;

public final class k0 {

    private static int f16471b;

    public static final k0 f16470a = new k0();

    private static long f16472c = -1;

    private static long f16473d = -1;

    private static long f16474e = -1;

    private static String f16475f = "";

    private static String f16476g = "";

    private static String f16477h = "NoCarrier";

    public interface a {
        void a(e2.s sVar);

        void b(JSONObject jSONObject);
    }

    private k0() {
    }

    public static final JSONObject A() {
        if (y2.a.d(k0.class)) {
            return null;
        }
        try {
            e2.f0 f0Var = e2.f0.f10014a;
            String string = e2.f0.l().getSharedPreferences("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) {
            y2.a.b(th, k0.class);
            return null;
        }
    }

    public static final String A0(String str) {
        if (str == null) {
            return null;
        }
        return f16470a.M("SHA-256", str);
    }

    public static final String B(String str) {
        boolean z10;
        int i10;
        Object obj;
        String str2;
        String str3;
        String w10;
        e2.f0 f0Var = e2.f0.f10014a;
        String u10 = e2.f0.u();
        if (str == null) {
            return u10;
        }
        if (lc.j.a(str, "gaming")) {
            z10 = false;
            i10 = 4;
            obj = null;
            str2 = "facebook.com";
            str3 = "fb.gg";
        } else {
            if (!lc.j.a(str, "instagram")) {
                return u10;
            }
            z10 = false;
            i10 = 4;
            obj = null;
            str2 = "facebook.com";
            str3 = "instagram.com";
        }
        w10 = tc.p.w(u10, str2, str3, z10, i10, obj);
        return w10;
    }

    public static final void B0(Parcel parcel, Map<String, String> map) {
        lc.j.f(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            parcel.writeString(key);
            parcel.writeString(value);
        }
    }

    private final e2.j0 C(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fields", I(z()));
        bundle.putString("access_token", str);
        e2.j0 y10 = e2.j0.f10080n.y(null, null);
        y10.H(bundle);
        y10.G(e2.p0.GET);
        return y10;
    }

    public static final void C0(Parcel parcel, Map<String, String> map) {
        lc.j.f(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            parcel.writeString(key);
            parcel.writeString(value);
        }
    }

    public static final void D(final String str, final a aVar) {
        lc.j.f(str, "accessToken");
        lc.j.f(aVar, "callback");
        f0 f0Var = f0.f16443a;
        JSONObject a10 = f0.a(str);
        if (a10 != null) {
            aVar.b(a10);
            return;
        }
        j0.b bVar = new j0.b() {
            @Override
            public final void a(e2.o0 o0Var) {
                k0.E(k0.a.this, str, o0Var);
            }
        };
        e2.j0 C = f16470a.C(str);
        C.D(bVar);
        C.l();
    }

    public static final void E(a aVar, String str, e2.o0 o0Var) {
        lc.j.f(aVar, "$callback");
        lc.j.f(str, "$accessToken");
        lc.j.f(o0Var, "response");
        if (o0Var.b() != null) {
            aVar.a(o0Var.b().f());
            return;
        }
        f0 f0Var = f0.f16443a;
        JSONObject d10 = o0Var.d();
        if (d10 == null) {
            throw new IllegalStateException("Required value was null.".toString());
        }
        f0.b(str, d10);
        aVar.b(o0Var.d());
    }

    public static final String F(Context context) {
        l0 l0Var = l0.f16479a;
        l0.j(context, "context");
        e2.f0 f0Var = e2.f0.f10014a;
        return e2.f0.m();
    }

    public static final Method G(Class<?> cls, String str, Class<?>... clsArr) {
        lc.j.f(cls, "clazz");
        lc.j.f(str, "methodName");
        lc.j.f(clsArr, "parameterTypes");
        try {
            return cls.getMethod(str, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (NoSuchMethodException unused) {
            return null;
        }
    }

    public static final Method H(String str, String str2, Class<?>... clsArr) {
        lc.j.f(str, "className");
        lc.j.f(str2, "methodName");
        lc.j.f(clsArr, "parameterTypes");
        try {
            Class<?> cls = Class.forName(str);
            lc.j.e(cls, "forName(className)");
            return G(cls, str2, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    private final String I(String str) {
        return lc.j.a(str, "instagram") ? "id,name,profile_picture" : "id,name,first_name,middle_name,last_name";
    }

    public static final Locale J() {
        try {
            e2.f0 f0Var = e2.f0.f10014a;
            return e2.f0.l().getResources().getConfiguration().locale;
        } catch (Exception unused) {
            return null;
        }
    }

    public static final Object K(JSONObject jSONObject, String str, String str2) {
        lc.j.f(jSONObject, "jsonObject");
        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) {
            throw new e2.s("Got an unexpected non-JSON object.");
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.putOpt(str2, opt);
        return jSONObject2;
    }

    private final String L(MessageDigest messageDigest, byte[] bArr) {
        messageDigest.update(bArr);
        byte[] digest = messageDigest.digest();
        StringBuilder sb2 = new StringBuilder();
        lc.j.e(digest, "digest");
        int length = digest.length;
        int i10 = 0;
        while (i10 < length) {
            byte b10 = digest[i10];
            i10++;
            sb2.append(Integer.toHexString((b10 >> 4) & 15));
            sb2.append(Integer.toHexString((b10 >> 0) & 15));
        }
        String sb3 = sb2.toString();
        lc.j.e(sb3, "builder.toString()");
        return sb3;
    }

    private final String M(String str, String str2) {
        Charset charset = tc.d.f17331b;
        Objects.requireNonNull(str2, "null cannot be cast to non-null type java.lang.String");
        byte[] bytes = str2.getBytes(charset);
        lc.j.e(bytes, "(this as java.lang.String).getBytes(charset)");
        return N(str, bytes);
    }

    private final String N(String str, byte[] bArr) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance(str);
            lc.j.e(messageDigest, "hash");
            return L(messageDigest, bArr);
        } catch (NoSuchAlgorithmException unused) {
            return null;
        }
    }

    public static final Object O(Object obj, Method method, Object... objArr) {
        lc.j.f(method, "method");
        lc.j.f(objArr, "args");
        try {
            return method.invoke(obj, Arrays.copyOf(objArr, objArr.length));
        } catch (IllegalAccessException | InvocationTargetException unused) {
            return null;
        }
    }

    public static final boolean P() {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            lc.t tVar = lc.t.f12919a;
            e2.f0 f0Var = e2.f0.f10014a;
            String format = String.format("fb%s://applinks", Arrays.copyOf(new Object[]{e2.f0.m()}, 1));
            lc.j.e(format, "java.lang.String.format(format, *args)");
            intent.setData(Uri.parse(format));
            Context l10 = e2.f0.l();
            PackageManager packageManager = l10.getPackageManager();
            String packageName = l10.getPackageName();
            Iterator<ResolveInfo> it = packageManager.queryIntentActivities(intent, 65536).iterator();
            while (it.hasNext()) {
                if (lc.j.a(packageName, it.next().activityInfo.packageName)) {
                    return true;
                }
            }
        } catch (Exception unused) {
        }
        return false;
    }

    public static final boolean Q(Context context) {
        AutofillManager autofillManager;
        lc.j.f(context, "context");
        return Build.VERSION.SDK_INT >= 26 && (autofillManager = (AutofillManager) context.getSystemService(AutofillManager.class)) != null && autofillManager.isAutofillSupported() && autofillManager.isEnabled();
    }

    public static final boolean R(Context context) {
        lc.j.f(context, "context");
        if (Build.VERSION.SDK_INT >= 27) {
            return context.getPackageManager().hasSystemFeature("android.hardware.type.pc");
        }
        String str = Build.DEVICE;
        if (str != null) {
            lc.j.e(str, "DEVICE");
            if (new tc.f(".+_cheets|cheets_.+").a(str)) {
                return true;
            }
        }
        return false;
    }

    public static final boolean S(Uri uri) {
        boolean n10;
        if (uri != null) {
            n10 = tc.p.n("content", uri.getScheme(), true);
            if (n10) {
                return true;
            }
        }
        return false;
    }

    public static final boolean T(e2.a aVar) {
        return aVar != null && lc.j.a(aVar, e2.a.f9954x.e());
    }

    public static final boolean U() {
        if (y2.a.d(k0.class)) {
            return false;
        }
        try {
            JSONObject A = A();
            if (A == null) {
                return false;
            }
            try {
                JSONArray jSONArray = A.getJSONArray("data_processing_options");
                int length = jSONArray.length();
                if (length > 0) {
                    int i10 = 0;
                    while (true) {
                        int i11 = i10 + 1;
                        String string = jSONArray.getString(i10);
                        lc.j.e(string, "options.getString(i)");
                        String lowerCase = string.toLowerCase();
                        lc.j.e(lowerCase, "(this as java.lang.String).toLowerCase()");
                        if (lc.j.a(lowerCase, "ldu")) {
                            return true;
                        }
                        if (i11 >= length) {
                            break;
                        }
                        i10 = i11;
                    }
                }
            } catch (Exception unused) {
            }
            return false;
        } catch (Throwable th) {
            y2.a.b(th, k0.class);
            return false;
        }
    }

    public static final boolean V(Uri uri) {
        boolean n10;
        if (uri != null) {
            n10 = tc.p.n("file", uri.getScheme(), true);
            if (n10) {
                return true;
            }
        }
        return false;
    }

    private final boolean W(Context context) {
        Method H = H("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", Context.class);
        if (H == null) {
            return false;
        }
        Object O = O(null, H, context);
        return (O instanceof Integer) && lc.j.a(O, 0);
    }

    public static final boolean X(String str) {
        if (str != null) {
            if (!(str.length() == 0)) {
                return false;
            }
        }
        return true;
    }

    public static final boolean Y(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static final boolean Z(Uri uri) {
        boolean n10;
        boolean n11;
        boolean n12;
        if (uri != null) {
            n10 = tc.p.n("http", uri.getScheme(), true);
            if (n10) {
                return true;
            }
            n11 = tc.p.n("https", uri.getScheme(), true);
            if (n11) {
                return true;
            }
            n12 = tc.p.n("fbstaging", uri.getScheme(), true);
            if (n12) {
                return true;
            }
        }
        return false;
    }

    public static final Set<String> a0(JSONArray jSONArray) {
        lc.j.f(jSONArray, "jsonArray");
        HashSet hashSet = new HashSet();
        int length = jSONArray.length();
        if (length > 0) {
            int i10 = 0;
            while (true) {
                int i11 = i10 + 1;
                String string = jSONArray.getString(i10);
                lc.j.e(string, "jsonArray.getString(i)");
                hashSet.add(string);
                if (i11 >= length) {
                    break;
                }
                i10 = i11;
            }
        }
        return hashSet;
    }

    public static final List<String> b0(JSONArray jSONArray) {
        lc.j.f(jSONArray, "jsonArray");
        ArrayList arrayList = new ArrayList();
        int length = jSONArray.length();
        if (length > 0) {
            int i10 = 0;
            while (true) {
                int i11 = i10 + 1;
                arrayList.add(jSONArray.getString(i10));
                if (i11 >= length) {
                    break;
                }
                i10 = i11;
            }
        }
        return arrayList;
    }

    private final void c(JSONObject jSONObject, t2.a aVar, String str, Context context) {
        if (Build.VERSION.SDK_INT >= 31 && W(context) && aVar.k()) {
            return;
        }
        jSONObject.put("anon_id", str);
    }

    public static final Map<String, String> c0(String str) {
        lc.j.f(str, "str");
        if (str.length() == 0) {
            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();
                lc.j.e(next, "key");
                String string = jSONObject.getString(next);
                lc.j.e(string, "jsonObject.getString(key)");
                hashMap.put(next, string);
            }
            return hashMap;
        } catch (JSONException unused) {
            return new HashMap();
        }
    }

    private final void d(JSONObject jSONObject, t2.a aVar, Context context) {
        if (Build.VERSION.SDK_INT >= 31 && W(context) && aVar.k()) {
            return;
        }
        jSONObject.put("attribution", aVar.j());
    }

    public static final void d0(String str, Exception exc) {
        e2.f0 f0Var = e2.f0.f10014a;
        if (!e2.f0.C() || str == null || exc == null) {
            return;
        }
        Log.d(str, exc.getClass().getSimpleName() + ": " + ((Object) exc.getMessage()));
    }

    public static final <T> boolean e(T t10, T t11) {
        return t10 == null ? t11 == null : lc.j.a(t10, t11);
    }

    public static final void e0(String str, String str2) {
        e2.f0 f0Var = e2.f0.f10014a;
        if (!e2.f0.C() || str == null || str2 == null) {
            return;
        }
        Log.d(str, str2);
    }

    public static final JSONObject f(String str) {
        lc.j.f(str, "accessToken");
        f0 f0Var = f0.f16443a;
        JSONObject a10 = f0.a(str);
        if (a10 != null) {
            return a10;
        }
        e2.o0 k10 = f16470a.C(str).k();
        if (k10.b() != null) {
            return null;
        }
        return k10.d();
    }

    public static final void f0(String str, String str2, Throwable th) {
        e2.f0 f0Var = e2.f0.f10014a;
        if (!e2.f0.C() || X(str)) {
            return;
        }
        Log.d(str, str2, th);
    }

    public static final Uri g(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 obj = bundle.get(str3);
                if (obj instanceof String) {
                    builder.appendQueryParameter(str3, (String) obj);
                }
            }
        }
        Uri build = builder.build();
        lc.j.e(build, "builder.build()");
        return build;
    }

    public static final String g0(Map<String, String> map) {
        lc.j.f(map, "map");
        String str = "";
        if (!map.isEmpty()) {
            try {
                JSONObject jSONObject = new JSONObject();
                for (Map.Entry<String, String> entry : map.entrySet()) {
                    jSONObject.put(entry.getKey(), entry.getValue());
                }
                str = jSONObject.toString();
            } catch (JSONException unused) {
            }
            lc.j.e(str, "{\n      try {\n        val jsonObject = JSONObject()\n        for ((key, value) in map) {\n          jsonObject.put(key, value)\n        }\n        jsonObject.toString()\n      } catch (_e: JSONException) {\n        \"\"\n      }\n    }");
        }
        return str;
    }

    private final void h(Context context, String str) {
        List n02;
        List n03;
        CookieSyncManager.createInstance(context).sync();
        CookieManager cookieManager = CookieManager.getInstance();
        String cookie = cookieManager.getCookie(str);
        if (cookie == null) {
            return;
        }
        n02 = tc.q.n0(cookie, new String[]{";"}, false, 0, 6, null);
        Object[] array = n02.toArray(new String[0]);
        Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
        String[] strArr = (String[]) array;
        int length = strArr.length;
        int i10 = 0;
        while (i10 < length) {
            String str2 = strArr[i10];
            i10++;
            n03 = tc.q.n0(str2, new String[]{"="}, false, 0, 6, null);
            Object[] array2 = n03.toArray(new String[0]);
            Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>");
            String[] strArr2 = (String[]) array2;
            if (strArr2.length > 0) {
                String str3 = strArr2[0];
                int length2 = str3.length() - 1;
                int i11 = 0;
                boolean z10 = false;
                while (i11 <= length2) {
                    boolean z11 = lc.j.h(str3.charAt(!z10 ? i11 : length2), 32) <= 0;
                    if (z10) {
                        if (!z11) {
                            break;
                        } else {
                            length2--;
                        }
                    } else if (z11) {
                        i11++;
                    } else {
                        z10 = true;
                    }
                }
                cookieManager.setCookie(str, lc.j.m(str3.subSequence(i11, length2 + 1).toString(), "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"));
            }
        }
        cookieManager.removeExpiredCookie();
    }

    public static final String h0(String str) {
        lc.j.f(str, "key");
        return f16470a.M("MD5", str);
    }

    public static final void i(Context context) {
        lc.j.f(context, "context");
        try {
            k0 k0Var = f16470a;
            k0Var.h(context, "facebook.com");
            k0Var.h(context, ".facebook.com");
            k0Var.h(context, "https://facebook.com");
            k0Var.h(context, "https://.facebook.com");
        } catch (Exception unused) {
        }
    }

    public static final boolean i0(Context context) {
        lc.j.f(context, "context");
        return Q(context);
    }

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

    public static final Bundle j0(String str) {
        List n02;
        List n03;
        Bundle bundle = new Bundle();
        if (!X(str)) {
            if (str == null) {
                throw new IllegalStateException("Required value was null.".toString());
            }
            n02 = tc.q.n0(str, new String[]{"&"}, false, 0, 6, null);
            Object[] array = n02.toArray(new String[0]);
            Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
            String[] strArr = (String[]) array;
            int length = strArr.length;
            int i10 = 0;
            while (i10 < length) {
                String str2 = strArr[i10];
                i10++;
                n03 = tc.q.n0(str2, new String[]{"="}, false, 0, 6, null);
                Object[] array2 = n03.toArray(new String[0]);
                Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>");
                String[] strArr2 = (String[]) array2;
                try {
                    if (strArr2.length == 2) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), URLDecoder.decode(strArr2[1], "UTF-8"));
                    } else if (strArr2.length == 1) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), "");
                    }
                } catch (UnsupportedEncodingException e10) {
                    d0("FacebookSDK", e10);
                }
            }
        }
        return bundle;
    }

    public static final String k(String str, String str2) {
        return X(str) ? str2 : str;
    }

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

    private final long l(double d10) {
        return Math.round(d10 / 1.073741824E9d);
    }

    public static final void l0(Bundle bundle, String str, String str2) {
        lc.j.f(bundle, "b");
        if (X(str2)) {
            return;
        }
        bundle.putString(str, str2);
    }

    public static final List<String> m(JSONArray jSONArray) {
        lc.j.f(jSONArray, "jsonArray");
        try {
            ArrayList arrayList = new ArrayList();
            int i10 = 0;
            int length = jSONArray.length();
            if (length <= 0) {
                return arrayList;
            }
            while (true) {
                int i11 = i10 + 1;
                String string = jSONArray.getString(i10);
                lc.j.e(string, "jsonArray.getString(i)");
                arrayList.add(string);
                if (i11 >= length) {
                    return arrayList;
                }
                i10 = i11;
            }
        } catch (JSONException unused) {
            return new ArrayList();
        }
    }

    public static final Map<String, String> m0(Parcel parcel) {
        lc.j.f(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        int i10 = 0;
    }

    public static final Map<String, Object> n(JSONObject jSONObject) {
        lc.j.f(jSONObject, "jsonObject");
        HashMap hashMap = new HashMap();
        JSONArray names = jSONObject.names();
        if (names == null) {
            return hashMap;
        }
        int i10 = 0;
        int length = names.length();
        if (length > 0) {
            while (true) {
                int i11 = i10 + 1;
                try {
                    String string = names.getString(i10);
                    lc.j.e(string, "keys.getString(i)");
                    Object obj = jSONObject.get(string);
                    if (obj instanceof JSONObject) {
                        obj = n((JSONObject) obj);
                    }
                    lc.j.e(obj, "value");
                    hashMap.put(string, obj);
                } catch (JSONException unused) {
                }
                if (i11 >= length) {
                    break;
                }
                i10 = i11;
            }
        }
        return hashMap;
    }

    public static final String n0(InputStream inputStream) {
        BufferedInputStream bufferedInputStream;
        Throwable th;
        InputStreamReader inputStreamReader;
        try {
            bufferedInputStream = new BufferedInputStream(inputStream);
            try {
                inputStreamReader = new InputStreamReader(bufferedInputStream);
                try {
                    StringBuilder sb2 = new StringBuilder();
                    char[] cArr = new char[2048];
                    while (true) {
                        int read = inputStreamReader.read(cArr);
                        if (read == -1) {
                            String sb3 = sb2.toString();
                            lc.j.e(sb3, "{\n      bufferedInputStream = BufferedInputStream(inputStream)\n      reader = InputStreamReader(bufferedInputStream)\n      val stringBuilder = StringBuilder()\n      val bufferSize = 1024 * 2\n      val buffer = CharArray(bufferSize)\n      var n = 0\n      while (reader.read(buffer).also { n = it } != -1) {\n        stringBuilder.append(buffer, 0, n)\n      }\n      stringBuilder.toString()\n    }");
                            j(bufferedInputStream);
                            j(inputStreamReader);
                            return sb3;
                        }
                        sb2.append(cArr, 0, read);
                    }
                } catch (Throwable th2) {
                    th = th2;
                    j(bufferedInputStream);
                    j(inputStreamReader);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inputStreamReader = null;
            }
        } catch (Throwable th4) {
            bufferedInputStream = null;
            th = th4;
            inputStreamReader = null;
        }
    }

    public static final Map<String, String> o(JSONObject jSONObject) {
        lc.j.f(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) {
                lc.j.e(next, "key");
                hashMap.put(next, optString);
            }
        }
        return hashMap;
    }

    public static final Map<String, String> o0(Parcel parcel) {
        lc.j.f(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        int i10 = 0;
    }

    public static final int p(InputStream inputStream, OutputStream outputStream) {
        lc.j.f(outputStream, "outputStream");
        BufferedInputStream bufferedInputStream = null;
        try {
            BufferedInputStream bufferedInputStream2 = new BufferedInputStream(inputStream);
            try {
                byte[] bArr = new byte[8192];
                int i10 = 0;
                while (true) {
                    int read = bufferedInputStream2.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    outputStream.write(bArr, 0, read);
                    i10 += read;
                }
                bufferedInputStream2.close();
                if (inputStream != null) {
                    inputStream.close();
                }
                return i10;
            } catch (Throwable th) {
                th = th;
                bufferedInputStream = bufferedInputStream2;
                if (bufferedInputStream != null) {
                    bufferedInputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    private final void p0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f16474e = statFs.getAvailableBlocks() * statFs.getBlockSize();
            }
            f16474e = l(f16474e);
        } catch (Exception unused) {
        }
    }

    public static final void q(URLConnection uRLConnection) {
        if (uRLConnection == null || !(uRLConnection instanceof HttpURLConnection)) {
            return;
        }
        ((HttpURLConnection) uRLConnection).disconnect();
    }

    private final int q0() {
        int i10 = f16471b;
        if (i10 > 0) {
            return i10;
        }
        try {
            File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new FilenameFilter() {
                @Override
                public final boolean accept(File file, String str) {
                    boolean r02;
                    r02 = k0.r0(file, str);
                    return r02;
                }
            });
            if (listFiles != null) {
                f16471b = listFiles.length;
            }
        } catch (Exception unused) {
        }
        if (f16471b <= 0) {
            f16471b = Math.max(Runtime.getRuntime().availableProcessors(), 1);
        }
        return f16471b;
    }

    private final boolean r() {
        return lc.j.a("mounted", Environment.getExternalStorageState());
    }

    public static final boolean r0(File file, String str) {
        return Pattern.matches("cpu[0-9]+", str);
    }

    public static final String s(int i10) {
        String bigInteger = new BigInteger(i10 * 5, new Random()).toString(32);
        lc.j.e(bigInteger, "BigInteger(length * 5, r).toString(32)");
        return bigInteger;
    }

    private final void s0(Context context) {
        if (lc.j.a(f16477h, "NoCarrier")) {
            try {
                Object systemService = context.getSystemService("phone");
                if (systemService == null) {
                    throw new NullPointerException("null cannot be cast to non-null type android.telephony.TelephonyManager");
                }
                String networkOperatorName = ((TelephonyManager) systemService).getNetworkOperatorName();
                lc.j.e(networkOperatorName, "telephonyManager.networkOperatorName");
                f16477h = networkOperatorName;
            } catch (Exception unused) {
            }
        }
    }

    public static final String t(Context context) {
        if (context == null) {
            return "null";
        }
        if (context == context.getApplicationContext()) {
            return "unknown";
        }
        String simpleName = context.getClass().getSimpleName();
        lc.j.e(simpleName, "{\n      context.javaClass.simpleName\n    }");
        return simpleName;
    }

    private final void t0(Context context) {
        if (f16472c == -1 || System.currentTimeMillis() - f16472c >= 1800000) {
            f16472c = System.currentTimeMillis();
            u0();
            s0(context);
            v0();
            p0();
        }
    }

    public static final String u(Context context) {
        String string;
        lc.j.f(context, "context");
        try {
            e2.f0 f0Var = e2.f0.f10014a;
            String n10 = e2.f0.n();
            if (n10 != null) {
                return n10;
            }
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            int i10 = applicationInfo.labelRes;
            if (i10 == 0) {
                string = applicationInfo.nonLocalizedLabel.toString();
            } else {
                string = context.getString(i10);
                lc.j.e(string, "context.getString(stringId)");
            }
            return string;
        } catch (Exception unused) {
            return "";
        }
    }

    private final void u0() {
        try {
            TimeZone timeZone = TimeZone.getDefault();
            String displayName = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
            lc.j.e(displayName, "tz.getDisplayName(tz.inDaylightTime(Date()), TimeZone.SHORT)");
            f16475f = displayName;
            String id2 = timeZone.getID();
            lc.j.e(id2, "tz.id");
            f16476g = id2;
        } catch (AssertionError | Exception unused) {
        }
    }

    public static final String v() {
        e2.f0 f0Var = e2.f0.f10014a;
        Context l10 = e2.f0.l();
        if (l10 == null) {
            return null;
        }
        try {
            PackageInfo packageInfo = l10.getPackageManager().getPackageInfo(l10.getPackageName(), 0);
            if (packageInfo == null) {
                return null;
            }
            return packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    private final void v0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f16473d = statFs.getBlockCount() * statFs.getBlockSize();
            }
            f16473d = l(f16473d);
        } catch (Exception unused) {
        }
    }

    public static final Date w(Bundle bundle, String str, Date date) {
        long parseLong;
        lc.j.f(date, "dateBase");
        if (bundle == null) {
            return null;
        }
        Object obj = bundle.get(str);
        if (!(obj instanceof Long)) {
            if (obj instanceof String) {
                try {
                    parseLong = Long.parseLong((String) obj);
                } catch (NumberFormatException unused) {
                }
            }
            return null;
        }
        parseLong = ((Number) obj).longValue();
        return parseLong == 0 ? new Date(Long.MAX_VALUE) : new Date(date.getTime() + (parseLong * 1000));
    }

    public static final void w0(Runnable runnable) {
        try {
            e2.f0 f0Var = e2.f0.f10014a;
            e2.f0.t().execute(runnable);
        } catch (Exception unused) {
        }
    }

    public static final long x(Uri uri) {
        lc.j.f(uri, "contentUri");
        Cursor cursor = null;
        try {
            e2.f0 f0Var = e2.f0.f10014a;
            cursor = e2.f0.l().getContentResolver().query(uri, null, null, null, null);
            if (cursor == null) {
                return 0L;
            }
            int columnIndex = cursor.getColumnIndex("_size");
            cursor.moveToFirst();
            long j10 = cursor.getLong(columnIndex);
            cursor.close();
            return j10;
        } catch (Throwable th) {
            if (cursor != null) {
                cursor.close();
            }
            throw th;
        }
    }

    public static final void x0(JSONObject jSONObject, t2.a aVar, String str, boolean z10, Context context) {
        lc.j.f(jSONObject, "params");
        lc.j.f(context, "context");
        n nVar = n.f16482a;
        n.b bVar = n.b.ServiceUpdateCompliance;
        if (!n.g(bVar)) {
            jSONObject.put("anon_id", str);
        }
        jSONObject.put("application_tracking_enabled", !z10);
        e2.f0 f0Var = e2.f0.f10014a;
        jSONObject.put("advertiser_id_collection_enabled", e2.f0.k());
        if (aVar != null) {
            if (n.g(bVar)) {
                f16470a.c(jSONObject, aVar, str, context);
            }
            if (aVar.j() != null) {
                if (n.g(bVar)) {
                    f16470a.d(jSONObject, aVar, context);
                } else {
                    jSONObject.put("attribution", aVar.j());
                }
            }
            if (aVar.h() != null) {
                jSONObject.put("advertiser_id", aVar.h());
                jSONObject.put("advertiser_tracking_enabled", !aVar.k());
            }
            if (!aVar.k()) {
                f2.e0 e0Var = f2.e0.f10439a;
                String b10 = f2.e0.b();
                if (!(b10.length() == 0)) {
                    jSONObject.put("ud", b10);
                }
            }
            if (aVar.i() != null) {
                jSONObject.put("installer_package", aVar.i());
            }
        }
    }

    public static final Locale y() {
        Locale J = J();
        if (J != null) {
            return J;
        }
        Locale locale = Locale.getDefault();
        lc.j.e(locale, "getDefault()");
        return locale;
    }

    public static final void y0(JSONObject jSONObject, Context context) {
        String str;
        Locale locale;
        int i10;
        Display display;
        PackageInfo packageInfo;
        lc.j.f(jSONObject, "params");
        lc.j.f(context, "appContext");
        JSONArray jSONArray = new JSONArray();
        k0 k0Var = f16470a;
        jSONArray.put("a2");
        k0Var.t0(context);
        String packageName = context.getPackageName();
        int i11 = 0;
        int i12 = -1;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
        } catch (PackageManager.NameNotFoundException unused) {
            str = "";
        }
        if (packageInfo == null) {
            return;
        }
        i12 = packageInfo.versionCode;
        str = packageInfo.versionName;
        jSONArray.put(packageName);
        jSONArray.put(i12);
        jSONArray.put(str);
        jSONArray.put(Build.VERSION.RELEASE);
        jSONArray.put(Build.MODEL);
        try {
            locale = context.getResources().getConfiguration().locale;
        } catch (Exception unused2) {
            locale = Locale.getDefault();
        }
        jSONArray.put(locale.getLanguage() + '_' + ((Object) locale.getCountry()));
        jSONArray.put(f16475f);
        jSONArray.put(f16477h);
        double d10 = 0.0d;
        try {
            Object systemService = context.getSystemService("display");
            display = null;
            DisplayManager displayManager = systemService instanceof DisplayManager ? (DisplayManager) systemService : null;
            if (displayManager != null) {
                display = displayManager.getDisplay(0);
            }
        } catch (Exception unused3) {
        }
        if (display != null) {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            display.getMetrics(displayMetrics);
            int i13 = displayMetrics.widthPixels;
            try {
                int i14 = displayMetrics.heightPixels;
                try {
                    d10 = displayMetrics.density;
                } catch (Exception unused4) {
                }
                i10 = i14;
                i11 = i13;
            } catch (Exception unused5) {
                i11 = i13;
            }
            jSONArray.put(i11);
            jSONArray.put(i10);
            jSONArray.put(new DecimalFormat("#.##").format(d10));
            jSONArray.put(f16470a.q0());
            jSONArray.put(f16473d);
            jSONArray.put(f16474e);
            jSONArray.put(f16476g);
            jSONObject.put("extinfo", jSONArray.toString());
        }
        i10 = 0;
        jSONArray.put(i11);
        jSONArray.put(i10);
        jSONArray.put(new DecimalFormat("#.##").format(d10));
        jSONArray.put(f16470a.q0());
        jSONArray.put(f16473d);
        jSONArray.put(f16474e);
        jSONArray.put(f16476g);
        jSONObject.put("extinfo", jSONArray.toString());
    }

    private final String z() {
        e2.a e10 = e2.a.f9954x.e();
        return (e10 == null || e10.p() == null) ? "facebook" : e10.p();
    }

    public static final String z0(byte[] bArr) {
        lc.j.f(bArr, "bytes");
        return f16470a.N("SHA-1", bArr);
    }
}