package defpackage;

import android.app.Activity;
import android.app.Application;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import j$.util.Objects;

/* JADX INFO: renamed from: ᵡᐧᵱ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3209 implements Application.ActivityLifecycleCallbacks {

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final /* synthetic */ int f12229;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final /* synthetic */ Object f12230;

    public /* synthetic */ C3209(int i, Object obj) {
        this.f12229 = i;
        this.f12230 = obj;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    private final void m7344(Activity activity) {
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    private final void m7345(Activity activity) {
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityCreated(Activity activity, Bundle bundle) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C4718(this, bundle, activity));
                break;
            default:
                m7346(C5379.m10967(activity), bundle);
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityDestroyed(Activity activity) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C5157(this, activity, 4));
                break;
            default:
                m7349(C5379.m10967(activity));
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityPaused(Activity activity) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C5157(this, activity, 2));
                break;
            default:
                m7347(C5379.m10967(activity));
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityResumed(Activity activity) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C5157(this, activity, 1));
                break;
            default:
                m7350(C5379.m10967(activity));
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        switch (this.f12229) {
            case 0:
                BinderC0669 binderC0669 = new BinderC0669();
                ((C2957) this.f12230).m7046(new C4718(this, activity, binderC0669));
                Bundle bundleM2445 = binderC0669.m2445(50L);
                if (bundleM2445 != null) {
                    bundle.putAll(bundleM2445);
                }
                break;
            default:
                m7348(C5379.m10967(activity), bundle);
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityStarted(Activity activity) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C5157(this, activity, 0));
                break;
        }
    }

    @Override // android.app.Application.ActivityLifecycleCallbacks
    public final void onActivityStopped(Activity activity) {
        switch (this.f12229) {
            case 0:
                ((C2957) this.f12230).m7046(new C5157(this, activity, 3));
                break;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x004a A[Catch: all -> 0x0028, RuntimeException -> 0x002c, TryCatch #1 {RuntimeException -> 0x002c, blocks: (B:3:0x0005, B:5:0x0019, B:7:0x001f, B:22:0x004a, B:25:0x0051, B:30:0x0063, B:35:0x0070, B:15:0x002f, B:17:0x0036, B:19:0x0042), top: B:44:0x0005, outer: #0 }] */
    /* JADX WARN: Removed duplicated region for block: B:27:0x005c  */
    /* JADX WARN: Removed duplicated region for block: B:29:0x0060  */
    /* JADX WARN: Removed duplicated region for block: B:32:0x006b  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x006e  */
    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void m7346(C5379 c5379, Bundle bundle) {
        C1103 c1103;
        C1103 c11032;
        Intent intent;
        Uri uri;
        C4799 c4799 = (C4799) this.f12230;
        try {
            try {
                c11032 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
                C3485 c3485 = c11032.f4729;
                C1103.m3564(c3485);
                c3485.f13414.m4476("onActivityCreated");
                intent = c5379.f20383;
            } catch (RuntimeException e) {
                C3485 c34852 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4729;
                C1103.m3564(c34852);
                c34852.f13423.m4474(e, "Throwable caught in onActivityCreated");
            }
            if (intent != null) {
                Uri data = intent.getData();
                if (data == null || !data.isHierarchical()) {
                    Bundle extras = intent.getExtras();
                    if (extras != null) {
                        String string = extras.getString("com.android.vending.referral_url");
                        if (!TextUtils.isEmpty(string)) {
                            data = Uri.parse(string);
                            uri = data;
                            if (uri != null && uri.isHierarchical()) {
                                C1103.m3567(c11032.f4730);
                                String str = !C3335.m7609(intent) ? "gs" : "auto";
                                String queryParameter = uri.getQueryParameter("referrer");
                                boolean z = bundle != null;
                                C1961 c1961 = c11032.f4707;
                                C1103.m3564(c1961);
                                c1961.m5246(new RunnableC1505(this, z, uri, str, queryParameter));
                                c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
                            }
                        }
                    }
                    uri = null;
                    if (uri != null) {
                        C1103.m3567(c11032.f4730);
                        String str2 = !C3335.m7609(intent) ? "gs" : "auto";
                        String queryParameter2 = uri.getQueryParameter("referrer");
                        boolean z2 = bundle != null;
                        C1961 c19612 = c11032.f4707;
                        C1103.m3564(c19612);
                        c19612.m5246(new RunnableC1505(this, z2, uri, str2, queryParameter2));
                        c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
                    }
                } else {
                    uri = data;
                    if (uri != null) {
                    }
                }
                C1533 c1533 = c1103.f4723;
                C1103.m3565(c1533);
                c1533.m4342(c5379, bundle);
            }
            c1103 = (C1103) ((ᵜᵪʾ) c4799).ˌᴵ;
            C1533 c15332 = c1103.f4723;
            C1103.m3565(c15332);
            c15332.m4342(c5379, bundle);
        } catch (Throwable th) {
            C1533 c15333 = ((C1103) ((ᵜᵪʾ) c4799).ˌᴵ).f4723;
            C1103.m3565(c15333);
            c15333.m4342(c5379, bundle);
            throw th;
        }
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public void m7347(C5379 c5379) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) ((C4799) this.f12230)).ˌᴵ;
        C1533 c1533 = c1103.f4723;
        C1103.m3565(c1533);
        synchronized (c1533.f6192) {
            c1533.f6187 = false;
            c1533.f6189 = true;
        }
        C1103 c11032 = (C1103) ((ᵜᵪʾ) c1533).ˌᴵ;
        c11032.f4701.getClass();
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        if (c11032.f4726.m8307()) {
            C3160 c3160M4344 = c1533.m4344(c5379);
            c1533.f6193 = c1533.f6191;
            c1533.f6191 = null;
            C1961 c1961 = c11032.f4707;
            C1103.m3564(c1961);
            c1961.m5246(new RunnableC4480(c1533, c3160M4344, jElapsedRealtime));
        } else {
            c1533.f6191 = null;
            C1961 c19612 = c11032.f4707;
            C1103.m3564(c19612);
            c19612.m5246(new RunnableC0436(c1533, jElapsedRealtime));
        }
        C1584 c1584 = c1103.f4714;
        C1103.m3565(c1584);
        C1103 c11033 = (C1103) ((ᵜᵪʾ) c1584).ˌᴵ;
        c11033.f4701.getClass();
        long jElapsedRealtime2 = SystemClock.elapsedRealtime();
        C1961 c19613 = c11033.f4707;
        C1103.m3564(c19613);
        c19613.m5246(new RunnableC2843(c1584, jElapsedRealtime2, 1));
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public void m7348(C5379 c5379, Bundle bundle) {
        C3160 c3160;
        C1533 c1533 = ((C1103) ((ᵜᵪʾ) ((C4799) this.f12230)).ˌᴵ).f4723;
        C1103.m3565(c1533);
        if (!((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4726.m8307() || bundle == null || (c3160 = (C3160) c1533.f6195.get(Integer.valueOf(c5379.f20382))) == null) {
            return;
        }
        Bundle bundle2 = new Bundle();
        bundle2.putLong("id", c3160.f12021);
        bundle2.putString("name", c3160.f12023);
        bundle2.putString("referrer_name", c3160.f12020);
        bundle.putBundle("com.google.app_measurement.screen_service", bundle2);
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public void m7349(C5379 c5379) {
        C1533 c1533 = ((C1103) ((ᵜᵪʾ) ((C4799) this.f12230)).ˌᴵ).f4723;
        C1103.m3565(c1533);
        synchronized (c1533.f6192) {
            try {
                if (Objects.equals(c1533.f6188, c5379)) {
                    c1533.f6188 = null;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        if (((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4726.m8307()) {
            c1533.f6195.remove(Integer.valueOf(c5379.f20382));
        }
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public void m7350(C5379 c5379) {
        C1103 c1103 = (C1103) ((ᵜᵪʾ) ((C4799) this.f12230)).ˌᴵ;
        C1584 c1584 = c1103.f4714;
        C1103.m3565(c1584);
        C1103 c11032 = (C1103) ((ᵜᵪʾ) c1584).ˌᴵ;
        c11032.f4701.getClass();
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        C1961 c1961 = c11032.f4707;
        C1103.m3564(c1961);
        c1961.m5246(new RunnableC2843(c1584, jElapsedRealtime, 0));
        C1533 c1533 = c1103.f4723;
        C1103.m3565(c1533);
        Object obj = c1533.f6192;
        synchronized (obj) {
            try {
                c1533.f6187 = true;
                if (!Objects.equals(c5379, c1533.f6188)) {
                    synchronized (obj) {
                        c1533.f6188 = c5379;
                        c1533.f6189 = false;
                        C1103 c11033 = (C1103) ((ᵜᵪʾ) c1533).ˌᴵ;
                        if (c11033.f4726.m8307()) {
                            c1533.f6196 = null;
                            C1961 c19612 = c11033.f4707;
                            C1103.m3564(c19612);
                            c19612.m5246(new RunnableC4647(c1533, 1));
                        }
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        C1103 c11034 = (C1103) ((ᵜᵪʾ) c1533).ˌᴵ;
        if (!c11034.f4726.m8307()) {
            c1533.f6191 = c1533.f6196;
            C1961 c19613 = c11034.f4707;
            C1103.m3564(c19613);
            c19613.m5246(new RunnableC4647(c1533, 0));
            return;
        }
        c1533.m4341(c5379.f20384, c1533.m4344(c5379), false);
        C3468 c3468 = ((C1103) ((ᵜᵪʾ) c1533).ˌᴵ).f4706;
        C1103.m3566(c3468);
        C1103 c11035 = (C1103) ((ᵜᵪʾ) c3468).ˌᴵ;
        c11035.f4701.getClass();
        long jElapsedRealtime2 = SystemClock.elapsedRealtime();
        C1961 c19614 = c11035.f4707;
        C1103.m3564(c19614);
        c19614.m5246(new RunnableC0436(c3468, jElapsedRealtime2));
    }
}
