APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Соседи
版本号:3.1.3
包名称:by.imlab.sosedi.kupilka

MD5 校验值:52ffe34fa08a87a6cc4bc36d7eb3dad1

反编译源代码说明

j6.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package pg;

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 android.util.Log;
import com.google.android.gms.measurement.internal.zzac;
import com.google.android.gms.measurement.internal.zzau;
import com.google.android.gms.measurement.internal.zzaw;
import com.huawei.agconnect.exception.AGCServerException;
import com.huawei.hms.push.constant.RemoteMessageConst;
import com.huawei.hms.support.hianalytics.HiAnalyticsConstant;
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.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull;

public final class j6 extends w2 {

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

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

    public SecureRandom f28827j;

    public final AtomicLong f28828k;

    public int f28829l;

    public Integer f28830m;

    public j6(c2 c2Var) {
        super(c2Var);
        this.f28830m = null;
        this.f28828k = new AtomicLong(0L);
    }

    public static boolean P(Object obj) {
        if (!(obj instanceof Parcelable[]) && !(obj instanceof ArrayList) && !(obj instanceof Bundle)) {
            return false;
        }
        return true;
    }

    public static boolean R(String str) {
        if (!TextUtils.isEmpty(str) && str.startsWith("_")) {
            return true;
        }
        return false;
    }

    public static boolean S(String str) {
        kf.j.f(str);
        if (str.charAt(0) == '_' && !str.equals("_ep")) {
            return false;
        }
        return true;
    }

