TikTok.apk(点击下载) / C40169Fq2.java


package X;

import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import com.bytedance.covode.number.Covode;
import com.google.android.gms.measurement.internal.zzan;
import com.google.android.gms.measurement.internal.zzao;
import com.google.android.gms.measurement.internal.zzkr;
import com.google.android.gms.measurement.internal.zzw;
import com.kakao.usermgmt.StringSet;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicReference;

/* renamed from: X.Fq2  reason: case insensitive filesystem */
public final class C40169Fq2 extends AbstractC40301FsA {
    public C40175Fq8 LIZ;
    public final C40183FqG LIZIZ;
    public boolean LIZJ = true;
    public AbstractC40446FuV LIZLLL;
    public final Set<AbstractC40470Fut> LJ = new CopyOnWriteArraySet();
    public boolean LJFF;
    public final AtomicReference<String> LJI = new AtomicReference<>();

    static {
        Covode.recordClassIndex(37150);
    }

    public C40169Fq2(C40167Fq0 fq0) {
        super(fq0);
        this.LIZIZ = new C40183FqG(fq0);
    }

    public static Context LIZ(Context context) {
        Context applicationContext = context.getApplicationContext();
        return (C16360kz.LIZJ && applicationContext == null) ? C16360kz.LIZ : applicationContext;
    }

    public static Object LIZ(Bundle bundle, String str) {
        try {
            return bundle.get(str);
        } catch (Exception | OutOfMemoryError unused) {
            return null;
        }
    }

    public static /* synthetic */ void LIZ(C40169Fq2 fq2, Bundle bundle) {
        fq2.LIZJ();
        fq2.LJJIIJZLJL();
        F6B.LIZ(bundle);
        F6B.LIZ(bundle.getString(StringSet.name));
        F6B.LIZ(bundle.getString("origin"));
        F6B.LIZ(LIZ(bundle, "value"));
        if (!fq2.LJJIFFI.LJIIZILJ()) {
            fq2.LJIILLIIL().LJIIJ.LIZ("Conditional property not set since app measurement is disabled");
            return;
        }
        zzkr zzkr = new zzkr(bundle.getString(StringSet.name), bundle.getLong("triggered_timestamp"), LIZ(bundle, "value"), bundle.getString("origin"));
        try {
            zzao LIZ2 = fq2.LJIILJJIL().LIZ(bundle.getString("app_id"), bundle.getString("triggered_event_name"), bundle.getBundle("triggered_event_params"), bundle.getString("origin"), 0);
            fq2.LJI().LIZ(new zzw(bundle.getString("app_id"), bundle.getString("origin"), zzkr, bundle.getLong("creation_timestamp"), false, bundle.getString("trigger_event_name"), fq2.LJIILJJIL().LIZ(bundle.getString("app_id"), bundle.getString("timed_out_event_name"), bundle.getBundle("timed_out_event_params"), bundle.getString("origin"), 0), bundle.getLong("trigger_timeout"), LIZ2, bundle.getLong("time_to_live"), fq2.LJIILJJIL().LIZ(bundle.getString("app_id"), bundle.getString("expired_event_name"), bundle.getBundle("expired_event_params"), bundle.getString("origin"), 0)));
        } catch (IllegalArgumentException unused) {
        }
    }

    public static /* synthetic */ void LIZ(C40169Fq2 fq2, boolean z) {
        fq2.LIZJ();
        fq2.LJJIIJZLJL();
        fq2.LJIILLIIL().LJIIIZ.LIZ("Setting app measurement enabled (FE)", Boolean.valueOf(z));
        fq2.LJIIZILJ().LIZIZ(z);
        fq2.LJJIJ();
    }

    private final void LIZ(String str, String str2, long j, Bundle bundle, boolean z, boolean z2, boolean z3) {
        LJIILL().LIZ(new RunnableC40372FtJ(this, str, str2, j, C40161Fpu.LIZIZ(bundle), z, z2, z3));
    }

    private final void LIZ(String str, String str2, long j, Object obj) {
        LJIILL().LIZ(new RunnableC40395Ftg(this, str, str2, obj, j));
    }

