导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - a5.java 源代码

正在查看: Minits v4.9.3.32 应用的 a5.java JAVA 源代码文件

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


package h4;

import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import com.google.android.gms.internal.measurement.C1753u6;
import com.google.android.gms.internal.measurement.InterfaceC1668k0;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
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.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 q3.AbstractC2852o;
import q3.C2848k;
import u3.AbstractC3204t;

public final class a5 extends F2 {

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

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

    public SecureRandom f20034c;

    public final AtomicLong f20035d;

    public int f20036e;

    public Integer f20037f;

    public a5(C2225l2 c2225l2) {
        super(c2225l2);
        this.f20037f = null;
        this.f20035d = new AtomicLong(0L);
    }

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

    public static boolean Z(String str) {
        AbstractC3204t.f(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean a0(Context context) {
        ActivityInfo receiverInfo;
        AbstractC3204t.l(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 b0(Context context, boolean z8) {
        AbstractC3204t.l(context);
        return Build.VERSION.SDK_INT >= 24 ? k0(context, "com.google.android.gms.measurement.AppMeasurementJobService") : k0(context, "com.google.android.gms.measurement.AppMeasurementService");
    }

    public static boolean c0(String str) {
        return !f20033h[0].equals(str);
    }

    public static final boolean f0(Bundle bundle, int i8) {
        if (bundle == null || bundle.getLong("_err") != 0) {
            return false;
        }
        bundle.putLong("_err", i8);
        return true;
    }

    public static final boolean g0(String str) {
        AbstractC3204t.l(str);
        return str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$");
    }

    public static boolean j0(String str, String[] strArr) {
        AbstractC3204t.l(strArr);
        for (String str2 : strArr) {
            if (Y4.a(str, str2)) {
                return true;
            }
        }
        return false;
    }

    public static boolean k0(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 s0(byte[] bArr) {
        AbstractC3204t.l(bArr);
        int length = bArr.length;
        int i8 = 0;
        AbstractC3204t.o(length > 0);
        long j8 = 0;
        for (int i9 = length - 1; i9 >= 0 && i9 >= bArr.length - 8; i9--) {
            j8 += (bArr[i9] & 255) << i8;
            i8 += 8;
        }
        return j8;
    }

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

    public static ArrayList v(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            C2174d c2174d = (C2174d) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", c2174d.f20078l);
            bundle.putString("origin", c2174d.f20079m);
            bundle.putLong("creation_timestamp", c2174d.f20081o);
            bundle.putString("name", c2174d.f20080n.f19960m);
            H2.b(bundle, AbstractC3204t.l(c2174d.f20080n.j1()));
            bundle.putBoolean("active", c2174d.f20082p);
            String str = c2174d.f20083q;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            C2282v c2282v = c2174d.f20084r;
            if (c2282v != null) {
                bundle.putString("timed_out_event_name", c2282v.f20529l);
                C2270t c2270t = c2282v.f20530m;
                if (c2270t != null) {
                    bundle.putBundle("timed_out_event_params", c2270t.l1());
                }
            }
            bundle.putLong("trigger_timeout", c2174d.f20085s);
            C2282v c2282v2 = c2174d.f20086t;
            if (c2282v2 != null) {
                bundle.putString("triggered_event_name", c2282v2.f20529l);
                C2270t c2270t2 = c2282v2.f20530m;
                if (c2270t2 != null) {
                    bundle.putBundle("triggered_event_params", c2270t2.l1());
                }
            }
            bundle.putLong("triggered_timestamp", c2174d.f20080n.f19961n);
            bundle.putLong("time_to_live", c2174d.f20087u);
            C2282v c2282v3 = c2174d.f20088v;
            if (c2282v3 != null) {
                bundle.putString("expired_event_name", c2282v3.f20529l);
                C2270t c2270t3 = c2282v3.f20530m;
                if (c2270t3 != null) {
                    bundle.putBundle("expired_event_params", c2270t3.l1());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void y(A3 a32, Bundle bundle, boolean z8) {
        if (bundle != null && a32 != null) {
            if (!bundle.containsKey("_sc") || z8) {
                String str = a32.f19624a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = a32.f19625b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", a32.f19626c);
                return;
            }
            z8 = false;
        }
        if (bundle != null && a32 == null && z8) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public final void A(Parcelable[] parcelableArr, int i8, boolean z8) {
        AbstractC3204t.l(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            int i9 = 0;
            for (String str : new TreeSet(bundle.keySet())) {
                if (Z(str) && !j0(str, M2.f19811d) && (i9 = i9 + 1) > i8) {
                    if (z8) {
                        this.f19681a.d().s().c("Param can't contain more than " + i8 + " item-scoped custom parameters", this.f19681a.D().e(str), this.f19681a.D().b(bundle));
                        f0(bundle, 28);
                    } else {
                        this.f19681a.d().s().c("Param cannot contain item-scoped custom parameters", this.f19681a.D().e(str), this.f19681a.D().b(bundle));
                        f0(bundle, 23);
                    }
                    bundle.remove(str);
                }
            }
        }
    }

    public final void B(A1 a12, int i8) {
        int i9 = 0;
        for (String str : new TreeSet(a12.f19621d.keySet())) {
            if (Z(str) && (i9 = i9 + 1) > i8) {
                this.f19681a.d().s().c("Event can't contain more than " + i8 + " params", this.f19681a.D().d(a12.f19618a), this.f19681a.D().b(a12.f19621d));
                f0(a12.f19621d, 5);
                a12.f19621d.remove(str);
            }
        }
    }

    public final void C(Z4 z42, String str, int i8, String str2, String str3, int i9) {
        Bundle bundle = new Bundle();
        f0(bundle, i8);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i8 == 6 || i8 == 7 || i8 == 2) {
            bundle.putLong("_el", i9);
        }
        z42.a(str, "_err", bundle);
    }

    public final void D(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());
        } else if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            this.f19681a.d().x().c("Not putting event parameter. Invalid value type. name, type", this.f19681a.D().e(str), obj != null ? obj.getClass().getSimpleName() : null);
        }
    }

    public final void E(InterfaceC1668k0 interfaceC1668k0, boolean z8) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z8);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning boolean value to wrapper", e8);
        }
    }

    public final void F(InterfaceC1668k0 interfaceC1668k0, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning bundle list to wrapper", e8);
        }
    }

    public final void G(InterfaceC1668k0 interfaceC1668k0, Bundle bundle) {
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning bundle value to wrapper", e8);
        }
    }