    public static boolean T(Context context) {
        ActivityInfo receiverInfo;
        kf.j.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 U(Context context) {
        ServiceInfo serviceInfo;
        ServiceInfo serviceInfo2;
        kf.j.i(context);
        if (Build.VERSION.SDK_INT >= 24) {
            try {
                PackageManager packageManager = context.getPackageManager();
                if (packageManager != null && (serviceInfo2 = packageManager.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementJobService"), 0)) != null) {
                    if (serviceInfo2.enabled) {
                        return true;
                    }
                }
            } catch (PackageManager.NameNotFoundException unused) {
            }
            return false;
        }
        try {
            PackageManager packageManager2 = context.getPackageManager();
            if (packageManager2 != null && (serviceInfo = packageManager2.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementService"), 0)) != null) {
                if (serviceInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused2) {
        }
        return false;
    }

    public static boolean V(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            kf.j.i(str);
            if (!str.equals(str2)) {
                return true;
            }
            return false;
        }
        if (isEmpty && isEmpty2) {
            if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                if (!str3.equals(str4)) {
                    return true;
                }
                return false;
            }
            if (!TextUtils.isEmpty(str4)) {
                return true;
            }
            return false;
        }
        if (!isEmpty) {
            if (TextUtils.isEmpty(str4)) {
                return false;
            }
            if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
                return true;
            }
            return false;
        }
        if (TextUtils.isEmpty(str3) || !str3.equals(str4)) {
            return true;
        }
        return false;
    }

    public static byte[] W(Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        Parcel obtain = Parcel.obtain();
        try {
            parcelable.writeToParcel(obtain, 0);
            return obtain.marshall();
        } finally {
            obtain.recycle();
        }
    }

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

    public static boolean a0(String str, String[] strArr) {
        boolean z10;
        kf.j.i(strArr);
        for (Object obj : strArr) {
            if (str != obj && (str == null || !str.equals(obj))) {
                z10 = false;
            } else {
                z10 = true;
            }
            if (z10) {
                return true;
            }
        }
        return false;
    }

    public static long h0(byte[] bArr) {
        boolean z10;
        kf.j.i(bArr);
        int length = bArr.length;
        int i10 = 0;
        if (length > 0) {
            z10 = true;
        } else {
            z10 = false;
        }
        kf.j.k(z10);
        long j10 = 0;
        for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
            j10 += (bArr[i11] & 255) << i10;
            i10 += 8;
        }
        return j10;
    }

    public static String n(int i10, String str, boolean z10) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) > i10) {
            if (!z10) {
                return null;
            }
            return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
        }
        return str;
    }

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

    public static ArrayList q(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            zzac zzacVar = (zzac) it.next();
            Bundle bundle = new Bundle();
            bundle.putString(HiAnalyticsConstant.BI_KEY_APP_ID, zzacVar.f8923a);
            bundle.putString("origin", zzacVar.f8924b);
            bundle.putLong("creation_timestamp", zzacVar.f8926d);
            bundle.putString("name", zzacVar.f8925c.f8940b);
            Object i10 = zzacVar.f8925c.i();
            kf.j.i(i10);
            com.google.gson.internal.b.o(bundle, i10);
            bundle.putBoolean("active", zzacVar.f8927e);
            String str = zzacVar.f8928f;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            zzaw zzawVar = zzacVar.f8929g;
            if (zzawVar != null) {
                bundle.putString("timed_out_event_name", zzawVar.f8935a);
                zzau zzauVar = zzawVar.f8936b;
                if (zzauVar != null) {
                    bundle.putBundle("timed_out_event_params", zzauVar.i());
                }
            }
            bundle.putLong("trigger_timeout", zzacVar.f8930h);
            zzaw zzawVar2 = zzacVar.f8931i;
            if (zzawVar2 != null) {
                bundle.putString("triggered_event_name", zzawVar2.f8935a);
                zzau zzauVar2 = zzawVar2.f8936b;
                if (zzauVar2 != null) {
                    bundle.putBundle("triggered_event_params", zzauVar2.i());
                }
            }
            bundle.putLong("triggered_timestamp", zzacVar.f8925c.f8941c);
            bundle.putLong("time_to_live", zzacVar.f8932j);
            zzaw zzawVar3 = zzacVar.f8933k;
            if (zzawVar3 != null) {
                bundle.putString("expired_event_name", zzawVar3.f8935a);
                zzau zzauVar3 = zzawVar3.f8936b;
                if (zzauVar3 != null) {
                    bundle.putBundle("expired_event_params", zzauVar3.i());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public static void t(e4 e4Var, Bundle bundle, boolean z10) {
        if (bundle != null && e4Var != null) {
            if (bundle.containsKey("_sc") && !z10) {
                z10 = false;
            } else {
                String str = e4Var.f28618a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = e4Var.f28619b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", e4Var.f28620c);
                return;
            }
        }
        if (bundle != null && e4Var == null && z10) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void w(i6 i6Var, String str, int i10, String str2, String str3, int i11) {
        Bundle bundle = new Bundle();
        X(i10, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i10 == 6 || i10 == 7 || i10 == 2) {
            bundle.putLong("_el", i11);
        }
        i6Var.a(str, bundle);
    }

    public final void A(cg.d1 d1Var, Bundle bundle) {
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void B(cg.d1 d1Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning byte array to wrapper");
        }
    }

    public final void C(cg.d1 d1Var, int i10) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i10);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning int value to wrapper");
        }
    }

    public final void D(cg.d1 d1Var, long j10) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j10);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning long value to wrapper");
        }
    }

    public final void E(String str, cg.d1 d1Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning string value to wrapper");
        }
    }

    public final void F(String str, String str2, Bundle bundle, List list, boolean z10) {
        int i10;
        String str3;
        int J;
        if (bundle == null) {
            return;
        }
        this.f29102h.getClass();
        Iterator it = new TreeSet(bundle.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str4 = (String) it.next();
            if (list != null && list.contains(str4)) {
                i10 = 0;
            } else {
                if (!z10) {
                    i10 = e0(str4);
                } else {
                    i10 = 0;
                }
                if (i10 == 0) {
                    i10 = d0(str4);
                }
            }
            if (i10 != 0) {
                if (i10 == 3) {
                    str3 = str4;
                } else {
                    str3 = null;
                }
                s(bundle, i10, str4, str3);
                bundle.remove(str4);
            } else {
                if (P(bundle.get(str4))) {
                    this.f29102h.b().f29088r.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
                    J = 22;
                } else {
                    J = J(str, str4, bundle.get(str4), bundle, list, z10, false);
                }
                if (J != 0 && !"_ev".equals(str4)) {
                    s(bundle, J, str4, bundle.get(str4));
                    bundle.remove(str4);
                } else if (S(str4) && !a0(str4, c2.i.f6845o) && (i11 = i11 + 1) > 0) {
                    this.f29102h.b().f29086o.c(this.f29102h.f28553t.d(str), this.f29102h.f28553t.b(bundle), "Item cannot contain custom parameters");
                    X(23, bundle);
                    bundle.remove(str4);
                }
            }
        }
    }

    public final boolean G(String str, String str2) {
        if (!TextUtils.isEmpty(str)) {
            kf.j.i(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                if (TextUtils.isEmpty(this.f29102h.f28543i)) {
                    this.f29102h.b().f29086o.b(v0.p(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        }
        if (!TextUtils.isEmpty(str2)) {
            kf.j.i(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                this.f29102h.b().f29086o.b(v0.p(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        }
        if (TextUtils.isEmpty(this.f29102h.f28543i)) {
            this.f29102h.b().f29086o.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
        }
        return false;
    }

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

    public final boolean I(String str, String[] strArr, String[] strArr2, String str2) {
        if (str2 == null) {
            this.f29102h.b().f29086o.b(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f28825n;
        for (int i10 = 0; i10 < 3; i10++) {
            if (str2.startsWith(strArr3[i10])) {
                this.f29102h.b().f29086o.c(str, str2, "Name starts with reserved prefix. Type, name");
                return false;
            }
        }
        if (strArr != null && a0(str2, strArr)) {
            if (strArr2 == null || !a0(str2, strArr2)) {
                this.f29102h.b().f29086o.c(str, str2, "Name is reserved. Type, name");
                return false;
            }
            return true;
        }
        return true;
    }

    public final int J(String str, String str2, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
        int i10;
        int i11;
        Object obj2;
        int size;
        g();
        int i12 = 0;
        if (P(obj)) {
            if (z11) {
                if (!a0(str2, c2.i.f6844n)) {
                    return 20;
                }
                a5 v10 = this.f29102h.v();
                v10.g();
                v10.h();
                if (v10.o() && v10.f29102h.x().g0() < 200900) {
                    return 25;
                }
                this.f29102h.getClass();
                boolean z12 = obj instanceof Parcelable[];
                if (z12) {
                    size = ((Parcelable[]) obj).length;
                } else if (obj instanceof ArrayList) {
                    size = ((ArrayList) obj).size();
                }
                if (size > 200) {
                    this.f29102h.b().f29088r.d("Parameter array is too long; discarded. Value kind, name, array length", RemoteMessageConst.MessageBody.PARAM, str2, Integer.valueOf(size));
                    this.f29102h.getClass();
                    if (z12) {
                        Parcelable[] parcelableArr = (Parcelable[]) obj;
                        if (parcelableArr.length > 200) {
                            bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr, AGCServerException.OK));
                        }
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList = (ArrayList) obj;
                        if (arrayList.size() > 200) {
                            bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, AGCServerException.OK)));
                        }
                    }
                    i10 = 17;
                    if (R(str) && !R(str2)) {
                        this.f29102h.getClass();
                        i11 = 100;
                    } else {
                        this.f29102h.getClass();
                        i11 = 256;
                    }
                    if (!L(RemoteMessageConst.MessageBody.PARAM, str2, i11, obj)) {
                        return i10;
                    }
                    if (z11) {
                        if (obj instanceof Bundle) {
                            F(str, str2, (Bundle) obj, list, z10);
                        } else if (obj instanceof Parcelable[]) {
                            Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                            int length = parcelableArr2.length;
                            while (i12 < length) {
                                Parcelable parcelable = parcelableArr2[i12];
                                if (!(parcelable instanceof Bundle)) {
                                    this.f29102h.b().f29088r.c(parcelable.getClass(), str2, "All Parcelable[] elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                F(str, str2, (Bundle) parcelable, list, z10);
                                i12++;
                            }
                        } else if (obj instanceof ArrayList) {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            while (i12 < size2) {
                                Object obj3 = arrayList2.get(i12);
                                if (!(obj3 instanceof Bundle)) {
                                    t0 t0Var = this.f29102h.b().f29088r;
                                    if (obj3 != null) {
                                        obj2 = obj3.getClass();
                                    } else {
                                        obj2 = "null";
                                    }
                                    t0Var.c(obj2, str2, "All ArrayList elements must be of type Bundle. Value type, name");
                                    return 4;
                                }
                                F(str, str2, (Bundle) obj3, list, z10);
                                i12++;
                            }
                        } else {
                            return 4;
                        }
                        return i10;
                    }
                    return 4;
                }
            } else {
                return 21;
            }
        }
        i10 = 0;
        if (R(str)) {
        }
        this.f29102h.getClass();
        i11 = 256;
        if (!L(RemoteMessageConst.MessageBody.PARAM, str2, i11, obj)) {
        }
    }

    public final void K() {
        g();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                this.f29102h.b().f29087p.a("Utils falling back to Random for random id");
            }
        }
        this.f28828k.set(nextLong);
    }

    public final boolean L(String str, String str2, int i10, Object obj) {
        if (obj != null && !(obj instanceof Long) && !(obj instanceof Float) && !(obj instanceof Integer) && !(obj instanceof Byte) && !(obj instanceof Short) && !(obj instanceof Boolean) && !(obj instanceof Double)) {
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                return false;
            }
            String obj2 = obj.toString();
            if (obj2.codePointCount(0, obj2.length()) > i10) {
                this.f29102h.b().f29088r.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

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

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

    public final boolean O(String str) {
        g();
        if (qf.d.a(this.f29102h.f28542h).f29869a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        this.f29102h.b().f29090t.b(str, "Permission not granted");
        return false;
    }

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

    public final int Y(String str) {
        if ("_ldl".equals(str)) {
            this.f29102h.getClass();
            return 2048;
        }
        if ("_id".equals(str)) {
            this.f29102h.getClass();
            return 256;
        }
        if ("_lgclid".equals(str)) {
            this.f29102h.getClass();
            return 100;
        }
        this.f29102h.getClass();
        return 36;
    }

    public final Object Z(int i10, Object obj, boolean z10, boolean z11) {
        long j10;
        if (obj == null) {
            return null;
        }
        if (!(obj instanceof Long) && !(obj instanceof Double)) {
            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) {
                if (true != ((Boolean) obj).booleanValue()) {
                    j10 = 0;
                } else {
                    j10 = 1;
                }
                return Long.valueOf(j10);
            }
            if (obj instanceof Float) {
                return Double.valueOf(((Float) obj).doubleValue());
            }
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                if (!z11 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
                    return null;
                }
                ArrayList arrayList = new ArrayList();
                for (Parcelable parcelable : (Parcelable[]) obj) {
                    if (parcelable instanceof Bundle) {
                        Bundle k02 = k0((Bundle) parcelable);
                        if (!k02.isEmpty()) {
                            arrayList.add(k02);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return n(i10, obj.toString(), z10);
        }
        return obj;
    }

    public final int b0(Object obj, String str) {
        boolean L;
        if ("_ldl".equals(str)) {
            L = L("user property referrer", str, Y(str), obj);
        } else {
            L = L("user property", str, Y(str), obj);
        }
        if (L) {
            return 0;
        }
        return 7;
    }

    public final int c0(String str) {
        if (!M("event", str)) {
            return 2;
        }
        if (!I("event", c2.g.f6830i, c2.g.f6831j, str)) {
            return 13;
        }
        this.f29102h.getClass();
        if (!H(40, "event", str)) {
            return 2;
        }
        return 0;
    }

    public final int d0(String str) {
        if (!M("event param", str)) {
            return 3;
        }
        if (!I("event param", null, null, str)) {
            return 14;
        }
        this.f29102h.getClass();
        if (!H(40, "event param", str)) {
            return 3;
        }
        return 0;
    }

    public final int e0(String str) {
        if (!N("event param", str)) {
            return 3;
        }
        if (!I("event param", null, null, str)) {
            return 14;
        }
        this.f29102h.getClass();
        if (!H(40, "event param", str)) {
            return 3;
        }
        return 0;
    }

    public final int f0(String str) {
        if (!M("user property", str)) {
            return 6;
        }
        if (!I("user property", c3.a.f6852n, null, str)) {
            return 15;
        }
        this.f29102h.getClass();
        if (!H(24, "user property", str)) {
            return 6;
        }
        return 0;
    }

    @EnsuresNonNull({"this.apkVersion"})
    public final int g0() {
        if (this.f28830m == null) {
            hf.d dVar = hf.d.f17498b;
            Context context = this.f29102h.f28542h;
            dVar.getClass();
            AtomicBoolean atomicBoolean = hf.f.f17500a;
            int i10 = 0;
            try {
                i10 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
            } catch (PackageManager.NameNotFoundException unused) {
                Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
            }
            this.f28830m = Integer.valueOf(i10 / 1000);
        }
        return this.f28830m.intValue();
    }

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

    public final long i0() {
        long andIncrement;
        long j10;
        if (this.f28828k.get() == 0) {
            synchronized (this.f28828k) {
                long nanoTime = System.nanoTime();
                this.f29102h.f28554u.getClass();
                long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
                int i10 = this.f28829l + 1;
                this.f28829l = i10;
                j10 = nextLong + i10;
            }
            return j10;
        }
        synchronized (this.f28828k) {
            this.f28828k.compareAndSet(-1L, 1L);
            andIncrement = this.f28828k.getAndIncrement();
        }
        return andIncrement;
    }

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

    public final Object k(Object obj, String str) {
        int i10 = 256;
        if ("_ev".equals(str)) {
            this.f29102h.getClass();
            return Z(256, obj, true, true);
        }
        if (R(str)) {
            this.f29102h.getClass();
        } else {
            this.f29102h.getClass();
            i10 = 100;
        }
        return Z(i10, obj, false, true);
    }

    public final Bundle k0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object k7 = k(bundle.get(str), str);
                if (k7 == null) {
                    this.f29102h.b().f29088r.b(this.f29102h.f28553t.e(str), "Param value can't be null");
                } else {
                    x(str, bundle2, k7);
                }
            }
        }
        return bundle2;
    }

    public final Object l(Object obj, String str) {
        if ("_ldl".equals(str)) {
            return Z(Y(str), obj, true, false);
        }
        return Z(Y(str), obj, false, false);
    }

    public final Bundle l0(String str, Bundle bundle, List list, boolean z10) {
        int i10;
        String str2;
        String str3;
        List list2 = list;
        boolean a02 = a0(str, c2.g.f6833l);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            int j10 = this.f29102h.f28548n.j();
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str4 = (String) it.next();
                if (list2 != null && list2.contains(str4)) {
                    i10 = 0;
                } else {
                    if (!z10) {
                        i10 = e0(str4);
                    } else {
                        i10 = 0;
                    }
                    if (i10 == 0) {
                        i10 = d0(str4);
                    }
                }
                if (i10 != 0) {
                    if (i10 == 3) {
                        str2 = str4;
                    } else {
                        str2 = null;
                    }
                    s(bundle2, i10, str4, str2);
                    bundle2.remove(str4);
                } else {
                    int J = J(str, str4, bundle.get(str4), bundle2, list, z10, a02);
                    if (J == 17) {
                        s(bundle2, 17, str4, Boolean.FALSE);
                    } else if (J != 0 && !"_ev".equals(str4)) {
                        if (J == 21) {
                            str3 = str;
                        } else {
                            str3 = str4;
                        }
                        s(bundle2, J, str3, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (S(str4)) {
                        int i12 = i11 + 1;
                        if (i12 > j10) {
                            StringBuilder b10 = androidx.activity.u.b("Event can't contain more than ", j10, " params");
                            this.f29102h.b().f29086o.c(this.f29102h.f28553t.d(str), this.f29102h.f28553t.b(bundle), b10.toString());
                            X(5, bundle2);
                            bundle2.remove(str4);
                        }
                        list2 = list;
                        i11 = i12;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

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

    public final zzaw m0(String str, Bundle bundle, String str2, long j10, boolean z10) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (c0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle l02 = l0(str, bundle2, Collections.singletonList("_o"), true);
            if (z10) {
                l02 = k0(l02);
            }
            kf.j.i(l02);
            return new zzaw(str, new zzau(l02), str2, j10);
        }
        this.f29102h.b().f29084m.b(this.f29102h.f28553t.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }

    @EnsuresNonNull({"this.secureRandom"})
    public final SecureRandom p() {
        g();
        if (this.f28827j == null) {
            this.f28827j = new SecureRandom();
        }
        return this.f28827j;
    }

    public final void r(Bundle bundle, long j10) {
        long j11 = bundle.getLong("_et");
        if (j11 != 0) {
            this.f29102h.b().f29087p.b(Long.valueOf(j11), "Params already contained engagement");
        } else {
            j11 = 0;
        }
        bundle.putLong("_et", j10 + j11);
    }

    public final void s(Bundle bundle, int i10, String str, Object obj) {
        if (X(i10, bundle)) {
            this.f29102h.getClass();
            bundle.putString("_ev", n(40, str, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void u(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                this.f29102h.x().x(str, bundle, bundle2.get(str));
            }
        }
    }

    public final void v(w0 w0Var, int i10) {
        Iterator it = new TreeSet(w0Var.f29114d.keySet()).iterator();
        int i11 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (S(str) && (i11 = i11 + 1) > i10) {
                this.f29102h.b().f29086o.c(this.f29102h.f28553t.d(w0Var.f29111a), this.f29102h.f28553t.b(w0Var.f29114d), androidx.activity.u.b("Event can't contain more than ", i10, " params").toString());
                X(5, w0Var.f29114d);
                w0Var.f29114d.remove(str);
            }
        }
    }

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

    public final void y(cg.d1 d1Var, boolean z10) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z10);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void z(cg.d1 d1Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            d1Var.Y(bundle);
        } catch (RemoteException e10) {
            this.f29102h.b().f29087p.b(e10, "Error returning bundle list to wrapper");
        }
    }
}