    public static /* synthetic */ void LIZIZ(C40169Fq2 fq2, Bundle bundle) {
        fq2.LIZJ();
        fq2.LJJIIJZLJL();
        F6B.LIZ(bundle);
        F6B.LIZ(bundle.getString(StringSet.name));
        if (!fq2.LJJIFFI.LJIIZILJ()) {
            fq2.LJIILLIIL().LJIIJ.LIZ("Conditional property not cleared since app measurement is disabled");
            return;
        }
        try {
            fq2.LJI().LIZ(new zzw(bundle.getString("app_id"), bundle.getString("origin"), new zzkr(bundle.getString(StringSet.name), 0, null, null), bundle.getLong("creation_timestamp"), bundle.getBoolean("active"), bundle.getString("trigger_event_name"), null, bundle.getLong("trigger_timeout"), null, bundle.getLong("time_to_live"), fq2.LJIILJJIL().LIZ(bundle.getString("app_id"), bundle.getString("expired_event_name"), bundle.getBundle("expired_event_params"), bundle.getString("origin"), bundle.getLong("creation_timestamp"))));
        } catch (IllegalArgumentException unused) {
        }
    }

    /* access modifiers changed from: private */
    public final void LJJIJ() {
        LIZJ();
        String LIZ2 = LJIIZILJ().LJIILJJIL.LIZ();
        if (LIZ2 != null) {
            if ("unset".equals(LIZ2)) {
                LIZ("app", "_npa", (Object) null, LJIIJJI().LIZ());
            } else {
                LIZ("app", "_npa", Long.valueOf("true".equals(LIZ2) ? 1 : 0), LJIIJJI().LIZ());
            }
        }
        if (!this.LJJIFFI.LJIIZILJ() || !this.LIZJ) {
            LJIILLIIL().LJIIIZ.LIZ("Updating Scion state (FE)");
            LJI().LJJ();
            return;
        }
        LJIILLIIL().LJIIIZ.LIZ("Recording app launch after enabling measurement for the first time (FE)");
        LJJI();
        C65187Pia.LIZIZ();
        if (LJIJ().LIZ(C65111PhM.LJJZZIII)) {
            LJIIIZ().LIZIZ.LIZ();
        }
        C65183PiW.LIZIZ();
        if (LJIJ().LIZ(C65111PhM.LJLIL) && this.LJJIFFI.LJIIIIZZ.LIZ.LIZIZ().LJIIIZ.LIZ() <= 0) {
            C39346Fcl fcl = this.LJJIFFI.LJIIIIZZ;
            fcl.LIZ(fcl.LIZ.LJIIL().getPackageName());
        }
        if (LJIJ().LIZ(C65111PhM.LJLZ)) {
            LJIILL().LIZ(new RunnableC40181FqE(this));
        }
    }

    public final ArrayList<Bundle> LIZ(String str, String str2, String str3) {
        if (LJIILL().LJFF()) {
            LJIILLIIL().LIZJ.LIZ("Cannot get conditional user properties from analytics worker thread");
            return new ArrayList<>(0);
        } else if (C40430FuF.LIZ()) {
            LJIILLIIL().LIZJ.LIZ("Cannot get conditional user properties from main thread");
            return new ArrayList<>(0);
        } else {
            AtomicReference atomicReference = new AtomicReference();
            this.LJJIFFI.LJIILL().LIZ(atomicReference, 5000, "get conditional user properties", new RunnableC40438FuN(this, atomicReference, str, str2, str3));
            List list = (List) atomicReference.get();
            if (list != null) {
                return C40161Fpu.LIZIZ((List<zzw>) list);
            }
            LJIILLIIL().LIZJ.LIZ("Timed out waiting for get conditional user properties", str);
            return new ArrayList<>();
        }
    }

    public final Map<String, Object> LIZ(String str, String str2, String str3, boolean z) {
        if (LJIILL().LJFF()) {
            LJIILLIIL().LIZJ.LIZ("Cannot get user properties from analytics worker thread");
            return Collections.emptyMap();
        } else if (C40430FuF.LIZ()) {
            LJIILLIIL().LIZJ.LIZ("Cannot get user properties from main thread");
            return Collections.emptyMap();
        } else {
            AtomicReference atomicReference = new AtomicReference();
            this.LJJIFFI.LJIILL().LIZ(atomicReference, 5000, "get user properties", new RunnableC40439FuO(this, atomicReference, str, str2, str3, z));
            List<zzkr> list = (List) atomicReference.get();
            if (list == null) {
                LJIILLIIL().LIZJ.LIZ("Timed out waiting for handle get user properties, includeInternal", Boolean.valueOf(z));
                return Collections.emptyMap();
            }
            C257410h r3 = new C257410h(list.size());
            for (zzkr zzkr : list) {
                r3.put(zzkr.LIZ, zzkr.LIZ());
            }
            return r3;
        }
    }

    @Override // X.C40190FqN, X.C40186FqJ
    public final /* bridge */ /* synthetic */ void LIZ() {
        super.LIZ();
    }