    public final void H(InterfaceC1668k0 interfaceC1668k0, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning byte array to wrapper", e8);
        }
    }

    public final void I(InterfaceC1668k0 interfaceC1668k0, int i8) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i8);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning int value to wrapper", e8);
        }
    }

    public final void J(InterfaceC1668k0 interfaceC1668k0, long j8) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j8);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning long value to wrapper", e8);
        }
    }

    public final void K(InterfaceC1668k0 interfaceC1668k0, String str) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            interfaceC1668k0.C(bundle);
        } catch (RemoteException e8) {
            this.f19681a.d().w().b("Error returning string value to wrapper", e8);
        }
    }

    public final void L(String str, String str2, String str3, Bundle bundle, List list, boolean z8) {
        int i8;
        int i9;
        a5 a5Var = this;
        String str4 = str2;
        List list2 = list;
        if (bundle == null) {
            return;
        }
        C2198h z9 = a5Var.f19681a.z();
        C1753u6.b();
        int i10 = (z9.f19681a.z().B(null, AbstractC2230m1.f20291B0) && z9.f19681a.N().X(231100000, true)) ? 35 : 0;
        int i11 = 0;
        for (String str5 : new TreeSet(bundle.keySet())) {
            if (list2 == null || !list2.contains(str5)) {
                int o02 = !z8 ? a5Var.o0(str5) : 0;
                if (o02 == 0) {
                    o02 = a5Var.n0(str5);
                }
                i8 = o02;
            } else {
                i8 = 0;
            }
            if (i8 != 0) {
                a5Var.x(bundle, i8, str5, str5, i8 == 3 ? str5 : null);
                bundle.remove(str5);
            } else {
                Bundle bundle2 = bundle;
                if (a5Var.V(bundle2.get(str5))) {
                    a5Var.f19681a.d().x().d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str4, str3, str5);
                    i9 = 22;
                } else {
                    String str6 = str4;
                    int O7 = a5Var.O(str, str6, str5, bundle2.get(str5), bundle2, list2, z8, false);
                    str4 = str6;
                    bundle2 = bundle2;
                    i9 = O7;
                }
                if (i9 == 0 || "_ev".equals(str5)) {
                    a5Var = this;
                    if (Z(str5) && !j0(str5, M2.f19811d)) {
                        i11++;
                        if (!a5Var.X(231100000, true)) {
                            a5Var.f19681a.d().s().c("Item array not supported on client's version of Google Play Services (Android Only)", a5Var.f19681a.D().d(str4), a5Var.f19681a.D().b(bundle2));
                            f0(bundle2, 23);
                            bundle2.remove(str5);
                        } else if (i11 > i10) {
                            C1753u6.b();
                            if (a5Var.f19681a.z().B(null, AbstractC2230m1.f20291B0)) {
                                a5Var.f19681a.d().s().c("Item can't contain more than " + i10 + " item-scoped custom params", a5Var.f19681a.D().d(str4), a5Var.f19681a.D().b(bundle2));
                                f0(bundle2, 28);
                                bundle2.remove(str5);
                            } else {
                                a5Var.f19681a.d().s().c("Item cannot contain custom parameters", a5Var.f19681a.D().d(str4), a5Var.f19681a.D().b(bundle2));
                                f0(bundle2, 23);
                                bundle2.remove(str5);
                            }
                        }
                    }
                } else {
                    a5Var = this;
                    a5Var.x(bundle2, i9, str5, str5, bundle2.get(str5));
                    bundle2.remove(str5);
                }
            }
            list2 = list;
        }
    }

    public final boolean M(String str, String str2) {
        if (!TextUtils.isEmpty(str)) {
            if (g0(str)) {
                return true;
            }
            if (this.f19681a.q()) {
                this.f19681a.d().s().b("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", C2308z1.z(str));
            }
            return false;
        }
        if (TextUtils.isEmpty(str2)) {
            if (this.f19681a.q()) {
                this.f19681a.d().s().a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
        if (g0(str2)) {
            return true;
        }
        this.f19681a.d().s().b("Invalid admob_app_id. Analytics disabled.", C2308z1.z(str2));
        return false;
    }

    public final boolean N(String str, int i8, String str2) {
        if (str2 == null) {
            this.f19681a.d().s().b("Name is required and can't be null. Type", str);
            return false;
        }
        if (str2.codePointCount(0, str2.length()) <= i8) {
            return true;
        }
        this.f19681a.d().s().d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i8), str2);
        return false;
    }

    public final int O(java.lang.String r12, java.lang.String r13, java.lang.String r14, java.lang.Object r15, android.os.Bundle r16, java.util.List r17, boolean r18, boolean r19) {
        throw new UnsupportedOperationException("Method not decompiled: h4.a5.O(java.lang.String, java.lang.String, java.lang.String, java.lang.Object, android.os.Bundle, java.util.List, boolean, boolean):int");
    }

    public final boolean P(String str, String[] strArr, String[] strArr2, String str2) {
        if (str2 == null) {
            this.f19681a.d().s().b("Name is required and can't be null. Type", str);
            return false;
        }
        AbstractC3204t.l(str2);
        String[] strArr3 = f20032g;
        for (int i8 = 0; i8 < 3; i8++) {
            if (str2.startsWith(strArr3[i8])) {
                this.f19681a.d().s().c("Name starts with reserved prefix. Type, name", str, str2);
                return false;
            }
        }
        if (strArr == null || !j0(str2, strArr)) {
            return true;
        }
        if (strArr2 != null && j0(str2, strArr2)) {
            return true;
        }
        this.f19681a.d().s().c("Name is reserved. Type, name", str, str2);
        return false;
    }

    public final boolean Q(String str, String str2, int i8, 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()) > i8) {
                this.f19681a.d().x().d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean R(String str, String str2) {
        if (str2 == null) {
            this.f19681a.d().s().b("Name is required and can't be null. Type", str);
            return false;
        }
        if (str2.length() == 0) {
            this.f19681a.d().s().b("Name is required and can't be empty. Type", str);
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            if (codePointAt != 95) {
                this.f19681a.d().s().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)) {
                this.f19681a.d().s().c("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, String str2) {
        if (str2 == null) {
            this.f19681a.d().s().b("Name is required and can't be null. Type", str);
            return false;
        }
        if (str2.length() == 0) {
            this.f19681a.d().s().b("Name is required and can't be empty. Type", str);
            return false;
        }
        int codePointAt = str2.codePointAt(0);
        if (!Character.isLetter(codePointAt)) {
            this.f19681a.d().s().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)) {
                this.f19681a.d().s().c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
                return false;
            }
            charCount += Character.charCount(codePointAt2);
        }
        return true;
    }

    public final boolean T(String str) {
        h();
        if (D3.f.a(this.f19681a.c()).a(str) == 0) {
            return true;
        }
        this.f19681a.d().q().b("Permission not granted", str);
        return false;
    }

    public final boolean U(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String u8 = this.f19681a.z().u();
        this.f19681a.b();
        return u8.equals(str);
    }

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

    public final boolean W(Context context, String str) {
        Signature[] signatureArr;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo e8 = D3.f.a(context).e(str, 64);
            if (e8 == null || (signatureArr = e8.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 e9) {
            this.f19681a.d().r().b("Package name not found", e9);
            return true;
        } catch (CertificateException e10) {
            this.f19681a.d().r().b("Error obtaining certificate", e10);
            return true;
        }
    }

    public final boolean X(int i8, boolean z8) {
        Boolean J7 = this.f19681a.L().J();
        if (q0() < i8 / 1000) {
            return (J7 == null || J7.booleanValue()) ? false : true;
        }
        return true;
    }

    public final boolean d0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            AbstractC3204t.l(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 final byte[] e0(Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        Parcel obtain = Parcel.obtain();
        try {
            parcelable.writeToParcel(obtain, 0);
            return obtain.marshall();
        } finally {
            obtain.recycle();
        }
    }

    public final int h0(String str) {
        if ("_ldl".equals(str)) {
            this.f19681a.z();
            return 2048;
        }
        if ("_id".equals(str)) {
            this.f19681a.z();
            return 256;
        }
        if ("_lgclid".equals(str)) {
            this.f19681a.z();
            return 100;
        }
        this.f19681a.z();
        return 36;
    }

    @Override
    public final void i() {
        h();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                this.f19681a.d().w().a("Utils falling back to Random for random id");
            }
        }
        this.f20035d.set(nextLong);
    }

    public final Object i0(int i8, Object obj, boolean z8, boolean z9) {
        if (obj == null) {
            return null;
        }
        if (obj instanceof Long) {
            return obj;
        }
        if (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(obj.toString(), i8, z8);
        }
        if (!z9 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Parcelable parcelable : (Parcelable[]) obj) {
            if (parcelable instanceof Bundle) {
                Bundle w02 = w0((Bundle) parcelable);
                if (!w02.isEmpty()) {
                    arrayList.add(w02);
                }
            }
        }
        return arrayList.toArray(new Bundle[arrayList.size()]);
    }

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

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

    public final int m0(String str) {
        if (!R("event", str)) {
            return 2;
        }
        if (!P("event", L2.f19796a, L2.f19797b, str)) {
            return 13;
        }
        this.f19681a.z();
        return !N("event", 40, str) ? 2 : 0;
    }

    public final int n0(String str) {
        if (!R("event param", str)) {
            return 3;
        }
        if (!P("event param", null, null, str)) {
            return 14;
        }
        this.f19681a.z();
        return !N("event param", 40, str) ? 3 : 0;
    }

    public final Object o(String str, Object obj) {
        int i8 = 256;
        if ("_ev".equals(str)) {
            this.f19681a.z();
            return i0(256, obj, true, true);
        }
        if (Y(str)) {
            this.f19681a.z();
        } else {
            this.f19681a.z();
            i8 = 100;
        }
        return i0(i8, obj, false, true);
    }

    public final int o0(String str) {
        if (!S("event param", str)) {
            return 3;
        }
        if (!P("event param", null, null, str)) {
            return 14;
        }
        this.f19681a.z();
        return !N("event param", 40, str) ? 3 : 0;
    }

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

    public final int p0(String str) {
        if (!R("user property", str)) {
            return 6;
        }
        if (!P("user property", N2.f19825a, null, str)) {
            return 15;
        }
        this.f19681a.z();
        return !N("user property", 24, str) ? 6 : 0;
    }

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

    public final int q0() {
        if (this.f20037f == null) {
            this.f20037f = Integer.valueOf(C2848k.f().a(this.f19681a.c()) / 1000);
        }
        return this.f20037f.intValue();
    }

    public final String r(String str, int i8, boolean z8) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) <= i8) {
            return str;
        }
        if (z8) {
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i8))).concat("...");
        }
        return null;
    }

    public final int r0(int i8) {
        return C2848k.f().h(this.f19681a.c(), AbstractC2852o.f23235a);
    }

    public final URL s(long j8, String str, String str2, long j9) {
        try {
            AbstractC3204t.f(str2);
            AbstractC3204t.f(str);
            String format = String.format("https://www.googleadservices.com/pagead/conversion/app/deeplink?id_type=adid&sdk_version=%s&rdid=%s&bundleid=%s&retry=%s", String.format("v%s.%s", 79000L, Integer.valueOf(q0())), str2, str, Long.valueOf(j9));
            if (str.equals(this.f19681a.z().v())) {
                format = format.concat("&ddl_test=1");
            }
            return new URL(format);
        } catch (IllegalArgumentException e8) {
            e = e8;
            this.f19681a.d().r().b("Failed to create BOW URL for Deferred Deep Link. exception", e.getMessage());
            return null;
        } catch (MalformedURLException e9) {
            e = e9;
            this.f19681a.d().r().b("Failed to create BOW URL for Deferred Deep Link. exception", e.getMessage());
            return null;
        }
    }

    public final long t0() {
        long andIncrement;
        long j8;
        if (this.f20035d.get() != 0) {
            synchronized (this.f20035d) {
                this.f20035d.compareAndSet(-1L, 1L);
                andIncrement = this.f20035d.getAndIncrement();
            }
            return andIncrement;
        }
        synchronized (this.f20035d) {
            long nextLong = new Random(System.nanoTime() ^ this.f19681a.a().a()).nextLong();
            int i8 = this.f20036e + 1;
            this.f20036e = i8;
            j8 = nextLong + i8;
        }
        return j8;
    }

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

    public final long u0(long j8, long j9) {
        return (j8 + (j9 * 60000)) / 86400000;
    }

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

    public final void w(Bundle bundle, long j8) {
        long j9 = bundle.getLong("_et");
        if (j9 != 0) {
            this.f19681a.d().w().b("Params already contained engagement", Long.valueOf(j9));
        } else {
            j9 = 0;
        }
        bundle.putLong("_et", j8 + j9);
    }

    public final Bundle w0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object o8 = o(str, bundle.get(str));
                if (o8 == null) {
                    this.f19681a.d().x().b("Param value can't be null", this.f19681a.D().e(str));
                } else {
                    D(bundle2, str, o8);
                }
            }
        }
        return bundle2;
    }

    public final void x(Bundle bundle, int i8, String str, String str2, Object obj) {
        if (f0(bundle, i8)) {
            this.f19681a.z();
            bundle.putString("_ev", r(str, 40, true));
            if (obj != null) {
                AbstractC3204t.l(bundle);
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final Bundle x0(String str, String str2, Bundle bundle, List list, boolean z8) {
        int o02;
        String str3 = str2;
        List list2 = list;
        boolean j02 = j0(str3, L2.f19799d);
        if (bundle == null) {
            return null;
        }
        Bundle bundle2 = new Bundle(bundle);
        int m8 = this.f19681a.z().m();
        int i8 = 0;
        for (String str4 : new TreeSet(bundle.keySet())) {
            if (list2 == null || !list2.contains(str4)) {
                o02 = !z8 ? o0(str4) : 0;
                if (o02 == 0) {
                    o02 = n0(str4);
                }
            } else {
                o02 = 0;
            }
            if (o02 != 0) {
                x(bundle2, o02, str4, str4, o02 == 3 ? str4 : null);
                bundle2.remove(str4);
            } else {
                Bundle bundle3 = bundle2;
                String str5 = str3;
                int O7 = O(str, str5, str4, bundle.get(str4), bundle3, list2, z8, j02);
                str3 = str5;
                bundle2 = bundle3;
                if (O7 == 17) {
                    x(bundle2, 17, str4, str4, Boolean.FALSE);
                } else if (O7 != 0 && !"_ev".equals(str4)) {
                    x(bundle2, O7, O7 == 21 ? str3 : str4, str4, bundle.get(str4));
                    bundle2.remove(str4);
                }
                if (Z(str4) && (i8 = i8 + 1) > m8) {
                    this.f19681a.d().s().c("Event can't contain more than " + m8 + " params", this.f19681a.D().d(str3), this.f19681a.D().b(bundle));
                    f0(bundle2, 5);
                    bundle2.remove(str4);
                }
            }
            list2 = list;
        }
        return bundle2;
    }

    public final C2282v y0(String str, String str2, Bundle bundle, String str3, long j8, boolean z8, boolean z9) {
        if (TextUtils.isEmpty(str2)) {
            return null;
        }
        if (m0(str2) != 0) {
            this.f19681a.d().r().b("Invalid conditional property event name", this.f19681a.D().f(str2));
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str3);
        Bundle x02 = x0(str, str2, bundle2, B3.e.b("_o"), true);
        if (z8) {
            x02 = w0(x02);
        }
        AbstractC3204t.l(x02);
        return new C2282v(str2, new C2270t(x02), str3, j8);
    }

    public final void z(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                this.f19681a.N().D(bundle, str, bundle2.get(str));
            }
        }
    }
}