导航菜单

页面标题

页面副标题

Kahramaa v15.23.3 - u9.java 源代码

正在查看: Kahramaa v15.23.3 应用的 u9.java JAVA 源代码文件

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


package r6;

import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
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.os.ext.SdkExtensions;
import android.text.TextUtils;
import android.util.Log;
import g6.bc;
import g6.kd;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
import k1.a;
import l1.e;
import org.conscrypt.EvpMdRef;

public final class u9 extends k6 {

    public static final String[] f12929w = {"firebase_", "google_", "ga_"};
    public static final String[] x = {"_err"};
    public SecureRandom q;

    public final AtomicLong f12930r;

    public int f12931s;

    public a.C0153a f12932t;

    public Boolean f12933u;

    public Integer f12934v;

    public u9(w5 w5Var) {
        super(w5Var);
        this.f12934v = null;
        this.f12930r = new AtomicLong(0L);
    }

    public static Bundle A(List<r9> list) {
        Bundle bundle = new Bundle();
        if (list == null) {
            return bundle;
        }
        for (r9 r9Var : list) {
            String str = r9Var.f12854r;
            if (str != null) {
                bundle.putString(r9Var.f12852o, str);
            } else {
                Long l10 = r9Var.q;
                if (l10 != null) {
                    bundle.putLong(r9Var.f12852o, l10.longValue());
                } else {
                    Double d10 = r9Var.f12856t;
                    if (d10 != null) {
                        bundle.putDouble(r9Var.f12852o, d10.doubleValue());
                    }
                }
            }
        }
        return bundle;
    }

