导航菜单

页面标题

页面副标题

OVO v3.139.0 - zam.java 源代码

正在查看: OVO v3.139.0 应用的 zam.java JAVA 源代码文件

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


package o.i;

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.util.VisibleForTesting;
import com.google.android.gms.measurement.internal.zzac;
import com.google.android.gms.measurement.internal.zzau;
import com.google.android.gms.measurement.internal.zzaw;
import com.google.firebase.analytics.FirebaseAnalytics;
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.AtomicLong;
import javax.security.auth.x500.X500Principal;

public final class zam extends dkl {
    public static final String[] h = {"firebase_", "google_", "ga_"};
    public static final String[] i = {"_err"};

    public SecureRandom f3143d;

    public final AtomicLong f3144e;
    public int f;
    public Integer g;

    public zam(nfl nflVar) {
        super(nflVar);
        this.g = null;
        this.f3144e = new AtomicLong(0L);
    }

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

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

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

    public static boolean V(Context context) {
        ActivityInfo receiverInfo;
        njb.i(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 W(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        njb.i(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 X(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            njb.i(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[] Y(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 Z(int i2, Bundle bundle) {
        if (bundle.getLong("_err") != 0) {
            return false;
        }
        bundle.putLong("_err", i2);
        return true;
    }

    public static boolean c0(String str, String[] strArr) {
        njb.i(strArr);
        int length = strArr.length;
        for (int i2 = 0; i2 < length; i2++) {
            Object obj = strArr[i2];
            if (str == obj || (str != null && str.equals(obj))) {
                return true;
            }
        }
        return false;
    }

    @VisibleForTesting
    public static long j0(byte[] bArr) {
        njb.i(bArr);
        int length = bArr.length;
        int i2 = 0;
        njb.l(length > 0);
        long j = 0;
        for (int i3 = length - 1; i3 >= 0 && i3 >= bArr.length - 8; i3--) {
            j += (bArr[i3] & 255) << i2;
            i2 += 8;
        }
        return j;
    }

    public static String o(int i2, String str, boolean z) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) <= i2) {
            return str;
        }
        if (z) {
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i2))).concat("...");
        }
        return null;
    }

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

    public static ArrayList r(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            zzac zzacVar = (zzac) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", zzacVar.a);
            bundle.putString(FirebaseAnalytics.Param.ORIGIN, zzacVar.b);
            bundle.putLong("creation_timestamp", zzacVar.f199d);
            bundle.putString("name", zzacVar.c.b);
            Object zza = zzacVar.c.zza();
            njb.i(zza);
            pj2.m(bundle, zza);
            bundle.putBoolean("active", zzacVar.f200e);
            String str = zzacVar.f;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            zzaw zzawVar = zzacVar.g;
            if (zzawVar != null) {
                bundle.putString("timed_out_event_name", zzawVar.a);
                zzau zzauVar = zzawVar.b;
                if (zzauVar != null) {
                    bundle.putBundle("timed_out_event_params", zzauVar.e());
                }
            }
            bundle.putLong("trigger_timeout", zzacVar.h);
            zzaw zzawVar2 = zzacVar.i;
            if (zzawVar2 != null) {
                bundle.putString("triggered_event_name", zzawVar2.a);
                zzau zzauVar2 = zzawVar2.b;
                if (zzauVar2 != null) {
                    bundle.putBundle("triggered_event_params", zzauVar2.e());
                }
            }
            bundle.putLong("triggered_timestamp", zzacVar.c.c);
            bundle.putLong("time_to_live", zzacVar.j);
            zzaw zzawVar3 = zzacVar.k;
            if (zzawVar3 != null) {
                bundle.putString("expired_event_name", zzawVar3.a);
                zzau zzauVar3 = zzawVar3.b;
                if (zzauVar3 != null) {
                    bundle.putBundle("expired_event_params", zzauVar3.e());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void u(xul xulVar, Bundle bundle, boolean z) {
        if (bundle != null && xulVar != null) {
            if (!bundle.containsKey("_sc") || z) {
                String str = xulVar.a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = xulVar.b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", xulVar.c);
                return;
            }
            z = false;
        }
        if (bundle != null && xulVar == null && z) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void x(uam uamVar, String str, int i2, String str2, String str3, int i3) {
        Bundle bundle = new Bundle();
        Z(i2, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i2 == 6 || i2 == 7 || i2 == 2) {
            bundle.putLong("_el", i3);
        }
        uamVar.a(str, bundle);
    }

    public final void A(yuk yukVar, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning bundle list to wrapper");
        }
    }

    public final void B(yuk yukVar, Bundle bundle) {
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning bundle value to wrapper");
        }
    }

    public final void C(yuk yukVar, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning byte array to wrapper");
        }
    }

    public final void D(yuk yukVar, int i2) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i2);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning int value to wrapper");
        }
    }

    public final void E(yuk yukVar, long j) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning long value to wrapper");
        }
    }

    public final void F(String str, yuk yukVar) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning string value to wrapper");
        }
    }

    public final void G(String str, String str2, Bundle bundle, List list, boolean z) {
        int g0;
        String str3;
        int K;
        if (bundle == null) {
            return;
        }
        nfl nflVar = (nfl) ((ffh) this).a;
        nflVar.getClass();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i2 = 0;
        while (it.hasNext()) {
            String str4 = (String) it.next();
            if (list == null || !list.contains(str4)) {
                g0 = !z ? g0(str4) : 0;
                if (g0 == 0) {
                    g0 = f0(str4);
                }
            } else {
                g0 = 0;
            }
            if (g0 != 0) {
                t(bundle, g0, str4, g0 == 3 ? str4 : null);
                bundle.remove(str4);
            } else {
                if (R(bundle.get(str4))) {
                    l7l l7lVar = nflVar.i;
                    nfl.k(l7lVar);
                    l7lVar.l.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
                    K = 22;
                    str3 = str4;
                } else {
                    str3 = str4;
                    K = K(str, str4, bundle.get(str4), bundle, list, z, false);
                }
                if (K != 0 && !"_ev".equals(str3)) {
                    t(bundle, K, str3, bundle.get(str3));
                    bundle.remove(str3);
                } else if (U(str3) && !c0(str3, sk3.g) && (i2 = i2 + 1) > 0) {
                    l7l l7lVar2 = nflVar.i;
                    nfl.k(l7lVar2);
                    l7lVar2.i.c("Item cannot contain custom parameters", nflVar.m.d(str), nflVar.m.b(bundle));
                    Z(23, bundle);
                    bundle.remove(str3);
                }
            }
        }
    }

    public final boolean H(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = ((ffh) this).a;
        if (!isEmpty) {
            njb.i(str);
            if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                return true;
            }
            nfl nflVar = (nfl) obj;
            if (TextUtils.isEmpty(nflVar.b)) {
                l7l l7lVar = nflVar.i;
                nfl.k(l7lVar);
                l7lVar.i.b(l7l.q(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
            }
            return false;
        }
        if (TextUtils.isEmpty(str2)) {
            nfl nflVar2 = (nfl) obj;
            if (TextUtils.isEmpty(nflVar2.b)) {
                l7l l7lVar2 = nflVar2.i;
                nfl.k(l7lVar2);
                l7lVar2.i.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
        njb.i(str2);
        if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
            return true;
        }
        l7l l7lVar3 = ((nfl) obj).i;
        nfl.k(l7lVar3);
        l7lVar3.i.b(l7l.q(str2), "Invalid admob_app_id. Analytics disabled.");
        return false;
    }

    public final boolean I(int i2, String str, String str2) {
        Object obj = ((ffh) this).a;
        if (str2 == null) {
            l7l l7lVar = ((nfl) obj).i;
            nfl.k(l7lVar);
            l7lVar.i.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.codePointCount(0, str2.length()) <= i2) {
            return true;
        }
        l7l l7lVar2 = ((nfl) obj).i;
        nfl.k(l7lVar2);
        l7lVar2.i.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i2), str2);
        return false;
    }

    public final boolean J(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = ((ffh) this).a;
        if (str2 == null) {
            l7l l7lVar = ((nfl) obj).i;
            nfl.k(l7lVar);
            l7lVar.i.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = h;
        for (int i2 = 0; i2 < 3; i2++) {
            if (str2.startsWith(strArr3[i2])) {
                l7l l7lVar2 = ((nfl) obj).i;
                nfl.k(l7lVar2);
                l7lVar2.i.c("Name starts with reserved prefix. Type, name", str, str2);
                return false;
            }
        }
        if (strArr == null || !c0(str2, strArr)) {
            return true;
        }
        if (strArr2 != null && c0(str2, strArr2)) {
            return true;
        }
        l7l l7lVar3 = ((nfl) obj).i;
        nfl.k(l7lVar3);
        l7lVar3.i.c("Name is reserved. Type, name", str, str2);
        return false;
    }

    public final int K(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: o.i.zam.K(java.lang.String, java.lang.String, java.lang.Object, android.os.Bundle, java.util.List, boolean, boolean):int");
    }

    public final void L() {
        h();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                l7l l7lVar = ((nfl) ((ffh) this).a).i;
                nfl.k(l7lVar);
                l7lVar.j.a("Utils falling back to Random for random id");
            }
        }
        this.f3144e.set(nextLong);
    }

    public final boolean M(String str, String str2, int i2, 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()) > i2) {
                l7l l7lVar = ((nfl) ((ffh) this).a).i;
                nfl.k(l7lVar);
                l7lVar.l.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean N(String str, String str2) {
        Object obj = ((ffh) this).a;
        if (str2 == null) {
            l7l l7lVar = ((nfl) obj).i;
            nfl.k(l7lVar);
            l7lVar.i.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            l7l l7lVar2 = ((nfl) obj).i;
            nfl.k(l7lVar2);
            l7lVar2.i.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            if (codePointAt != 95) {
                l7l l7lVar3 = ((nfl) obj).i;
                nfl.k(l7lVar3);
                l7lVar3.i.c("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)) {
                l7l l7lVar4 = ((nfl) obj).i;
                nfl.k(l7lVar4);
                l7lVar4.i.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean O(String str, String str2) {
        Object obj = ((ffh) this).a;
        if (str2 == null) {
            l7l l7lVar = ((nfl) obj).i;
            nfl.k(l7lVar);
            l7lVar.i.b(str, "Name is required and can't be null. Type");
            return false;
        }
        if (str2.length() == 0) {
            l7l l7lVar2 = ((nfl) obj).i;
            nfl.k(l7lVar2);
            l7lVar2.i.b(str, "Name is required and can't be empty. Type");
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            l7l l7lVar3 = ((nfl) obj).i;
            nfl.k(l7lVar3);
            l7lVar3.i.c("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)) {
                l7l l7lVar4 = ((nfl) obj).i;
                nfl.k(l7lVar4);
                l7lVar4.i.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean P(String str) {
        h();
        nfl nflVar = (nfl) ((ffh) this).a;
        if (lyg.a(nflVar.a).a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        l7l l7lVar = nflVar.i;
        nfl.k(l7lVar);
        l7lVar.n.b(str, "Permission not granted");
        return false;
    }

    public final boolean Q(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        nfl nflVar = (nfl) ((ffh) this).a;
        String i2 = nflVar.g.i("debug.firebase.analytics.app");
        nflVar.getClass();
        return i2.equals(str);
    }

    @VisibleForTesting
    public final boolean S(Context context, String str) {
        Signature[] signatureArr;
        Object obj = ((ffh) this).a;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo b = lyg.a(context).b(64, str);
            if (b == null || (signatureArr = b.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 e4) {
            l7l l7lVar = ((nfl) obj).i;
            nfl.k(l7lVar);
            l7lVar.g.b(e4, "Package name not found");
            return true;
        } catch (CertificateException e5) {
            l7l l7lVar2 = ((nfl) obj).i;
            nfl.k(l7lVar2);
            l7lVar2.g.b(e5, "Error obtaining certificate");
            return true;
        }
    }

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

    public final Object b0(int i2, Object obj, boolean z, boolean z2) {
        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 o(i2, obj.toString(), z);
        }
        if (!z2 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Parcelable parcelable : (Parcelable[]) obj) {
            if (parcelable instanceof Bundle) {
                Bundle m0 = m0((Bundle) parcelable);
                if (!m0.isEmpty()) {
                    arrayList.add(m0);
                }
            }
        }
        return arrayList.toArray(new Bundle[arrayList.size()]);
    }

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

    public final int e0(String str) {
        if (!N("event", str)) {
            return 2;
        }
        if (!J("event", lp.e, lp.f, str)) {
            return 13;
        }
        ((nfl) ((ffh) this).a).getClass();
        return !I(40, "event", str) ? 2 : 0;
    }

    public final int f0(String str) {
        if (!N("event param", str)) {
            return 3;
        }
        if (!J("event param", null, null, str)) {
            return 14;
        }
        ((nfl) ((ffh) this).a).getClass();
        return !I(40, "event param", str) ? 3 : 0;
    }

    public final int g0(String str) {
        if (!O("event param", str)) {
            return 3;
        }
        if (!J("event param", null, null, str)) {
            return 14;
        }
        ((nfl) ((ffh) this).a).getClass();
        return !I(40, "event param", str) ? 3 : 0;
    }

    public final int h0(String str) {
        if (!N("user property", str)) {
            return 6;
        }
        if (!J("user property", hw9.e, null, str)) {
            return 15;
        }
        ((nfl) ((ffh) this).a).getClass();
        return !I(24, "user property", str) ? 6 : 0;
    }

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

    public final int i0() {
        if (this.g == null) {
            dd6 dd6Var = dd6.b;
            Context context = ((nfl) ((ffh) this).a).a;
            dd6Var.getClass();
            this.g = Integer.valueOf(dd6.a(context) / 1000);
        }
        return this.g.intValue();
    }

    public final long k0() {
        long andIncrement;
        long j;
        if (this.f3144e.get() != 0) {
            synchronized (this.f3144e) {
                this.f3144e.compareAndSet(-1L, 1L);
                andIncrement = this.f3144e.getAndIncrement();
            }
            return andIncrement;
        }
        synchronized (this.f3144e) {
            long nanoTime = System.nanoTime();
            ((nfl) ((ffh) this).a).n.getClass();
            long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
            int i2 = this.f + 1;
            this.f = i2;
            j = nextLong + i2;
        }
        return j;
    }

    public final Object l(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        int i2 = 256;
        Object obj2 = ((ffh) this).a;
        if (equals) {
            ((nfl) obj2).getClass();
            return b0(256, obj, true, true);
        }
        if (T(str)) {
            ((nfl) obj2).getClass();
        } else {
            ((nfl) obj2).getClass();
            i2 = 100;
        }
        return b0(i2, obj, false, true);
    }

    public final Bundle l0(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(FirebaseAnalytics.Param.TERM, queryParameter);
                }
                String queryParameter2 = uri.getQueryParameter("utm_content");
                if (!TextUtils.isEmpty(queryParameter2)) {
                    bundle.putString(FirebaseAnalytics.Param.CONTENT, queryParameter2);
                }
                String queryParameter3 = uri.getQueryParameter(FirebaseAnalytics.Param.ACLID);
                if (!TextUtils.isEmpty(queryParameter3)) {
                    bundle.putString(FirebaseAnalytics.Param.ACLID, queryParameter3);
                }
                String queryParameter4 = uri.getQueryParameter(FirebaseAnalytics.Param.CP1);
                if (!TextUtils.isEmpty(queryParameter4)) {
                    bundle.putString(FirebaseAnalytics.Param.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 e4) {
                l7l l7lVar = ((nfl) ((ffh) this).a).i;
                nfl.k(l7lVar);
                l7lVar.j.b(e4, "Install referrer url isn't a hierarchical URI");
            }
        }
        return null;
    }

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

    public final Bundle m0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object l = l(bundle.get(str), str);
                if (l == null) {
                    Object obj = ((ffh) this).a;
                    l7l l7lVar = ((nfl) obj).i;
                    nfl.k(l7lVar);
                    l7lVar.l.b(((nfl) obj).m.e(str), "Param value can't be null");
                } else {
                    y(bundle2, str, l);
                }
            }
        }
        return bundle2;
    }

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

    public final Bundle n0(String str, Bundle bundle, List list, boolean z) {
        int g0;
        List list2 = list;
        boolean c0 = c0(str, lp.h);
        if (bundle == null) {
            return null;
        }
        Bundle bundle2 = new Bundle(bundle);
        nfl nflVar = (nfl) ((ffh) this).a;
        int k = nflVar.g.k();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i2 = 0;
        while (it.hasNext()) {
            String str2 = (String) it.next();
            if (list2 == null || !list2.contains(str2)) {
                g0 = !z ? g0(str2) : 0;
                if (g0 == 0) {
                    g0 = f0(str2);
                }
            } else {
                g0 = 0;
            }
            if (g0 != 0) {
                t(bundle2, g0, str2, g0 == 3 ? str2 : null);
                bundle2.remove(str2);
            } else {
                int K = K(str, str2, bundle.get(str2), bundle2, list, z, c0);
                if (K == 17) {
                    t(bundle2, 17, str2, Boolean.FALSE);
                } else if (K != 0 && !"_ev".equals(str2)) {
                    t(bundle2, K, K == 21 ? str : str2, bundle.get(str2));
                    bundle2.remove(str2);
                }
                if (U(str2)) {
                    int i3 = i2 + 1;
                    if (i3 > k) {
                        StringBuilder a = uq4.a("Event can't contain more than ", k, " params");
                        l7l l7lVar = nflVar.i;
                        nfl.k(l7lVar);
                        l7lVar.i.c(a.toString(), nflVar.m.d(str), nflVar.m.b(bundle));
                        Z(5, bundle2);
                        bundle2.remove(str2);
                    }
                    i2 = i3;
                }
            }
            list2 = list;
        }
        return bundle2;
    }

    public final zzaw o0(String str, Bundle bundle, String str2, long j, boolean z) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (e0(str) != 0) {
            nfl nflVar = (nfl) ((ffh) this).a;
            l7l l7lVar = nflVar.i;
            nfl.k(l7lVar);
            l7lVar.g.b(nflVar.m.f(str), "Invalid conditional property event name");
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str2);
        Bundle n0 = n0(str, bundle2, Collections.singletonList("_o"), true);
        if (z) {
            n0 = m0(n0);
        }
        njb.i(n0);
        return new zzaw(str, new zzau(n0), str2, j);
    }

    public final SecureRandom q() {
        h();
        if (this.f3143d == null) {
            this.f3143d = new SecureRandom();
        }
        return this.f3143d;
    }

    public final void s(Bundle bundle, long j) {
        long j2 = bundle.getLong("_et");
        if (j2 != 0) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(Long.valueOf(j2), "Params already contained engagement");
        } else {
            j2 = 0;
        }
        bundle.putLong("_et", j + j2);
    }

    public final void t(Bundle bundle, int i2, String str, Object obj) {
        if (Z(i2, bundle)) {
            ((nfl) ((ffh) this).a).getClass();
            bundle.putString("_ev", o(40, str, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void v(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                zam zamVar = ((nfl) ((ffh) this).a).l;
                nfl.i(zamVar);
                zamVar.y(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void w(r7l r7lVar, int i2) {
        Bundle bundle = r7lVar.f2418d;
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i3 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (U(str) && (i3 = i3 + 1) > i2) {
                StringBuilder a = uq4.a("Event can't contain more than ", i2, " params");
                nfl nflVar = (nfl) ((ffh) this).a;
                l7l l7lVar = nflVar.i;
                nfl.k(l7lVar);
                l7lVar.i.c(a.toString(), nflVar.m.d(r7lVar.a), nflVar.m.b(bundle));
                Z(5, bundle);
                bundle.remove(str);
            }
        }
    }

    public final void y(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 = ((ffh) this).a;
            l7l l7lVar = ((nfl) obj2).i;
            nfl.k(l7lVar);
            l7lVar.l.c("Not putting event parameter. Invalid value type. name, type", ((nfl) obj2).m.e(str), simpleName);
        }
    }

    public final void z(yuk yukVar, boolean z) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z);
        try {
            yukVar.L(bundle);
        } catch (RemoteException e4) {
            l7l l7lVar = ((nfl) ((ffh) this).a).i;
            nfl.k(l7lVar);
            l7lVar.j.b(e4, "Error returning boolean value to wrapper");
        }
    }
}