Pdf Converter v5.0版本的 MD5 值为:258149214e8277c73fa6b365aba312ef

以下内容为反编译后的 j6.java 源代码,内容仅作参考


package m7;

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.google.android.gms.internal.ads.ri;
import com.google.android.gms.internal.measurement.gc;
import com.google.android.gms.internal.measurement.hc;
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;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
public final class j6 extends p3 {
    public static final String[] f21508x = {"firebase_", "google_", "ga_"};
    public static final String[] f21509y = {"_err"};
    public SecureRandom f21510t;
    public final AtomicLong f21511u;
    public int f21512v;
    public Integer f21513w;

    public j6(d3 d3Var) {
        super(d3Var);
        this.f21513w = null;
        this.f21511u = new AtomicLong(0L);
    }

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

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

    public static boolean Q(String str) {
        n6.n.e(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean R(Context context) {
        ActivityInfo receiverInfo;
        n6.n.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 S(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        n6.n.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 U(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            n6.n.h(str);
            return !str.equals(str2);
        } else if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        } else if (isEmpty) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        } else if (TextUtils.isEmpty(str4)) {
            return false;
        } else {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
    }

    public static byte[] V(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 Y(int i10, Bundle bundle) {
        if (bundle != null && bundle.getLong("_err") == 0) {
            bundle.putLong("_err", i10);
            return true;
        }
        return false;
    }

    public static boolean c0(String str, String[] strArr) {
        n6.n.h(strArr);
        for (int i10 = 0; i10 < strArr.length; i10++) {
            String str2 = strArr[i10];
            if (str == str2 || (str != null && str.equals(str2))) {
                return true;
            }
        }
        return false;
    }

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

    public static long j0(byte[] bArr) {
        n6.n.h(bArr);
        int length = bArr.length;
        int i10 = 0;
        n6.n.k(length > 0);
        long j10 = 0;
        for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
            j10 += (bArr[i11] & 255) << i10;
            i10 += 8;
        }
        return j10;
    }

    public static MessageDigest k() {
        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 m(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.f21320r);
            bundle.putString("origin", cVar.f21321s);
            bundle.putLong("creation_timestamp", cVar.f21323u);
            bundle.putString("name", cVar.f21322t.f21425s);
            Object l10 = cVar.f21322t.l();
            n6.n.h(l10);
            e7.y.K(bundle, l10);
            bundle.putBoolean("active", cVar.f21324v);
            String str = cVar.f21325w;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            r rVar = cVar.f21326x;
            if (rVar != null) {
                bundle.putString("timed_out_event_name", rVar.f21731r);
                p pVar = rVar.f21732s;
                if (pVar != null) {
                    bundle.putBundle("timed_out_event_params", pVar.l());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f21327y);
            r rVar2 = cVar.f21328z;
            if (rVar2 != null) {
                bundle.putString("triggered_event_name", rVar2.f21731r);
                p pVar2 = rVar2.f21732s;
                if (pVar2 != null) {
                    bundle.putBundle("triggered_event_params", pVar2.l());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f21322t.f21426t);
            bundle.putLong("time_to_live", cVar.A);
            r rVar3 = cVar.B;
            if (rVar3 != null) {
                bundle.putString("expired_event_name", rVar3.f21731r);
                p pVar3 = rVar3.f21732s;
                if (pVar3 != null) {
                    bundle.putBundle("expired_event_params", pVar3.l());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void p(o4 o4Var, Bundle bundle, boolean z10) {
        if (bundle != null && o4Var != null) {
            if (!bundle.containsKey("_sc") || z10) {
                String str = o4Var.f21622a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = o4Var.f21623b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", o4Var.f21624c);
                return;
            }
            z10 = false;
        }
        if (bundle != null && o4Var == null && z10) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void t(i6 i6Var, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        Y(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        i6Var.a(str, bundle);
    }

    public final void A(com.google.android.gms.internal.measurement.x0 x0Var, long j10) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j10);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning long value to wrapper", e10);
        }
    }

    public final void B(String str, com.google.android.gms.internal.measurement.x0 x0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning string value to wrapper", e10);
        }
    }

    public final void C(String str, String str2, Bundle bundle, List list, boolean z10) {
        int i10;
        Iterator it;
        int g02;
        c2 c2Var;
        String str3;
        int i11;
        int F;
        String str4;
        if (bundle == null) {
            return;
        }
        d3 d3Var = this.f21621r;
        f fVar = d3Var.f21371x;
        ((hc) gc.f14233s.f14234r.zza()).zza();
        String str5 = null;
        if (fVar.f21621r.f21371x.l(null, q1.f21699t0)) {
            j6 j6Var = fVar.f21621r.C;
            d3.e(j6Var);
            if (j6Var.O(231100000)) {
                i10 = 35;
                it = new TreeSet(bundle.keySet()).iterator();
                int i12 = 0;
                while (it.hasNext()) {
                    String str6 = (String) it.next();
                    if (list == null || !list.contains(str6)) {
                        g02 = !z10 ? g0(str6) : 0;
                        if (g02 == 0) {
                            g02 = f0(str6);
                        }
                    } else {
                        g02 = 0;
                    }
                    if (g02 != 0) {
                        o(bundle, g02, str6, g02 == 3 ? str6 : str5);
                        bundle.remove(str6);
                        str4 = str5;
                        i11 = i10;
                    } else {
                        boolean M = M(bundle.get(str6));
                        c2 c2Var2 = d3Var.f21373z;
                        if (M) {
                            d3.g(c2Var2);
                            c2Var2.B.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str6);
                            F = 22;
                            c2Var = c2Var2;
                            str3 = str6;
                            i11 = i10;
                        } else {
                            c2Var = c2Var2;
                            str3 = str6;
                            i11 = i10;
                            F = F(str, str6, bundle.get(str6), bundle, list, z10, false);
                        }
                        if (F != 0 && !"_ev".equals(str3)) {
                            o(bundle, F, str3, bundle.get(str3));
                            bundle.remove(str3);
                        } else if (Q(str3) && !c0(str3, v.f21822v)) {
                            int i13 = i12 + 1;
                            boolean O = O(231100000);
                            x1 x1Var = d3Var.D;
                            if (O) {
                                c2 c2Var3 = c2Var;
                                if (i13 > i11) {
                                    ((hc) gc.f14233s.f14234r.zza()).zza();
                                    str4 = null;
                                    if (d3Var.f21371x.l(null, q1.f21699t0)) {
                                        d3.g(c2Var3);
                                        c2Var3.f21336y.c(x1Var.d(str), "Item can't contain more than " + i11 + " item-scoped custom params", x1Var.b(bundle));
                                        Y(28, bundle);
                                        bundle.remove(str3);
                                    } else {
                                        d3.g(c2Var3);
                                        c2Var3.f21336y.c(x1Var.d(str), "Item cannot contain custom parameters", x1Var.b(bundle));
                                        Y(23, bundle);
                                        bundle.remove(str3);
                                    }
                                    i12 = i13;
                                }
                            } else {
                                d3.g(c2Var);
                                c2Var.f21336y.c(x1Var.d(str), "Item array not supported on client's version of Google Play Services (Android Only)", x1Var.b(bundle));
                                Y(23, bundle);
                                bundle.remove(str3);
                            }
                            str4 = null;
                            i12 = i13;
                        }
                        str4 = null;
                    }
                    i10 = i11;
                    str5 = str4;
                }
            }
        }
        i10 = 0;
        it = new TreeSet(bundle.keySet()).iterator();
        int i122 = 0;
        while (it.hasNext()) {
        }
    }

    public final boolean D(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        d3 d3Var = this.f21621r;
        if (!isEmpty) {
            n6.n.h(str);
            if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                return true;
            }
            if (TextUtils.isEmpty(d3Var.f21366s)) {
                c2 c2Var = d3Var.f21373z;
                d3.g(c2Var);
                c2Var.f21336y.b("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", c2.l(str));
            }
            return false;
        } else if (TextUtils.isEmpty(str2)) {
            if (TextUtils.isEmpty(d3Var.f21366s)) {
                c2 c2Var2 = d3Var.f21373z;
                d3.g(c2Var2);
                c2Var2.f21336y.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        } else {
            n6.n.h(str2);
            if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                return true;
            }
            c2 c2Var3 = d3Var.f21373z;
            d3.g(c2Var3);
            c2Var3.f21336y.b("Invalid admob_app_id. Analytics disabled.", c2.l(str2));
            return false;
        }
    }

    public final boolean E(int i10, String str, String str2) {
        d3 d3Var = this.f21621r;
        if (str2 == null) {
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21336y.b("Name is required and can't be null. Type", str);
            return false;
        } else if (str2.codePointCount(0, str2.length()) > i10) {
            c2 c2Var2 = d3Var.f21373z;
            d3.g(c2Var2);
            c2Var2.f21336y.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
            return false;
        } else {
            return true;
        }
    }

    public final int F(String str, String str2, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
        int i10;
        int i11;
        Parcelable[] parcelableArr;
        int size;
        c();
        boolean M = M(obj);
        d3 d3Var = this.f21621r;
        if (M) {
            if (!z11) {
                return 21;
            }
            if (!c0(str2, v.f21821u)) {
                return 20;
            }
            h5 p10 = d3Var.p();
            p10.c();
            p10.d();
            if (p10.k()) {
                j6 j6Var = p10.f21621r.C;
                d3.e(j6Var);
                if (j6Var.i0() < 200900) {
                    return 25;
                }
            }
            boolean z12 = obj instanceof Parcelable[];
            if (z12) {
                size = ((Parcelable[]) obj).length;
            } else if (obj instanceof ArrayList) {
                size = ((ArrayList) obj).size();
            }
            if (size > 200) {
                c2 c2Var = d3Var.f21373z;
                d3.g(c2Var);
                c2Var.B.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                if (z12) {
                    Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                    if (parcelableArr2.length > 200) {
                        bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr2, 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 (!P(str) || P(str2)) {
                    d3Var.getClass();
                    i11 = 256;
                } else {
                    d3Var.getClass();
                    i11 = 100;
                }
                if (I("param", str2, i11, obj)) {
                    if (z11) {
                        if (obj instanceof Bundle) {
                            C(str, str2, (Bundle) obj, list, z10);
                        } else if (obj instanceof Parcelable[]) {
                            for (Parcelable parcelable : (Parcelable[]) obj) {
                                if (!(parcelable instanceof Bundle)) {
                                    c2 c2Var2 = d3Var.f21373z;
                                    d3.g(c2Var2);
                                    c2Var2.B.c(parcelable.getClass(), "All Parcelable[] elements must be of type Bundle. Value type, name", str2);
                                    return 4;
                                }
                                C(str, str2, (Bundle) parcelable, list, z10);
                            }
                        } else if (!(obj instanceof ArrayList)) {
                            return 4;
                        } else {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            for (int i12 = 0; i12 < size2; i12++) {
                                Object obj2 = arrayList2.get(i12);
                                if (!(obj2 instanceof Bundle)) {
                                    c2 c2Var3 = d3Var.f21373z;
                                    d3.g(c2Var3);
                                    c2Var3.B.c(obj2 != null ? obj2.getClass() : "null", "All ArrayList elements must be of type Bundle. Value type, name", str2);
                                    return 4;
                                }
                                C(str, str2, (Bundle) obj2, list, z10);
                            }
                        }
                        return i10;
                    }
                    return 4;
                }
                return i10;
            }
        }
        i10 = 0;
        if (P(str)) {
        }
        d3Var.getClass();
        i11 = 256;
        if (I("param", str2, i11, obj)) {
        }
    }

    public final void G() {
        c();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                c2 c2Var = this.f21621r.f21373z;
                d3.g(c2Var);
                c2Var.f21337z.a("Utils falling back to Random for random id");
            }
        }
        this.f21511u.set(nextLong);
    }

    public final boolean H(String str, String[] strArr, String[] strArr2, String str2) {
        d3 d3Var = this.f21621r;
        if (str2 == null) {
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21336y.b("Name is required and can't be null. Type", str);
            return false;
        }
        String[] strArr3 = f21508x;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                c2 c2Var2 = d3Var.f21373z;
                d3.g(c2Var2);
                c2Var2.f21336y.c(str, "Name starts with reserved prefix. Type, name", str2);
                return false;
            }
        }
        if (strArr == null || !c0(str2, strArr)) {
            return true;
        }
        if (strArr2 == null || !c0(str2, strArr2)) {
            c2 c2Var3 = d3Var.f21373z;
            d3.g(c2Var3);
            c2Var3.f21336y.c(str, "Name is reserved. Type, name", str2);
            return false;
        }
        return true;
    }

    public final boolean I(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) {
                c2 c2Var = this.f21621r.f21373z;
                d3.g(c2Var);
                c2Var.B.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean J(String str, String str2) {
        d3 d3Var = this.f21621r;
        if (str2 == null) {
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21336y.b("Name is required and can't be null. Type", str);
            return false;
        } else if (str2.length() == 0) {
            c2 c2Var2 = d3Var.f21373z;
            d3.g(c2Var2);
            c2Var2.f21336y.b("Name is required and can't be empty. Type", str);
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                if (codePointAt != 95) {
                    c2 c2Var3 = d3Var.f21373z;
                    d3.g(c2Var3);
                    c2Var3.f21336y.c(str, "Name must start with a letter or _ (underscore). Type, name", str2);
                    return false;
                }
                codePointAt = 95;
            }
            int length = str2.length();
            int charCount = Character.charCount(codePointAt);
            while (charCount < length) {
                int codePointAt2 = str2.codePointAt(charCount);
                if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                    c2 c2Var4 = d3Var.f21373z;
                    d3.g(c2Var4);
                    c2Var4.f21336y.c(str, "Name must consist of letters, digits or _ (underscores). Type, name", str2);
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean K(String str, String str2) {
        d3 d3Var = this.f21621r;
        if (str2 == null) {
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21336y.b("Name is required and can't be null. Type", str);
            return false;
        } else if (str2.length() == 0) {
            c2 c2Var2 = d3Var.f21373z;
            d3.g(c2Var2);
            c2Var2.f21336y.b("Name is required and can't be empty. Type", str);
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                c2 c2Var3 = d3Var.f21373z;
                d3.g(c2Var3);
                c2Var3.f21336y.c(str, "Name must start with a letter. Type, name", str2);
                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)) {
                    c2 c2Var4 = d3Var.f21373z;
                    d3.g(c2Var4);
                    c2Var4.f21336y.c(str, "Name must consist of letters, digits or _ (underscores). Type, name", str2);
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean L(String str) {
        c();
        d3 d3Var = this.f21621r;
        if (v6.c.a(d3Var.f21365r).f26857a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        c2 c2Var = d3Var.f21373z;
        d3.g(c2Var);
        c2Var.D.b("Permission not granted", str);
        return false;
    }

    public final boolean N(Context context, String str) {
        Signature[] signatureArr;
        d3 d3Var = this.f21621r;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo b10 = v6.c.a(context).b(64, str);
            if (b10 == null || (signatureArr = b10.signatures) == null || signatureArr.length <= 0) {
                return true;
            }
            return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(signatureArr[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal);
        } catch (PackageManager.NameNotFoundException e10) {
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21334w.b("Package name not found", e10);
            return true;
        } catch (CertificateException e11) {
            c2 c2Var2 = d3Var.f21373z;
            d3.g(c2Var2);
            c2Var2.f21334w.b("Error obtaining certificate", e11);
            return true;
        }
    }

    public final boolean O(int i10) {
        Boolean bool = this.f21621r.p().f21467v;
        return i0() >= i10 / 1000 || !(bool == null || bool.booleanValue());
    }

    public final int a0(String str) {
        boolean equals = "_ldl".equals(str);
        d3 d3Var = this.f21621r;
        if (equals) {
            d3Var.getClass();
            return 2048;
        } else if ("_id".equals(str)) {
            d3Var.getClass();
            return 256;
        } else if ("_lgclid".equals(str)) {
            d3Var.getClass();
            return 100;
        } else {
            d3Var.getClass();
            return 36;
        }
    }

    public final Object b0(int i10, Object obj, boolean z10, boolean z11) {
        Parcelable[] parcelableArr;
        if (obj == null) {
            return null;
        }
        if ((obj instanceof Long) || (obj instanceof Double)) {
            return obj;
        }
        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) {
            return Long.valueOf(true != ((Boolean) obj).booleanValue() ? 0L : 1L);
        } else if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        } else {
            if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
                return j(obj.toString(), i10, z10);
            }
            if (z11 && ((obj instanceof Bundle[]) || (obj instanceof Parcelable[]))) {
                ArrayList arrayList = new ArrayList();
                for (Parcelable parcelable : (Parcelable[]) obj) {
                    if (parcelable instanceof Bundle) {
                        Bundle m02 = m0((Bundle) parcelable);
                        if (!m02.isEmpty()) {
                            arrayList.add(m02);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return null;
        }
    }

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

    public final int d0(String str, Object obj) {
        return "_ldl".equals(str) ? I("user property referrer", str, a0(str), obj) : I("user property", str, a0(str), obj) ? 0 : 7;
    }

    public final int e0(String str) {
        if (J("event", str)) {
            if (H("event", ri.A, ri.B, str)) {
                this.f21621r.getClass();
                return !E(40, "event", str) ? 2 : 0;
            }
            return 13;
        }
        return 2;
    }

    public final int f0(String str) {
        if (J("event param", str)) {
            if (H("event param", null, null, str)) {
                this.f21621r.getClass();
                return !E(40, "event param", str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

    public final Object g(String str, Object obj) {
        boolean equals = "_ev".equals(str);
        int i10 = 256;
        d3 d3Var = this.f21621r;
        if (equals) {
            d3Var.getClass();
            return b0(256, obj, true, true);
        }
        if (P(str)) {
            d3Var.getClass();
        } else {
            d3Var.getClass();
            i10 = 100;
        }
        return b0(i10, obj, false, true);
    }

    public final int g0(String str) {
        if (K("event param", str)) {
            if (H("event param", null, null, str)) {
                this.f21621r.getClass();
                return !E(40, "event param", str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

    public final Object h(String str, Object obj) {
        return "_ldl".equals(str) ? b0(a0(str), obj, true, false) : b0(a0(str), obj, false, false);
    }

    public final int h0(String str) {
        if (J("user property", str)) {
            if (H("user property", androidx.lifecycle.n.f1991u, null, str)) {
                this.f21621r.getClass();
                return !E(24, "user property", str) ? 6 : 0;
            }
            return 15;
        }
        return 6;
    }

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

    @EnsuresNonNull({"this.apkVersion"})
    public final int i0() {
        if (this.f21513w == null) {
            k6.f fVar = k6.f.f19859b;
            Context context = this.f21621r.f21365r;
            fVar.getClass();
            this.f21513w = Integer.valueOf(k6.f.a(context) / 1000);
        }
        return this.f21513w.intValue();
    }

    public final long k0() {
        long andIncrement;
        long j10;
        if (this.f21511u.get() != 0) {
            synchronized (this.f21511u) {
                this.f21511u.compareAndSet(-1L, 1L);
                andIncrement = this.f21511u.getAndIncrement();
            }
            return andIncrement;
        }
        synchronized (this.f21511u) {
            long nanoTime = System.nanoTime();
            this.f21621r.E.getClass();
            long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
            int i10 = this.f21512v + 1;
            this.f21512v = i10;
            j10 = nextLong + i10;
        }
        return j10;
    }

    @EnsuresNonNull({"this.secureRandom"})
    public final SecureRandom l() {
        c();
        if (this.f21510t == null) {
            this.f21510t = new SecureRandom();
        }
        return this.f21510t;
    }

    public final Bundle l0(boolean z10, Uri uri) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        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");
                    str8 = z10 ? uri.getQueryParameter("sfmc_id") : null;
                } else {
                    str = null;
                    str2 = null;
                    str3 = null;
                    str4 = null;
                    str5 = null;
                    str6 = null;
                    str7 = null;
                    str8 = null;
                }
                if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && (!z10 || TextUtils.isEmpty(str8))) {
                    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);
                }
                if (z10 && !TextUtils.isEmpty(str8)) {
                    bundle.putString("sfmc_id", str8);
                }
                return bundle;
            } catch (UnsupportedOperationException e10) {
                c2 c2Var = this.f21621r.f21373z;
                d3.g(c2Var);
                c2Var.f21337z.b("Install referrer url isn't a hierarchical URI", e10);
                return null;
            }
        }
        return null;
    }

    public final Bundle m0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object g10 = g(str, bundle.get(str));
                if (g10 == null) {
                    d3 d3Var = this.f21621r;
                    c2 c2Var = d3Var.f21373z;
                    d3.g(c2Var);
                    c2Var.B.b("Param value can't be null", d3Var.D.e(str));
                } else {
                    u(bundle2, str, g10);
                }
            }
        }
        return bundle2;
    }

    public final void n(Bundle bundle, long j10) {
        long j11 = bundle.getLong("_et");
        if (j11 != 0) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Params already contained engagement", Long.valueOf(j11));
        } else {
            j11 = 0;
        }
        bundle.putLong("_et", j10 + j11);
    }

    public final Bundle n0(String str, Bundle bundle, List list, boolean z10) {
        int g02;
        List list2 = list;
        boolean c02 = c0(str, ri.D);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            d3 d3Var = this.f21621r;
            j6 j6Var = d3Var.f21371x.f21621r.C;
            d3.e(j6Var);
            int i10 = j6Var.O(201500000) ? 100 : 25;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str2 = (String) it.next();
                if (list2 == null || !list2.contains(str2)) {
                    g02 = !z10 ? g0(str2) : 0;
                    if (g02 == 0) {
                        g02 = f0(str2);
                    }
                } else {
                    g02 = 0;
                }
                if (g02 != 0) {
                    o(bundle2, g02, str2, g02 == 3 ? str2 : null);
                    bundle2.remove(str2);
                } else {
                    int F = F(str, str2, bundle.get(str2), bundle2, list, z10, c02);
                    if (F == 17) {
                        o(bundle2, 17, str2, Boolean.FALSE);
                    } else if (F != 0 && !"_ev".equals(str2)) {
                        o(bundle2, F, F == 21 ? str : str2, bundle.get(str2));
                        bundle2.remove(str2);
                    }
                    if (Q(str2)) {
                        int i12 = i11 + 1;
                        if (i12 > i10) {
                            String b10 = md.v.b("Event can't contain more than ", i10, " params");
                            c2 c2Var = d3Var.f21373z;
                            d3.g(c2Var);
                            x1 x1Var = d3Var.D;
                            c2Var.f21336y.c(x1Var.d(str), b10, x1Var.b(bundle));
                            Y(5, bundle2);
                            bundle2.remove(str2);
                        }
                        i11 = i12;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

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

    public final r o0(String str, Bundle bundle, String str2, long j10, boolean z10) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (e0(str) != 0) {
            d3 d3Var = this.f21621r;
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.f21334w.b("Invalid conditional property event name", d3Var.D.f(str));
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str2);
        Bundle n02 = n0(str, bundle2, Collections.singletonList("_o"), true);
        if (z10) {
            n02 = m0(n02);
        }
        n6.n.h(n02);
        return new r(str, new p(n02), str2, j10);
    }

    public final void q(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                j6 j6Var = this.f21621r.C;
                d3.e(j6Var);
                j6Var.u(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void r(Parcelable[] parcelableArr, int i10, boolean z10) {
        n6.n.h(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str = (String) it.next();
                if (Q(str) && !c0(str, v.f21822v) && (i11 = i11 + 1) > i10) {
                    d3 d3Var = this.f21621r;
                    if (z10) {
                        c2 c2Var = d3Var.f21373z;
                        d3.g(c2Var);
                        x1 x1Var = d3Var.D;
                        c2Var.f21336y.c(x1Var.e(str), "Param can't contain more than " + i10 + " item-scoped custom parameters", x1Var.b(bundle));
                        Y(28, bundle);
                    } else {
                        c2 c2Var2 = d3Var.f21373z;
                        d3.g(c2Var2);
                        x1 x1Var2 = d3Var.D;
                        c2Var2.f21336y.c(x1Var2.e(str), "Param cannot contain item-scoped custom parameters", x1Var2.b(bundle));
                        Y(23, bundle);
                    }
                    bundle.remove(str);
                }
            }
        }
    }

    public final void s(d2 d2Var, int i10) {
        Bundle bundle = d2Var.f21364d;
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (Q(str) && (i11 = i11 + 1) > i10) {
                String b10 = md.v.b("Event can't contain more than ", i10, " params");
                d3 d3Var = this.f21621r;
                c2 c2Var = d3Var.f21373z;
                d3.g(c2Var);
                String str2 = d2Var.f21361a;
                x1 x1Var = d3Var.D;
                c2Var.f21336y.c(x1Var.d(str2), b10, x1Var.b(bundle));
                Y(5, bundle);
                bundle.remove(str);
            }
        }
    }

    public final void u(Bundle bundle, String str, Object obj) {
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
        } else if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
        } else if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
        } else if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            String simpleName = obj != null ? obj.getClass().getSimpleName() : null;
            d3 d3Var = this.f21621r;
            c2 c2Var = d3Var.f21373z;
            d3.g(c2Var);
            c2Var.B.c(d3Var.D.e(str), "Not putting event parameter. Invalid value type. name, type", simpleName);
        }
    }

    public final void v(com.google.android.gms.internal.measurement.x0 x0Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning boolean value to wrapper", e10);
        }
    }

    public final void w(com.google.android.gms.internal.measurement.x0 x0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning bundle list to wrapper", e10);
        }
    }

    public final void x(com.google.android.gms.internal.measurement.x0 x0Var, Bundle bundle) {
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning bundle value to wrapper", e10);
        }
    }

    public final void y(com.google.android.gms.internal.measurement.x0 x0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning byte array to wrapper", e10);
        }
    }

    public final void z(com.google.android.gms.internal.measurement.x0 x0Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            x0Var.j3(bundle);
        } catch (RemoteException e10) {
            c2 c2Var = this.f21621r.f21373z;
            d3.g(c2Var);
            c2Var.f21337z.b("Error returning int value to wrapper", e10);
        }
    }
}