    public static String C(String str, boolean z, int i10) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) <= i10) {
            return str;
        }
        if (z) {
            return androidx.activity.result.d.j(str.substring(0, str.offsetByCodePoints(0, i10)), "...");
        }
        return null;
    }

    public static int C0(String str) {
        if ("_ldl".equals(str)) {
            return 2048;
        }
        if ("_id".equals(str)) {
            return 256;
        }
        return ("_lgclid".equals(str) || "_gbraid".equals(str)) ? 100 : 36;
    }

    public static void E(Bundle bundle, int i10, String str, Object obj) {
        if (l0(i10, bundle)) {
            bundle.putString("_ev", C(str, true, 40));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", String.valueOf(obj).length());
                }
            }
        }
    }

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

    public static void R(o5 o5Var, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        l0(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        o5Var.c(str, "_err", bundle);
    }

    public static void S(v7 v7Var, Bundle bundle, boolean z) {
        if (bundle == null || v7Var == null || (bundle.containsKey("_sc") && !z)) {
            if (bundle != null && v7Var == null && z) {
                bundle.remove("_sn");
                bundle.remove("_sc");
                bundle.remove("_si");
                return;
            }
            return;
        }
        String str = v7Var.f12951a;
        if (str != null) {
            bundle.putString("_sn", str);
        } else {
            bundle.remove("_sn");
        }
        String str2 = v7Var.f12952b;
        if (str2 != null) {
            bundle.putString("_sc", str2);
        } else {
            bundle.remove("_sc");
        }
        bundle.putLong("_si", v7Var.f12953c);
    }

    public static boolean U(Context context) {
        ActivityInfo receiverInfo;
        l5.m.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 V(Intent intent) {
        String stringExtra = intent.getStringExtra("android.intent.extra.REFERRER_NAME");
        return "android-app://com.google.android.googlequicksearchbox/https/www.google.com".equals(stringExtra) || "https://www.google.com".equals(stringExtra) || "android-app://com.google.appcrawler".equals(stringExtra);
    }

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

    public static boolean b0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            l5.m.i(str);
            return !str.equals(str2);
        }
        if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        }
        if (isEmpty || !isEmpty2) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
        if (TextUtils.isEmpty(str4)) {
            return false;
        }
        return TextUtils.isEmpty(str3) || !str3.equals(str4);
    }

    public static boolean c0(String str, String[] strArr) {
        l5.m.i(strArr);
        for (String str2 : strArr) {
            if (Objects.equals(str, str2)) {
                return true;
            }
        }
        return false;
    }

    public static 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 static boolean g0(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        l5.m.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 ArrayList<Bundle> k0(List<d> list) {
        if (list == null) {
            return new ArrayList<>(0);
        }
        ArrayList<Bundle> arrayList = new ArrayList<>(list.size());
        for (d dVar : list) {
            Bundle bundle = new Bundle();
            bundle.putString("app_id", dVar.f12417n);
            bundle.putString("origin", dVar.f12418o);
            bundle.putLong("creation_timestamp", dVar.q);
            bundle.putString("name", dVar.f12419p.f12852o);
            Object m02 = dVar.f12419p.m0();
            l5.m.i(m02);
            androidx.activity.x.J(bundle, m02);
            bundle.putBoolean("active", dVar.f12420r);
            String str = dVar.f12421s;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            b0 b0Var = dVar.f12422t;
            if (b0Var != null) {
                bundle.putString("timed_out_event_name", b0Var.f12356n);
                w wVar = b0Var.f12357o;
                if (wVar != null) {
                    bundle.putBundle("timed_out_event_params", wVar.n0());
                }
            }
            bundle.putLong("trigger_timeout", dVar.f12423u);
            b0 b0Var2 = dVar.f12424v;
            if (b0Var2 != null) {
                bundle.putString("triggered_event_name", b0Var2.f12356n);
                w wVar2 = b0Var2.f12357o;
                if (wVar2 != null) {
                    bundle.putBundle("triggered_event_params", wVar2.n0());
                }
            }
            bundle.putLong("triggered_timestamp", dVar.f12419p.f12853p);
            bundle.putLong("time_to_live", dVar.f12425w);
            b0 b0Var3 = dVar.x;
            if (b0Var3 != null) {
                bundle.putString("expired_event_name", b0Var3.f12356n);
                w wVar3 = b0Var3.f12357o;
                if (wVar3 != null) {
                    bundle.putBundle("expired_event_params", wVar3.n0());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

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

    public static int o0() {
        if (Build.VERSION.SDK_INT < 30 || SdkExtensions.getExtensionVersion(30) <= 3) {
            return 0;
        }
        return SdkExtensions.getExtensionVersion(1000000);
    }

    public static boolean t0(String str, String str2) {
        return str.equals("*") || Arrays.asList(str.split(",")).contains(str2);
    }

    public static boolean u0(String str) {
        return t0(d0.f12468v0.a(null), str);
    }

    public static long v(w wVar) {
        long j10 = 0;
        if (wVar == null) {
            return 0L;
        }
        z zVar = new z(wVar);
        while (zVar.hasNext()) {
            if (wVar.f12957n.get((String) zVar.next()) instanceof Parcelable[]) {
                j10 += ((Parcelable[]) r3).length;
            }
        }
        return j10;
    }

    public static long w(byte[] bArr) {
        l5.m.i(bArr);
        int i10 = 0;
        if (!(bArr.length > 0)) {
            throw new IllegalStateException();
        }
        long j10 = 0;
        for (int length = bArr.length - 1; length >= 0 && length >= bArr.length - 8; length--) {
            j10 += (bArr[length] & 255) << i10;
            i10 += 8;
        }
        return j10;
    }

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

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

    public final int A0(String str) {
        if (!n0("event param", str)) {
            return 3;
        }
        if (d0("event param", null, null, str)) {
            return !Y("event param", 40, str) ? 3 : 0;
        }
        return 14;
    }

    public final Object B(int i10, Object obj, boolean z, boolean z10) {
        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(((Boolean) obj).booleanValue() ? 1L : 0L);
        }
        if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        }
        if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
            return C(String.valueOf(obj), z, i10);
        }
        if (!z10 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        for (Parcelable parcelable : (Parcelable[]) obj) {
            if (parcelable instanceof Bundle) {
                Bundle y10 = y((Bundle) parcelable);
                if (!y10.isEmpty()) {
                    arrayList.add(y10);
                }
            }
        }
        return arrayList.toArray(new Bundle[arrayList.size()]);
    }

    public final int B0(String str) {
        if (!q0("event param", str)) {
            return 3;
        }
        if (d0("event param", null, null, str)) {
            return !Y("event param", 40, str) ? 3 : 0;
        }
        return 14;
    }

    public final b0 D(String str, Bundle bundle, String str2, long j10, boolean z) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (t(str) != 0) {
            i().f12811t.b(l().g(str), "Invalid conditional property event name");
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str2);
        Bundle z10 = z(str, bundle2, Collections.singletonList("_o"), true);
        if (z) {
            z10 = y(z10);
        }
        l5.m.i(z10);
        return new b0(str, new w(z10), str2, j10);
    }

    public final long D0() {
        long andIncrement;
        long j10;
        if (this.f12930r.get() != 0) {
            synchronized (this.f12930r) {
                this.f12930r.compareAndSet(-1L, 1L);
                andIncrement = this.f12930r.getAndIncrement();
            }
            return andIncrement;
        }
        synchronized (this.f12930r) {
            long nanoTime = System.nanoTime();
            ((q8.b) b()).getClass();
            long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
            int i10 = this.f12931s + 1;
            this.f12931s = i10;
            j10 = nextLong + i10;
        }
        return j10;
    }

    public final k1.a E0() {
        if (this.f12932t == null) {
            Context a10 = a();
            te.h.e(a10, "context");
            StringBuilder sb2 = new StringBuilder();
            sb2.append("AdServicesInfo.version=");
            int i10 = Build.VERSION.SDK_INT;
            sb2.append(i10 >= 30 ? i1.a.f8355a.a() : 0);
            Log.d("MeasurementManager", sb2.toString());
            e.a aVar = (i10 >= 30 ? i1.a.f8355a.a() : 0) >= 5 ? new e.a(a10) : null;
            this.f12932t = aVar != null ? new a.C0153a(aVar) : null;
        }
        return this.f12932t;
    }

    public final void F(Bundle bundle, long j10) {
        long j11 = bundle.getLong("_et");
        if (j11 != 0) {
            i().f12814w.b(Long.valueOf(j11), "Params already contained engagement");
        }
        bundle.putLong("_et", j10 + j11);
    }

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

    public final void G(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                n().H(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void H(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) {
            i().f12815y.a(l().f(str), obj != null ? obj.getClass().getSimpleName() : null, "Not putting event parameter. Invalid value type. name, type");
        }
    }

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

    public final void I(g6.l1 l1Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning int value to wrapper");
        }
    }

    public final boolean I0() {
        o();
        return x0() == 1;
    }

    public final void J(g6.l1 l1Var, long j10) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j10);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning long value to wrapper");
        }
    }

    public final void K(g6.l1 l1Var, Bundle bundle) {
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void L(g6.l1 l1Var, ArrayList<Bundle> arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void M(g6.l1 l1Var, boolean z) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void N(g6.l1 l1Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning byte array to wrapper");
        }
    }

    public final void O(String str, g6.l1 l1Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            l1Var.s(bundle);
        } catch (RemoteException e10) {
            ((w5) this.f13764o).i().f12814w.b(e10, "Error returning string value to wrapper");
        }
    }

    public final void P(String str, String str2, Bundle bundle, List list, boolean z) {
        int B0;
        String str3;
        int u10;
        if (bundle == null) {
            return;
        }
        e j10 = j();
        j10.getClass();
        bc.a();
        int i10 = (j10.j().A(null, d0.B0) && j10.n().f0(231100000)) ? 35 : 0;
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str4 = (String) it.next();
            if (list == null || !list.contains(str4)) {
                B0 = !z ? B0(str4) : 0;
                if (B0 == 0) {
                    B0 = A0(str4);
                }
            } else {
                B0 = 0;
            }
            if (B0 != 0) {
                E(bundle, B0, str4, B0 == 3 ? str4 : null);
                bundle.remove(str4);
            } else {
                if (W(bundle.get(str4))) {
                    i().f12815y.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
                    u10 = 22;
                    str3 = str4;
                } else {
                    str3 = str4;
                    u10 = u(str, str4, bundle.get(str4), bundle, list, z, false);
                }
                if (u10 != 0 && !"_ev".equals(str3)) {
                    E(bundle, u10, str3, bundle.get(str3));
                    bundle.remove(str3);
                } else if (y0(str3) && !c0(str3, q8.b.C)) {
                    int i12 = i11 + 1;
                    if (!f0(231100000)) {
                        i().f12813v.a(l().b(str), l().a(bundle), "Item array not supported on client's version of Google Play Services (Android Only)");
                        l0(23, bundle);
                        bundle.remove(str3);
                    } else if (i12 > i10) {
                        bc.a();
                        if (j().A(null, d0.B0)) {
                            i().f12813v.a(l().b(str), l().a(bundle), "Item can't contain more than " + i10 + " item-scoped custom params");
                            l0(28, bundle);
                            bundle.remove(str3);
                        } else {
                            i().f12813v.a(l().b(str), l().a(bundle), "Item cannot contain custom parameters");
                            l0(23, bundle);
                            bundle.remove(str3);
                        }
                    }
                    i11 = i12;
                }
            }
        }
    }

    public final void Q(u4 u4Var, int i10) {
        Iterator it = new TreeSet(u4Var.f12917d.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (y0(str) && (i11 = i11 + 1) > i10) {
                i().f12813v.a(l().b(u4Var.f12914a), l().a(u4Var.f12917d), "Event can't contain more than " + i10 + " params");
                l0(5, u4Var.f12917d);
                u4Var.f12917d.remove(str);
            }
        }
    }

    public final void T(Parcelable[] parcelableArr, int i10, boolean z) {
        l5.m.i(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str = (String) it.next();
                if (y0(str) && !c0(str, q8.b.C) && (i11 = i11 + 1) > i10) {
                    if (z) {
                        i().f12813v.a(l().f(str), l().a(bundle), "Param can't contain more than " + i10 + " item-scoped custom parameters");
                        l0(28, bundle);
                    } else {
                        i().f12813v.a(l().f(str), l().a(bundle), "Param cannot contain item-scoped custom parameters");
                        l0(23, bundle);
                    }
                    bundle.remove(str);
                }
            }
        }
    }

    @SuppressLint({"ApplySharedPref"})
    public final boolean X(String str, double d10) {
        try {
            SharedPreferences.Editor edit = a().getSharedPreferences("google.analytics.deferred.deeplink.prefs", 0).edit();
            edit.putString("deeplink", str);
            edit.putLong("timestamp", Double.doubleToRawLongBits(d10));
            return edit.commit();
        } catch (RuntimeException e10) {
            i().f12811t.b(e10, "Failed to persist Deferred Deep Link. exception");
            return false;
        }
    }

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

    public final boolean Z(String str, String str2) {
        if (!TextUtils.isEmpty(str)) {
            l5.m.i(str);
            if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                return true;
            }
            if (TextUtils.isEmpty(((w5) this.f13764o).f12963o)) {
                i().f12813v.b(q4.u(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
            }
            return false;
        }
        if (TextUtils.isEmpty(str2)) {
            if (TextUtils.isEmpty(((w5) this.f13764o).f12963o)) {
                i().f12813v.c("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
        l5.m.i(str2);
        if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
            return true;
        }
        i().f12813v.b(q4.u(str2), "Invalid admob_app_id. Analytics disabled.");
        return false;
    }

    public final boolean a0(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 valueOf = String.valueOf(obj);
            if (valueOf.codePointCount(0, valueOf.length()) > i10) {
                i().f12815y.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(valueOf.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean d0(String str, String[] strArr, String[] strArr2, String str2) {
        boolean z;
        if (str2 == null) {
            i().f12813v.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f12929w;
        int i10 = 0;
        while (true) {
            if (i10 >= 3) {
                z = false;
                break;
            }
            if (str2.startsWith(strArr3[i10])) {
                z = true;
                break;
            }
            i10++;
        }
        if (z) {
            i().f12813v.a(str, str2, "Name starts with reserved prefix. Type, name");
            return false;
        }
        if (strArr == null || !c0(str2, strArr) || (strArr2 != null && c0(str2, strArr2))) {
            return true;
        }
        i().f12813v.a(str, str2, "Name is reserved. Type, name");
        return false;
    }

    public final boolean f0(int i10) {
        Boolean bool = ((w5) this.f13764o).t().f12346s;
        if (v0() < i10 / 1000) {
            return (bool == null || bool.booleanValue()) ? false : true;
        }
        return true;
    }

    public final void h0() {
        o();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                i().f12814w.c("Utils falling back to Random for random id");
            }
        }
        this.f12930r.set(nextLong);
    }

    public final int i0(String str) {
        if (!n0("user property", str)) {
            return 6;
        }
        if (d0("user property", g6.a1.f7246s, null, str)) {
            return !Y("user property", 24, str) ? 6 : 0;
        }
        return 15;
    }

    public final Object j0(Object obj, String str) {
        if ("_ev".equals(str)) {
            return B(j().u(null, false), obj, true, true);
        }
        return B(w0(str) ? j().u(null, false) : j().r(null, false), obj, false, true);
    }

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

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

    public final Object p0(Object obj, String str) {
        return "_ldl".equals(str) ? B(C0(str), obj, true, false) : B(C0(str), obj, false, false);
    }

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

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

    public final boolean r0(String str, String str2) {
        kd.a();
        if (j().A(null, d0.f12466u0) && !TextUtils.isEmpty(str2)) {
            return true;
        }
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        return j().e("debug.firebase.analytics.app", "").equals(str);
    }

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

    public final boolean s0(String str) {
        o();
        if (r5.c.a(a()).f12323a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        i().A.b(str, "Permission not granted");
        return false;
    }

    public final int t(String str) {
        if (!n0("event", str)) {
            return 2;
        }
        if (d0("event", a.a.f14n0, a.a.f16o0, str)) {
            return !Y("event", 40, str) ? 2 : 0;
        }
        return 13;
    }

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

    public final int v0() {
        if (this.f12934v == null) {
            g5.f fVar = g5.f.f7198b;
            Context a10 = a();
            fVar.getClass();
            AtomicBoolean atomicBoolean = g5.j.f7206a;
            int i10 = 0;
            try {
                i10 = a10.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
            } catch (PackageManager.NameNotFoundException unused) {
                Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
            }
            this.f12934v = Integer.valueOf(i10 / 1000);
        }
        return this.f12934v.intValue();
    }

    public final Bundle x(Uri uri, boolean z, boolean z10) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        String str9;
        String str10;
        if (uri == null) {
            return 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 = z10 ? uri.getQueryParameter("gbraid") : null;
                str6 = uri.getQueryParameter("utm_id");
                str7 = uri.getQueryParameter("dclid");
                str8 = uri.getQueryParameter("srsltid");
                str9 = z ? uri.getQueryParameter("sfmc_id") : null;
            } else {
                str = null;
                str2 = null;
                str3 = null;
                str4 = null;
                str5 = null;
                str6 = null;
                str7 = null;
                str8 = null;
                str9 = null;
            }
            if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && ((!z10 || TextUtils.isEmpty(str5)) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && TextUtils.isEmpty(str8) && (!z || TextUtils.isEmpty(str9)))) {
                return null;
            }
            Bundle bundle = new Bundle();
            if (TextUtils.isEmpty(str)) {
                str10 = "sfmc_id";
            } else {
                str10 = "sfmc_id";
                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);
            }
            if (z10 && !TextUtils.isEmpty(str5)) {
                bundle.putString("gbraid", str5);
            }
            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(str6)) {
                bundle.putString("campaign_id", str6);
            }
            if (!TextUtils.isEmpty(str7)) {
                bundle.putString("dclid", str7);
            }
            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(str8)) {
                bundle.putString("srsltid", str8);
            }
            if (z && !TextUtils.isEmpty(str9)) {
                bundle.putString(str10, str9);
            }
            return bundle;
        } catch (UnsupportedOperationException e10) {
            i().f12814w.b(e10, "Install referrer url isn't a hierarchical URI");
            return null;
        }
    }

    public final long x0() {
        throw new UnsupportedOperationException("Method not decompiled: r6.u9.x0():long");
    }

    public final Bundle y(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object j02 = j0(bundle.get(str), str);
                if (j02 == null) {
                    i().f12815y.b(l().f(str), "Param value can't be null");
                } else {
                    H(bundle2, str, j02);
                }
            }
        }
        return bundle2;
    }

    public final Bundle z(String str, Bundle bundle, List list, boolean z) {
        int B0;
        boolean c02 = c0(str, a.a.f19q0);
        if (bundle == null) {
            return null;
        }
        Bundle bundle2 = new Bundle(bundle);
        int i10 = j().n().f0(201500000) ? 100 : 25;
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str2 = (String) it.next();
            if (list == null || !list.contains(str2)) {
                B0 = !z ? B0(str2) : 0;
                if (B0 == 0) {
                    B0 = A0(str2);
                }
            } else {
                B0 = 0;
            }
            if (B0 != 0) {
                E(bundle2, B0, str2, B0 == 3 ? str2 : null);
                bundle2.remove(str2);
            } else {
                int u10 = u(str, str2, bundle.get(str2), bundle2, list, z, c02);
                if (u10 == 17) {
                    E(bundle2, u10, str2, Boolean.FALSE);
                } else if (u10 != 0 && !"_ev".equals(str2)) {
                    E(bundle2, u10, u10 == 21 ? str : str2, bundle.get(str2));
                    bundle2.remove(str2);
                }
                if (y0(str2)) {
                    int i12 = i11 + 1;
                    if (i12 > i10) {
                        i().f12813v.a(l().b(str), l().a(bundle), "Event can't contain more than " + i10 + " params");
                        l0(5, bundle2);
                        bundle2.remove(str2);
                    }
                    i11 = i12;
                }
            }
        }
        return bundle2;
    }

    public final boolean z0(String str) {
        List<ResolveInfo> queryIntentActivities;
        return (TextUtils.isEmpty(str) || (queryIntentActivities = a().getPackageManager().queryIntentActivities(new Intent("android.intent.action.VIEW", Uri.parse(str)), 0)) == null || queryIntentActivities.isEmpty()) ? false : true;
    }
}