导航菜单

页面标题

页面副标题

Releam v2.13.2 - q5.java 源代码

正在查看: Releam v2.13.2 应用的 q5.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package c4;

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 android.util.Log;
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.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.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
import org.apache.commons.codec.digest.MessageDigestAlgorithms;

public final class q5 extends v3 {

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

    public static final String[] f2764b0 = {"_err"};
    public SecureRandom V;
    public final AtomicLong W;
    public int Y;
    public Integer Z;

    public q5(p3 p3Var) {
        super(p3Var);
        this.Z = null;
        this.W = new AtomicLong(0L);
    }

    public static void A(h.a aVar, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        c0(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        switch (aVar.f5108i) {
            case 24:
                if (!TextUtils.isEmpty(str)) {
                    ((i4) aVar.f5109q).getClass();
                    throw new IllegalStateException("Unexpected call on client side");
                }
                i4 i4Var = (i4) aVar.f5109q;
                ((p3) i4Var.f6066i).f2721h0.getClass();
                i4Var.q("auto", "_err", bundle, true, true, System.currentTimeMillis());
                return;
            default:
                if (!TextUtils.isEmpty(str)) {
                    ((m5) aVar.f5109q).a().s(new i.g(aVar, str, bundle));
                    return;
                }
                p3 p3Var = ((m5) aVar.f5109q).f2648f0;
                if (p3Var != null) {
                    t2 t2Var = p3Var.f2716c0;
                    p3.k(t2Var);
                    t2Var.Z.c("_err", "AppId not known when logging event");
                    return;
                }
                return;
        }
    }

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

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

    public static boolean X(String str) {
        ka.v.q(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean Y(Context context) {
        ActivityInfo receiverInfo;
        ka.v.t(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 Z(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        ka.v.t(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 a0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            ka.v.t(str);
            return !str.equals(str2);
        }
        if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        }
        if (isEmpty) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
        if (TextUtils.isEmpty(str4)) {
            return false;
        }
        return TextUtils.isEmpty(str3) || !str3.equals(str4);
    }

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

    public static boolean f0(String str, String[] strArr) {
        ka.v.t(strArr);
        int length = strArr.length;
        for (int i10 = 0; i10 < length; i10++) {
            Object obj = strArr[i10];
            if (str == obj || (str != null && str.equals(obj))) {
                return true;
            }
        }
        return false;
    }

    public static long m0(byte[] bArr) {
        ka.v.t(bArr);
        int length = bArr.length;
        int i10 = 0;
        if (!(length > 0)) {
            throw new IllegalStateException();
        }
        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 String r(int i10, String str, boolean z10) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) <= i10) {
            return str;
        }
        if (z10) {
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
        }
        return null;
    }

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

    public static ArrayList u(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.f2419i);
            bundle.putString("origin", cVar.f2420q);
            bundle.putLong("creation_timestamp", cVar.W);
            bundle.putString("name", cVar.V.f2704q);
            Object e10 = cVar.V.e();
            ka.v.t(e10);
            s9.a.G0(bundle, e10);
            bundle.putBoolean("active", cVar.Y);
            String str = cVar.Z;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            p pVar = cVar.f2414a0;
            if (pVar != null) {
                bundle.putString("timed_out_event_name", pVar.f2705i);
                o oVar = pVar.f2706q;
                if (oVar != null) {
                    bundle.putBundle("timed_out_event_params", oVar.e());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f2415b0);
            p pVar2 = cVar.f2416c0;
            if (pVar2 != null) {
                bundle.putString("triggered_event_name", pVar2.f2705i);
                o oVar2 = pVar2.f2706q;
                if (oVar2 != null) {
                    bundle.putBundle("triggered_event_params", oVar2.e());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.V.V);
            bundle.putLong("time_to_live", cVar.f2417d0);
            p pVar3 = cVar.f2418e0;
            if (pVar3 != null) {
                bundle.putString("expired_event_name", pVar3.f2705i);
                o oVar3 = pVar3.f2706q;
                if (oVar3 != null) {
                    bundle.putBundle("expired_event_params", oVar3.e());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void x(n4 n4Var, Bundle bundle, boolean z10) {
        if (bundle != null && n4Var != null) {
            if (!bundle.containsKey("_sc") || z10) {
                String str = n4Var.f2685a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = n4Var.f2686b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", n4Var.f2687c);
                return;
            }
            z10 = false;
        }
        if (bundle != null && n4Var == null && z10) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public final void B(Bundle bundle, String str, Object obj) {
        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);
            return;
        }
        if (str != null) {
            String simpleName = obj != null ? obj.getClass().getSimpleName() : null;
            Object obj2 = this.f6066i;
            t2 t2Var = ((p3) obj2).f2716c0;
            p3.k(t2Var);
            t2Var.f2815e0.d("Not putting event parameter. Invalid value type. name, type", ((p3) obj2).f2720g0.e(str), simpleName);
        }
    }

    public final void C(com.google.android.gms.internal.measurement.k0 k0Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void D(com.google.android.gms.internal.measurement.k0 k0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void E(com.google.android.gms.internal.measurement.k0 k0Var, Bundle bundle) {
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void F(com.google.android.gms.internal.measurement.k0 k0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning byte array to wrapper");
        }
    }

    public final void G(com.google.android.gms.internal.measurement.k0 k0Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning int value to wrapper");
        }
    }

    public final void H(com.google.android.gms.internal.measurement.k0 k0Var, long j10) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j10);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning long value to wrapper");
        }
    }

    public final void I(String str, com.google.android.gms.internal.measurement.k0 k0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            k0Var.m(bundle);
        } catch (RemoteException e10) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(e10, "Error returning string value to wrapper");
        }
    }

    public final void J(String str, String str2, Bundle bundle, List list, boolean z10) {
        int j02;
        String str3;
        int N;
        if (bundle == null) {
            return;
        }
        p3 p3Var = (p3) this.f6066i;
        p3Var.getClass();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i10 = 0;
        while (it.hasNext()) {
            String str4 = (String) it.next();
            if (list == null || !list.contains(str4)) {
                j02 = !z10 ? j0(str4) : 0;
                if (j02 == 0) {
                    j02 = i0(str4);
                }
            } else {
                j02 = 0;
            }
            if (j02 != 0) {
                w(bundle, j02, str4, j02 == 3 ? str4 : null);
                bundle.remove(str4);
            } else {
                if (U(bundle.get(str4))) {
                    t2 t2Var = p3Var.f2716c0;
                    p3.k(t2Var);
                    t2Var.f2815e0.e("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
                    N = 22;
                    str3 = str4;
                } else {
                    str3 = str4;
                    N = N(str, str4, bundle.get(str4), bundle, list, z10, false);
                }
                if (N != 0 && !"_ev".equals(str3)) {
                    w(bundle, N, str3, bundle.get(str3));
                    bundle.remove(str3);
                } else if (X(str3) && !f0(str3, s9.a.f9155d) && (i10 = i10 + 1) > 0) {
                    t2 t2Var2 = p3Var.f2716c0;
                    p3.k(t2Var2);
                    t2Var2.f2812b0.d("Item cannot contain custom parameters", p3Var.f2720g0.d(str), p3Var.f2720g0.b(bundle));
                    c0(23, bundle);
                    bundle.remove(str3);
                }
            }
        }
    }

    public final boolean K(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = this.f6066i;
        if (!isEmpty) {
            ka.v.t(str);
            if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                return true;
            }
            p3 p3Var = (p3) obj;
            if (TextUtils.isEmpty(p3Var.f2731q)) {
                t2 t2Var = p3Var.f2716c0;
                p3.k(t2Var);
                t2Var.f2812b0.c(t2.t(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
            }
            return false;
        }
        if (TextUtils.isEmpty(str2)) {
            p3 p3Var2 = (p3) obj;
            if (TextUtils.isEmpty(p3Var2.f2731q)) {
                t2 t2Var2 = p3Var2.f2716c0;
                p3.k(t2Var2);
                t2Var2.f2812b0.b("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
        ka.v.t(str2);
        if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
            return true;
        }
        t2 t2Var3 = ((p3) obj).f2716c0;
        p3.k(t2Var3);
        t2Var3.f2812b0.c(t2.t(str2), "Invalid admob_app_id. Analytics disabled.");
        return false;
    }

    public final boolean L(int i10, String str, String str2) {
        Object obj = this.f6066i;
        if (str2 == null) {
            t2 t2Var = ((p3) obj).f2716c0;
            p3.k(t2Var);
            t2Var.f2812b0.c(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.codePointCount(0, str2.length()) <= i10) {
            return true;
        }
        t2 t2Var2 = ((p3) obj).f2716c0;
        p3.k(t2Var2);
        t2Var2.f2812b0.e("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
        return false;
    }

    public final boolean M(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = this.f6066i;
        if (str2 == null) {
            t2 t2Var = ((p3) obj).f2716c0;
            p3.k(t2Var);
            t2Var.f2812b0.c(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f2763a0;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                t2 t2Var2 = ((p3) obj).f2716c0;
                p3.k(t2Var2);
                t2Var2.f2812b0.d("Name starts with reserved prefix. Type, name", str, str2);
                return false;
            }
        }
        if (strArr == null || !f0(str2, strArr)) {
            return true;
        }
        if (strArr2 != null && f0(str2, strArr2)) {
            return true;
        }
        t2 t2Var3 = ((p3) obj).f2716c0;
        p3.k(t2Var3);
        t2Var3.f2812b0.d("Name is reserved. Type, name", str, str2);
        return false;
    }

    public final int N(java.lang.String r14, java.lang.String r15, java.lang.Object r16, android.os.Bundle r17, java.util.List r18, boolean r19, boolean r20) {
        throw new UnsupportedOperationException("Method not decompiled: c4.q5.N(java.lang.String, java.lang.String, java.lang.Object, android.os.Bundle, java.util.List, boolean, boolean):int");
    }

    public final void O() {
        k();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                t2 t2Var = ((p3) this.f6066i).f2716c0;
                p3.k(t2Var);
                t2Var.f2813c0.b("Utils falling back to Random for random id");
            }
        }
        this.W.set(nextLong);
    }

    public final boolean P(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) {
                t2 t2Var = ((p3) this.f6066i).f2716c0;
                p3.k(t2Var);
                t2Var.f2815e0.e("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean Q(String str, String str2) {
        Object obj = this.f6066i;
        if (str2 == null) {
            t2 t2Var = ((p3) obj).f2716c0;
            p3.k(t2Var);
            t2Var.f2812b0.c(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            t2 t2Var2 = ((p3) obj).f2716c0;
            p3.k(t2Var2);
            t2Var2.f2812b0.c(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            if (codePointAt != 95) {
                t2 t2Var3 = ((p3) obj).f2716c0;
                p3.k(t2Var3);
                t2Var3.f2812b0.d("Name must start with a letter or _ (underscore). Type, name", str, 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)) {
                t2 t2Var4 = ((p3) obj).f2716c0;
                p3.k(t2Var4);
                t2Var4.f2812b0.d("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean R(String str, String str2) {
        Object obj = this.f6066i;
        if (str2 == null) {
            t2 t2Var = ((p3) obj).f2716c0;
            p3.k(t2Var);
            t2Var.f2812b0.c(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            t2 t2Var2 = ((p3) obj).f2716c0;
            p3.k(t2Var2);
            t2Var2.f2812b0.c(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            t2 t2Var3 = ((p3) obj).f2716c0;
            p3.k(t2Var3);
            t2Var3.f2812b0.d("Name must start with a letter. Type, name", str, 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)) {
                t2 t2Var4 = ((p3) obj).f2716c0;
                p3.k(t2Var4);
                t2Var4.f2812b0.d("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean S(String str) {
        k();
        p3 p3Var = (p3) this.f6066i;
        if (u3.b.a(p3Var.f2722i).f1042q.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        t2 t2Var = p3Var.f2716c0;
        p3.k(t2Var);
        t2Var.f2817g0.c(str, "Permission not granted");
        return false;
    }

    public final boolean T(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        p3 p3Var = (p3) this.f6066i;
        String l10 = p3Var.f2714a0.l("debug.firebase.analytics.app");
        p3Var.getClass();
        return l10.equals(str);
    }

    public final boolean V(Context context, String str) {
        Signature[] signatureArr;
        Object obj = this.f6066i;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo c10 = u3.b.a(context).c(64, str);
            if (c10 == null || (signatureArr = c10.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) {
            t2 t2Var = ((p3) obj).f2716c0;
            p3.k(t2Var);
            t2Var.Z.c(e10, "Package name not found");
            return true;
        } catch (CertificateException e11) {
            t2 t2Var2 = ((p3) obj).f2716c0;
            p3.k(t2Var2);
            t2Var2.Z.c(e11, "Error obtaining certificate");
            return true;
        }
    }

    public final int d0(String str) {
        boolean equals = "_ldl".equals(str);
        Object obj = this.f6066i;
        if (equals) {
            ((p3) obj).getClass();
            return 2048;
        }
        if ("_id".equals(str)) {
            ((p3) obj).getClass();
            return 256;
        }
        if ("_lgclid".equals(str)) {
            ((p3) obj).getClass();
            return 100;
        }
        ((p3) obj).getClass();
        return 36;
    }

    public final Object e0(int i10, Object obj, boolean z10, boolean z11) {
        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);
        }
        if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        }
        if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
            return r(i10, obj.toString(), z10);
        }
        if (!z11 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Parcelable parcelable : (Parcelable[]) obj) {
            if (parcelable instanceof Bundle) {
                Bundle p02 = p0((Bundle) parcelable);
                if (!p02.isEmpty()) {
                    arrayList.add(p02);
                }
            }
        }
        return arrayList.toArray(new Bundle[arrayList.size()]);
    }

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

    public final int h0(String str) {
        if (!Q("event", str)) {
            return 2;
        }
        if (!M("event", s1.g0.V, s1.g0.W, str)) {
            return 13;
        }
        ((p3) this.f6066i).getClass();
        return !L(40, "event", str) ? 2 : 0;
    }

    public final int i0(String str) {
        if (!Q("event param", str)) {
            return 3;
        }
        if (!M("event param", null, null, str)) {
            return 14;
        }
        ((p3) this.f6066i).getClass();
        return !L(40, "event param", str) ? 3 : 0;
    }

    public final int j0(String str) {
        if (!R("event param", str)) {
            return 3;
        }
        if (!M("event param", null, null, str)) {
            return 14;
        }
        ((p3) this.f6066i).getClass();
        return !L(40, "event param", str) ? 3 : 0;
    }

    public final int k0(String str) {
        if (!Q("user property", str)) {
            return 6;
        }
        if (!M("user property", u3.a.f9720d, null, str)) {
            return 15;
        }
        ((p3) this.f6066i).getClass();
        return !L(24, "user property", str) ? 6 : 0;
    }

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

    public final int l0() {
        if (this.Z == null) {
            l3.f fVar = l3.f.f6524b;
            Context context = ((p3) this.f6066i).f2722i;
            fVar.getClass();
            AtomicBoolean atomicBoolean = l3.j.f6528a;
            int i10 = 0;
            try {
                i10 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
            } catch (PackageManager.NameNotFoundException unused) {
                Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
            }
            this.Z = Integer.valueOf(i10 / 1000);
        }
        return this.Z.intValue();
    }

    public final long n0() {
        long andIncrement;
        long j10;
        if (this.W.get() != 0) {
            synchronized (this.W) {
                this.W.compareAndSet(-1L, 1L);
                andIncrement = this.W.getAndIncrement();
            }
            return andIncrement;
        }
        synchronized (this.W) {
            long nanoTime = System.nanoTime();
            ((p3) this.f6066i).f2721h0.getClass();
            long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
            int i10 = this.Y + 1;
            this.Y = i10;
            j10 = nextLong + i10;
        }
        return j10;
    }

    public final Object o(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        int i10 = 256;
        Object obj2 = this.f6066i;
        if (equals) {
            ((p3) obj2).getClass();
            return e0(256, obj, true, true);
        }
        if (W(str)) {
            ((p3) obj2).getClass();
        } else {
            ((p3) obj2).getClass();
            i10 = 100;
        }
        return e0(i10, obj, false, true);
    }

    public final Bundle o0(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) {
                t2 t2Var = ((p3) this.f6066i).f2716c0;
                p3.k(t2Var);
                t2Var.f2813c0.c(e10, "Install referrer url isn't a hierarchical URI");
            }
        }
        return null;
    }

    public final Object p(Object obj, String str) {
        return "_ldl".equals(str) ? e0(d0(str), obj, true, false) : e0(d0(str), obj, false, false);
    }

    public final Bundle p0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object o10 = o(bundle.get(str), str);
                if (o10 == null) {
                    Object obj = this.f6066i;
                    t2 t2Var = ((p3) obj).f2716c0;
                    p3.k(t2Var);
                    t2Var.f2815e0.c(((p3) obj).f2720g0.e(str), "Param value can't be null");
                } else {
                    B(bundle2, str, o10);
                }
            }
        }
        return bundle2;
    }

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

    public final Bundle q0(String str, Bundle bundle, List list, boolean z10) {
        int j02;
        List list2 = list;
        boolean f02 = f0(str, s1.g0.Z);
        if (bundle == null) {
            return null;
        }
        Bundle bundle2 = new Bundle(bundle);
        p3 p3Var = (p3) this.f6066i;
        int n10 = p3Var.f2714a0.n();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i10 = 0;
        while (it.hasNext()) {
            String str2 = (String) it.next();
            if (list2 == null || !list2.contains(str2)) {
                j02 = !z10 ? j0(str2) : 0;
                if (j02 == 0) {
                    j02 = i0(str2);
                }
            } else {
                j02 = 0;
            }
            if (j02 != 0) {
                w(bundle2, j02, str2, j02 == 3 ? str2 : null);
                bundle2.remove(str2);
            } else {
                int N = N(str, str2, bundle.get(str2), bundle2, list, z10, f02);
                if (N == 17) {
                    w(bundle2, 17, str2, Boolean.FALSE);
                } else if (N != 0 && !"_ev".equals(str2)) {
                    w(bundle2, N, N == 21 ? str : str2, bundle.get(str2));
                    bundle2.remove(str2);
                }
                if (X(str2)) {
                    int i11 = i10 + 1;
                    if (i11 > n10) {
                        StringBuilder q2 = a0.w.q("Event can't contain more than ", n10, " params");
                        t2 t2Var = p3Var.f2716c0;
                        p3.k(t2Var);
                        t2Var.f2812b0.d(q2.toString(), p3Var.f2720g0.d(str), p3Var.f2720g0.b(bundle));
                        c0(5, bundle2);
                        bundle2.remove(str2);
                    }
                    i10 = i11;
                }
            }
            list2 = list;
        }
        return bundle2;
    }

    public final p r0(String str, Bundle bundle, String str2, long j10, boolean z10) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (h0(str) != 0) {
            p3 p3Var = (p3) this.f6066i;
            t2 t2Var = p3Var.f2716c0;
            p3.k(t2Var);
            t2Var.Z.c(p3Var.f2720g0.f(str), "Invalid conditional property event name");
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str2);
        Bundle q02 = q0(str, bundle2, Collections.singletonList("_o"), true);
        if (z10) {
            q02 = p0(q02);
        }
        ka.v.t(q02);
        return new p(str, new o(q02), str2, j10);
    }

    public final SecureRandom t() {
        k();
        if (this.V == null) {
            this.V = new SecureRandom();
        }
        return this.V;
    }

    public final void v(Bundle bundle, long j10) {
        long j11 = bundle.getLong("_et");
        if (j11 != 0) {
            t2 t2Var = ((p3) this.f6066i).f2716c0;
            p3.k(t2Var);
            t2Var.f2813c0.c(Long.valueOf(j11), "Params already contained engagement");
        } else {
            j11 = 0;
        }
        bundle.putLong("_et", j10 + j11);
    }

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

    public final void y(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                q5 q5Var = ((p3) this.f6066i).f2719f0;
                p3.i(q5Var);
                q5Var.B(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void z(u2 u2Var, int i10) {
        Object obj = u2Var.f2838e;
        Iterator it = new TreeSet(((Bundle) obj).keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (X(str) && (i11 = i11 + 1) > i10) {
                StringBuilder q2 = a0.w.q("Event can't contain more than ", i10, " params");
                p3 p3Var = (p3) this.f6066i;
                t2 t2Var = p3Var.f2716c0;
                p3.k(t2Var);
                Bundle bundle = (Bundle) obj;
                t2Var.f2812b0.d(q2.toString(), p3Var.f2720g0.d((String) u2Var.f2836c), p3Var.f2720g0.b(bundle));
                c0(5, bundle);
                bundle.remove(str);
            }
        }
    }
}