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

应用版本信息
应用名称:Shopping List
版本号:2.74
包名称:com.icedblueberry.shoppinglisteasy

MD5 校验值:8005b9444b02324a81f85f1ef7e26f28

反编译源代码说明

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


package b6;

import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import com.facebook.ads.AdError;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;

public final class b7 extends n4 {

    public static final String[] f1990y = {"firebase_", "google_", "ga_"};

    public static final String[] f1991z = {"_err"};

    public SecureRandom f1992u;
    public final AtomicLong v;

    public int f1993w;

    public Integer f1994x;

    public b7(c4 c4Var) {
        super(c4Var);
        this.f1994x = null;
        this.v = new AtomicLong(0L);
    }

    public static boolean T(Object obj) {
        return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle);
    }

    public static boolean V(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("_");
    }

    public static boolean W(String str) {
        d5.o.e(str);
        if (str.charAt(0) == '_' && !str.equals("_ep")) {
            return false;
        }
        return true;
    }

    public static boolean X(Context context) {
        ActivityInfo receiverInfo;
        d5.o.h(context);
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null && (receiverInfo = packageManager.getReceiverInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementReceiver"), 0)) != null) {
                if (receiverInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return false;
    }

    public static boolean Y(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        d5.o.h(context);
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                PackageManager packageManager = context.getPackageManager();
                if (packageManager != null && (serviceInfo2 = packageManager.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementJobService"), 0)) != null) {
                    if (serviceInfo2.enabled) {
                        return true;
                    }
                }
            } catch (PackageManager.NameNotFoundException unused) {
            }
            return false;
        }
        try {
            PackageManager packageManager2 = context.getPackageManager();
            if (packageManager2 != null && (serviceInfo = packageManager2.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementService"), 0)) != null) {
                if (serviceInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused2) {
        }
        return false;
    }

    public static boolean Z(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            d5.o.h(str);
            if (!str.equals(str2)) {
                return true;
            }
            return false;
        }
        if (isEmpty && isEmpty2) {
            if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                if (!str3.equals(str4)) {
                    return true;
                }
                return false;
            }
            if (!TextUtils.isEmpty(str4)) {
                return true;
            }
            return false;
        }
        if (!isEmpty) {
            if (TextUtils.isEmpty(str4)) {
                return false;
            }
            if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
                return true;
            }
            return false;
        }
        if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
            return true;
        }
        return false;
    }

    public static byte[] a0(Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        Parcel obtain = Parcel.obtain();
        try {
            parcelable.writeToParcel(obtain, 0);
            return obtain.marshall();
        } finally {
            obtain.recycle();
        }
    }

    public static final boolean b0(int i10, Bundle bundle) {
        if (bundle.getLong("_err") == 0) {
            bundle.putLong("_err", i10);
            return true;
        }
        return false;
    }

    public static boolean e0(String str, String[] strArr) {
        boolean z10;
        d5.o.h(strArr);
        for (Object obj : strArr) {
            if (str != obj && (str == null || !str.equals(obj))) {
                z10 = false;
            } else {
                z10 = true;
            }
            if (z10) {
                return true;
            }
        }
        return false;
    }

    public static long l0(byte[] bArr) {
        boolean z10;
        d5.o.h(bArr);
        int length = bArr.length;
        int i10 = 0;
        if (length > 0) {
            z10 = true;
        } else {
            z10 = false;
        }
        d5.o.k(z10);
        long j = 0;
        for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
            j += (bArr[i11] & 255) << i10;
            i10 += 8;
        }
        return j;
    }

    public static String q(int i10, String str, boolean z10) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) > i10) {
            if (!z10) {
                return null;
            }
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
        }
        return str;
    }

    public static MessageDigest r() {
        MessageDigest messageDigest;
        for (int i10 = 0; i10 < 2; i10++) {
            try {
                messageDigest = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException unused) {
            }
            if (messageDigest != null) {
                return messageDigest;
            }
        }
        return null;
    }

    public static ArrayList t(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            c cVar = (c) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", cVar.f1995s);
            bundle.putString("origin", cVar.f1996t);
            bundle.putLong("creation_timestamp", cVar.v);
            bundle.putString("name", cVar.f1997u.f2490t);
            Object A0 = cVar.f1997u.A0();
            d5.o.h(A0);
            t7.a.p(bundle, A0);
            bundle.putBoolean("active", cVar.f1998w);
            String str = cVar.f1999x;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            t tVar = cVar.f2000y;
            if (tVar != null) {
                bundle.putString("timed_out_event_name", tVar.f2401s);
                r rVar = tVar.f2402t;
                if (rVar != null) {
                    bundle.putBundle("timed_out_event_params", rVar.A0());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f2001z);
            t tVar2 = cVar.A;
            if (tVar2 != null) {
                bundle.putString("triggered_event_name", tVar2.f2401s);
                r rVar2 = tVar2.f2402t;
                if (rVar2 != null) {
                    bundle.putBundle("triggered_event_params", rVar2.A0());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f1997u.f2491u);
            bundle.putLong("time_to_live", cVar.B);
            t tVar3 = cVar.C;
            if (tVar3 != null) {
                bundle.putString("expired_event_name", tVar3.f2401s);
                r rVar3 = tVar3.f2402t;
                if (rVar3 != null) {
                    bundle.putBundle("expired_event_params", rVar3.A0());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void w(l5 l5Var, Bundle bundle, boolean z10) {
        if (bundle != null && l5Var != null) {
            if (bundle.containsKey("_sc") && !z10) {
                z10 = false;
            } else {
                String str = l5Var.f2215a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = l5Var.f2216b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", l5Var.f2217c);
                return;
            }
        }
        if (bundle != null && l5Var == null && z10) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void z(a7 a7Var, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        b0(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        a7Var.b(str, bundle);
    }

    public final void A(Bundle bundle, String str, Object obj) {
        String str2;
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
            return;
        }
        if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
            return;
        }
        if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
            return;
        }
        if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            if (obj != null) {
                str2 = obj.getClass().getSimpleName();
            } else {
                str2 = null;
            }
            ((c4) this.f4620s).c().C.c(((c4) this.f4620s).E.e(str), str2, "Not putting event parameter. Invalid value type. name, type");
        }
    }

    public final void B(v5.w0 w0Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void C(v5.w0 w0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void D(v5.w0 w0Var, Bundle bundle) {
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void E(v5.w0 w0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning byte array to wrapper");
        }
    }

    public final void F(v5.w0 w0Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning int value to wrapper");
        }
    }

    public final void G(v5.w0 w0Var, long j) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning long value to wrapper");
        }
    }

    public final void H(String str, v5.w0 w0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            w0Var.T1(bundle);
        } catch (RemoteException e10) {
            ((c4) this.f4620s).c().A.b(e10, "Error returning string value to wrapper");
        }
    }

    public final void I(String str, String str2, Bundle bundle, List list, boolean z10) {
        int i10;
        String str3;
        int M;
        if (bundle == null) {
            return;
        }
        ((c4) this.f4620s).getClass();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str4 = (String) it.next();
            if (list != null && list.contains(str4)) {
                i10 = 0;
            } else {
                if (!z10) {
                    i10 = i0(str4);
                } else {
                    i10 = 0;
                }
                if (i10 == 0) {
                    i10 = h0(str4);
                }
            }
            if (i10 != 0) {
                if (i10 == 3) {
                    str3 = str4;
                } else {
                    str3 = null;
                }
                v(bundle, i10, str4, str3);
                bundle.remove(str4);
            } else {
                if (T(bundle.get(str4))) {
                    ((c4) this.f4620s).c().C.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
                    M = 22;
                } else {
                    M = M(str, str4, bundle.get(str4), bundle, list, z10, false);
                }
                if (M != 0 && !"_ev".equals(str4)) {
                    v(bundle, M, str4, bundle.get(str4));
                    bundle.remove(str4);
                } else if (W(str4) && !e0(str4, b0.u.f1736w) && (i11 = i11 + 1) > 0) {
                    ((c4) this.f4620s).c().f2525z.c(((c4) this.f4620s).E.d(str), ((c4) this.f4620s).E.b(bundle), "Item cannot contain custom parameters");
                    b0(23, bundle);
                    bundle.remove(str4);
                }
            }
        }
    }

    public final boolean J(String str, String str2) {
        if (!TextUtils.isEmpty(str)) {
            d5.o.h(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                if (TextUtils.isEmpty(((c4) this.f4620s).f2018t)) {
                    ((c4) this.f4620s).c().f2525z.b(z2.s(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        }
        if (!TextUtils.isEmpty(str2)) {
            d5.o.h(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                ((c4) this.f4620s).c().f2525z.b(z2.s(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        }
        if (TextUtils.isEmpty(((c4) this.f4620s).f2018t)) {
            ((c4) this.f4620s).c().f2525z.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
        }
        return false;
    }

    public final boolean K(String str, int i10, String str2) {
        if (str2 == null) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.codePointCount(0, str2.length()) > i10) {
            ((c4) this.f4620s).c().f2525z.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
            return false;
        }
        return true;
    }

    public final boolean L(String str, String[] strArr, String[] strArr2, String str2) {
        if (str2 == null) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f1990y;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                ((c4) this.f4620s).c().f2525z.c(str, str2, "Name starts with reserved prefix. Type, name");
                return false;
            }
        }
        if (strArr != null && e0(str2, strArr)) {
            if (strArr2 == null || !e0(str2, strArr2)) {
                ((c4) this.f4620s).c().f2525z.c(str, str2, "Name is reserved. Type, name");
                return false;
            }
            return true;
        }
        return true;
    }

    public final int M(String str, String str2, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
        int i10;
        int i11;
        Object obj2;
        int size;
        e();
        int i12 = 0;
        if (T(obj)) {
            if (z11) {
                if (!e0(str2, b0.u.v)) {
                    return 20;
                }
                a6 w10 = ((c4) this.f4620s).w();
                w10.e();
                w10.f();
                if (w10.r() && ((c4) w10.f4620s).y().k0() < 200900) {
                    return 25;
                }
                ((c4) this.f4620s).getClass();
                boolean z12 = obj instanceof Parcelable[];
                if (z12) {
                    size = ((Parcelable[]) obj).length;
                } else if (obj instanceof ArrayList) {
                    size = ((ArrayList) obj).size();
                }
                if (size > 200) {
                    ((c4) this.f4620s).c().C.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                    ((c4) this.f4620s).getClass();
                    if (z12) {
                        Parcelable[] parcelableArr = (Parcelable[]) obj;
                        if (parcelableArr.length > 200) {
                            bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr, 200));
                        }
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList = (ArrayList) obj;
                        if (arrayList.size() > 200) {
                            bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, 200)));
                        }
                    }
                    i10 = 17;
                    if (V(str) && !V(str2)) {
                        ((c4) this.f4620s).getClass();
                        i11 = 100;
                    } else {
                        ((c4) this.f4620s).getClass();
                        i11 = 256;
                    }
                    if (!O("param", str2, i11, obj)) {
                        return i10;
                    }
                    if (z11) {
                        if (obj instanceof Bundle) {
                            I(str, str2, (Bundle) obj, list, z10);
                        } else if (obj instanceof Parcelable[]) {
                            Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                            int length = parcelableArr2.length;
                            while (i12 < length) {
                                Parcelable parcelable = parcelableArr2[i12];
                                if (!(parcelable instanceof Bundle)) {
                                    ((c4) this.f4620s).c().C.c(parcelable.getClass(), str2, "All Parcelable[] elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                I(str, str2, (Bundle) parcelable, list, z10);
                                i12++;
                            }
                        } else if (obj instanceof ArrayList) {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            while (i12 < size2) {
                                Object obj3 = arrayList2.get(i12);
                                if (!(obj3 instanceof Bundle)) {
                                    x2 x2Var = ((c4) this.f4620s).c().C;
                                    if (obj3 != null) {
                                        obj2 = obj3.getClass();
                                    } else {
                                        obj2 = "null";
                                    }
                                    x2Var.c(obj2, str2, "All ArrayList elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                I(str, str2, (Bundle) obj3, list, z10);
                                i12++;
                            }
                        } else {
                            return 4;
                        }
                        return i10;
                    }
                    return 4;
                }
            } else {
                return 21;
            }
        }
        i10 = 0;
        if (V(str)) {
        }
        ((c4) this.f4620s).getClass();
        i11 = 256;
        if (!O("param", str2, i11, obj)) {
        }
    }

    public final void N() {
        e();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                ((c4) this.f4620s).c().A.a("Utils falling back to Random for random id");
            }
        }
        this.v.set(nextLong);
    }

    public final boolean O(String str, String str2, int i10, Object obj) {
        if (obj != null && !(obj instanceof Long) && !(obj instanceof Float) && !(obj instanceof Integer) && !(obj instanceof Byte) && !(obj instanceof Short) && !(obj instanceof Boolean) && !(obj instanceof Double)) {
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                return false;
            }
            String obj2 = obj.toString();
            if (obj2.codePointCount(0, obj2.length()) > i10) {
                ((c4) this.f4620s).c().C.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean P(String str, String str2) {
        if (str2 == null) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            if (codePointAt == 95) {
                codePointAt = 95;
            } else {
                ((c4) this.f4620s).c().f2525z.c(str, str2, "Name must start with a letter or _ (underscore). Type, name");
                return false;
            }
        }
        int length = str2.length();
        int charCount = Character.charCount(codePointAt);
        while (charCount < length) {
            int codePointAt2 = str2.codePointAt(charCount);
            if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                ((c4) this.f4620s).c().f2525z.c(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean Q(String str, String str2) {
        if (str2 == null) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            ((c4) this.f4620s).c().f2525z.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            ((c4) this.f4620s).c().f2525z.c(str, str2, "Name must start with a letter. Type, name");
            return false;
        }
        int length = str2.length();
        int charCount = Character.charCount(codePointAt);
        while (charCount < length) {
            int codePointAt2 = str2.codePointAt(charCount);
            if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                ((c4) this.f4620s).c().f2525z.c(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean R(String str) {
        e();
        if (j5.d.a(((c4) this.f4620s).f2017s).f7504a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        ((c4) this.f4620s).c().E.b(str, "Permission not granted");
        return false;
    }

    public final boolean S(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String f10 = ((c4) this.f4620s).f2022y.f("debug.firebase.analytics.app");
        ((c4) this.f4620s).getClass();
        return f10.equals(str);
    }

    public final boolean U(Context context, String str) {
        Signature[] signatureArr;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo b10 = j5.d.a(context).b(64, str);
            if (b10 != null && (signatureArr = b10.signatures) != null && signatureArr.length > 0) {
                return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(signatureArr[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal);
            }
            return true;
        } catch (PackageManager.NameNotFoundException e10) {
            ((c4) this.f4620s).c().f2523x.b(e10, "Package name not found");
            return true;
        } catch (CertificateException e11) {
            ((c4) this.f4620s).c().f2523x.b(e11, "Error obtaining certificate");
            return true;
        }
    }

    public final int c0(String str) {
        if ("_ldl".equals(str)) {
            ((c4) this.f4620s).getClass();
            return 2048;
        }
        if ("_id".equals(str)) {
            ((c4) this.f4620s).getClass();
            return 256;
        }
        if ("_lgclid".equals(str)) {
            ((c4) this.f4620s).getClass();
            return 100;
        }
        ((c4) this.f4620s).getClass();
        return 36;
    }

    public final Object d0(int i10, Object obj, boolean z10, boolean z11) {
        long j;
        if (obj == null) {
            return null;
        }
        if (!(obj instanceof Long) && !(obj instanceof Double)) {
            if (obj instanceof Integer) {
                return Long.valueOf(((Integer) obj).intValue());
            }
            if (obj instanceof Byte) {
                return Long.valueOf(((Byte) obj).byteValue());
            }
            if (obj instanceof Short) {
                return Long.valueOf(((Short) obj).shortValue());
            }
            if (obj instanceof Boolean) {
                if (true != ((Boolean) obj).booleanValue()) {
                    j = 0;
                } else {
                    j = 1;
                }
                return Long.valueOf(j);
            }
            if (obj instanceof Float) {
                return Double.valueOf(((Float) obj).doubleValue());
            }
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                if (!z11 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
                    return null;
                }
                ArrayList arrayList = new ArrayList();
                for (Parcelable parcelable : (Parcelable[]) obj) {
                    if (parcelable instanceof Bundle) {
                        Bundle o02 = o0((Bundle) parcelable);
                        if (!o02.isEmpty()) {
                            arrayList.add(o02);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return q(i10, obj.toString(), z10);
        }
        return obj;
    }

    @Override
    public final boolean f() {
        return true;
    }

    public final int f0(Object obj, String str) {
        boolean O;
        if ("_ldl".equals(str)) {
            O = O("user property referrer", str, c0(str), obj);
        } else {
            O = O("user property", str, c0(str), obj);
        }
        if (O) {
            return 0;
        }
        return 7;
    }

    public final int g0(String str) {
        if (!P("event", str)) {
            return 2;
        }
        if (!L("event", c0.f2003t, c0.f2004u, str)) {
            return 13;
        }
        ((c4) this.f4620s).getClass();
        if (!K("event", 40, str)) {
            return 2;
        }
        return 0;
    }

    public final int h0(String str) {
        if (!P("event param", str)) {
            return 3;
        }
        if (!L("event param", null, null, str)) {
            return 14;
        }
        ((c4) this.f4620s).getClass();
        if (!K("event param", 40, str)) {
            return 3;
        }
        return 0;
    }

    public final int i0(String str) {
        if (!Q("event param", str)) {
            return 3;
        }
        if (!L("event param", null, null, str)) {
            return 14;
        }
        ((c4) this.f4620s).getClass();
        if (!K("event param", 40, str)) {
            return 3;
        }
        return 0;
    }

    public final int j0(String str) {
        if (!P("user property", str)) {
            return 6;
        }
        if (!L("user property", t7.a.f21085t, null, str)) {
            return 15;
        }
        ((c4) this.f4620s).getClass();
        if (!K("user property", 24, str)) {
            return 6;
        }
        return 0;
    }

    public final int k0() {
        if (this.f1994x == null) {
            z4.f fVar = z4.f.f24042b;
            Context context = ((c4) this.f4620s).f2017s;
            fVar.getClass();
            this.f1994x = Integer.valueOf(z4.f.a(context) / AdError.NETWORK_ERROR_CODE);
        }
        return this.f1994x.intValue();
    }

    public final long m0() {
        long andIncrement;
        long j;
        if (this.v.get() == 0) {
            synchronized (this.v) {
                long nanoTime = System.nanoTime();
                ((c4) this.f4620s).F.getClass();
                long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
                int i10 = this.f1993w + 1;
                this.f1993w = i10;
                j = nextLong + i10;
            }
            return j;
        }
        synchronized (this.v) {
            this.v.compareAndSet(-1L, 1L);
            andIncrement = this.v.getAndIncrement();
        }
        return andIncrement;
    }

    public final Object n(Object obj, String str) {
        int i10 = 256;
        if ("_ev".equals(str)) {
            ((c4) this.f4620s).getClass();
            return d0(256, obj, true, true);
        }
        if (V(str)) {
            ((c4) this.f4620s).getClass();
        } else {
            ((c4) this.f4620s).getClass();
            i10 = 100;
        }
        return d0(i10, obj, false, true);
    }

    public final Bundle n0(Uri uri) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        if (uri != null) {
            try {
                if (uri.isHierarchical()) {
                    str = uri.getQueryParameter("utm_campaign");
                    str2 = uri.getQueryParameter("utm_source");
                    str3 = uri.getQueryParameter("utm_medium");
                    str4 = uri.getQueryParameter("gclid");
                    str5 = uri.getQueryParameter("utm_id");
                    str6 = uri.getQueryParameter("dclid");
                    str7 = uri.getQueryParameter("srsltid");
                } else {
                    str = null;
                    str2 = null;
                    str3 = null;
                    str4 = null;
                    str5 = null;
                    str6 = null;
                    str7 = null;
                }
                if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7)) {
                    return null;
                }
                Bundle bundle = new Bundle();
                if (!TextUtils.isEmpty(str)) {
                    bundle.putString("campaign", str);
                }
                if (!TextUtils.isEmpty(str2)) {
                    bundle.putString("source", str2);
                }
                if (!TextUtils.isEmpty(str3)) {
                    bundle.putString("medium", str3);
                }
                if (!TextUtils.isEmpty(str4)) {
                    bundle.putString("gclid", str4);
                }
                String queryParameter = uri.getQueryParameter("utm_term");
                if (!TextUtils.isEmpty(queryParameter)) {
                    bundle.putString("term", queryParameter);
                }
                String queryParameter2 = uri.getQueryParameter("utm_content");
                if (!TextUtils.isEmpty(queryParameter2)) {
                    bundle.putString("content", queryParameter2);
                }
                String queryParameter3 = uri.getQueryParameter("aclid");
                if (!TextUtils.isEmpty(queryParameter3)) {
                    bundle.putString("aclid", queryParameter3);
                }
                String queryParameter4 = uri.getQueryParameter("cp1");
                if (!TextUtils.isEmpty(queryParameter4)) {
                    bundle.putString("cp1", queryParameter4);
                }
                String queryParameter5 = uri.getQueryParameter("anid");
                if (!TextUtils.isEmpty(queryParameter5)) {
                    bundle.putString("anid", queryParameter5);
                }
                if (!TextUtils.isEmpty(str5)) {
                    bundle.putString("campaign_id", str5);
                }
                if (!TextUtils.isEmpty(str6)) {
                    bundle.putString("dclid", str6);
                }
                String queryParameter6 = uri.getQueryParameter("utm_source_platform");
                if (!TextUtils.isEmpty(queryParameter6)) {
                    bundle.putString("source_platform", queryParameter6);
                }
                String queryParameter7 = uri.getQueryParameter("utm_creative_format");
                if (!TextUtils.isEmpty(queryParameter7)) {
                    bundle.putString("creative_format", queryParameter7);
                }
                String queryParameter8 = uri.getQueryParameter("utm_marketing_tactic");
                if (!TextUtils.isEmpty(queryParameter8)) {
                    bundle.putString("marketing_tactic", queryParameter8);
                }
                if (!TextUtils.isEmpty(str7)) {
                    bundle.putString("srsltid", str7);
                }
                return bundle;
            } catch (UnsupportedOperationException e10) {
                ((c4) this.f4620s).c().A.b(e10, "Install referrer url isn't a hierarchical URI");
            }
        }
        return null;
    }

    public final Object o(Object obj, String str) {
        if ("_ldl".equals(str)) {
            return d0(c0(str), obj, true, false);
        }
        return d0(c0(str), obj, false, false);
    }

    public final Bundle o0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object n10 = n(bundle.get(str), str);
                if (n10 == null) {
                    ((c4) this.f4620s).c().C.b(((c4) this.f4620s).E.e(str), "Param value can't be null");
                } else {
                    A(bundle2, str, n10);
                }
            }
        }
        return bundle2;
    }

    public final String p() {
        byte[] bArr = new byte[16];
        s().nextBytes(bArr);
        return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
    }

    public final Bundle p0(String str, Bundle bundle, List list, boolean z10) {
        int i10;
        String str2;
        String str3;
        List list2 = list;
        boolean e02 = e0(str, c0.f2005w);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            int h10 = ((c4) this.f4620s).f2022y.h();
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str4 = (String) it.next();
                if (list2 != null && list2.contains(str4)) {
                    i10 = 0;
                } else {
                    if (!z10) {
                        i10 = i0(str4);
                    } else {
                        i10 = 0;
                    }
                    if (i10 == 0) {
                        i10 = h0(str4);
                    }
                }
                if (i10 != 0) {
                    if (i10 == 3) {
                        str2 = str4;
                    } else {
                        str2 = null;
                    }
                    v(bundle2, i10, str4, str2);
                    bundle2.remove(str4);
                } else {
                    int M = M(str, str4, bundle.get(str4), bundle2, list, z10, e02);
                    if (M == 17) {
                        v(bundle2, 17, str4, Boolean.FALSE);
                    } else if (M != 0 && !"_ev".equals(str4)) {
                        if (M == 21) {
                            str3 = str;
                        } else {
                            str3 = str4;
                        }
                        v(bundle2, M, str3, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (W(str4)) {
                        int i12 = i11 + 1;
                        if (i12 > h10) {
                            StringBuilder c10 = cb.g.c("Event can't contain more than ", h10, " params");
                            ((c4) this.f4620s).c().f2525z.c(((c4) this.f4620s).E.d(str), ((c4) this.f4620s).E.b(bundle), c10.toString());
                            b0(5, bundle2);
                            bundle2.remove(str4);
                        }
                        list2 = list;
                        i11 = i12;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

    public final t q0(String str, Bundle bundle, String str2, long j, boolean z10) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (g0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle p02 = p0(str, bundle2, Collections.singletonList("_o"), true);
            if (z10) {
                p02 = o0(p02);
            }
            d5.o.h(p02);
            return new t(str, new r(p02), str2, j);
        }
        ((c4) this.f4620s).c().f2523x.b(((c4) this.f4620s).E.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }

    public final SecureRandom s() {
        e();
        if (this.f1992u == null) {
            this.f1992u = new SecureRandom();
        }
        return this.f1992u;
    }

    public final void u(Bundle bundle, long j) {
        long j10 = bundle.getLong("_et");
        if (j10 != 0) {
            ((c4) this.f4620s).c().A.b(Long.valueOf(j10), "Params already contained engagement");
        } else {
            j10 = 0;
        }
        bundle.putLong("_et", j + j10);
    }

    public final void v(Bundle bundle, int i10, String str, Object obj) {
        if (b0(i10, bundle)) {
            ((c4) this.f4620s).getClass();
            bundle.putString("_ev", q(40, str, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void x(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                ((c4) this.f4620s).y().A(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void y(a3 a3Var, int i10) {
        Iterator it = new TreeSet(a3Var.f1955d.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (W(str) && (i11 = i11 + 1) > i10) {
                ((c4) this.f4620s).c().f2525z.c(((c4) this.f4620s).E.d(a3Var.f1952a), ((c4) this.f4620s).E.b(a3Var.f1955d), cb.g.c("Event can't contain more than ", i10, " params").toString());
                b0(5, a3Var.f1955d);
                a3Var.f1955d.remove(str);
            }
        }
    }
}