FlixOlé v4.4.0版本的 MD5 值为:50e7f767ca3e8715936523e9ef089581

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


package i.d.a.d.k.b;

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.swift.sandhook.utils.FileUtils;
import i.d.a.d.j.j.ed;
import java.io.ByteArrayInputStream;
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.Arrays;
import java.util.List;
import java.util.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
public final class ia extends w5 {
    public static final String[] f6750g = {"firebase_", "google_", "ga_"};
    public static final String[] f6751h = {"_err"};
    public static final int f6752i = 0;
    public SecureRandom c;
    public final AtomicLong d;
    public int e;
    public Integer f6753f;

    public ia(b5 b5Var) {
        super(b5Var);
        this.f6753f = null;
        this.d = new AtomicLong(0L);
    }

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

    public static boolean W(String str) {
        i.d.a.d.f.q.q.g(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean X(Context context) {
        ActivityInfo receiverInfo;
        i.d.a.d.f.q.q.k(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 Y(Context context, boolean z) {
        i.d.a.d.f.q.q.k(context);
        return i0(context, Build.VERSION.SDK_INT >= 24 ? "com.google.android.gms.measurement.AppMeasurementJobService" : "com.google.android.gms.measurement.AppMeasurementService");
    }

    public static boolean Z(String str, String str2) {
        if (str == null && str2 == null) {
            return true;
        }
        if (str == null) {
            return false;
        }
        return str.equals(str2);
    }

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

    public static final boolean d0(Bundle bundle, int i2) {
        if (bundle.getLong("_err") == 0) {
            bundle.putLong("_err", i2);
            return true;
        }
        return false;
    }

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

    public static boolean h0(String str, String[] strArr) {
        i.d.a.d.f.q.q.k(strArr);
        for (String str2 : strArr) {
            if (Z(str, str2)) {
                return true;
            }
        }
        return false;
    }

    public static boolean i0(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 q0(byte[] bArr) {
        i.d.a.d.f.q.q.k(bArr);
        int length = bArr.length;
        int i2 = 0;
        i.d.a.d.f.q.q.n(length > 0);
        long j2 = 0;
        for (int i3 = length - 1; i3 >= 0 && i3 >= bArr.length - 8; i3--) {
            j2 += (bArr[i3] & 255) << i2;
            i2 += 8;
        }
        return j2;
    }

    public static MessageDigest s() {
        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<Bundle> u(List<c> list) {
        if (list == null) {
            return new ArrayList<>(0);
        }
        ArrayList<Bundle> arrayList = new ArrayList<>(list.size());
        for (c cVar : list) {
            Bundle bundle = new Bundle();
            bundle.putString("app_id", cVar.f6609n);
            bundle.putString("origin", cVar.f6610o);
            bundle.putLong("creation_timestamp", cVar.f6612q);
            bundle.putString("name", cVar.f6611p.f6659o);
            Object R = cVar.f6611p.R();
            i.d.a.d.f.q.q.k(R);
            y5.b(bundle, R);
            bundle.putBoolean("active", cVar.r);
            String str = cVar.s;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            u uVar = cVar.t;
            if (uVar != null) {
                bundle.putString("timed_out_event_name", uVar.f6930n);
                s sVar = uVar.f6931o;
                if (sVar != null) {
                    bundle.putBundle("timed_out_event_params", sVar.e0());
                }
            }
            bundle.putLong("trigger_timeout", cVar.u);
            u uVar2 = cVar.v;
            if (uVar2 != null) {
                bundle.putString("triggered_event_name", uVar2.f6930n);
                s sVar2 = uVar2.f6931o;
                if (sVar2 != null) {
                    bundle.putBundle("triggered_event_params", sVar2.e0());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f6611p.f6660p);
            bundle.putLong("time_to_live", cVar.w);
            u uVar3 = cVar.x;
            if (uVar3 != null) {
                bundle.putString("expired_event_name", uVar3.f6930n);
                s sVar3 = uVar3.f6931o;
                if (sVar3 != null) {
                    bundle.putBundle("expired_event_params", sVar3.e0());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

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

    public final void A(ha haVar, String str, int i2, String str2, String str3, int i3) {
        Bundle bundle = new Bundle();
        d0(bundle, i2);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i2 == 6 || i2 == 7 || i2 == 2) {
            bundle.putLong("_el", i3);
        }
        haVar.a(str, "_err", bundle);
    }

    public final void B(Bundle bundle, String str, Object obj) {
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
        } else if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
        } else if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
        } else if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            this.a.b().x().c("Not putting event parameter. Invalid value type. name, type", this.a.D().e(str), obj != null ? obj.getClass().getSimpleName() : null);
        }
    }

    public final void C(i.d.a.d.j.j.i1 i1Var, boolean z) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(i.f.a.h.b.d.r.e, z);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning boolean value to wrapper", e);
        }
    }

    public final void D(i.d.a.d.j.j.i1 i1Var, ArrayList<Bundle> arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList(i.f.a.h.b.d.r.e, arrayList);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning bundle list to wrapper", e);
        }
    }

    public final void E(i.d.a.d.j.j.i1 i1Var, Bundle bundle) {
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning bundle value to wrapper", e);
        }
    }

    public final void F(i.d.a.d.j.j.i1 i1Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray(i.f.a.h.b.d.r.e, bArr);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning byte array to wrapper", e);
        }
    }

    public final void G(i.d.a.d.j.j.i1 i1Var, int i2) {
        Bundle bundle = new Bundle();
        bundle.putInt(i.f.a.h.b.d.r.e, i2);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning int value to wrapper", e);
        }
    }

