Flash Cleaner v1.0.14版本的 MD5 值为:afbed0179616af7c25ad332b251e759c

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


package ib;

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.common.GoogleApiAvailabilityLight;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.CollectionUtils;
import com.google.android.gms.common.wrappers.Wrappers;
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.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.litepal.util.Const;
public final class s5 extends w3 {
    public static final String[] f10734h = {"firebase_", "google_", "ga_"};
    public static final String[] f10735i = {"_err"};
    public SecureRandom f10736d;
    public final AtomicLong f10737e;
    public int f10738f;
    public Integer f10739g;

    public s5(p3 p3Var) {
        super(p3Var);
        this.f10739g = null;
        this.f10737e = new AtomicLong(0L);
    }

    public static ArrayList B(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.f10288a);
            bundle.putString("origin", cVar.f10289b);
            bundle.putLong("creation_timestamp", cVar.f10291d);
            bundle.putString(Const.TableSchema.COLUMN_NAME, cVar.f10290c.f10685b);
            bb.g.a0(bundle, Preconditions.checkNotNull(cVar.f10290c.f0()));
            bundle.putBoolean("active", cVar.f10292e);
            String str = cVar.f10293f;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            q qVar = cVar.f10294g;
            if (qVar != null) {
                bundle.putString("timed_out_event_name", qVar.f10669a);
                p pVar = qVar.f10670b;
                if (pVar != null) {
                    bundle.putBundle("timed_out_event_params", pVar.f0());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f10295h);
            q qVar2 = cVar.f10296i;
            if (qVar2 != null) {
                bundle.putString("triggered_event_name", qVar2.f10669a);
                p pVar2 = qVar2.f10670b;
                if (pVar2 != null) {
                    bundle.putBundle("triggered_event_params", pVar2.f0());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f10290c.f10686c);
            bundle.putLong("time_to_live", cVar.f10297j);
            q qVar3 = cVar.f10298k;
            if (qVar3 != null) {
                bundle.putString("expired_event_name", qVar3.f10669a);
                p pVar3 = qVar3.f10670b;
                if (pVar3 != null) {
                    bundle.putBundle("expired_event_params", pVar3.f0());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

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

    public static void H(c9.b bVar, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        j0(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 (bVar.f3107a) {
            case 14:
                boolean isEmpty = TextUtils.isEmpty(str);
                j4 j4Var = (j4) bVar.f3108b;
                if (isEmpty) {
                    j4Var.x("auto", "_err", bundle, true, true, ((p3) j4Var.f18581b).f10657n.currentTimeMillis());
                    return;
                } else {
                    j4Var.getClass();
                    throw new IllegalStateException("Unexpected call on client side");
                }
            default:
                if (TextUtils.isEmpty(str)) {
                    p3 p3Var = ((n5) bVar.f3108b).f10583l;
                    if (p3Var != null) {
                        v2 v2Var = p3Var.f10652i;
                        p3.k(v2Var);
                        v2Var.f10799g.c("_err", "AppId not known when logging event");
                        return;
                    }
                    return;
                }
                ((n5) bVar.f3108b).b().z(new k.g(bVar, str, bundle));
                return;
        }
    }

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

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

    public static boolean e0(String str) {
        Preconditions.checkNotEmpty(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean f0(Context context) {
        ActivityInfo receiverInfo;
        Preconditions.checkNotNull(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 g0(Context context) {
        Preconditions.checkNotNull(context);
        return n0(context, Build.VERSION.SDK_INT >= 24 ? "com.google.android.gms.measurement.AppMeasurementJobService" : "com.google.android.gms.measurement.AppMeasurementService");
    }

    public static boolean h0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            Preconditions.checkNotNull(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[] i0(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 j0(int i10, Bundle bundle) {
        if (bundle.getLong("_err") == 0) {
            bundle.putLong("_err", i10);
            return true;
        }
        return false;
    }

    public static boolean m0(String str, String[] strArr) {
        boolean z10;
        Preconditions.checkNotNull(strArr);
        for (String str2 : strArr) {
            if (str != str2 && (str == null || !str.equals(str2))) {
                z10 = false;
            } else {
                z10 = true;
            }
            if (z10) {
                return true;
            }
        }
        return false;
    }

    public static boolean n0(Context context, String str) {
        ServiceInfo serviceInfo;
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null && (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, str), 0)) != null) {
                if (serviceInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return false;
    }

    public static long u0(byte[] bArr) {
        Preconditions.checkNotNull(bArr);
        int length = bArr.length;
        int i10 = 0;
        Preconditions.checkState(length > 0);
        long j9 = 0;
        for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
            j9 += (bArr[i11] & 255) << i10;
            i10 += 8;
        }
        return j9;
    }

    public static String y(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 MessageDigest z() {
        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 final SecureRandom A() {
        r();
        if (this.f10736d == null) {
            this.f10736d = new SecureRandom();
        }
        return this.f10736d;
    }

    public final void C(Bundle bundle, long j9) {
        long j10 = bundle.getLong("_et");
        if (j10 != 0) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(Long.valueOf(j10), "Params already contained engagement");
        } else {
            j10 = 0;
        }
        bundle.putLong("_et", j9 + j10);
    }

    public final void D(Bundle bundle, int i10, String str, Object obj) {
        if (j0(i10, bundle)) {
            ((p3) this.f18581b).getClass();
            bundle.putString("_ev", y(str, 40, true));
            if (obj != null) {
                Preconditions.checkNotNull(bundle);
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void F(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                s5 s5Var = ((p3) this.f18581b).f10655l;
                p3.h(s5Var);
                s5Var.I(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void G(com.google.android.gms.common.m mVar, int i10) {
        Iterator it = new TreeSet(((Bundle) mVar.f5832e).keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (e0(str) && (i11 = i11 + 1) > i10) {
                StringBuilder r10 = a4.b.r("Event can't contain more than ", i10, " params");
                p3 p3Var = (p3) this.f18581b;
                v2 v2Var = p3Var.f10652i;
                p3.k(v2Var);
                v2Var.f10801i.d(p3Var.f10656m.d((String) mVar.f5829b), p3Var.f10656m.b((Bundle) mVar.f5832e), r10.toString());
                j0(5, (Bundle) mVar.f5832e);
                ((Bundle) mVar.f5832e).remove(str);
            }
        }
    }

    public final void I(Bundle bundle, String str, Object obj) {
        String str2;
        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) {
            if (obj != null) {
                str2 = obj.getClass().getSimpleName();
            } else {
                str2 = null;
            }
            Object obj2 = this.f18581b;
            v2 v2Var = ((p3) obj2).f10652i;
            p3.k(v2Var);
            v2Var.f10804l.d(((p3) obj2).f10656m.e(str), str2, "Not putting event parameter. Invalid value type. name, type");
        }
    }

    public final void J(com.google.android.gms.internal.measurement.k0 k0Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void K(com.google.android.gms.internal.measurement.k0 k0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void L(com.google.android.gms.internal.measurement.k0 k0Var, Bundle bundle) {
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void M(com.google.android.gms.internal.measurement.k0 k0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning byte array to wrapper");
        }
    }

    public final void N(com.google.android.gms.internal.measurement.k0 k0Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning int value to wrapper");
        }
    }

    public final void O(com.google.android.gms.internal.measurement.k0 k0Var, long j9) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j9);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning long value to wrapper");
        }
    }

    public final void P(String str, com.google.android.gms.internal.measurement.k0 k0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            k0Var.q(bundle);
        } catch (RemoteException e10) {
            v2 v2Var = ((p3) this.f18581b).f10652i;
            p3.k(v2Var);
            v2Var.f10802j.c(e10, "Error returning string value to wrapper");
        }
    }

    public final void Q(String str, String str2, Bundle bundle, List list, boolean z10) {
        int i10;
        String str3;
        String str4;
        int U;
        if (bundle == null) {
            return;
        }
        p3 p3Var = (p3) this.f18581b;
        p3Var.getClass();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str5 = (String) it.next();
            if (list != null && list.contains(str5)) {
                i10 = 0;
            } else {
                if (!z10) {
                    i10 = r0(str5);
                } else {
                    i10 = 0;
                }
                if (i10 == 0) {
                    i10 = q0(str5);
                }
            }
            if (i10 != 0) {
                if (i10 == 3) {
                    str3 = str5;
                } else {
                    str3 = null;
                }
                D(bundle, i10, str5, str3);
                bundle.remove(str5);
            } else {
                if (b0(bundle.get(str5))) {
                    v2 v2Var = p3Var.f10652i;
                    p3.k(v2Var);
                    v2Var.f10804l.e("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str5);
                    U = 22;
                    str4 = str5;
                } else {
                    str4 = str5;
                    U = U(str, str5, bundle.get(str5), bundle, list, z10, false);
                }
                if (U != 0 && !"_ev".equals(str4)) {
                    D(bundle, U, str4, bundle.get(str4));
                } else if (e0(str4) && !m0(str4, com.bumptech.glide.e.f5482f) && (i11 = i11 + 1) > 0) {
                    v2 v2Var2 = p3Var.f10652i;
                    p3.k(v2Var2);
                    v2Var2.f10801i.d(p3Var.f10656m.d(str), p3Var.f10656m.b(bundle), "Item cannot contain custom parameters");
                    j0(23, bundle);
                }
                bundle.remove(str4);
            }
        }
    }

    public final boolean R(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = this.f18581b;
        if (!isEmpty) {
            Preconditions.checkNotNull(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                p3 p3Var = (p3) obj;
                if (TextUtils.isEmpty(p3Var.f10641b)) {
                    v2 v2Var = p3Var.f10652i;
                    p3.k(v2Var);
                    v2Var.f10801i.c(v2.A(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        } else if (!TextUtils.isEmpty(str2)) {
            Preconditions.checkNotNull(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                v2 v2Var2 = ((p3) obj).f10652i;
                p3.k(v2Var2);
                v2Var2.f10801i.c(v2.A(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        } else {
            p3 p3Var2 = (p3) obj;
            if (TextUtils.isEmpty(p3Var2.f10641b)) {
                v2 v2Var3 = p3Var2.f10652i;
                p3.k(v2Var3);
                v2Var3.f10801i.b("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
    }

    public final boolean S(String str, int i10, String str2) {
        Object obj = this.f18581b;
        if (str2 == null) {
            v2 v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            v2Var.f10801i.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.codePointCount(0, str2.length()) > i10) {
            v2 v2Var2 = ((p3) obj).f10652i;
            p3.k(v2Var2);
            v2Var2.f10801i.e("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
            return false;
        } else {
            return true;
        }
    }

    public final boolean T(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = this.f18581b;
        if (str2 == null) {
            v2 v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            v2Var.f10801i.c(str, "Name is required and can't be null. Type");
            return false;
        }
        Preconditions.checkNotNull(str2);
        String[] strArr3 = f10734h;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                v2 v2Var2 = ((p3) obj).f10652i;
                p3.k(v2Var2);
                v2Var2.f10801i.d(str, str2, "Name starts with reserved prefix. Type, name");
                return false;
            }
        }
        if (strArr != null && m0(str2, strArr)) {
            if (strArr2 == null || !m0(str2, strArr2)) {
                v2 v2Var3 = ((p3) obj).f10652i;
                p3.k(v2Var3);
                v2Var3.f10801i.d(str, str2, "Name is reserved. Type, name");
                return false;
            }
            return true;
        }
        return true;
    }

    public final int U(String str, String str2, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
        int i10;
        int i11;
        Class<?> cls;
        String str3;
        t2 t2Var;
        Parcelable[] parcelableArr;
        int size;
        r();
        boolean b02 = b0(obj);
        Object obj2 = this.f18581b;
        if (b02) {
            if (z11) {
                if (!m0(str2, com.bumptech.glide.e.f5481e)) {
                    return 20;
                }
                p3 p3Var = (p3) obj2;
                z4 t10 = p3Var.t();
                t10.r();
                t10.s();
                if (t10.z()) {
                    s5 s5Var = ((p3) t10.f18581b).f10655l;
                    p3.h(s5Var);
                    if (s5Var.t0() < 200900) {
                        return 25;
                    }
                }
                p3Var.getClass();
                boolean z12 = obj instanceof Parcelable[];
                if (z12) {
                    size = ((Parcelable[]) obj).length;
                } else if (obj instanceof ArrayList) {
                    size = ((ArrayList) obj).size();
                }
                if (size > 200) {
                    v2 v2Var = p3Var.f10652i;
                    p3.k(v2Var);
                    v2Var.f10804l.e("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                    p3Var.getClass();
                    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 (d0(str) && !d0(str2)) {
                        ((p3) obj2).getClass();
                        i11 = 100;
                    } else {
                        ((p3) obj2).getClass();
                        i11 = 256;
                    }
                    if (!W("param", str2, i11, obj)) {
                        return i10;
                    }
                    if (z11) {
                        if (obj instanceof Bundle) {
                            Q(str, str2, (Bundle) obj, list, z10);
                        } else if (obj instanceof Parcelable[]) {
                            for (Parcelable parcelable : (Parcelable[]) obj) {
                                if (!(parcelable instanceof Bundle)) {
                                    v2 v2Var2 = ((p3) obj2).f10652i;
                                    p3.k(v2Var2);
                                    cls = parcelable.getClass();
                                    t2Var = v2Var2.f10804l;
                                    str3 = "All Parcelable[] elements must be of type Bundle. Value type, name";
                                    t2Var.d(cls, str2, str3);
                                    return 4;
                                }
                                Q(str, str2, (Bundle) parcelable, list, z10);
                            }
                        } else if (obj instanceof ArrayList) {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            for (int i12 = 0; i12 < size2; i12++) {
                                Object obj3 = arrayList2.get(i12);
                                if (!(obj3 instanceof Bundle)) {
                                    v2 v2Var3 = ((p3) obj2).f10652i;
                                    p3.k(v2Var3);
                                    if (obj3 != null) {
                                        cls = obj3.getClass();
                                    } else {
                                        cls = "null";
                                    }
                                    str3 = "All ArrayList elements must be of type Bundle. Value type, name";
                                    t2Var = v2Var3.f10804l;
                                    t2Var.d(cls, str2, str3);
                                    return 4;
                                }
                                Q(str, str2, (Bundle) obj3, list, z10);
                            }
                        } else {
                            return 4;
                        }
                        return i10;
                    }
                    return 4;
                }
            } else {
                return 21;
            }
        }
        i10 = 0;
        if (d0(str)) {
        }
        ((p3) obj2).getClass();
        i11 = 256;
        if (!W("param", str2, i11, obj)) {
        }
    }

    public final void V() {
        r();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                v2 v2Var = ((p3) this.f18581b).f10652i;
                p3.k(v2Var);
                v2Var.f10802j.b("Utils falling back to Random for random id");
            }
        }
        this.f10737e.set(nextLong);
    }

    public final boolean W(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) {
                v2 v2Var = ((p3) this.f18581b).f10652i;
                p3.k(v2Var);
                v2Var.f10804l.e("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean X(String str, String str2) {
        Object obj = this.f18581b;
        if (str2 == null) {
            v2 v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            v2Var.f10801i.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            v2 v2Var2 = ((p3) obj).f10652i;
            p3.k(v2Var2);
            v2Var2.f10801i.c(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                if (codePointAt == 95) {
                    codePointAt = 95;
                } else {
                    v2 v2Var3 = ((p3) obj).f10652i;
                    p3.k(v2Var3);
                    v2Var3.f10801i.d(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)) {
                    v2 v2Var4 = ((p3) obj).f10652i;
                    p3.k(v2Var4);
                    v2Var4.f10801i.d(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean Y(String str, String str2) {
        Object obj = this.f18581b;
        if (str2 == null) {
            v2 v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            v2Var.f10801i.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            v2 v2Var2 = ((p3) obj).f10652i;
            p3.k(v2Var2);
            v2Var2.f10801i.c(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                v2 v2Var3 = ((p3) obj).f10652i;
                p3.k(v2Var3);
                v2Var3.f10801i.d(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)) {
                    v2 v2Var4 = ((p3) obj).f10652i;
                    p3.k(v2Var4);
                    v2Var4.f10801i.d(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean Z(String str) {
        r();
        p3 p3Var = (p3) this.f18581b;
        if (Wrappers.packageManager(p3Var.f10639a).checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        v2 v2Var = p3Var.f10652i;
        p3.k(v2Var);
        v2Var.f10806n.c(str, "Permission not granted");
        return false;
    }

    public final boolean a0(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        p3 p3Var = (p3) this.f18581b;
        String s10 = p3Var.f10650g.s("debug.firebase.analytics.app");
        p3Var.getClass();
        return s10.equals(str);
    }

    public final boolean c0(Context context, String str) {
        v2 v2Var;
        String str2;
        Signature[] signatureArr;
        Object obj = this.f18581b;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo packageInfo = Wrappers.packageManager(context).getPackageInfo(str, 64);
            if (packageInfo != null && (signatureArr = packageInfo.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) {
            e = e10;
            v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            str2 = "Package name not found";
            v2Var.f10799g.c(e, str2);
            return true;
        } catch (CertificateException e11) {
            e = e11;
            v2Var = ((p3) obj).f10652i;
            p3.k(v2Var);
            str2 = "Error obtaining certificate";
            v2Var.f10799g.c(e, str2);
            return true;
        }
    }

    public final int k0(String str) {
        boolean equals = "_ldl".equals(str);
        Object obj = this.f18581b;
        if (equals) {
            ((p3) obj).getClass();
            return 2048;
        } else if ("_id".equals(str)) {
            ((p3) obj).getClass();
            return 256;
        } else {
            boolean equals2 = "_lgclid".equals(str);
            ((p3) obj).getClass();
            return equals2 ? 100 : 36;
        }
    }

    public final Object l0(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 y(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 x02 = x0((Bundle) parcelable);
                        if (!x02.isEmpty()) {
                            arrayList.add(x02);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return null;
        }
    }

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

    public final int p0(String str) {
        if (X("event", str)) {
            if (T("event", com.bumptech.glide.d.f5471b, com.bumptech.glide.d.f5472c, str)) {
                ((p3) this.f18581b).getClass();
                return !S("event", 40, str) ? 2 : 0;
            }
            return 13;
        }
        return 2;
    }

    public final int q0(String str) {
        if (X("event param", str)) {
            if (T("event param", null, null, str)) {
                ((p3) this.f18581b).getClass();
                return !S("event param", 40, str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

    public final int r0(String str) {
        if (Y("event param", str)) {
            if (T("event param", null, null, str)) {
                ((p3) this.f18581b).getClass();
                return !S("event param", 40, str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

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

    public final int s0(String str) {
        if (X("user property", str)) {
            if (T("user property", com.bumptech.glide.f.f5495a, null, str)) {
                ((p3) this.f18581b).getClass();
                return !S("user property", 24, str) ? 6 : 0;
            }
            return 15;
        }
        return 6;
    }

    public final int t0() {
        if (this.f10739g == null) {
            this.f10739g = Integer.valueOf(GoogleApiAvailabilityLight.getInstance().getApkVersion(((p3) this.f18581b).f10639a) / 1000);
        }
        return this.f10739g.intValue();
    }

    public final Object v(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        Object obj2 = this.f18581b;
        if (equals) {
            ((p3) obj2).getClass();
            return l0(256, obj, true, true);
        }
        boolean d02 = d0(str);
        ((p3) obj2).getClass();
        return l0(d02 ? 256 : 100, obj, false, true);
    }

    public final long v0() {
        int i10 = (this.f10737e.get() > 0L ? 1 : (this.f10737e.get() == 0L ? 0 : -1));
        synchronized (this.f10737e) {
            if (i10 == 0) {
                long nextLong = new Random(System.nanoTime() ^ ((p3) this.f18581b).f10657n.currentTimeMillis()).nextLong();
                int i11 = this.f10738f + 1;
                this.f10738f = i11;
                return nextLong + i11;
            }
            this.f10737e.compareAndSet(-1L, 1L);
            return this.f10737e.getAndIncrement();
        }
    }

    public final Object w(Object obj, String str) {
        boolean equals = "_ldl".equals(str);
        int k02 = k0(str);
        return equals ? l0(k02, obj, true, false) : l0(k02, obj, false, false);
    }

    public final Bundle w0(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) {
                v2 v2Var = ((p3) this.f18581b).f10652i;
                p3.k(v2Var);
                v2Var.f10802j.c(e10, "Install referrer url isn't a hierarchical URI");
            }
        }
        return null;
    }

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

    public final Bundle x0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object v10 = v(bundle.get(str), str);
                if (v10 == null) {
                    Object obj = this.f18581b;
                    v2 v2Var = ((p3) obj).f10652i;
                    p3.k(v2Var);
                    v2Var.f10804l.c(((p3) obj).f10656m.e(str), "Param value can't be null");
                } else {
                    I(bundle2, str, v10);
                }
            }
        }
        return bundle2;
    }

    public final Bundle y0(String str, Bundle bundle, List list, boolean z10) {
        int i10;
        String str2;
        String str3;
        List list2 = list;
        boolean m02 = m0(str, com.bumptech.glide.d.f5474e);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            p3 p3Var = (p3) this.f18581b;
            int t10 = p3Var.f10650g.t();
            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 = r0(str4);
                    } else {
                        i10 = 0;
                    }
                    if (i10 == 0) {
                        i10 = q0(str4);
                    }
                }
                if (i10 != 0) {
                    if (i10 == 3) {
                        str3 = str4;
                    } else {
                        str3 = null;
                    }
                    D(bundle2, i10, str4, str3);
                    bundle2.remove(str4);
                } else {
                    int U = U(str, str4, bundle.get(str4), bundle2, list, z10, m02);
                    if (U == 17) {
                        D(bundle2, 17, str4, Boolean.FALSE);
                    } else if (U != 0 && !"_ev".equals(str4)) {
                        if (U == 21) {
                            str2 = str;
                        } else {
                            str2 = str4;
                        }
                        D(bundle2, U, str2, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (e0(str4)) {
                        int i12 = i11 + 1;
                        if (i12 > t10) {
                            StringBuilder r10 = a4.b.r("Event can't contain more than ", t10, " params");
                            v2 v2Var = p3Var.f10652i;
                            p3.k(v2Var);
                            String sb2 = r10.toString();
                            v2Var.f10801i.d(p3Var.f10656m.d(str), p3Var.f10656m.b(bundle), sb2);
                            j0(5, bundle2);
                            bundle2.remove(str4);
                        }
                        i11 = i12;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

    public final q z0(String str, Bundle bundle, String str2, long j9, boolean z10) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (p0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle y02 = y0(str, bundle2, CollectionUtils.listOf("_o"), true);
            if (z10) {
                y02 = x0(y02);
            }
            Preconditions.checkNotNull(y02);
            return new q(str, new p(y02), str2, j9);
        }
        p3 p3Var = (p3) this.f18581b;
        v2 v2Var = p3Var.f10652i;
        p3.k(v2Var);
        v2Var.f10799g.c(p3Var.f10656m.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }
}