package com.google.android.gms.measurement.internal;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.text.TextUtils;
import defpackage.AbstractBinderC5405;
import defpackage.AbstractC3818;
import defpackage.BinderC3730;
import defpackage.C0357;
import defpackage.C0992;
import defpackage.C1103;
import defpackage.C1216;
import defpackage.C1533;
import defpackage.C1623;
import defpackage.C1961;
import defpackage.C1979;
import defpackage.C2303;
import defpackage.C2994;
import defpackage.C3160;
import defpackage.C3209;
import defpackage.C3310;
import defpackage.C3335;
import defpackage.C3468;
import defpackage.C3485;
import defpackage.C3590;
import defpackage.C3606;
import defpackage.C4368;
import defpackage.C4799;
import defpackage.C5379;
import defpackage.EnumC0308;
import defpackage.InterfaceC3007;
import defpackage.InterfaceC3046;
import defpackage.InterfaceC3267;
import defpackage.InterfaceC4279;
import defpackage.InterfaceC4754;
import defpackage.InterfaceC5550;
import defpackage.RunnableC0648;
import defpackage.RunnableC0735;
import defpackage.RunnableC1505;
import defpackage.RunnableC1779;
import defpackage.RunnableC2801;
import defpackage.RunnableC3021;
import defpackage.RunnableC3161;
import defpackage.RunnableC4190;
import defpackage.RunnableC4537;
import defpackage.RunnableC5243;
import j$.util.Objects;
import j$.util.concurrent.ConcurrentHashMap;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;

/* JADX INFO: loaded from: classes3.dex */
public class AppMeasurementDynamiteService extends AbstractBinderC5405 {

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final C3310 f1030;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public C1103 f1031;

    public AppMeasurementDynamiteService() {
        super("com.google.android.gms.measurement.api.internal.IAppMeasurementDynamiteService");
        this.f1031 = null;
        this.f1030 = new C3310(0);
    }

    @Override // defpackage.InterfaceC5047
    public void beginAdUnitExposure(String str, long j) {
        m812();
        C3468 c3468 = this.f1031.f4706;
        C1103.m3566(c3468);
        c3468.m7905(j, str);
    }