    public final void H(i.d.a.d.j.j.i1 i1Var, long j2) {
        Bundle bundle = new Bundle();
        bundle.putLong(i.f.a.h.b.d.r.e, j2);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning long value to wrapper", e);
        }
    }

    public final void I(i.d.a.d.j.j.i1 i1Var, String str) {
        Bundle bundle = new Bundle();
        bundle.putString(i.f.a.h.b.d.r.e, str);
        try {
            i1Var.A(bundle);
        } catch (RemoteException e) {
            this.a.b().w().b("Error returning string value to wrapper", e);
        }
    }

    public final void J(String str, String str2, String str3, Bundle bundle, List<String> list, boolean z) {
        int i2;
        String str4;
        int O;
        if (bundle == null) {
            return;
        }
        this.a.z();
        int i3 = 0;
        for (String str5 : new TreeSet(bundle.keySet())) {
            if (list == null || !list.contains(str5)) {
                int m0 = !z ? m0(str5) : 0;
                if (m0 == 0) {
                    m0 = l0(str5);
                }
                i2 = m0;
            } else {
                i2 = 0;
            }
            if (i2 != 0) {
                w(bundle, i2, str5, str5, i2 == 3 ? str5 : null);
                bundle.remove(str5);
            } else {
                if (T(bundle.get(str5))) {
                    this.a.b().x().d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str2, str3, str5);
                    str4 = str5;
                    O = 22;
                } else {
                    str4 = str5;
                    O = O(str, str2, str5, bundle.get(str5), bundle, list, z, false);
                }
                if (O != 0 && !"_ev".equals(str4)) {
                    w(bundle, O, str4, str4, bundle.get(str4));
                } else if (W(str4) && !h0(str4, a6.d) && (i3 = i3 + 1) > 0) {
                    this.a.b().s().c("Item cannot contain custom parameters", this.a.D().d(str2), this.a.D().b(bundle));
                    d0(bundle, 23);
                }
                bundle.remove(str4);
            }
        }
    }

    public final boolean K(String str, String str2, String str3) {
        if (!TextUtils.isEmpty(str)) {
            if (e0(str)) {
                return true;
            }
            if (this.a.q()) {
                this.a.b().s().b("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", q3.z(str));
            }
            return false;
        }
        ed.b();
        if (!this.a.z().B(null, c3.d0) || TextUtils.isEmpty(str3)) {
            if (TextUtils.isEmpty(str2)) {
                if (this.a.q()) {
                    this.a.b().s().a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
                }
                return false;
            } else if (e0(str2)) {
                return true;
            } else {
                this.a.b().s().b("Invalid admob_app_id. Analytics disabled.", q3.z(str2));
                return false;
            }
        }
        return true;
    }

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

    public final boolean M(String str, String[] strArr, String[] strArr2, String str2) {
        if (str2 == null) {
            this.a.b().s().b("Name is required and can't be null. Type", str);
            return false;
        }
        i.d.a.d.f.q.q.k(str2);
        String[] strArr3 = f6750g;
        for (int i2 = 0; i2 < 3; i2++) {
            if (str2.startsWith(strArr3[i2])) {
                this.a.b().s().c("Name starts with reserved prefix. Type, name", str, str2);
                return false;
            }
        }
        if (strArr == null || !h0(str2, strArr)) {
            return true;
        }
        if (strArr2 == null || !h0(str2, strArr2)) {
            this.a.b().s().c("Name is reserved. Type, name", str, str2);
            return false;
        }
        return true;
    }

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

    public final int O(String str, String str2, String str3, Object obj, Bundle bundle, List<String> list, boolean z, boolean z2) {
        int i2;
        int i3;
        o3 x;
        String str4;
        String str5;
        Parcelable[] parcelableArr;
        int size;
        h();
        if (T(obj)) {
            if (!z2) {
                return 21;
            }
            if (!h0(str3, a6.c)) {
                return 20;
            }
            w8 L = this.a.L();
            L.h();
            L.i();
            if (L.B() && L.a.N().o0() < 200900) {
                return 25;
            }
            this.a.z();
            boolean z3 = obj instanceof Parcelable[];
            if (z3) {
                size = ((Parcelable[]) obj).length;
            } else if (obj instanceof ArrayList) {
                size = ((ArrayList) obj).size();
            }
            if (size > 200) {
                this.a.b().x().d("Parameter array is too long; discarded. Value kind, name, array length", "param", str3, Integer.valueOf(size));
                this.a.z();
                if (z3) {
                    Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                    if (parcelableArr2.length > 200) {
                        bundle.putParcelableArray(str3, (Parcelable[]) Arrays.copyOf(parcelableArr2, 200));
                    }
                } else if (obj instanceof ArrayList) {
                    ArrayList arrayList = (ArrayList) obj;
                    if (arrayList.size() > 200) {
                        bundle.putParcelableArrayList(str3, new ArrayList<>(arrayList.subList(0, 200)));
                    }
                }
                i2 = 17;
                if ((this.a.z().B(str, c3.S) || !V(str2)) && !V(str3)) {
                    this.a.z();
                    i3 = 100;
                } else {
                    this.a.z();
                    i3 = FileUtils.FileMode.MODE_IRUSR;
                }
                if (N("param", str3, i3, obj)) {
                    if (z2) {
                        if (obj instanceof Bundle) {
                            J(str, str2, str3, (Bundle) obj, list, z);
                        } else if (obj instanceof Parcelable[]) {
                            for (Parcelable parcelable : (Parcelable[]) obj) {
                                if (!(parcelable instanceof Bundle)) {
                                    x = this.a.b().x();
                                    str4 = parcelable.getClass();
                                    str5 = "All Parcelable[] elements must be of type Bundle. Value type, name";
                                    x.c(str5, str4, str3);
                                    return 4;
                                }
                                J(str, str2, str3, (Bundle) parcelable, list, z);
                            }
                        } else if (!(obj instanceof ArrayList)) {
                            return 4;
                        } else {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            for (int i4 = 0; i4 < size2; i4++) {
                                Object obj2 = arrayList2.get(i4);
                                if (!(obj2 instanceof Bundle)) {
                                    x = this.a.b().x();
                                    str4 = obj2 != null ? obj2.getClass() : "null";
                                    str5 = "All ArrayList elements must be of type Bundle. Value type, name";
                                    x.c(str5, str4, str3);
                                    return 4;
                                }
                                J(str, str2, str3, (Bundle) obj2, list, z);
                            }
                        }
                        return i2;
                    }
                    return 4;
                }
                return i2;
            }
        }
        i2 = 0;
        if (this.a.z().B(str, c3.S)) {
        }
        this.a.z();
        i3 = 100;
        if (N("param", str3, i3, obj)) {
        }
    }

    public final boolean P(String str, String str2) {
        if (str2 == null) {
            this.a.b().s().b("Name is required and can't be null. Type", str);
            return false;
        } else if (str2.length() == 0) {
            this.a.b().s().b("Name is required and can't be empty. Type", str);
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                if (codePointAt != 95) {
                    this.a.b().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.a.b().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 Q(String str, String str2) {
        if (str2 == null) {
            this.a.b().s().b("Name is required and can't be null. Type", str);
            return false;
        } else if (str2.length() == 0) {
            this.a.b().s().b("Name is required and can't be empty. Type", str);
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                this.a.b().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.a.b().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 R(String str) {
        h();
        if (i.d.a.d.f.u.c.a(this.a.f()).a(str) == 0) {
            return true;
        }
        this.a.b().q().b("Permission not granted", str);
        return false;
    }

    public final boolean S(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String u = this.a.z().u();
        this.a.d();
        return u.equals(str);
    }

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

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

    public final boolean b0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            i.d.a.d.f.q.q.k(str);
            return !str.equals(str2);
        } else if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        } else if (isEmpty) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        } else if (TextUtils.isEmpty(str4)) {
            return false;
        } else {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
    }

    public final byte[] c0(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 f0(String str) {
        if ("_ldl".equals(str)) {
            this.a.z();
            return FileUtils.FileMode.MODE_ISUID;
        } else if ("_id".equals(str)) {
            this.a.z();
            return FileUtils.FileMode.MODE_IRUSR;
        } else if (this.a.z().B(null, c3.c0) && "_lgclid".equals(str)) {
            this.a.z();
            return 100;
        } else {
            this.a.z();
            return 36;
        }
    }

    public final Object g0(int i2, Object obj, boolean z, boolean z2) {
        Parcelable[] parcelableArr;
        if (obj == null) {
            return null;
        }
        if ((obj instanceof Long) || (obj instanceof Double)) {
            return obj;
        }
        if (obj instanceof Integer) {
            return Long.valueOf(((Integer) obj).intValue());
        }
        if (obj instanceof Byte) {
            return Long.valueOf(((Byte) obj).byteValue());
        }
        if (obj instanceof Short) {
            return Long.valueOf(((Short) obj).shortValue());
        }
        if (obj instanceof Boolean) {
            return Long.valueOf(true != ((Boolean) obj).booleanValue() ? 0L : 1L);
        } else if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        } else {
            if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
                return q(obj.toString(), i2, z);
            }
            if (z2 && ((obj instanceof Bundle[]) || (obj instanceof Parcelable[]))) {
                ArrayList arrayList = new ArrayList();
                for (Parcelable parcelable : (Parcelable[]) obj) {
                    if (parcelable instanceof Bundle) {
                        Bundle u0 = u0((Bundle) parcelable);
                        if (!u0.isEmpty()) {
                            arrayList.add(u0);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return null;
        }
    }

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

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

    public final int j0(String str, Object obj) {
        int f0;
        String str2;
        if ("_ldl".equals(str)) {
            f0 = f0(str);
            str2 = "user property referrer";
        } else {
            f0 = f0(str);
            str2 = "user property";
        }
        return N(str2, str, f0, obj) ? 0 : 7;
    }

    public final int k0(String str) {
        if (P("event", str)) {
            if (M("event", z5.a, z5.b, str)) {
                this.a.z();
                return !L("event", 40, str) ? 2 : 0;
            }
            return 13;
        }
        return 2;
    }

    public final int l0(String str) {
        if (P("event param", str)) {
            if (M("event param", null, null, str)) {
                this.a.z();
                return !L("event param", 40, str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

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

    public final int n0(String str) {
        if (P("user property", str)) {
            if (M("user property", b6.a, null, str)) {
                this.a.z();
                return !L("user property", 24, str) ? 6 : 0;
            }
            return 15;
        }
        return 6;
    }

    public final Object o(String str, Object obj) {
        boolean equals = "_ev".equals(str);
        int i2 = FileUtils.FileMode.MODE_IRUSR;
        if (equals) {
            this.a.z();
            return g0(FileUtils.FileMode.MODE_IRUSR, obj, true, true);
        }
        if (V(str)) {
            this.a.z();
        } else {
            this.a.z();
            i2 = 100;
        }
        return g0(i2, obj, false, true);
    }

    public final int o0() {
        if (this.f6753f == null) {
            this.f6753f = Integer.valueOf(i.d.a.d.f.f.h().b(this.a.f()) / i.f.a.e.f.q0.c.f8511o);
        }
        return this.f6753f.intValue();
    }

    public final Object p(String str, Object obj) {
        boolean equals = "_ldl".equals(str);
        int f0 = f0(str);
        return equals ? g0(f0, obj, true, false) : g0(f0, obj, false, false);
    }

    public final int p0(int i2) {
        return i.d.a.d.f.f.h().j(this.a.f(), i.d.a.d.f.j.a);
    }

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

    public final URL r(long j2, String str, String str2, long j3) {
        try {
            i.d.a.d.f.q.q.g(str2);
            i.d.a.d.f.q.q.g(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", 46000L, Integer.valueOf(o0())), str2, str, Long.valueOf(j3));
            if (str.equals(this.a.z().v())) {
                format = format.concat("&ddl_test=1");
            }
            return new URL(format);
        } catch (IllegalArgumentException | MalformedURLException e) {
            this.a.b().r().b("Failed to create BOW URL for Deferred Deep Link. exception", e.getMessage());
            return null;
        }
    }

    public final long r0() {
        int i2 = (this.d.get() > 0L ? 1 : (this.d.get() == 0L ? 0 : -1));
        synchronized (this.d) {
            if (i2 != 0) {
                this.d.compareAndSet(-1L, 1L);
                return this.d.getAndIncrement();
            }
            long nextLong = new Random(System.nanoTime() ^ this.a.c().a()).nextLong();
            int i3 = this.e + 1;
            this.e = i3;
            return nextLong + i3;
        }
    }

    public final long s0(long j2, long j3) {
        return (j2 + (j3 * 60000)) / 86400000;
    }

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

    public final Bundle t0(Uri uri) {
        String str;
        String str2;
        String str3;
        String str4;
        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");
                } else {
                    str = null;
                    str2 = null;
                    str3 = null;
                    str4 = null;
                }
                if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4)) {
                    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);
                }
                return bundle;
            } catch (UnsupportedOperationException e) {
                this.a.b().w().b("Install referrer url isn't a hierarchical URI", e);
            }
        }
        return null;
    }

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

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

    public final Bundle v0(String str, String str2, Bundle bundle, List<String> list, boolean z) {
        int i2;
        int i3;
        String str3;
        boolean h0 = h0(str2, z5.d);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            int m2 = this.a.z().m();
            int i4 = 0;
            for (String str4 : new TreeSet(bundle.keySet())) {
                if (list == null || !list.contains(str4)) {
                    int m0 = !z ? m0(str4) : 0;
                    if (m0 == 0) {
                        m0 = l0(str4);
                    }
                    i2 = m0;
                } else {
                    i2 = 0;
                }
                if (i2 != 0) {
                    w(bundle2, i2, str4, str4, i2 == 3 ? str4 : null);
                    bundle2.remove(str4);
                    i3 = m2;
                } else {
                    i3 = m2;
                    int O = O(str, str2, str4, bundle.get(str4), bundle2, list, z, h0);
                    if (O == 17) {
                        w(bundle2, 17, str4, str4, Boolean.FALSE);
                    } else if (O != 0) {
                        str3 = str4;
                        if (!"_ev".equals(str3)) {
                            w(bundle2, O, O == 21 ? str2 : str3, str3, bundle.get(str3));
                            bundle2.remove(str3);
                        }
                        if (W(str3)) {
                            int i5 = i4 + 1;
                            if (i5 > i3) {
                                StringBuilder sb = new StringBuilder(48);
                                sb.append("Event can't contain more than ");
                                sb.append(i3);
                                sb.append(" params");
                                this.a.b().s().c(sb.toString(), this.a.D().d(str2), this.a.D().b(bundle));
                                d0(bundle2, 5);
                                bundle2.remove(str3);
                            }
                            i4 = i5;
                        }
                    }
                    str3 = str4;
                    if (W(str3)) {
                    }
                }
                m2 = i3;
            }
            return bundle2;
        }
        return null;
    }

    public final void w(Bundle bundle, int i2, String str, String str2, Object obj) {
        if (d0(bundle, i2)) {
            this.a.z();
            bundle.putString("_ev", q(str, 40, true));
            if (obj != null) {
                i.d.a.d.f.q.q.k(bundle);
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final u w0(String str, String str2, Bundle bundle, String str3, long j2, boolean z, boolean z2) {
        if (TextUtils.isEmpty(str2)) {
            return null;
        }
        if (k0(str2) != 0) {
            this.a.b().r().b("Invalid conditional property event name", this.a.D().f(str2));
            throw new IllegalArgumentException();
        }
        Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
        bundle2.putString("_o", str3);
        Bundle v0 = v0(str, str2, bundle2, i.d.a.d.f.t.f.b("_o"), true);
        if (z) {
            v0 = u0(v0);
        }
        i.d.a.d.f.q.q.k(v0);
        return new u(str2, new s(v0), str3, j2);
    }

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

    public final void z(r3 r3Var, int i2) {
        int i3 = 0;
        for (String str : new TreeSet(r3Var.d.keySet())) {
            if (W(str) && (i3 = i3 + 1) > i2) {
                StringBuilder sb = new StringBuilder(48);
                sb.append("Event can't contain more than ");
                sb.append(i2);
                sb.append(" params");
                this.a.b().s().c(sb.toString(), this.a.D().d(r3Var.a), this.a.D().b(r3Var.d));
                d0(r3Var.d, 5);
                r3Var.d.remove(str);
            }
        }
    }
}