    public final void LIZ(AbstractC40446FuV fuV) {
        AbstractC40446FuV fuV2;
        LIZJ();
        LJJIIJZLJL();
        if (!(fuV == null || fuV == (fuV2 = this.LIZLLL))) {
            F6B.LIZ(fuV2 == null, "EventInterceptor already set.");
        }
        this.LIZLLL = fuV;
    }

    public final void LIZ(AbstractC40470Fut fut) {
        LJJIIJZLJL();
        F6B.LIZ(fut);
        if (!this.LJ.add(fut)) {
            LJIILLIIL().LJFF.LIZ("OnEventListener already registered");
        }
    }

    public final void LIZ(Bundle bundle, long j) {
        F6B.LIZ(bundle);
        Bundle bundle2 = new Bundle(bundle);
        if (!TextUtils.isEmpty(bundle2.getString("app_id"))) {
            LJIILLIIL().LJFF.LIZ("Package name should be null when calling setConditionalUserProperty");
        }
        bundle2.remove("app_id");
        LIZIZ(bundle2, j);
    }

    public final void LIZ(String str) {
        this.LJI.set(str);
    }

    public final void LIZ(String str, String str2, long j, Bundle bundle) {
        LIZJ();
        LIZ(str, str2, j, bundle, true, this.LIZLLL == null || C40161Fpu.LJ(str2), false, null);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:57:0x0159, code lost:
        if (r11.LIZ(X.C59681Nby.LJIIIIZZ, 40, r38) == false) goto L_0x011e;
     */
    /* JADX WARNING: Removed duplicated region for block: B:102:0x0278  */
    /* JADX WARNING: Removed duplicated region for block: B:132:0x038f  */
    /* JADX WARNING: Removed duplicated region for block: B:147:0x03fc  */
    /* JADX WARNING: Removed duplicated region for block: B:158:0x0460  */
    /* JADX WARNING: Removed duplicated region for block: B:162:0x0474  */
    public final void LIZ(String str, String str2, long j, Bundle bundle, boolean z, boolean z2, boolean z3, String str3) {
        String str4;
        ArrayList arrayList;
        String[] strArr;
        int i2;
        int i3;
        C40484Fv7 fv7;
        List<String> list;
        F6B.LIZ(str);
        F6B.LIZ(bundle);
        LIZJ();
        LJJIIJZLJL();
        if (!this.LJJIFFI.LJIIZILJ()) {
            LJIILLIIL().LJIIIZ.LIZ("Event not sent since app measurement is disabled");
        } else if (!LJIJ().LIZ(C65111PhM.LJJJLL) || (list = LJFF().LIZ) == null || list.contains(str2)) {
            String str5 = null;
            int i4 = 0;
            if (!this.LJFF) {
                this.LJFF = true;
                try {
                    try {
                        (!this.LJJIFFI.LIZLLL ? Class.forName("com.google.android.gms.tagmanager.TagManagerService", true, LJIIL().getClassLoader()) : Class.forName("com.google.android.gms.tagmanager.TagManagerService")).getDeclaredMethod("initialize", Context.class).invoke(null, LJIIL());
                    } catch (Exception e) {
                        LJIILLIIL().LJFF.LIZ("Failed to invoke Tag Manager's initialize() method", e);
                    }
                } catch (ClassNotFoundException unused) {
                    LJIILLIIL().LJIIIIZZ.LIZ("Tag Manager is not found and thus will not be used");
                }
            }
            if (LJIJ().LIZ(C65111PhM.LJJLIIIJ) && "_cmp".equals(str2) && bundle.containsKey("gclid")) {
                LIZ("auto", "_lgclid", bundle.getString("gclid"), LJIIJJI().LIZ());
            }
            C65192Pif.LIZIZ();
            if (LJIJ().LIZ(C65111PhM.LJLLJ)) {
                LJIJI();
                if (z && C40161Fpu.LJI(str2)) {
                    LJIILJJIL().LIZ(bundle, LJIIZILJ().LJJI.LIZ());
                }
            }
            if (z3) {
                LJIJI();
                if (!"_iap".equals(str2)) {
                    C40161Fpu LJ2 = this.LJJIFFI.LJ();
                    int i5 = 2;
                    if (LJ2.LIZ(C59681Nby.LJIIIIZZ, str2)) {
                        if (!LJ2.LIZ(C59681Nby.LJIIIIZZ, FFG.LIZ, str2)) {
                            i5 = 13;
                        }
                    }
                    LJIILLIIL().LJ.LIZ("Invalid public event name. Event will not be logged (FE)", LJIILIIL().LIZ(str2));
                    this.LJJIFFI.LJ();
                    String LIZ2 = C40161Fpu.LIZ(str2, 40, true);
                    if (str2 != null) {
                        i4 = str2.length();
                    }
                    this.LJJIFFI.LJ().LIZ(i5, "_ev", LIZ2, i4);
                    return;
                }
            }
            LJIJI();
            C40484Fv7 LIZ3 = LJII().LIZ(false);
            if (LIZ3 != null && !bundle.containsKey("_sc")) {
                LIZ3.LIZLLL = true;
            }
            C40171Fq4.LIZ(LIZ3, bundle, z && z3);
            boolean equals = "am".equals(str);
            boolean LJ3 = C40161Fpu.LJ(str2);
            if (z && this.LIZLLL != null && !LJ3 && !equals) {
                LJIILLIIL().LJIIIZ.LIZ("Passing event to registered event handler (FE)", LJIILIIL().LIZ(str2), LJIILIIL().LIZ(bundle));
                this.LIZLLL.LIZ(str, str2, bundle, j);
            } else if (this.LJJIFFI.LJIL()) {
                int LIZIZ2 = LJIILJJIL().LIZIZ(str2);
                if (LIZIZ2 != 0) {
                    LJIILLIIL().LJ.LIZ("Invalid event name. Event will not be logged (FE)", LJIILIIL().LIZ(str2));
                    LJIILJJIL();
                    String LIZ4 = C40161Fpu.LIZ(str2, 40, true);
                    if (str2 != null) {
                        i4 = str2.length();
                    }
                    this.LJJIFFI.LJ().LIZIZ(LIZIZ2, "_ev", LIZ4, i4);
                    return;
                }
                List<String> unmodifiableList = Collections.unmodifiableList(Arrays.asList("_o", "_sn", "_sc", "_si"));
                Bundle LIZ5 = LJIILJJIL().LIZ(str3, str2, bundle, unmodifiableList, z3, true);
                if (LIZ5 != null && LIZ5.containsKey("_sc") && LIZ5.containsKey("_si") && (fv7 = new C40484Fv7(LIZ5.getString("_sn"), LIZ5.getString("_sc"), Long.valueOf(LIZ5.getLong("_si")).longValue())) != null) {
                    LIZ3 = fv7;
                }
                if (LJIJ().LIZ(C65111PhM.LJJJJJ)) {
                    LJIJI();
                    if (LJII().LIZ(false) != null) {
                        str4 = str2;
                        if ("_ae".equals(str4)) {
                            long LIZ6 = LJIIIZ().LIZJ.LIZ();
                            if (LIZ6 > 0) {
                                LJIILJJIL().LIZ(LIZ5, LIZ6);
                            }
                        }
                        C65180PiT.LIZIZ();
                        if (LJIJ().LIZ(C65111PhM.LJJZZI)) {
                            if (!"auto".equals(str) && "_ssr".equals(str4)) {
                                C40161Fpu LJIILJJIL = LJIILJJIL();
                                String string = LIZ5.getString("_ffr");
                                if (!C38028Ewb.LIZ(string)) {
                                    str5 = string.trim();
                                }
                                if (C40161Fpu.LIZJ(str5, LJIILJJIL.LJIIZILJ().LJIJJLI.LIZ())) {
                                    LJIILJJIL.LJIILLIIL().LJIIIZ.LIZ("Not logging duplicate session_start_with_rollout event");
                                    return;
                                }
                                LJIILJJIL.LJIIZILJ().LJIJJLI.LIZ(str5);
                            } else if ("_ae".equals(str4)) {
                                String LIZ7 = LJIILJJIL().LJIIZILJ().LJIJJLI.LIZ();
                                if (!TextUtils.isEmpty(LIZ7)) {
                                    LIZ5.putString("_ffr", LIZ7);
                                }
                            }
                        }
                        arrayList = new ArrayList();
                        arrayList.add(LIZ5);
                        long nextLong = LJIILJJIL().LJI().nextLong();
                        if (LJIIZILJ().LJIILLIIL.LIZ() > 0 && LJIIZILJ().LIZ(j) && LJIIZILJ().LJIJ.LIZ()) {
                            LJIILLIIL().LJIIJ.LIZ("Current session is expired, remove the session number, ID, and engagement time");
                            LIZ("auto", "_sid", (Object) null, LJIIJJI().LIZ());
                            LIZ("auto", "_sno", (Object) null, LJIIJJI().LIZ());
                            LIZ("auto", "_se", (Object) null, LJIIJJI().LIZ());
                        }
                        if (LIZ5.getLong("extend_session", 0) == 1) {
                            LJIILLIIL().LJIIJ.LIZ("EXTEND_SESSION param attached: initiate a new session or extend the current active session");
                            this.LJJIFFI.LIZJ().LIZIZ.LIZ(j, true);
                        }
                        strArr = (String[]) LIZ5.keySet().toArray(new String[LIZ5.size()]);
                        Arrays.sort(strArr);
                        C65212Piz.LIZIZ();
                        if (LJIJ().LIZ(C65111PhM.LJLJL) || !LJIJ().LIZ(C65111PhM.LJLJJLL)) {
                            i3 = 0;
                            for (String str6 : strArr) {
                                Object LIZ8 = LIZ(LIZ5, str6);
                                LJIILJJIL();
                                Bundle[] LIZIZ3 = C40161Fpu.LIZIZ(LIZ8);
                                if (LIZIZ3 != null) {
                                    LIZ5.putInt(str6, LIZIZ3.length);
                                    int i6 = 0;
                                    while (i6 < LIZIZ3.length) {
                                        Bundle bundle2 = LIZIZ3[i6];
                                        C40171Fq4.LIZ(LIZ3, bundle2, true);
                                        Bundle LIZ9 = LJIILJJIL().LIZ(str3, "_ep", bundle2, unmodifiableList, z3, false);
                                        LIZ9.putString("_en", str4);
                                        LIZ9.putLong("_eid", nextLong);
                                        LIZ9.putString("_gn", str6);
                                        LIZ9.putInt("_ll", LIZIZ3.length);
                                        LIZ9.putInt("_i", i6);
                                        arrayList.add(LIZ9);
                                        i6++;
                                        str4 = str4;
                                    }
                                    i3 += LIZIZ3.length;
                                }
                            }
                            if (i3 != 0) {
                                LIZ5.putLong("_eid", nextLong);
                                LIZ5.putInt("_epc", i3);
                            }
                        } else {
                            for (String str7 : strArr) {
                                LJIILJJIL();
                                Bundle[] LIZIZ4 = C40161Fpu.LIZIZ(LIZ(LIZ5, str7));
                                if (LIZIZ4 != null) {
                                    LIZ5.putParcelableArray(str7, LIZIZ4);
                                }
                            }
                        }
                        i2 = 0;
                        while (i2 < arrayList.size()) {
                            Bundle bundle3 = (Bundle) arrayList.get(i2);
                            String str8 = i2 != 0 ? "_ep" : str4;
                            bundle3.putString("_o", str);
                            if (z2) {
                                bundle3 = LJIILJJIL().LIZ(bundle3);
                            }
                            LJI().LIZ(new zzao(str8, new zzan(bundle3), str, j), str3);
                            if (!equals) {
                                for (AbstractC40470Fut fut : this.LJ) {
                                    fut.LIZ(str, str4, new Bundle(bundle3), j);
                                }
                            }
                            i2++;
                        }
                        LJIJI();
                        if (LJII().LIZ(false) != null && "_ae".equals(str4)) {
                            LJIIIZ().LIZ(true, true, LJIIJJI().LIZIZ());
                            return;
                        }
                    }
                }
                str4 = str2;
                C65180PiT.LIZIZ();
                if (LJIJ().LIZ(C65111PhM.LJJZZI)) {
                }
                arrayList = new ArrayList();
                arrayList.add(LIZ5);
                long nextLong2 = LJIILJJIL().LJI().nextLong();
                LJIILLIIL().LJIIJ.LIZ("Current session is expired, remove the session number, ID, and engagement time");
                LIZ("auto", "_sid", (Object) null, LJIIJJI().LIZ());
                LIZ("auto", "_sno", (Object) null, LJIIJJI().LIZ());
                LIZ("auto", "_se", (Object) null, LJIIJJI().LIZ());
                if (LIZ5.getLong("extend_session", 0) == 1) {
                }
                strArr = (String[]) LIZ5.keySet().toArray(new String[LIZ5.size()]);
                Arrays.sort(strArr);
                C65212Piz.LIZIZ();
                if (LJIJ().LIZ(C65111PhM.LJLJL)) {
                }
                i3 = 0;
                while (r7 < r14) {
                }
                if (i3 != 0) {
                }
                i2 = 0;
                while (i2 < arrayList.size()) {
                }
                LJIJI();
                if (LJII().LIZ(false) != null) {
                }
            }
        } else {
            LJIILLIIL().LJIIIZ.LIZ("Dropping non-safelisted event. event name, origin", str2, str);
        }
    }

    public final void LIZ(String str, String str2, Bundle bundle) {
        LIZ(str, str2, bundle, true, true, LJIIJJI().LIZ());
    }

    public final void LIZ(String str, String str2, Bundle bundle, boolean z, boolean z2, long j) {
        String str3 = str;
        Bundle bundle2 = bundle;
        if (str3 == null) {
            str3 = "app";
        }
        if (bundle2 == null) {
            bundle2 = new Bundle();
        }
        if (!LJIJ().LIZ(C65111PhM.LJLJI) || !C40161Fpu.LIZJ(str2, "screen_view")) {
            LIZ(str3, str2, j, bundle2, z2, !z2 || this.LIZLLL == null || C40161Fpu.LJ(str2), !z);
        } else {
            LJII().LIZ(bundle2, j);
        }
    }

    public final void LIZ(String str, String str2, Object obj) {
        LIZ(str, str2, obj, true, LJIIJJI().LIZ());
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x0056  */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x0075  */
    public final void LIZ(String str, String str2, Object obj, long j) {
        Long l;
        Object obj2 = obj;
        F6B.LIZ(str);
        F6B.LIZ(str2);
        LIZJ();
        LJJIIJZLJL();
        String str3 = "_npa";
        if ("allow_personalized_ads".equals(str2)) {
            if (obj2 instanceof String) {
                String str4 = (String) obj2;
                if (!TextUtils.isEmpty(str4)) {
                    String str5 = "false";
                    Long valueOf = Long.valueOf(str5.equals(str4.toLowerCase(Locale.ENGLISH)) ? 1 : 0);
                    C40447FuW fuW = LJIIZILJ().LJIILJJIL;
                    if (valueOf.longValue() == 1) {
                        str5 = "true";
                    }
                    fuW.LIZ(str5);
                    l = valueOf;
                    if (!this.LJJIFFI.LJIIZILJ()) {
                        LJIILLIIL().LJIIJ.LIZ("User property not set since app measurement is disabled");
                        return;
                    } else if (this.LJJIFFI.LJIL()) {
                        LJI().LIZ(new zzkr(str3, j, l, str));
                        return;
                    } else {
                        return;
                    }
                }
            }
            if (obj2 == null) {
                LJIIZILJ().LJIILJJIL.LIZ("unset");
                l = obj2;
                if (!this.LJJIFFI.LJIIZILJ()) {
                }
            }
        }
        str3 = str2;
        l = obj2;
        if (!this.LJJIFFI.LJIIZILJ()) {
        }
    }

    public final void LIZ(String str, String str2, Object obj, boolean z, long j) {
        String str3 = str;
        if (str3 == null) {
            str3 = "app";
        }
        int i2 = 6;
        int i3 = 0;
        if (z) {
            i2 = LJIILJJIL().LIZJ(str2);
        } else {
            C40161Fpu LJIILJJIL = LJIILJJIL();
            if (LJIILJJIL.LIZ("user property", str2)) {
                if (!LJIILJJIL.LIZ("user property", C40274Frj.LIZ, str2)) {
                    i2 = 15;
                } else if (LJIILJJIL.LIZ("user property", 24, str2)) {
                    i2 = 0;
                }
            }
        }
        if (i2 != 0) {
            LJIILJJIL();
            String LIZ2 = C40161Fpu.LIZ(str2, 24, true);
            if (str2 != null) {
                i3 = str2.length();
            }
            this.LJJIFFI.LJ().LIZ(i2, "_ev", LIZ2, i3);
        } else if (obj != null) {
            int LIZIZ2 = LJIILJJIL().LIZIZ(str2, obj);
            if (LIZIZ2 != 0) {
                LJIILJJIL();
                String LIZ3 = C40161Fpu.LIZ(str2, 24, true);
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    i3 = String.valueOf(obj).length();
                }
                this.LJJIFFI.LJ().LIZ(LIZIZ2, "_ev", LIZ3, i3);
                return;
            }
            Object LIZJ2 = LJIILJJIL().LIZJ(str2, obj);
            if (LIZJ2 != null) {
                LIZ(str3, str2, j, LIZJ2);
            }
        } else {
            LIZ(str3, str2, j, (Object) null);
        }
    }

    public final void LIZ(String str, String str2, String str3, Bundle bundle) {
        long LIZ2 = LJIIJJI().LIZ();
        F6B.LIZ(str2);
        Bundle bundle2 = new Bundle();
        if (str != null) {
            bundle2.putString("app_id", str);
        }
        bundle2.putString(StringSet.name, str2);
        bundle2.putLong("creation_timestamp", LIZ2);
        if (str3 != null) {
            bundle2.putString("expired_event_name", str3);
            bundle2.putBundle("expired_event_params", bundle);
        }
        LJIILL().LIZ(new RunnableC40373FtK(this, bundle2));
    }

    public final void LIZ(boolean z) {
        LJJIIJZLJL();
        LJIILL().LIZ(new RunnableC40396Fth(this, z));
    }

    @Override // X.C40190FqN, X.C40186FqJ
    public final /* bridge */ /* synthetic */ void LIZIZ() {
        super.LIZIZ();
    }

    public final void LIZIZ(AbstractC40470Fut fut) {
        LJJIIJZLJL();
        F6B.LIZ(fut);
        if (!this.LJ.remove(fut)) {
            LJIILLIIL().LJFF.LIZ("OnEventListener had not been registered");
        }
    }

    public final void LIZIZ(Bundle bundle, long j) {
        F6B.LIZ(bundle);
        C534428v.LIZ(bundle, "app_id", String.class, null);
        C534428v.LIZ(bundle, "origin", String.class, null);
        C534428v.LIZ(bundle, StringSet.name, String.class, null);
        C534428v.LIZ(bundle, "value", Object.class, null);
        C534428v.LIZ(bundle, "trigger_event_name", String.class, null);
        C534428v.LIZ(bundle, "trigger_timeout", Long.class, 0L);
        C534428v.LIZ(bundle, "timed_out_event_name", String.class, null);
        C534428v.LIZ(bundle, "timed_out_event_params", Bundle.class, null);
        C534428v.LIZ(bundle, "triggered_event_name", String.class, null);
        C534428v.LIZ(bundle, "triggered_event_params", Bundle.class, null);
        C534428v.LIZ(bundle, "time_to_live", Long.class, 0L);
        C534428v.LIZ(bundle, "expired_event_name", String.class, null);
        C534428v.LIZ(bundle, "expired_event_params", Bundle.class, null);
        F6B.LIZ(bundle.getString(StringSet.name));
        F6B.LIZ(bundle.getString("origin"));
        F6B.LIZ(LIZ(bundle, "value"));
        bundle.putLong("creation_timestamp", j);
        String string = bundle.getString(StringSet.name);
        Object LIZ2 = LIZ(bundle, "value");
        if (LJIILJJIL().LIZJ(string) != 0) {
            LJIILLIIL().LIZJ.LIZ("Invalid conditional user property name", LJIILIIL().LIZJ(string));
        } else if (LJIILJJIL().LIZIZ(string, LIZ2) != 0) {
            LJIILLIIL().LIZJ.LIZ("Invalid conditional user property value", LJIILIIL().LIZJ(string), LIZ2);
        } else {
            Object LIZJ2 = LJIILJJIL().LIZJ(string, LIZ2);
            if (LIZJ2 == null) {
                LJIILLIIL().LIZJ.LIZ("Unable to normalize conditional user property value", LJIILIIL().LIZJ(string), LIZ2);
                return;
            }
            C534428v.LIZ(bundle, LIZJ2);
            long j2 = bundle.getLong("trigger_timeout");
            if (TextUtils.isEmpty(bundle.getString("trigger_event_name")) || (j2 <= 15552000000L && j2 >= 1)) {
                long j3 = bundle.getLong("time_to_live");
                if (j3 > 15552000000L || j3 < 1) {
                    LJIILLIIL().LIZJ.LIZ("Invalid conditional user property time to live", LJIILIIL().LIZJ(string), Long.valueOf(j3));
                } else {
                    LJIILL().LIZ(new RunnableC40374FtL(this, bundle));
                }
            } else {
                LJIILLIIL().LIZJ.LIZ("Invalid conditional user property timeout", LJIILIIL().LIZJ(string), Long.valueOf(j2));
            }
        }
    }

    public final void LIZIZ(String str, String str2, Bundle bundle) {
        LIZJ();
        LIZ(str, str2, LJIIJJI().LIZ(), bundle);
    }

    @Override // X.C40190FqN, X.C40186FqJ
    public final /* bridge */ /* synthetic */ void LIZJ() {
        super.LIZJ();
    }

    public final void LIZJ(String str, String str2, Bundle bundle) {
        LIZ((String) null, str, str2, bundle);
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40176Fq9 LIZLLL() {
        return super.LIZLLL();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40169Fq2 LJ() {
        return super.LJ();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40168Fq1 LJFF() {
        return super.LJFF();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40170Fq3 LJI() {
        return super.LJI();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40171Fq4 LJII() {
        return super.LJII();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40173Fq6 LJIIIIZZ() {
        return super.LJIIIIZZ();
    }

    @Override // X.C40190FqN
    public final /* bridge */ /* synthetic */ C40174Fq7 LJIIIZ() {
        return super.LJIIIZ();
    }

    @Override // X.C40186FqJ
    public final /* bridge */ /* synthetic */ C40139FpY LJIIJ() {
        return super.LJIIJ();
    }

    @Override // X.C40186FqJ, X.AbstractC40429FuE
    public final /* bridge */ /* synthetic */ AbstractC40150Fpj LJIIJJI() {
        return super.LJIIJJI();
    }

    @Override // X.C40186FqJ, X.AbstractC40429FuE
    public final /* bridge */ /* synthetic */ Context LJIIL() {
        return super.LJIIL();
    }

    @Override // X.C40186FqJ
    public final /* bridge */ /* synthetic */ C40140FpZ LJIILIIL() {
        return super.LJIILIIL();
    }

    @Override // X.C40186FqJ
    public final /* bridge */ /* synthetic */ C40161Fpu LJIILJJIL() {
        return super.LJIILJJIL();
    }

    @Override // X.C40186FqJ, X.AbstractC40429FuE
    public final /* bridge */ /* synthetic */ C40137FpW LJIILL() {
        return super.LJIILL();
    }

    @Override // X.C40186FqJ, X.AbstractC40429FuE
    public final /* bridge */ /* synthetic */ C40159Fps LJIILLIIL() {
        return super.LJIILLIIL();
    }

    @Override // X.C40186FqJ
    public final /* bridge */ /* synthetic */ C40172Fq5 LJIIZILJ() {
        return super.LJIIZILJ();
    }

    @Override // X.C40186FqJ
    public final /* bridge */ /* synthetic */ C40187FqK LJIJ() {
        return super.LJIJ();
    }

    @Override // X.C40186FqJ, X.AbstractC40429FuE
    public final /* bridge */ /* synthetic */ C40430FuF LJIJI() {
        return super.LJIJI();
    }

    @Override // X.AbstractC40301FsA
    public final boolean LJIJJ() {
        return false;
    }

    public final void LJIL() {
        if (LIZ(LJIIL()) instanceof Application) {
            ((Application) LIZ(LJIIL())).unregisterActivityLifecycleCallbacks(this.LIZ);
        }
    }

    public final String LJJ() {
        return this.LJI.get();
    }

    public final void LJJI() {
        LIZJ();
        LJJIIJZLJL();
        if (this.LJJIFFI.LJIL()) {
            if (LJIJ().LIZ(C65111PhM.LJJLIIIIJ)) {
                C40187FqK LJIJ = LJIJ();
                LJIJ.LJIJI();
                Boolean LIZLLL2 = LJIJ.LIZLLL("google_analytics_deferred_deep_link_enabled");
                if (LIZLLL2 != null && LIZLLL2.booleanValue()) {
                    LJIILLIIL().LJIIIZ.LIZ("Deferred Deep Link feature enabled.");
                    LJIILL().LIZ(new RunnableC40200FqX(this));
                }
            }
            LJI().LJJIFFI();
            this.LIZJ = false;
            String LJIJJLI = LJIIZILJ().LJIJJLI();
            if (!TextUtils.isEmpty(LJIJJLI)) {
                LJIIJ().LJJ();
                if (!LJIJJLI.equals(Build.VERSION.RELEASE)) {
                    Bundle bundle = new Bundle();
                    bundle.putString("_po", LJIJJLI);
                    LIZ("auto", "_ou", bundle);
                }
            }
        }
    }

    public final String LJJIFFI() {
        C40484Fv7 fv7 = this.LJJIFFI.LJII().LIZ;
        if (fv7 != null) {
            return fv7.LIZ;
        }
        return null;
    }

    public final String LJJII() {
        C40484Fv7 fv7 = this.LJJIFFI.LJII().LIZ;
        if (fv7 != null) {
            return fv7.LIZIZ;
        }
        return null;
    }

    public final String LJJIII() {
        if (this.LJJIFFI.LIZ != null) {
            return this.LJJIFFI.LIZ;
        }
        try {
            return FFH.LIZ(LJIIL(), "google_app_id");
        } catch (IllegalStateException e) {
            this.LJJIFFI.LJIILLIIL().LIZJ.LIZ("getGoogleAppId failed with exception", e);
            return null;
        }
    }
}