package defpackage;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
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.SystemClock;
import android.text.TextUtils;
import android.util.SparseArray;
import com.google.android.gms.measurement.internal.AppMeasurementDynamiteService;
import com.google.common.util.concurrent.ListenableFuture;
import j$.util.Comparator;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.PriorityQueue;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

/* JADX INFO: renamed from: ᵶʿʝ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4799 extends AbstractC2191 {

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public C0166 f18257;

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public C0166 f18258;

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final AtomicLong f18259;

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public C0875 f18260;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public final AtomicReference f18261;

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final ᵷˇ f18262;

    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    public PriorityQueue f18263;

    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    public final C2198 f18264;

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public long f18265;

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public final Object f18266;

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public SharedPreferencesOnSharedPreferenceChangeListenerC2887 f18267;

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public int f18268;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public C3209 f18269;

    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    public boolean f18270;

    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    public C0166 f18271;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public ʽᵺᴵ f18272;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public final CopyOnWriteArraySet f18273;

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public C0166 f18274;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public boolean f18275;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public boolean f18276;

    public C4799(C1103 c1103) {
        super(c1103);
        this.f18273 = new CopyOnWriteArraySet();
        this.f18266 = new Object();
        this.f18276 = false;
        this.f18268 = 1;
        this.f18270 = true;
        this.f18262 = new ᵷˇ(this);
        this.f18261 = new AtomicReference();
        this.f18260 = C0875.f3871;
        this.f18265 = -1L;
        this.f18259 = new AtomicLong(0L);
        this.f18264 = new C2198(14, c1103);
    }

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public final void m10007(String str, String str2, Bundle bundle) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        c1103.f4701.getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        Bundle bundle2 = new Bundle();
        bundle2.putString("name", str);
        bundle2.putLong("creation_timestamp", jCurrentTimeMillis);
        if (str2 != null) {
            bundle2.putString("expired_event_name", str2);
            bundle2.putBundle("expired_event_params", bundle);
        }
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC0735(this, bundle2, 0));
    }

    /* JADX INFO: renamed from: ʿٴˇ, reason: contains not printable characters */
    public final void m10008(String str, String str2, Bundle bundle) {
        long jElapsedRealtime;
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        c1103.f4701.getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        if (c1103.f4726.m8314(null, AbstractC3818.f14549)) {
            c1103.f4701.getClass();
            jElapsedRealtime = SystemClock.elapsedRealtime();
        } else {
            jElapsedRealtime = 0;
        }
        m10025(str, str2, bundle, true, true, jCurrentTimeMillis, jElapsedRealtime);
    }

    /* JADX INFO: renamed from: ʿᵿʽᵞ, reason: contains not printable characters */
    public final void m10009() {
        C0756.m2702();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3691 c3691 = c1103.f4726;
        C1961 c1961 = c1103.f4707;
        C3485 c3485 = c1103.f4729;
        if (c3691.m8314(null, AbstractC3818.f14526)) {
            C1103.m3564(c1961);
            if (c1961.m5244()) {
                C1103.m3564(c3485);
                c3485.f13423.m4476("Cannot get trigger URIs from analytics worker thread");
                return;
            }
            if (ᵖˊʨ.ᵜᵪʾ()) {
                C1103.m3564(c3485);
                c3485.f13423.m4476("Cannot get trigger URIs from main thread");
                return;
            }
            m5699();
            C1103.m3564(c3485);
            c3485.f13414.m4476("Getting trigger URIs (FE)");
            AtomicReference atomicReference = new AtomicReference();
            C1103.m3564(c1961);
            c1961.m5245(atomicReference, 10000L, "get trigger URIs", new RunnableC1779(this, atomicReference, 2));
            final List list = (List) atomicReference.get();
            if (list == null) {
                C1103.m3564(c3485);
                c3485.f13417.m4476("Timed out waiting for get trigger URIs");
            } else {
                C1103.m3564(c1961);
                c1961.m5246(new Runnable() { // from class: ᵶᵺ
                    @Override // java.lang.Runnable
                    public final void run() {
                        C4799 c4799 = this.f18513;
                        c4799.m6166();
                        if (Build.VERSION.SDK_INT < 30) {
                            return;
                        }
                        C3740 c3740 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4727;
                        C1103.m3567(c3740);
                        SparseArray sparseArrayM8410 = c3740.m8410();
                        for (C2004 c2004 : list) {
                            int i = c2004.f7926;
                            if (!sparseArrayM8410.contains(i) || ((Long) sparseArrayM8410.get(i)).longValue() < c2004.f7927) {
                                c4799.m10026().add(c2004);
                            }
                        }
                        c4799.m10027();
                    }
                });
            }
        }
    }

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public final void m10010(Bundle bundle, int i, long j) {
        Boolean bool;
        String string;
        EnumC3695 enumC3695;
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        m5699();
        C0875 c0875 = C0875.f3871;
        EnumC0174[] enumC0174Arr = EnumC1791.STORAGE.f7181;
        int length = enumC0174Arr.length;
        int i2 = 0;
        while (true) {
            bool = null;
            if (i2 >= length) {
                string = null;
                break;
            }
            String str = enumC0174Arr[i2].f1603;
            if (bundle.containsKey(str) && (string = bundle.getString(str)) != null) {
                if ((string.equals("granted") ? Boolean.TRUE : string.equals("denied") ? Boolean.FALSE : null) == null) {
                    break;
                }
            }
            i2++;
        }
        if (string != null) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13413.m4474(string, "Ignoring invalid consent setting");
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13413.m4476("Valid consent values are 'granted', 'denied'");
        }
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        boolean zM5244 = c1961.m5244();
        C0875 c0875M3063 = C0875.m3063(i, bundle);
        Iterator it = c0875M3063.f3873.values().iterator();
        while (true) {
            boolean zHasNext = it.hasNext();
            enumC3695 = EnumC3695.f14082;
            if (!zHasNext) {
                break;
            } else if (((EnumC3695) it.next()) != enumC3695) {
                m10022(c0875M3063, zM5244);
                break;
            }
        }
        C1102 c1102M3560 = C1102.m3560(i, bundle);
        Iterator it2 = c1102M3560.f4696.values().iterator();
        while (true) {
            if (!it2.hasNext()) {
                break;
            } else if (((EnumC3695) it2.next()) != enumC3695) {
                m10020(c1102M3560, zM5244);
                break;
            }
        }
        if (bundle != null) {
            int iOrdinal = C0875.m3069(bundle.getString("ad_personalization")).ordinal();
            if (iOrdinal == 2) {
                bool = Boolean.FALSE;
            } else if (iOrdinal == 3) {
                bool = Boolean.TRUE;
            }
        }
        if (bool != null) {
            String str2 = i == -30 ? "tcf" : "app";
            if (zM5244) {
                m10023(j, bool.toString(), str2, "allow_personalized_ads");
            } else {
                m10017(str2, "allow_personalized_ads", bool.toString(), false, j);
            }
        }
    }

    /* JADX INFO: renamed from: ˀᵭ, reason: contains not printable characters */
    public final void m10011(long j, long j2, Bundle bundle, String str, String str2) {
        m6166();
        boolean z = true;
        if (this.f18272 != null && !C3335.m7615(str2)) {
            z = false;
        }
        m10018(str, str2, j, j2, bundle, true, z, true);
    }

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public final void m10012() {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        if (!(c1103.f4713.getApplicationContext() instanceof Application) || this.f18269 == null) {
            return;
        }
        ((Application) c1103.f4713.getApplicationContext()).unregisterActivityLifecycleCallbacks(this.f18269);
    }

    /* JADX INFO: renamed from: ˁˌᵩ, reason: contains not printable characters */
    public final void m10013(String str, String str2, Bundle bundle) {
        long jElapsedRealtime;
        m6166();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        c1103.f4701.getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        if (c1103.f4726.m8314(null, AbstractC3818.f14549)) {
            c1103.f4701.getClass();
            jElapsedRealtime = SystemClock.elapsedRealtime();
        } else {
            jElapsedRealtime = 0;
        }
        m10011(jCurrentTimeMillis, jElapsedRealtime, bundle, str, str2);
    }

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final String m10014() {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        try {
            return ᵴᵧˈ.ˊᵨᵧ(c1103.f4713, c1103.f4712);
        } catch (IllegalStateException e) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13423.m4474(e, "getGoogleAppId failed with exception");
            return null;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:124:0x03c0  */
    /* JADX WARN: Removed duplicated region for block: B:125:0x03c6  */
    /* JADX WARN: Removed duplicated region for block: B:136:0x040e  */
    /* JADX WARN: Removed duplicated region for block: B:211:? A[RETURN, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:63:0x01c9  */
    /* JADX WARN: Removed duplicated region for block: B:65:0x01db  */
    /* JADX INFO: renamed from: ˉᵵᵜ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m10015() {
        int i;
        int i2;
        int i3;
        int i4;
        int i5;
        EnumC5008 enumC5008;
        int i6;
        C1103 c1103;
        boolean z;
        Object obj;
        Object obj2;
        int i7;
        char c;
        String str;
        String str2;
        Object obj3;
        C1323 c1323M4052;
        String string;
        C5280 c5280;
        String string2;
        String strM10874;
        C4799 c4799;
        String str3;
        EnumC5008 enumC50082;
        m6166();
        C1103 c11032 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3485 c3485 = c11032.f4729;
        C3485 c34852 = c11032.f4729;
        C1103.m3564(c3485);
        c3485.f13416.m4476("Handle tcf update.");
        C3740 c3740 = c11032.f4727;
        C1103.m3567(c3740);
        SharedPreferences sharedPreferencesM8412 = c3740.m8412();
        C2598 c2598 = AbstractC1534.f6197;
        EnumC4255 enumC4255 = EnumC4255.f16241;
        EnumC2232 enumC2232 = EnumC2232.f8838;
        EnumC2232 enumC22322 = EnumC2232.f8840;
        EnumC4255 enumC42552 = EnumC4255.f16242;
        EnumC4255 enumC42553 = EnumC4255.f16243;
        int i8 = 0;
        EnumC4255 enumC42554 = EnumC4255.f16244;
        C1323 c1323M3843 = C1323.m3843(7, new Object[]{enumC4255, enumC2232, EnumC4255.f16240, enumC22322, enumC42552, enumC2232, enumC42553, enumC2232, enumC42554, enumC22322, EnumC4255.f16237, enumC22322, EnumC4255.f16238, enumC22322}, null);
        int i9 = AbstractC5291.f20005;
        C1599 c1599 = new C1599("CH");
        char[] cArr = new char[5];
        boolean zContains = sharedPreferencesM8412.contains("IABTCF_TCString");
        try {
            i = sharedPreferencesM8412.getInt("IABTCF_CmpSdkID", -1);
        } catch (ClassCastException unused) {
            i = -1;
        }
        try {
            i2 = sharedPreferencesM8412.getInt("IABTCF_PolicyVersion", -1);
        } catch (ClassCastException unused2) {
            i2 = -1;
        }
        try {
            i3 = sharedPreferencesM8412.getInt("IABTCF_gdprApplies", -1);
        } catch (ClassCastException unused3) {
            i3 = -1;
        }
        try {
            i4 = sharedPreferencesM8412.getInt("IABTCF_PurposeOneTreatment", -1);
        } catch (ClassCastException unused4) {
            i4 = -1;
        }
        try {
            i5 = sharedPreferencesM8412.getInt("IABTCF_EnableAdvertiserConsentMode", -1);
        } catch (ClassCastException unused5) {
            i5 = -1;
        }
        String strM4351 = AbstractC1534.m4351(sharedPreferencesM8412, "IABTCF_PublisherCC");
        C1404 c1404M7805 = AbstractC3409.m7805();
        AbstractC0228 it = c1323M3843.keySet().iterator();
        while (true) {
            boolean zHasNext = it.hasNext();
            enumC5008 = EnumC5008.f18986;
            i6 = i2;
            if (!zHasNext) {
                break;
            }
            EnumC4255 enumC42555 = (EnumC4255) it.next();
            int i10 = i;
            int iMo2070 = enumC42555.mo2070();
            boolean z2 = zContains;
            StringBuilder sb = new StringBuilder(String.valueOf(iMo2070).length() + 28);
            sb.append("IABTCF_PublisherRestrictions");
            sb.append(iMo2070);
            String strM43512 = AbstractC1534.m4351(sharedPreferencesM8412, sb.toString());
            if (TextUtils.isEmpty(strM43512) || strM43512.length() < 755) {
                enumC50082 = enumC5008;
            } else {
                int iDigit = Character.digit(strM43512.charAt(754), 10);
                enumC50082 = EnumC5008.f18984;
                if (iDigit >= 0 && iDigit <= EnumC5008.values().length && iDigit != 0) {
                    if (iDigit == 1) {
                        enumC5008 = EnumC5008.f18983;
                    } else if (iDigit == 2) {
                        enumC5008 = EnumC5008.f18985;
                    }
                    enumC50082 = enumC5008;
                }
            }
            c1404M7805.m4036(enumC42555, enumC50082);
            i = i10;
            i2 = i6;
            zContains = z2;
        }
        int i11 = i;
        boolean z3 = zContains;
        C1323 c1323M40522 = c1404M7805.m4052(true);
        String strM43513 = AbstractC1534.m4351(sharedPreferencesM8412, "IABTCF_PurposeConsents");
        String strM43514 = AbstractC1534.m4351(sharedPreferencesM8412, "IABTCF_VendorConsents");
        boolean z4 = !TextUtils.isEmpty(strM43514) && strM43514.length() >= 755 && strM43514.charAt(754) == '1';
        String strM43515 = AbstractC1534.m4351(sharedPreferencesM8412, "IABTCF_PurposeLegitimateInterests");
        String strM43516 = AbstractC1534.m4351(sharedPreferencesM8412, "IABTCF_VendorLegitimateInterests");
        if (!TextUtils.isEmpty(strM43516)) {
            c1103 = c11032;
            if (strM43516.length() >= 755 && strM43516.charAt(754) == '1') {
                z = true;
            }
            cArr[0] = '2';
            if (z3) {
                c1323M4052 = C1323.f5510;
                obj = "EnableAdvertiserConsentMode";
                str = "1";
                obj2 = "gdprApplies";
                obj3 = "PurposeDiagnostics";
                str2 = "0";
                c = 1;
                i7 = 2;
            } else {
                EnumC5008 enumC50083 = (EnumC5008) c1323M40522.get(enumC4255);
                EnumC5008 enumC50084 = (EnumC5008) c1323M40522.get(enumC42552);
                EnumC5008 enumC50085 = (EnumC5008) c1323M40522.get(enumC42553);
                EnumC5008 enumC50086 = (EnumC5008) c1323M40522.get(enumC42554);
                C1404 c1404M78052 = AbstractC3409.m7805();
                c1404M78052.m4036("Version", "2");
                boolean z5 = z4;
                c1404M78052.m4036("VendorConsent", true != z4 ? "0" : "1");
                boolean z6 = z;
                c1404M78052.m4036("VendorLegitimateInterest", true != z ? "0" : "1");
                c1404M78052.m4036("gdprApplies", i3 != 1 ? "0" : "1");
                c1404M78052.m4036("EnableAdvertiserConsentMode", i5 != 1 ? "0" : "1");
                c1404M78052.m4036("PolicyVersion", String.valueOf(i6));
                c1404M78052.m4036("CmpSdkID", String.valueOf(i11));
                c1404M78052.m4036("PurposeOneTreatment", i4 != 1 ? "0" : "1");
                c1404M78052.m4036("PublisherCC", strM4351);
                c1404M78052.m4036("PublisherRestrictions1", String.valueOf(enumC50083 != null ? enumC50083.mo2070() : enumC5008.mo2070()));
                c1404M78052.m4036("PublisherRestrictions3", String.valueOf(enumC50084 != null ? enumC50084.mo2070() : enumC5008.mo2070()));
                c1404M78052.m4036("PublisherRestrictions4", String.valueOf(enumC50085 != null ? enumC50085.mo2070() : enumC5008.mo2070()));
                c1404M78052.m4036("PublisherRestrictions7", String.valueOf(enumC50086 != null ? enumC50086.mo2070() : enumC5008.mo2070()));
                int i12 = i4;
                c1404M78052.m4041(C1323.m3843(4, new Object[]{"Purpose1", AbstractC1534.m4353(enumC4255, strM43513, strM43515), "Purpose3", AbstractC1534.m4353(enumC42552, strM43513, strM43515), "Purpose4", AbstractC1534.m4353(enumC42553, strM43513, strM43515), "Purpose7", AbstractC1534.m4353(enumC42554, strM43513, strM43515)}, null).entrySet());
                obj = "EnableAdvertiserConsentMode";
                obj2 = "gdprApplies";
                i7 = 2;
                c = 1;
                str = "1";
                str2 = "0";
                int i13 = i5;
                int i14 = i3;
                obj3 = "PurposeDiagnostics";
                c1404M78052.m4041(C1323.m3843(5, new Object[]{"AuthorizePurpose1", true != AbstractC1534.m4348(enumC4255, c1323M3843, c1323M40522, c1599, cArr, i13, i14, i12, strM4351, strM43513, strM43515, z5, z6) ? str2 : str, "AuthorizePurpose3", true != AbstractC1534.m4348(enumC42552, c1323M3843, c1323M40522, c1599, cArr, i13, i14, i12, strM4351, strM43513, strM43515, z5, z6) ? str2 : str, "AuthorizePurpose4", true != AbstractC1534.m4348(enumC42553, c1323M3843, c1323M40522, c1599, cArr, i13, i14, i12, strM4351, strM43513, strM43515, z5, z6) ? str2 : str, "AuthorizePurpose7", true != AbstractC1534.m4348(enumC42554, c1323M3843, c1323M40522, c1599, cArr, i13, i14, i12, strM4351, strM43513, strM43515, z5, z6) ? str2 : str, obj3, new String(cArr)}, null).entrySet());
                c1323M4052 = c1404M78052.m4052(true);
            }
            C5280 c52802 = new C5280(c1323M4052);
            C1103.m3564(c34852);
            c34852.f13414.m4474(c52802, "Tcf preferences read");
            c3740.ˈᵲᵢ();
            string = c3740.m8407().getString("stored_tcf_param", "");
            HashMap map = new HashMap();
            if (TextUtils.isEmpty(string)) {
                String[] strArrSplit = string.split(";");
                int length = strArrSplit.length;
                int i15 = 0;
                while (i15 < length) {
                    String[] strArrSplit2 = strArrSplit[i15].split("=");
                    if (strArrSplit2.length >= i7 && AbstractC1534.f6197.contains(strArrSplit2[0])) {
                        map.put(strArrSplit2[0], strArrSplit2[c]);
                    }
                    i15++;
                    i7 = 2;
                }
                c5280 = new C5280(map);
            } else {
                c5280 = new C5280(map);
            }
            c3740.ˈᵲᵢ();
            string2 = c3740.m8407().getString("stored_tcf_param", "");
            strM10874 = c52802.m10874();
            if (strM10874.equals(string2)) {
                SharedPreferences.Editor editorEdit = c3740.m8407().edit();
                editorEdit.putString("stored_tcf_param", strM10874);
                editorEdit.apply();
                Bundle bundleM10872 = c52802.m10872();
                C1103.m3564(c34852);
                c34852.f13414.m4474(bundleM10872, "Consent generated from Tcf");
                if (bundleM10872 != Bundle.EMPTY) {
                    c1103.f4701.getClass();
                    c4799 = this;
                    c4799.m10010(bundleM10872, -30, System.currentTimeMillis());
                } else {
                    c4799 = this;
                }
                Bundle bundle = new Bundle();
                HashMap map2 = c5280.f19935;
                String str4 = (map2.isEmpty() || ((String) map2.get("Version")) != null) ? str2 : str;
                Bundle bundleM108722 = c52802.m10872();
                Bundle bundleM108723 = c5280.m10872();
                bundle.putString("_tcfm", str4.concat((bundleM108722.size() == bundleM108723.size() && Objects.equals(bundleM108722.getString("ad_storage"), bundleM108723.getString("ad_storage")) && Objects.equals(bundleM108722.getString("ad_personalization"), bundleM108723.getString("ad_personalization")) && Objects.equals(bundleM108722.getString("ad_user_data"), bundleM108723.getString("ad_user_data"))) ? str2 : str));
                HashMap map3 = c52802.f19935;
                String str5 = (String) map3.get(obj3);
                if (TextUtils.isEmpty(str5)) {
                    str5 = "200000";
                }
                bundle.putString("_tcfd2", str5);
                StringBuilder sb2 = new StringBuilder(str);
                try {
                    str3 = (String) map3.get("CmpSdkID");
                } catch (NumberFormatException unused6) {
                }
                int i16 = !TextUtils.isEmpty(str3) ? Integer.parseInt(str3) : -1;
                if (i16 < 0 || i16 > 4095) {
                    sb2.append("00");
                } else {
                    sb2.append("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".charAt(i16 >> 6));
                    sb2.append("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".charAt(i16 & 63));
                }
                int iM10873 = c52802.m10873();
                if (iM10873 < 0 || iM10873 > 63) {
                    sb2.append(str2);
                } else {
                    sb2.append("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".charAt(iM10873));
                }
                if (c == str.equals(map3.get(obj2))) {
                    i8 = 2;
                }
                int i17 = i8 | 4;
                if (str.equals(map3.get(obj))) {
                    i17 = i8 | 12;
                }
                sb2.append("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_".charAt(i17));
                bundle.putString("_tcfd", sb2.toString());
                c4799.m10013("auto", "_tcf", bundle);
                return;
            }
            return;
        }
        c1103 = c11032;
        z = false;
        cArr[0] = '2';
        if (z3) {
        }
        C5280 c528022 = new C5280(c1323M4052);
        C1103.m3564(c34852);
        c34852.f13414.m4474(c528022, "Tcf preferences read");
        c3740.ˈᵲᵢ();
        string = c3740.m8407().getString("stored_tcf_param", "");
        HashMap map4 = new HashMap();
        if (TextUtils.isEmpty(string)) {
        }
        c3740.ˈᵲᵢ();
        string2 = c3740.m8407().getString("stored_tcf_param", "");
        strM10874 = c528022.m10874();
        if (strM10874.equals(string2)) {
        }
    }

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public final void m10016() {
        m6166();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3740 c3740 = c1103.f4727;
        C3485 c3485 = c1103.f4729;
        ᵠʽᵲ r2 = c1103.f4701;
        C1103.m3567(c3740);
        String strM2744 = c3740.f14204.m2744();
        int i = 1;
        if (strM2744 != null) {
            if ("unset".equals(strM2744)) {
                r2.getClass();
                m10023(System.currentTimeMillis(), null, "app", "_npa");
            } else {
                Long lValueOf = Long.valueOf(true != "true".equals(strM2744) ? 0L : 1L);
                r2.getClass();
                m10023(System.currentTimeMillis(), lValueOf, "app", "_npa");
            }
        }
        if (!c1103.m3568() || !this.f18270) {
            C1103.m3564(c3485);
            c3485.f13416.m4476("Updating Scion state (FE)");
            C1618 c1618M3573 = c1103.m3573();
            c1618M3573.m6166();
            c1618M3573.m5699();
            c1618M3573.m4457(new RunnableC3375(c1618M3573, c1618M3573.m4471(true), 2));
            return;
        }
        C1103.m3564(c3485);
        c3485.f13416.m4476("Recording app launch after enabling measurement for the first time (FE)");
        m10029();
        C1584 c1584 = c1103.f4714;
        C1103.m3565(c1584);
        c1584.f6360.m7127();
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC1673(this, i));
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0021  */
    /* JADX INFO: renamed from: ˊᵡᵗʨ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m10017(String str, String str2, Object obj, boolean z, long j) {
        int iM7654;
        int length;
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        if (z) {
            C3335 c3335 = c1103.f4730;
            C1103.m3567(c3335);
            iM7654 = c3335.m7654(str2);
        } else {
            C3335 c33352 = c1103.f4730;
            C1103.m3567(c33352);
            if (c33352.m7655("user property", str2)) {
                if (c33352.m7637("user property", ˑᵕʾ.ːˏᵟᵯ, null, str2)) {
                    ((C1103) ((ᵜᵪʾ) c33352).ˌᴵ).getClass();
                    iM7654 = !c33352.m7632(24, "user property", str2) ? 6 : 0;
                } else {
                    iM7654 = 15;
                }
            }
        }
        ᵷˇ r7 = this.f18262;
        if (iM7654 != 0) {
            C1103.m3567(c1103.f4730);
            String strM7608 = C3335.m7608(24, str2, true);
            length = str2 != null ? str2.length() : 0;
            C1103.m3567(c1103.f4730);
            C3335.m7610(r7, null, iM7654, "_ev", strM7608, length);
            return;
        }
        String str3 = str == null ? "app" : str;
        if (obj == null) {
            C1961 c1961 = c1103.f4707;
            C1103.m3564(c1961);
            c1961.m5246(new RunnableC1802(this, str3, str2, null, j, 1));
            return;
        }
        C3335 c33353 = c1103.f4730;
        C3335 c33354 = c1103.f4730;
        C1103.m3567(c33353);
        int iM7633 = c33353.m7633(obj, str2);
        if (iM7633 != 0) {
            C1103.m3567(c33354);
            String strM76082 = C3335.m7608(24, str2, true);
            length = ((obj instanceof String) || (obj instanceof CharSequence)) ? obj.toString().length() : 0;
            C1103.m3567(c33354);
            C3335.m7610(r7, null, iM7633, "_ev", strM76082, length);
            return;
        }
        C1103.m3567(c33354);
        Object objM7657 = c33354.m7657(obj, str2);
        if (objM7657 != null) {
            C1961 c19612 = c1103.f4707;
            C1103.m3564(c19612);
            c19612.m5246(new RunnableC1802(this, str3, str2, objM7657, j, 1));
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:64:0x014a  */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$UnknownArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    /* JADX WARN: Unreachable blocks removed: 2, instructions: 2 */
    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m10018(String str, String str2, long j, long j2, Bundle bundle, boolean z, boolean z2, boolean z3) {
        int length;
        C3740 c3740;
        ᵠʽᵲ r20;
        C3691 c3691;
        C3740 c37402;
        InterfaceC4029 interfaceC4029;
        boolean z4;
        long j3;
        boolean zM3016;
        long j4;
        long j5;
        boolean zM9434;
        ArrayList arrayList;
        Bundle[] bundleArr;
        int i;
        int i2;
        String str3 = str;
        String str4 = str2;
        ᵘᵞʿⁱ.ˊᵫᵗ(str3);
        ᵘᵞʿⁱ.ᵶᵥᵝ(bundle);
        m6166();
        m5699();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        boolean zM3568 = c1103.m3568();
        C1584 c1584 = c1103.f4714;
        C3691 c36912 = c1103.f4726;
        Context context = c1103.f4713;
        C3335 c3335 = c1103.f4730;
        C3485 c3485 = c1103.f4729;
        if (!zM3568) {
            C1103.m3564(c3485);
            c3485.f13416.m4476("Event not sent since app measurement is disabled");
            return;
        }
        List list = c1103.m3569().f9048;
        if (list != null && !list.contains(str4)) {
            C1103.m3564(c3485);
            c3485.f13416.m4475("Dropping non-safelisted event. event name, origin", str4, str3);
            return;
        }
        if (this.f18275) {
            length = 0;
        } else {
            this.f18275 = true;
            try {
                length = 0;
                try {
                    (!c1103.f4721 ? Class.forName("com.google.android.gms.tagmanager.TagManagerService", true, context.getClassLoader()) : Class.forName("com.google.android.gms.tagmanager.TagManagerService")).getDeclaredMethod("initialize", Context.class).invoke(null, context);
                } catch (Exception e) {
                    try {
                        C1103.m3564(c3485);
                        c3485.f13424.m4474(e, "Failed to invoke Tag Manager's initialize() method");
                    } catch (ClassNotFoundException unused) {
                        C1103.m3564(c3485);
                        c3485.f13420.m4476("Tag Manager is not found and thus will not be used");
                    }
                }
            } catch (ClassNotFoundException unused2) {
                length = 0;
            }
        }
        C2063 c2063 = c1103.f4717;
        C3740 c37403 = c1103.f4727;
        ᵠʽᵲ r4 = c1103.f4701;
        if (!c36912.m8314(null, AbstractC3818.f14509) && "_cmp".equals(str4) && bundle.containsKey("gclid")) {
            String string = bundle.getString("gclid");
            r4.getClass();
            c3740 = c37403;
            r20 = r4;
            c3691 = c36912;
            m10023(System.currentTimeMillis(), string, "auto", "_lgclid");
        } else {
            c3740 = c37403;
            r20 = r4;
            c3691 = c36912;
        }
        if (!z || C3335.f12793[length].equals(str4)) {
            c37402 = c3740;
        } else {
            C1103.m3567(c3335);
            C1103.m3567(c3740);
            c37402 = c3740;
            c3335.m7644(bundle, c37402.f14205.m8885());
        }
        InterfaceC4029 interfaceC40292 = this.f18262;
        if (z3 || "_iap".equals(str4)) {
            interfaceC4029 = interfaceC40292;
        } else {
            C1103.m3567(c3335);
            if (c3335.m7655("event", str4)) {
                interfaceC4029 = interfaceC40292;
                if (c3335.m7637("event", ᵱˉˈ.ᵵᵽ, ((C1103) ((ᵜᵪʾ) c3335).ˌᴵ).f4726.m8314(null, AbstractC3818.f14475) ? ᵱˉˈ.ᵻʽᵯ : ᵱˉˈ.ˊᵫᵗ, str4)) {
                    i = 40;
                    i2 = !c3335.m7632(40, "event", str4) ? 2 : length;
                    if (i2 != 0) {
                        C1103.m3564(c3485);
                        c3485.f13417.m4474(c2063.m5504(str4), "Invalid public event name. Event will not be logged (FE)");
                        C1103.m3567(c3335);
                        String strM7608 = C3335.m7608(i, str4, true);
                        if (str4 != null) {
                            length = str4.length();
                        }
                        C3335.m7610(interfaceC4029, null, i2, "_ev", strM7608, length);
                        return;
                    }
                } else {
                    i2 = 13;
                }
            } else {
                interfaceC4029 = interfaceC40292;
                i2 = 2;
            }
            i = 40;
            if (i2 != 0) {
            }
        }
        C1533 c1533 = c1103.f4723;
        C1103.m3565(c1533);
        C3160 c3160M4340 = c1533.m4340(length);
        if (c3160M4340 != null && !bundle.containsKey("_sc")) {
            c3160M4340.f12025 = true;
        }
        C3335.m7622(c3160M4340, bundle, z && !z3);
        boolean zEquals = "am".equals(str3);
        boolean zM7615 = C3335.m7615(str4);
        if (!z || this.f18272 == null || zM7615) {
            z4 = zEquals;
        } else {
            if (!zEquals) {
                C1103.m3564(c3485);
                c3485.f13416.m4475("Passing event to registered event handler (FE)", c2063.m5504(str4), c2063.m5503(bundle));
                ᵘᵞʿⁱ.ᵶᵥᵝ(this.f18272);
                ʽᵺᴵ r6 = this.f18272;
                r6.getClass();
                try {
                    ((InterfaceC3007) r6.ᵜᵪʾ).mo1122(str3, str4, bundle, j);
                    return;
                } catch (RemoteException e2) {
                    C1103 c11032 = ((AppMeasurementDynamiteService) r6.ᵔᵖᵹᵫ).f1031;
                    if (c11032 != null) {
                        C3485 c34852 = c11032.f4729;
                        C1103.m3564(c34852);
                        c34852.f13424.m4474(e2, "Event interceptor threw exception");
                        return;
                    }
                    return;
                }
            }
            z4 = true;
        }
        if (c1103.m3581()) {
            C1103.m3567(c3335);
            C1103 c11033 = (C1103) ((ᵜᵪʾ) c3335).ˌᴵ;
            int iM7639 = c3335.m7639(str4);
            if (iM7639 != 0) {
                C1103.m3564(c3485);
                c3485.f13417.m4474(c2063.m5504(str4), "Invalid event name. Event will not be logged (FE)");
                String strM76082 = C3335.m7608(40, str4, true);
                int length2 = str4 != null ? str4.length() : 0;
                C1103.m3567(c3335);
                C3335.m7610(interfaceC4029, null, iM7639, "_ev", strM76082, length2);
                return;
            }
            Bundle bundleM7636 = c3335.m7636(str4, bundle, ᵴᵧˈ.ᵪᵹᵥᵻ(new String[]{"_o", "_sn", "_sc", "_si"}), z3);
            ᵘᵞʿⁱ.ᵶᵥᵝ(bundleM7636);
            C1103.m3565(c1533);
            String str5 = "_o";
            if (c1533.m4340(false) == null || !"_ae".equals(str4)) {
                j3 = 0;
            } else {
                C1103.m3565(c1584);
                C1889 c1889 = c1584.f6361;
                ((C1103) ((ᵜᵪʾ) ((C1584) c1889.f7488)).ˌᴵ).f4701.getClass();
                j3 = 0;
                long jElapsedRealtime = SystemClock.elapsedRealtime();
                long j6 = jElapsedRealtime - c1889.f7487;
                c1889.f7487 = jElapsedRealtime;
                if (j6 > 0) {
                    c3335.m7660(bundleM7636, j6);
                }
            }
            if (!"auto".equals(str3) && "_ssr".equals(str4)) {
                String string2 = bundleM7636.getString("_ffr");
                int i3 = AbstractC4761.f18141;
                if (string2 == null || string2.trim().isEmpty()) {
                    string2 = null;
                } else if (string2 != null) {
                    string2 = string2.trim();
                }
                C3740 c37404 = c11033.f4727;
                C1103.m3567(c37404);
                if (Objects.equals(string2, c37404.f14203.m2744())) {
                    C3485 c34853 = c11033.f4729;
                    C1103.m3564(c34853);
                    c34853.f13416.m4476("Not logging duplicate session_start_with_rollout event");
                    return;
                } else {
                    C3740 c37405 = c11033.f4727;
                    C1103.m3567(c37405);
                    c37405.f14203.m2742(string2);
                }
            } else if ("_ae".equals(str4)) {
                C3740 c37406 = c11033.f4727;
                C1103.m3567(c37406);
                String strM2744 = c37406.f14203.m2744();
                if (!TextUtils.isEmpty(strM2744)) {
                    bundleM7636.putString("_ffr", strM2744);
                }
            }
            ArrayList arrayList2 = new ArrayList();
            arrayList2.add(bundleM7636);
            if (c3691.m8314(null, AbstractC3818.f14528)) {
                C1103.m3565(c1584);
                c1584.m6166();
                zM3016 = c1584.f6359;
            } else {
                C1103.m3567(c37402);
                zM3016 = c37402.f14218.m3016();
            }
            C1103.m3567(c37402);
            if (c37402.f14207.m6318() > j3 && c37402.m8411(j) && zM3016) {
                C1103.m3564(c3485);
                c3485.f13414.m4476("Current session is expired, remove the session number, ID, and engagement time");
                r20.getClass();
                C3740 c37407 = c37402;
                m10023(System.currentTimeMillis(), null, "auto", "_sid");
                m10023(System.currentTimeMillis(), null, "auto", "_sno");
                m10023(System.currentTimeMillis(), null, "auto", "_se");
                j4 = j3;
                c37407.f14206.m6316(j4);
            } else {
                j4 = j3;
            }
            if (bundleM7636.getLong("extend_session", j4) == 1) {
                C1103.m3564(c3485);
                c3485.f13414.m4476("EXTEND_SESSION param attached: initiate a new session or extend the current active session");
                C1103.m3565(c1584);
                j5 = j;
                c1584.f6360.m7125(j5, j2);
            } else {
                j5 = j;
            }
            ArrayList arrayList3 = new ArrayList(bundleM7636.keySet());
            Collections.sort(arrayList3);
            int size = arrayList3.size();
            int i4 = 0;
            while (i4 < size) {
                String str6 = (String) arrayList3.get(i4);
                if (str6 != null) {
                    C1103.m3567(c3335);
                    arrayList = arrayList3;
                    Object obj = bundleM7636.get(str6);
                    if (obj instanceof Bundle) {
                        bundleArr = new Bundle[]{(Bundle) obj};
                    } else if (obj instanceof Parcelable[]) {
                        Parcelable[] parcelableArr = (Parcelable[]) obj;
                        bundleArr = (Bundle[]) Arrays.copyOf(parcelableArr, parcelableArr.length, Bundle[].class);
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList4 = (ArrayList) obj;
                        bundleArr = (Bundle[]) arrayList4.toArray(new Bundle[arrayList4.size()]);
                    } else {
                        bundleArr = null;
                    }
                    if (bundleArr != null) {
                        bundleM7636.putParcelableArray(str6, bundleArr);
                    }
                } else {
                    arrayList = arrayList3;
                }
                i4++;
                arrayList3 = arrayList;
            }
            int i5 = 0;
            while (i5 < arrayList2.size()) {
                Bundle bundleM7666 = (Bundle) arrayList2.get(i5);
                String str7 = i5 != 0 ? "_ep" : str4;
                String str8 = str5;
                bundleM7666.putString(str8, str3);
                if (z2) {
                    bundleM7666 = c3335.m7666(bundleM7666);
                }
                ArrayList arrayList5 = arrayList2;
                Bundle bundle2 = bundleM7666;
                C0357 c0357 = new C0357(str7, new C3590(bundleM7666), str3, j5, j2);
                C1618 c1618M3573 = c1103.m3573();
                c1618M3573.getClass();
                c1618M3573.m6166();
                c1618M3573.m5699();
                c1618M3573.m4472();
                C4421 c4421M3575 = ((C1103) ((ᵜᵪʾ) c1618M3573).ˌᴵ).m3575();
                c4421M3575.getClass();
                Parcel parcelObtain = Parcel.obtain();
                ᵩᵭᵾʟ.ᵲᵶᵳˈ(c0357, parcelObtain, 0);
                byte[] bArrMarshall = parcelObtain.marshall();
                parcelObtain.recycle();
                if (bArrMarshall.length > 131072) {
                    C3485 c34854 = ((C1103) ((ᵜᵪʾ) c4421M3575).ˌᴵ).f4729;
                    C1103.m3564(c34854);
                    c34854.f13415.m4476("Event is too long for local database. Sending event directly to service");
                    zM9434 = false;
                } else {
                    zM9434 = c4421M3575.m9434(0, bArrMarshall);
                }
                c1618M3573.m4457(new RunnableC0742(c1618M3573, c1618M3573.m4471(true), zM9434, c0357, 1));
                if (!z4) {
                    Iterator it = this.f18273.iterator();
                    while (it.hasNext()) {
                        ((InterfaceC4279) it.next()).mo3319(str, str2, new Bundle(bundle2), j);
                    }
                }
                i5++;
                str3 = str;
                j5 = j;
                arrayList2 = arrayList5;
                str4 = str2;
                str5 = str8;
            }
            String str9 = str4;
            C1103.m3565(c1533);
            if (c1533.m4340(false) == null || !"_ae".equals(str9)) {
                return;
            }
            C1103.m3565(c1584);
            r20.getClass();
            c1584.f6361.m5132(SystemClock.elapsedRealtime(), true, true);
        }
    }

    /* JADX INFO: renamed from: ˋʿᐧ, reason: contains not printable characters */
    public final void m10019(C0875 c0875) {
        m6166();
        boolean z = (c0875.m3073(EnumC0174.f1598) && c0875.m3073(EnumC0174.f1599)) || ((C1103) ((ᵜᵪʾ) this).ˌᴵ).m3573().m4466();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        c1961.m5243();
        if (z != c1103.f4705) {
            C1961 c19612 = c1103.f4707;
            C1103.m3564(c19612);
            c19612.m5243();
            c1103.f4705 = z;
            C3740 c3740 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4727;
            C1103.m3567(c3740);
            c3740.ˈᵲᵢ();
            Boolean boolValueOf = c3740.m8407().contains("measurement_enabled_from_api") ? Boolean.valueOf(c3740.m8407().getBoolean("measurement_enabled_from_api", true)) : null;
            if (!z || boolValueOf == null || boolValueOf.booleanValue()) {
                m10024(Boolean.valueOf(z), false);
            }
        }
    }

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public final void m10020(C1102 c1102, boolean z) {
        RunnableC0648 runnableC0648 = new RunnableC0648(this, 16, c1102);
        if (z) {
            m6166();
            runnableC0648.run();
        } else {
            C1961 c1961 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4707;
            C1103.m3564(c1961);
            c1961.m5246(runnableC0648);
        }
    }

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public final void m10021(Bundle bundle, long j) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        ᵘᵞʿⁱ.ᵶᵥᵝ(bundle);
        Bundle bundle2 = new Bundle(bundle);
        if (!TextUtils.isEmpty(bundle2.getString("app_id"))) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13424.m4476("Package name should be null when calling setConditionalUserProperty");
        }
        bundle2.remove("app_id");
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "app_id", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "origin", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "name", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "value", Object.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "trigger_event_name", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "trigger_timeout", Long.class, 0L);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "timed_out_event_name", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "timed_out_event_params", Bundle.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "triggered_event_name", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "triggered_event_params", Bundle.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "time_to_live", Long.class, 0L);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "expired_event_name", String.class, (Object) null);
        ᵷˆᵣ.ᵜᵪʾ(bundle2, "expired_event_params", Bundle.class, (Object) null);
        ᵘᵞʿⁱ.ˊᵫᵗ(bundle2.getString("name"));
        ᵘᵞʿⁱ.ˊᵫᵗ(bundle2.getString("origin"));
        ᵘᵞʿⁱ.ᵶᵥᵝ(bundle2.get("value"));
        bundle2.putLong("creation_timestamp", j);
        String string = bundle2.getString("name");
        Object obj = bundle2.get("value");
        C3335 c3335 = c1103.f4730;
        C2063 c2063 = c1103.f4717;
        C3485 c34852 = c1103.f4729;
        C1103.m3567(c3335);
        if (c3335.m7654(string) != 0) {
            C1103.m3564(c34852);
            c34852.f13423.m4474(c2063.m5502(string), "Invalid conditional user property name");
            return;
        }
        C1103.m3567(c3335);
        if (c3335.m7633(obj, string) != 0) {
            C1103.m3564(c34852);
            c34852.f13423.m4475("Invalid conditional user property value", c2063.m5502(string), obj);
            return;
        }
        Object objM7657 = c3335.m7657(obj, string);
        if (objM7657 == null) {
            C1103.m3564(c34852);
            c34852.f13423.m4475("Unable to normalize conditional user property value", c2063.m5502(string), obj);
            return;
        }
        ᵷˆᵣ.ˊᵨᵧ(bundle2, objM7657);
        long j2 = bundle2.getLong("trigger_timeout");
        if (!TextUtils.isEmpty(bundle2.getString("trigger_event_name")) && (j2 > 15552000000L || j2 < 1)) {
            C1103.m3564(c34852);
            c34852.f13423.m4475("Invalid conditional user property timeout", c2063.m5502(string), Long.valueOf(j2));
            return;
        }
        long j3 = bundle2.getLong("time_to_live");
        if (j3 > 15552000000L || j3 < 1) {
            C1103.m3564(c34852);
            c34852.f13423.m4475("Invalid conditional user property time to live", c2063.m5502(string), Long.valueOf(j3));
        } else {
            C1961 c1961 = c1103.f4707;
            C1103.m3564(c1961);
            c1961.m5246(new RunnableC0648(this, 14, bundle2));
        }
    }

    @Override // defpackage.AbstractC2191
    /* JADX INFO: renamed from: ˑˊᵲ */
    public final boolean mo4346() {
        return false;
    }

    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public final void m10022(C0875 c0875, boolean z) {
        boolean z2;
        boolean z3;
        boolean z4;
        C0875 c08752;
        m5699();
        int i = c0875.f3872;
        if (i != -10) {
            EnumC3695 enumC3695 = (EnumC3695) c0875.f3873.get(EnumC0174.f1599);
            if (enumC3695 == null) {
                enumC3695 = EnumC3695.f14082;
            }
            EnumC3695 enumC36952 = EnumC3695.f14082;
            if (enumC3695 == enumC36952) {
                EnumC3695 enumC36953 = (EnumC3695) c0875.f3873.get(EnumC0174.f1598);
                if (enumC36953 == null) {
                    enumC36953 = enumC36952;
                }
                if (enumC36953 == enumC36952) {
                    C3485 c3485 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4729;
                    C1103.m3564(c3485);
                    c3485.f13413.m4476("Ignoring empty consent settings");
                    return;
                }
            }
        }
        synchronized (this.f18266) {
            try {
                z2 = false;
                if (C0875.m3067(i, this.f18260.f3872)) {
                    C0875 c08753 = this.f18260;
                    EnumMap enumMap = c0875.f3873;
                    EnumC0174[] enumC0174Arr = (EnumC0174[]) enumMap.keySet().toArray(new EnumC0174[0]);
                    int length = enumC0174Arr.length;
                    int i2 = 0;
                    while (true) {
                        if (i2 >= length) {
                            z3 = false;
                            break;
                        }
                        EnumC0174 enumC0174 = enumC0174Arr[i2];
                        EnumC3695 enumC36954 = (EnumC3695) enumMap.get(enumC0174);
                        EnumC3695 enumC36955 = (EnumC3695) c08753.f3873.get(enumC0174);
                        EnumC3695 enumC36956 = EnumC3695.f14083;
                        if (enumC36954 == enumC36956 && enumC36955 != enumC36956) {
                            z3 = true;
                            break;
                        }
                        i2++;
                    }
                    EnumC0174 enumC01742 = EnumC0174.f1598;
                    if (c0875.m3073(enumC01742) && !this.f18260.m3073(enumC01742)) {
                        z2 = true;
                    }
                    c0875 = c0875.m3072(this.f18260);
                    this.f18260 = c0875;
                    z4 = z2;
                    z2 = true;
                } else {
                    z3 = false;
                    z4 = false;
                }
                c08752 = c0875;
            } catch (Throwable th) {
                throw th;
            }
        }
        if (!z2) {
            C3485 c34852 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4729;
            C1103.m3564(c34852);
            c34852.f13420.m4474(c08752, "Ignoring lower-priority consent settings, proposed settings");
            return;
        }
        long andIncrement = this.f18259.getAndIncrement();
        if (z3) {
            this.f18261.set(null);
            RunnableC0913 runnableC0913 = new RunnableC0913(this, c08752, andIncrement, z4, 0);
            if (z) {
                m6166();
                runnableC0913.run();
                return;
            } else {
                C1961 c1961 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4707;
                C1103.m3564(c1961);
                c1961.m5249(runnableC0913);
                return;
            }
        }
        RunnableC0913 runnableC09132 = new RunnableC0913(this, c08752, andIncrement, z4, 1);
        if (z) {
            m6166();
            runnableC09132.run();
        } else if (i == 30 || i == -10) {
            C1961 c19612 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4707;
            C1103.m3564(c19612);
            c19612.m5249(runnableC09132);
        } else {
            C1961 c19613 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4707;
            C1103.m3564(c19613);
            c19613.m5246(runnableC09132);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0055  */
    /* JADX INFO: renamed from: ᵛˑﹳ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m10023(long j, Object obj, String str, String str2) {
        String str3;
        boolean zM9434;
        Object objValueOf = obj;
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        ᵘᵞʿⁱ.ˊᵫᵗ(str2);
        m6166();
        m5699();
        if ("allow_personalized_ads".equals(str2)) {
            String str4 = "_npa";
            if (objValueOf instanceof String) {
                String str5 = (String) objValueOf;
                if (!TextUtils.isEmpty(str5)) {
                    long j2 = true != "false".equals(str5.toLowerCase(Locale.ENGLISH)) ? 0L : 1L;
                    objValueOf = Long.valueOf(j2);
                    C3740 c3740 = c1103.f4727;
                    C1103.m3567(c3740);
                    c3740.f14204.m2742(j2 == 1 ? "true" : "false");
                } else if (objValueOf == null) {
                    C3740 c37402 = c1103.f4727;
                    C1103.m3567(c37402);
                    c37402.f14204.m2742("unset");
                } else {
                    str4 = str2;
                }
                C3485 c3485 = c1103.f4729;
                C1103.m3564(c3485);
                c3485.f13414.m4475("Setting user property(FE)", "non_personalized_ads(_npa)", objValueOf);
                str3 = str4;
            }
        } else {
            str3 = str2;
        }
        Object obj2 = objValueOf;
        if (!c1103.m3568()) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13414.m4476("User property not set since app measurement is disabled");
            return;
        }
        if (c1103.m3581()) {
            C0973 c0973 = new C0973(j, obj2, str3, str);
            C1618 c1618M3573 = c1103.m3573();
            c1618M3573.m6166();
            c1618M3573.m5699();
            c1618M3573.m4472();
            C4421 c4421M3575 = ((C1103) ((ᵜᵪʾ) c1618M3573).ˌᴵ).m3575();
            c4421M3575.getClass();
            Parcel parcelObtain = Parcel.obtain();
            C4040.m8841(c0973, parcelObtain);
            byte[] bArrMarshall = parcelObtain.marshall();
            parcelObtain.recycle();
            if (bArrMarshall.length > 131072) {
                C3485 c34853 = ((C1103) ((ᵜᵪʾ) c4421M3575).ˌᴵ).f4729;
                C1103.m3564(c34853);
                c34853.f13415.m4476("User property too long for local database. Sending directly to service");
                zM9434 = false;
            } else {
                zM9434 = c4421M3575.m9434(1, bArrMarshall);
            }
            c1618M3573.m4457(new RunnableC0742(c1618M3573, c1618M3573.m4471(true), zM9434, c0973, 0));
        }
    }

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public final void m10024(Boolean bool, boolean z) {
        m6166();
        m5699();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3485 c3485 = c1103.f4729;
        C1103.m3564(c3485);
        c3485.f13416.m4474(bool, "Setting app measurement enabled (FE)");
        C3740 c3740 = c1103.f4727;
        C1103.m3567(c3740);
        c3740.ˈᵲᵢ();
        SharedPreferences.Editor editorEdit = c3740.m8407().edit();
        if (bool != null) {
            editorEdit.putBoolean("measurement_enabled", bool.booleanValue());
        } else {
            editorEdit.remove("measurement_enabled");
        }
        editorEdit.apply();
        if (z) {
            c3740.ˈᵲᵢ();
            SharedPreferences.Editor editorEdit2 = c3740.m8407().edit();
            if (bool != null) {
                editorEdit2.putBoolean("measurement_enabled_from_api", bool.booleanValue());
            } else {
                editorEdit2.remove("measurement_enabled_from_api");
            }
            editorEdit2.apply();
        }
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        c1961.m5243();
        if (c1103.f4705 || !(bool == null || bool.booleanValue())) {
            m10016();
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:26:0x006c, code lost:
    
        if (r3 > 500) goto L27;
     */
    /* JADX WARN: Code restructure failed: missing block: B:35:0x00a3, code lost:
    
        if (r5 > 500) goto L36;
     */
    /* JADX INFO: renamed from: ᵠˏˏ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m10025(String str, String str2, Bundle bundle, boolean z, boolean z2, long j, long j2) {
        Bundle bundle2 = bundle == null ? new Bundle() : bundle;
        if (!Objects.equals(str2, "screen_view")) {
            boolean z3 = !z2 || this.f18272 == null || C3335.m7615(str2);
            String str3 = str == null ? "app" : str;
            long j3 = true != ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4726.m8314(null, AbstractC3818.f14549) ? 0L : j2;
            Bundle bundle3 = new Bundle(bundle2);
            for (String str4 : bundle3.keySet()) {
                Object obj = bundle3.get(str4);
                if (obj instanceof Bundle) {
                    bundle3.putBundle(str4, new Bundle((Bundle) obj));
                } else if (obj instanceof Parcelable[]) {
                    Parcelable[] parcelableArr = (Parcelable[]) obj;
                    for (int i = 0; i < parcelableArr.length; i++) {
                        Parcelable parcelable = parcelableArr[i];
                        if (parcelable instanceof Bundle) {
                            parcelableArr[i] = new Bundle((Bundle) parcelable);
                        }
                    }
                } else if (obj instanceof List) {
                    List list = (List) obj;
                    for (int i2 = 0; i2 < list.size(); i2++) {
                        Object obj2 = list.get(i2);
                        if (obj2 instanceof Bundle) {
                            list.set(i2, new Bundle((Bundle) obj2));
                        }
                    }
                }
            }
            C1961 c1961 = ((C1103) ((ᵜᵪʾ) this).ˌᴵ).f4707;
            C1103.m3564(c1961);
            c1961.m5246(new RunnableC4800(this, str3, str2, j, j3, bundle3, z2, z3, z));
            return;
        }
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C1533 c1533 = c1103.f4723;
        C1103.m3565(c1533);
        long j4 = true != c1103.f4726.m8314(null, AbstractC3818.f14549) ? 0L : j2;
        synchronized (c1533.f6192) {
            try {
                if (!c1533.f6187) {
                    C3485 c3485 = ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4729;
                    C1103.m3564(c3485);
                    c3485.f13413.m4476("Cannot log screen view event when the app is in the background.");
                    return;
                }
                String string = bundle2.getString("screen_name");
                if (string != null) {
                    if (string.length() > 0) {
                        int length = string.length();
                        ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4726.getClass();
                    }
                    C3485 c34852 = ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4729;
                    C1103.m3564(c34852);
                    c34852.f13413.m4474(Integer.valueOf(string.length()), "Invalid screen name length for screen view. Length");
                    return;
                }
                String string2 = bundle2.getString("screen_class");
                if (string2 != null) {
                    if (string2.length() > 0) {
                        int length2 = string2.length();
                        ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4726.getClass();
                    }
                    C3485 c34853 = ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4729;
                    C1103.m3564(c34853);
                    c34853.f13413.m4474(Integer.valueOf(string2.length()), "Invalid screen class length for screen view. Length");
                    return;
                }
                if (string2 == null) {
                    C5379 c5379 = c1533.f6188;
                    string2 = c5379 != null ? c1533.m4347(c5379.f20384) : "Activity";
                }
                String str5 = string2;
                C3160 c3160 = c1533.f6191;
                if (c1533.f6189 && c3160 != null) {
                    c1533.f6189 = false;
                    boolean zEquals = Objects.equals(c3160.f12020, str5);
                    boolean zEquals2 = Objects.equals(c3160.f12023, string);
                    if (zEquals && zEquals2) {
                        C3485 c34854 = ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4729;
                        C1103.m3564(c34854);
                        c34854.f13413.m4476("Ignoring call to log screen view event with duplicate parameters.");
                        return;
                    }
                }
                C1103 c11032 = (C1103) ((ᵜᵪʾ) c1533).ˌᴵ;
                C3485 c34855 = c11032.f4729;
                C1103.m3564(c34855);
                c34855.f13414.m4475("Logging screen view with name, class", string == null ? "null" : string, str5);
                C3160 c31602 = c1533.f6191 == null ? c1533.f6193 : c1533.f6191;
                C3335 c3335 = c11032.f4730;
                C1103.m3567(c3335);
                C3160 c31603 = new C3160(string, str5, c3335.m7650(), true, j, j4);
                c1533.f6191 = c31603;
                c1533.f6193 = c31602;
                c1533.f6196 = c31603;
                c11032.f4701.getClass();
                long jElapsedRealtime = SystemClock.elapsedRealtime();
                C1961 c19612 = c11032.f4707;
                C1103.m3564(c19612);
                c19612.m5246(new RunnableC1802(c1533, bundle2, c31603, c31602, jElapsedRealtime));
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* JADX INFO: renamed from: ᵡᵶ, reason: contains not printable characters */
    public final PriorityQueue m10026() {
        if (this.f18263 == null) {
            this.f18263 = new PriorityQueue(Comparator.CC.comparing(C4360.f16575, C4784.f18196));
        }
        return this.f18263;
    }

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public final void m10027() {
        C2004 c2004;
        m6166();
        if (m10026().isEmpty() || this.f18276 || (c2004 = (C2004) m10026().poll()) == null) {
            return;
        }
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3335 c3335 = c1103.f4730;
        C1103.m3567(c3335);
        C4929 c4929M7626 = c3335.m7626();
        if (c4929M7626 != null) {
            this.f18276 = true;
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            C1623 c1623 = c3485.f13414;
            String str = c2004.f7925;
            c1623.m4474(str, "Registering trigger URI");
            ListenableFuture listenableFutureM10226 = c4929M7626.m10226(Uri.parse(str));
            if (listenableFutureM10226 != null) {
                listenableFutureM10226.mo834(new ʾˀᵯˁ(listenableFutureM10226, 0, new ʽᵺᴵ(this, 12, c2004)), new ˆـᵨʾ(4, this));
            } else {
                this.f18276 = false;
                m10026().add(c2004);
            }
        }
    }

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final void m10028(C0875 c0875, long j, boolean z) {
        int i = c0875.f3872;
        m6166();
        m5699();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        C3740 c3740 = c1103.f4727;
        C3485 c3485 = c1103.f4729;
        C1103.m3567(c3740);
        C0875 c0875M8409 = c3740.m8409();
        if (j <= this.f18265 && C0875.m3067(c0875M8409.f3872, i)) {
            C1103.m3564(c3485);
            c3485.f13420.m4474(c0875, "Dropped out-of-date consent setting, proposed settings");
            return;
        }
        C3740 c37402 = c1103.f4727;
        C1103.m3567(c37402);
        c37402.ˈᵲᵢ();
        if (!C0875.m3067(i, c37402.m8407().getInt("consent_source", 100))) {
            C1103.m3564(c3485);
            c3485.f13420.m4474(Integer.valueOf(i), "Lower precedence consent source ignored, proposed source");
            return;
        }
        SharedPreferences.Editor editorEdit = c37402.m8407().edit();
        editorEdit.putString("consent_settings", c0875.m3071());
        editorEdit.putInt("consent_source", i);
        editorEdit.apply();
        C1103.m3564(c3485);
        c3485.f13414.m4474(c0875, "Setting storage consent(FE)");
        this.f18265 = j;
        if (c1103.m3573().m4465()) {
            C1618 c1618M3573 = c1103.m3573();
            c1618M3573.m6166();
            c1618M3573.m5699();
            c1618M3573.m4457(new RunnableC1604(c1618M3573, 2));
        } else {
            C1618 c1618M35732 = c1103.m3573();
            c1618M35732.m6166();
            c1618M35732.m5699();
            if (c1618M35732.m4466()) {
                c1618M35732.m4457(new RunnableC0627(c1618M35732, c1618M35732.m4471(false), 1));
            }
        }
        if (z) {
            c1103.m3573().m4458(new AtomicReference());
        }
    }

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public final void m10029() {
        m6166();
        m5699();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) this).ˌᴵ;
        if (c1103.m3581()) {
            C3691 c3691 = c1103.f4726;
            ((C1103) ((ᵜᵪʾ) c3691).ˌᴵ).getClass();
            Boolean boolM8312 = c3691.m8312("google_analytics_deferred_deep_link_enabled");
            if (boolM8312 != null && boolM8312.booleanValue()) {
                C3485 c3485 = c1103.f4729;
                C1103.m3564(c3485);
                c3485.f13416.m4476("Deferred Deep Link feature enabled.");
                C1961 c1961 = c1103.f4707;
                C1103.m3564(c1961);
                c1961.m5246(new RunnableC1673(this, 2));
            }
            C1618 c1618M3573 = c1103.m3573();
            c1618M3573.m6166();
            c1618M3573.m5699();
            C2847 c2847M4471 = c1618M3573.m4471(true);
            c1618M3573.m4472();
            C1103 c11032 = (C1103) ((ᵜᵪʾ) c1618M3573).ˌᴵ;
            c11032.f4726.m8314(null, AbstractC3818.f14493);
            c11032.m3575().m9434(3, new byte[0]);
            c1618M3573.m4457(new RunnableC0627(c1618M3573, c2847M4471, 0));
            this.f18270 = false;
            C3740 c3740 = c1103.f4727;
            C1103.m3567(c3740);
            c3740.ˈᵲᵢ();
            String string = c3740.m8407().getString("previous_os_version", null);
            ((C1103) ((ᵜᵪʾ) c3740).ˌᴵ).m3576().m9448();
            String str = Build.VERSION.RELEASE;
            if (!TextUtils.isEmpty(str) && !str.equals(string)) {
                SharedPreferences.Editor editorEdit = c3740.m8407().edit();
                editorEdit.putString("previous_os_version", str);
                editorEdit.apply();
            }
            if (TextUtils.isEmpty(string)) {
                return;
            }
            c1103.m3576().m9448();
            if (string.equals(str)) {
                return;
            }
            Bundle bundle = new Bundle();
            bundle.putString("_po", string);
            m10013("auto", "_ou", bundle);
        }
    }
}