    @Override // defpackage.InterfaceC5047
    public void clearConditionalUserProperty(String str, String str2, Bundle bundle) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m10007(str, str2, bundle);
    }

    @Override // defpackage.InterfaceC5047
    public void clearMeasurementEnabled(long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m5699();
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new ᵟᵰᵕ(12, c4799, (Object) null, false));
    }

    @Override // defpackage.InterfaceC5047
    public void endAdUnitExposure(String str, long j) {
        m812();
        C3468 c3468 = this.f1031.f4706;
        C1103.m3566(c3468);
        c3468.m7908(j, str);
    }

    @Override // defpackage.InterfaceC5047
    public void generateEventId(InterfaceC3046 interfaceC3046) {
        m812();
        C3335 c3335 = this.f1031.f4730;
        C1103.m3567(c3335);
        long jM7650 = c3335.m7650();
        m812();
        C3335 c33352 = this.f1031.f4730;
        C1103.m3567(c33352);
        c33352.m7661(interfaceC3046, jM7650);
    }

    @Override // defpackage.InterfaceC5047
    public void getAppInstanceId(InterfaceC3046 interfaceC3046) {
        m812();
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC4537(this, interfaceC3046, 0));
    }

    @Override // defpackage.InterfaceC5047
    public void getCachedAppInstanceId(InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        m813((String) c4799.f18261.get(), interfaceC3046);
    }

    @Override // defpackage.InterfaceC5047
    public void getConditionalUserProperties(String str, String str2, InterfaceC3046 interfaceC3046) {
        m812();
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC3161(this, interfaceC3046, str, str2, 9));
    }

    @Override // defpackage.InterfaceC5047
    public void getCurrentScreenClass(InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1533 c1533 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4723;
        C1103.m3565(c1533);
        C3160 c3160 = c1533.f6191;
        m813(c3160 != null ? c3160.f12020 : null, interfaceC3046);
    }

    @Override // defpackage.InterfaceC5047
    public void getCurrentScreenName(InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1533 c1533 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4723;
        C1103.m3565(c1533);
        C3160 c3160 = c1533.f6191;
        m813(c3160 != null ? c3160.f12023 : null, interfaceC3046);
    }

    @Override // defpackage.InterfaceC5047
    public void getGmpAppId(InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        m813(c4799.m10014(), interfaceC3046);
    }

    @Override // defpackage.InterfaceC5047
    public void getMaxUserProperties(String str, InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        ᵘᵞʿⁱ.ˊᵫᵗ(str);
        ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).getClass();
        m812();
        C3335 c3335 = this.f1031.f4730;
        C1103.m3567(c3335);
        c3335.m7656(interfaceC3046, 25);
    }

    @Override // defpackage.InterfaceC5047
    public void getSessionId(InterfaceC3046 interfaceC3046) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC0648(c4799, interfaceC3046));
    }

    @Override // defpackage.InterfaceC5047
    public void getTestFlag(InterfaceC3046 interfaceC3046, int i) {
        m812();
        if (i == 0) {
            C3335 c3335 = this.f1031.f4730;
            C1103.m3567(c3335);
            C4799 c4799 = this.f1031.f4709;
            C1103.m3565(c4799);
            AtomicReference atomicReference = new AtomicReference();
            C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
            C1103.m3564(c1961);
            c3335.m7642((String) c1961.m5245(atomicReference, 15000L, "String test flag value", new RunnableC3021(c4799, atomicReference, 1)), interfaceC3046);
            return;
        }
        if (i == 1) {
            C3335 c33352 = this.f1031.f4730;
            C1103.m3567(c33352);
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            AtomicReference atomicReference2 = new AtomicReference();
            C1961 c19612 = ((C1103) ((ᵜᵪʾ) c47992).ˌᴵ).f4707;
            C1103.m3564(c19612);
            c33352.m7661(interfaceC3046, ((Long) c19612.m5245(atomicReference2, 15000L, "long test flag value", new RunnableC1779(c47992, atomicReference2, 0))).longValue());
            return;
        }
        if (i == 2) {
            C3335 c33353 = this.f1031.f4730;
            C1103.m3567(c33353);
            C4799 c47993 = this.f1031.f4709;
            C1103.m3565(c47993);
            AtomicReference atomicReference3 = new AtomicReference();
            C1961 c19613 = ((C1103) ((ᵜᵪʾ) c47993).ˌᴵ).f4707;
            C1103.m3564(c19613);
            double dDoubleValue = ((Double) c19613.m5245(atomicReference3, 15000L, "double test flag value", new RunnableC1779(c47993, atomicReference3, 1))).doubleValue();
            Bundle bundle = new Bundle();
            bundle.putDouble("r", dDoubleValue);
            try {
                interfaceC3046.mo2444(bundle);
                return;
            } catch (RemoteException e) {
                C3485 c3485 = ((C1103) ((ᵜᵪʾ) c33353).ˌᴵ).f4729;
                C1103.m3564(c3485);
                c3485.f13424.m4474(e, "Error returning double value to wrapper");
                return;
            }
        }
        if (i == 3) {
            C3335 c33354 = this.f1031.f4730;
            C1103.m3567(c33354);
            C4799 c47994 = this.f1031.f4709;
            C1103.m3565(c47994);
            AtomicReference atomicReference4 = new AtomicReference();
            C1961 c19614 = ((C1103) ((ᵜᵪʾ) c47994).ˌᴵ).f4707;
            C1103.m3564(c19614);
            c33354.m7656(interfaceC3046, ((Integer) c19614.m5245(atomicReference4, 15000L, "int test flag value", new RunnableC3021(c47994, atomicReference4, 2))).intValue());
            return;
        }
        if (i != 4) {
            return;
        }
        C3335 c33355 = this.f1031.f4730;
        C1103.m3567(c33355);
        C4799 c47995 = this.f1031.f4709;
        C1103.m3565(c47995);
        AtomicReference atomicReference5 = new AtomicReference();
        C1961 c19615 = ((C1103) ((ᵜᵪʾ) c47995).ˌᴵ).f4707;
        C1103.m3564(c19615);
        c33355.m7646(interfaceC3046, ((Boolean) c19615.m5245(atomicReference5, 15000L, "boolean test flag value", new RunnableC3021(c47995, atomicReference5, 0))).booleanValue());
    }

    @Override // defpackage.InterfaceC5047
    public void getUserProperties(String str, String str2, boolean z, InterfaceC3046 interfaceC3046) {
        m812();
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC1505(this, interfaceC3046, str, str2, z));
    }

    @Override // defpackage.InterfaceC5047
    public void initForTests(Map map) {
        m812();
    }

    @Override // defpackage.InterfaceC5047
    public void initialize(InterfaceC4754 interfaceC4754, C1216 c1216, long j) {
        C1103 c1103 = this.f1031;
        if (c1103 == null) {
            Context context = (Context) BinderC3730.m8395(interfaceC4754);
            ᵘᵞʿⁱ.ᵶᵥᵝ(context);
            this.f1031 = C1103.m3563(context, c1216, Long.valueOf(j), null);
        } else {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13424.m4476("Attempting to initialize multiple times");
        }
    }

    @Override // defpackage.InterfaceC5047
    public void initializeWithElapsedTime(InterfaceC4754 interfaceC4754, C1216 c1216, long j, long j2) {
        C1103 c1103 = this.f1031;
        if (c1103 == null) {
            Context context = (Context) BinderC3730.m8395(interfaceC4754);
            ᵘᵞʿⁱ.ᵶᵥᵝ(context);
            this.f1031 = C1103.m3563(context, c1216, Long.valueOf(j), Long.valueOf(j2));
        } else {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13424.m4476("Attempting to initialize multiple times");
        }
    }

    @Override // defpackage.InterfaceC5047
    public void isDataCollectionEnabled(InterfaceC3046 interfaceC3046) {
        m812();
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC4537(this, interfaceC3046, 1));
    }

    @Override // defpackage.InterfaceC5047
    public void logEvent(String str, String str2, Bundle bundle, boolean z, boolean z2, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m10025(str, str2, bundle, z, z2, j, 0L);
    }

    @Override // defpackage.InterfaceC5047
    public void logEventAndBundle(String str, String str2, Bundle bundle, InterfaceC3046 interfaceC3046, long j) {
        m812();
        ᵘᵞʿⁱ.ˊᵫᵗ(str2);
        String str3 = true != this.f1031.f4726.m8314(null, AbstractC3818.f14475) ? "app" : "auto";
        (bundle != null ? new Bundle(bundle) : new Bundle()).putString("_o", str3);
        C0357 c0357 = new C0357(str2, new C3590(bundle), str3, j, 0L);
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC3161(this, interfaceC3046, c0357, str, 4));
    }

    @Override // defpackage.InterfaceC5047
    public void logEventWithElapsedTime(String str, String str2, Bundle bundle, boolean z, boolean z2, long j, long j2) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m10025(str, str2, bundle, z, z2, j, j2);
    }

    @Override // defpackage.InterfaceC5047
    public void logHealthData(int i, String str, InterfaceC4754 interfaceC4754, InterfaceC4754 interfaceC47542, InterfaceC4754 interfaceC47543) {
        m812();
        Object objM8395 = interfaceC4754 == null ? null : BinderC3730.m8395(interfaceC4754);
        Object objM83952 = interfaceC47542 == null ? null : BinderC3730.m8395(interfaceC47542);
        Object objM83953 = interfaceC47543 != null ? BinderC3730.m8395(interfaceC47543) : null;
        C3485 c3485 = this.f1031.f4729;
        C1103.m3564(c3485);
        c3485.m7986(i, true, false, str, objM8395, objM83952, objM83953);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityCreated(InterfaceC4754 interfaceC4754, Bundle bundle, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityCreatedByScionActivityInfo(C5379.m10967(activity), bundle, j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityCreatedByScionActivityInfo(C5379 c5379, Bundle bundle, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C3209 c3209 = c4799.f18269;
        if (c3209 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
            c3209.m7346(c5379, bundle);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityDestroyed(InterfaceC4754 interfaceC4754, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityDestroyedByScionActivityInfo(C5379.m10967(activity), j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityDestroyedByScionActivityInfo(C5379 c5379, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C3209 c3209 = c4799.f18269;
        if (c3209 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
            c3209.m7349(c5379);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityPaused(InterfaceC4754 interfaceC4754, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityPausedByScionActivityInfo(C5379.m10967(activity), j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityPausedByScionActivityInfo(C5379 c5379, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C3209 c3209 = c4799.f18269;
        if (c3209 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
            c3209.m7347(c5379);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityResumed(InterfaceC4754 interfaceC4754, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityResumedByScionActivityInfo(C5379.m10967(activity), j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityResumedByScionActivityInfo(C5379 c5379, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C3209 c3209 = c4799.f18269;
        if (c3209 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
            c3209.m7350(c5379);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivitySaveInstanceState(InterfaceC4754 interfaceC4754, InterfaceC3046 interfaceC3046, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivitySaveInstanceStateByScionActivityInfo(C5379.m10967(activity), interfaceC3046, j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivitySaveInstanceStateByScionActivityInfo(C5379 c5379, InterfaceC3046 interfaceC3046, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C3209 c3209 = c4799.f18269;
        Bundle bundle = new Bundle();
        if (c3209 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
            c3209.m7348(c5379, bundle);
        }
        try {
            interfaceC3046.mo2444(bundle);
        } catch (RemoteException e) {
            C3485 c3485 = this.f1031.f4729;
            C1103.m3564(c3485);
            c3485.f13424.m4474(e, "Error returning bundle value to wrapper");
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityStarted(InterfaceC4754 interfaceC4754, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityStartedByScionActivityInfo(C5379.m10967(activity), j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityStartedByScionActivityInfo(C5379 c5379, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        if (c4799.f18269 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
        }
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityStopped(InterfaceC4754 interfaceC4754, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        onActivityStoppedByScionActivityInfo(C5379.m10967(activity), j);
    }

    @Override // defpackage.InterfaceC5047
    public void onActivityStoppedByScionActivityInfo(C5379 c5379, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        if (c4799.f18269 != null) {
            C4799 c47992 = this.f1031.f4709;
            C1103.m3565(c47992);
            c47992.m10012();
        }
    }

    @Override // defpackage.InterfaceC5047
    public void performAction(Bundle bundle, InterfaceC3046 interfaceC3046, long j) {
        m812();
        interfaceC3046.mo2444(null);
    }

    @Override // defpackage.InterfaceC5047
    public void registerOnMeasurementEventListener(InterfaceC3007 interfaceC3007) {
        Object c0992;
        m812();
        C3310 c3310 = this.f1030;
        synchronized (c3310) {
            try {
                c0992 = (InterfaceC4279) c3310.get(Integer.valueOf(interfaceC3007.mo1121()));
                if (c0992 == null) {
                    c0992 = new C0992(this, interfaceC3007);
                    c3310.put(Integer.valueOf(interfaceC3007.mo1121()), c0992);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m5699();
        if (c4799.f18273.add(c0992)) {
            return;
        }
        C3485 c3485 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4729;
        C1103.m3564(c3485);
        c3485.f13424.m4476("OnEventListener already registered");
    }

    @Override // defpackage.InterfaceC5047
    @Deprecated
    public void resetAnalyticsData(long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.f18261.set(null);
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC4190(c4799, j, 1));
    }

    @Override // defpackage.InterfaceC5047
    public void resetAnalyticsDataWithElapsedTime(long j, long j2) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.f18261.set(null);
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC4190(c4799, j, 1));
    }

    @Override // defpackage.InterfaceC5047
    public void retrieveAndUploadBatches(InterfaceC5550 interfaceC5550) {
        EnumC0308 enumC0308;
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m5699();
        C1103 c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
        C1961 c1961 = c1103.f4707;
        C1103.m3564(c1961);
        if (c1961.m5244()) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13423.m4476("Cannot retrieve and upload batches from analytics worker thread");
            return;
        }
        C1961 c19612 = c1103.f4707;
        C1103.m3564(c19612);
        if (Thread.currentThread() == c19612.f7791) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13423.m4476("Cannot retrieve and upload batches from analytics network thread");
            return;
        }
        boolean z = ᵖˊʨ.ᵜᵪʾ();
        C3485 c34853 = c1103.f4729;
        if (z) {
            C1103.m3564(c34853);
            c34853.f13423.m4476("Cannot retrieve and upload batches from main thread");
            return;
        }
        C1103.m3564(c34853);
        c34853.f13414.m4476("[sgtm] Started client-side batch upload work.");
        boolean z2 = false;
        int size = 0;
        int i = 0;
        while (!z2) {
            C3485 c34854 = c1103.f4729;
            C1103.m3564(c34854);
            c34854.f13414.m4476("[sgtm] Getting upload batches from service (FE)");
            AtomicReference atomicReference = new AtomicReference();
            C1961 c19613 = c1103.f4707;
            C1103.m3564(c19613);
            c19613.m5245(atomicReference, 10000L, "[sgtm] Getting upload batches", new RunnableC3021(c4799, atomicReference, 3));
            C1979 c1979 = (C1979) atomicReference.get();
            if (c1979 == null) {
                break;
            }
            List list = c1979.f7850;
            if (list.isEmpty()) {
                break;
            }
            C3485 c34855 = c1103.f4729;
            C1103.m3564(c34855);
            c34855.f13414.m4474(Integer.valueOf(list.size()), "[sgtm] Retrieved upload batches. count");
            size += list.size();
            Iterator it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    z2 = false;
                    break;
                }
                C4368 c4368 = (C4368) it.next();
                try {
                    URL url = new URI(c4368.f16592).toURL();
                    AtomicReference atomicReference2 = new AtomicReference();
                    C2303 c2303M3569 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).m3569();
                    c2303M3569.m5699();
                    ᵘᵞʿⁱ.ᵶᵥᵝ(c2303M3569.f9051);
                    String str = c2303M3569.f9051;
                    C1103 c11032 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
                    C3485 c34856 = c11032.f4729;
                    C1103.m3564(c34856);
                    C1623 c1623 = c34856.f13414;
                    Long lValueOf = Long.valueOf(c4368.f16591);
                    c1623.m4477("[sgtm] Uploading data from app. row_id, url, uncompressed size", lValueOf, c4368.f16592, Integer.valueOf(c4368.f16593.length));
                    if (!TextUtils.isEmpty(c4368.f16590)) {
                        C3485 c34857 = c11032.f4729;
                        C1103.m3564(c34857);
                        c34857.f13414.m4475("[sgtm] Uploading data from app. row_id", lValueOf, c4368.f16590);
                    }
                    HashMap map = new HashMap();
                    Bundle bundle = c4368.f16594;
                    for (String str2 : bundle.keySet()) {
                        String string = bundle.getString(str2);
                        if (!TextUtils.isEmpty(string)) {
                            map.put(str2, string);
                        }
                    }
                    C3606 c3606 = c11032.f4704;
                    C1103.m3564(c3606);
                    byte[] bArr = c4368.f16593;
                    C2994 c2994 = new C2994(c4799, atomicReference2, c4368, 10);
                    c3606.m9448();
                    ᵘᵞʿⁱ.ᵶᵥᵝ(url);
                    ᵘᵞʿⁱ.ᵶᵥᵝ(bArr);
                    C1961 c19614 = ((C1103) ((ᵜᵪʾ) c3606).ˌᴵ).f4707;
                    C1103.m3564(c19614);
                    c19614.m5251(new RunnableC5243(c3606, str, url, bArr, map, c2994));
                    try {
                        C3335 c3335 = c11032.f4730;
                        C1103.m3567(c3335);
                        C1103 c11033 = (C1103) ((ᵜᵪʾ) c3335).ˌᴵ;
                        c11033.f4701.getClass();
                        long jCurrentTimeMillis = System.currentTimeMillis() + 60000;
                        synchronized (atomicReference2) {
                            for (long jCurrentTimeMillis2 = 60000; atomicReference2.get() == null && jCurrentTimeMillis2 > 0; jCurrentTimeMillis2 = jCurrentTimeMillis - System.currentTimeMillis()) {
                                try {
                                    atomicReference2.wait(jCurrentTimeMillis2);
                                    c11033.f4701.getClass();
                                } catch (Throwable th) {
                                    throw th;
                                }
                            }
                        }
                    } catch (InterruptedException unused) {
                        C3485 c34858 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4729;
                        C1103.m3564(c34858);
                        c34858.f13424.m4476("[sgtm] Interrupted waiting for uploading batch");
                    }
                    enumC0308 = atomicReference2.get() == null ? EnumC0308.f1988 : (EnumC0308) atomicReference2.get();
                } catch (MalformedURLException | URISyntaxException e) {
                    C3485 c34859 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4729;
                    C1103.m3564(c34859);
                    c34859.f13423.m4477("[sgtm] Bad upload url for row_id", c4368.f16592, Long.valueOf(c4368.f16591), e);
                    enumC0308 = EnumC0308.f1989;
                }
                if (enumC0308 != EnumC0308.f1987) {
                    if (enumC0308 == EnumC0308.f1990) {
                        z2 = true;
                        break;
                    }
                } else {
                    i++;
                }
            }
        }
        C3485 c348510 = c1103.f4729;
        C1103.m3564(c348510);
        c348510.f13414.m4475("[sgtm] Completed client-side batch upload work. total, success", Integer.valueOf(size), Integer.valueOf(i));
        try {
            interfaceC5550.mo7199();
        } catch (RemoteException e2) {
            C1103 c11034 = this.f1031;
            ᵘᵞʿⁱ.ᵶᵥᵝ(c11034);
            C3485 c348511 = c11034.f4729;
            C1103.m3564(c348511);
            c348511.f13424.m4474(e2, "Failed to call IDynamiteUploadBatchesCallback");
        }
    }

    @Override // defpackage.InterfaceC5047
    public void setConditionalUserProperty(Bundle bundle, long j) {
        m812();
        C1103 c1103 = this.f1031;
        if (bundle == null) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13423.m4476("Conditional user property must not be null");
        } else {
            C4799 c4799 = c1103.f4709;
            C1103.m3565(c4799);
            c4799.m10021(bundle, j);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void setConsent(Bundle bundle, long j) {
    }

    @Override // defpackage.InterfaceC5047
    public void setConsentThirdParty(Bundle bundle, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m10010(bundle, -20, j);
    }

    @Override // defpackage.InterfaceC5047
    public void setCurrentScreen(InterfaceC4754 interfaceC4754, String str, String str2, long j) {
        m812();
        Activity activity = (Activity) BinderC3730.m8395(interfaceC4754);
        ᵘᵞʿⁱ.ᵶᵥᵝ(activity);
        setCurrentScreenByScionActivityInfo(C5379.m10967(activity), str, str2, j);
    }

    /* JADX WARN: Code restructure failed: missing block: B:26:0x0087, code lost:
    
        if (r2 > 500) goto L27;
     */
    @Override // defpackage.InterfaceC5047
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void setCurrentScreenByScionActivityInfo(C5379 c5379, String str, String str2, long j) {
        m812();
        C1533 c1533 = this.f1031.f4723;
        C1103.m3565(c1533);
        C1103 c1103 = (C1103) ((ᵜᵪʾ) c1533).ˌᴵ;
        if (!c1103.f4726.m8307()) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13413.m4476("setCurrentScreen cannot be called while screen reporting is disabled.");
            return;
        }
        C3160 c3160 = c1533.f6191;
        if (c3160 == null) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13413.m4476("setCurrentScreen cannot be called while no activity active");
            return;
        }
        ConcurrentHashMap concurrentHashMap = c1533.f6195;
        Integer numValueOf = Integer.valueOf(c5379.f20382);
        if (concurrentHashMap.get(numValueOf) == null) {
            C3485 c34853 = c1103.f4729;
            C1103.m3564(c34853);
            c34853.f13413.m4476("setCurrentScreen must be called with an activity in the activity lifecycle");
            return;
        }
        if (str2 == null) {
            str2 = c1533.m4347(c5379.f20384);
        }
        String str3 = c3160.f12020;
        String str4 = c3160.f12023;
        boolean zEquals = Objects.equals(str3, str2);
        boolean zEquals2 = Objects.equals(str4, str);
        if (zEquals && zEquals2) {
            C3485 c34854 = c1103.f4729;
            C1103.m3564(c34854);
            c34854.f13413.m4476("setCurrentScreen cannot be called with the same class and name");
            return;
        }
        if (str != null) {
            if (str.length() > 0) {
                int length = str.length();
                c1103.f4726.getClass();
            }
            C3485 c34855 = c1103.f4729;
            C1103.m3564(c34855);
            c34855.f13413.m4474(Integer.valueOf(str.length()), "Invalid screen name length in setCurrentScreen. Length");
            return;
        }
        if (str2.length() > 0) {
            int length2 = str2.length();
            c1103.f4726.getClass();
            if (length2 <= 500) {
                C3485 c34856 = c1103.f4729;
                C1103.m3564(c34856);
                c34856.f13414.m4475("Setting current screen to name, class", str == null ? "null" : str, str2);
                C3335 c3335 = c1103.f4730;
                C1103.m3567(c3335);
                C3160 c31602 = new C3160(c3335.m7650(), str, str2);
                concurrentHashMap.put(numValueOf, c31602);
                c1533.m4341(c5379.f20384, c31602, true);
                return;
            }
        }
        C3485 c34857 = c1103.f4729;
        C1103.m3564(c34857);
        c34857.f13413.m4474(Integer.valueOf(str2.length()), "Invalid class name length in setCurrentScreen. Length");
    }

    @Override // defpackage.InterfaceC5047
    public void setDataCollectionEnabled(boolean z) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m5699();
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC2801(c4799, z));
    }

    @Override // defpackage.InterfaceC5047
    public void setDefaultEventParameters(Bundle bundle) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        Bundle bundle2 = bundle == null ? new Bundle() : new Bundle(bundle);
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC0735(c4799, bundle2, 1));
    }

    @Override // defpackage.InterfaceC5047
    public void setEventInterceptor(InterfaceC3007 interfaceC3007) {
        m812();
        ʽᵺᴵ r0 = new ʽᵺᴵ(this, 14, interfaceC3007);
        C1961 c1961 = this.f1031.f4707;
        C1103.m3564(c1961);
        boolean zM5244 = c1961.m5244();
        C1103 c1103 = this.f1031;
        if (!zM5244) {
            C1961 c19612 = c1103.f4707;
            C1103.m3564(c19612);
            c19612.m5246(new ᵟᵰᵕ(13, this, r0, false));
            return;
        }
        C4799 c4799 = c1103.f4709;
        C1103.m3565(c4799);
        c4799.m6166();
        c4799.m5699();
        ʽᵺᴵ r5 = c4799.f18272;
        if (r0 != r5) {
            ᵘᵞʿⁱ.ᵝᵶ("EventInterceptor already set.", r5 == null);
        }
        c4799.f18272 = r0;
    }

    @Override // defpackage.InterfaceC5047
    public void setInstanceIdProvider(InterfaceC3267 interfaceC3267) {
        m812();
    }

    @Override // defpackage.InterfaceC5047
    public void setMeasurementEnabled(boolean z, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        Boolean boolValueOf = Boolean.valueOf(z);
        c4799.m5699();
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new ᵟᵰᵕ(12, c4799, boolValueOf, false));
    }

    @Override // defpackage.InterfaceC5047
    public void setMinimumSessionDuration(long j) {
        m812();
    }

    @Override // defpackage.InterfaceC5047
    public void setSessionTimeoutDuration(long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1961 c1961 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC4190(c4799, j, 0));
    }

    @Override // defpackage.InterfaceC5047
    public void setSgtmDebugInfo(Intent intent) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1103 c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
        Uri data = intent.getData();
        if (data == null) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13420.m4476("Activity intent has no data. Preview Mode was not enabled.");
            return;
        }
        String queryParameter = data.getQueryParameter("sgtm_debug_enable");
        if (queryParameter == null || !queryParameter.equals("1")) {
            C3485 c34852 = c1103.f4729;
            C1103.m3564(c34852);
            c34852.f13420.m4476("[sgtm] Preview Mode was not enabled.");
            c1103.f4726.f14067 = null;
            return;
        }
        String queryParameter2 = data.getQueryParameter("sgtm_preview_key");
        if (TextUtils.isEmpty(queryParameter2)) {
            return;
        }
        C3485 c34853 = c1103.f4729;
        C1103.m3564(c34853);
        c34853.f13420.m4474(queryParameter2, "[sgtm] Preview Mode was enabled. Using the sgtmPreviewKey: ");
        c1103.f4726.f14067 = queryParameter2;
    }

    @Override // defpackage.InterfaceC5047
    public void setUserId(String str, long j) {
        m812();
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        C1103 c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
        if (str != null && TextUtils.isEmpty(str)) {
            C3485 c3485 = c1103.f4729;
            C1103.m3564(c3485);
            c3485.f13424.m4476("User ID must be non-empty or null");
        } else {
            C1961 c1961 = c1103.f4707;
            C1103.m3564(c1961);
            c1961.m5246(new RunnableC0648(c4799, 17, str));
            c4799.m10017(null, "_id", str, true, j);
        }
    }

    @Override // defpackage.InterfaceC5047
    public void setUserProperty(String str, String str2, InterfaceC4754 interfaceC4754, boolean z, long j) {
        m812();
        Object objM8395 = BinderC3730.m8395(interfaceC4754);
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m10017(str, str2, objM8395, z, j);
    }

    @Override // defpackage.InterfaceC5047
    public void unregisterOnMeasurementEventListener(InterfaceC3007 interfaceC3007) {
        Object c0992;
        m812();
        C3310 c3310 = this.f1030;
        synchronized (c3310) {
            c0992 = (InterfaceC4279) c3310.remove(Integer.valueOf(interfaceC3007.mo1121()));
        }
        if (c0992 == null) {
            c0992 = new C0992(this, interfaceC3007);
        }
        C4799 c4799 = this.f1031.f4709;
        C1103.m3565(c4799);
        c4799.m5699();
        if (c4799.f18273.remove(c0992)) {
            return;
        }
        C3485 c3485 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4729;
        C1103.m3564(c3485);
        c3485.f13424.m4476("OnEventListener had not been registered");
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final void m812() {
        if (this.f1031 != null) {
            return;
        }
        ᵕᵩʽᵲ.ᵪᵹᵥᵻ("Attempting to perform action before initialize.");
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final void m813(String str, InterfaceC3046 interfaceC3046) {
        m812();
        C3335 c3335 = this.f1031.f4730;
        C1103.m3567(c3335);
        c3335.m7642(str, interfaceC3046);
    }
}
