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

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.measurement.dynamite.ModuleDescriptor;

/* JADX INFO: renamed from: com.google.android.gms.internal.measurement.a0, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0607a0 extends AbstractRunnableC0642h0 {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ int f9806u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ Object f9807v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final /* synthetic */ Object f9808w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final /* synthetic */ Object f9809x;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ C0607a0(C0662l0 c0662l0, Object obj, Object obj2, int i) {
        super(c0662l0, true);
        this.f9806u = i;
        this.f9808w = obj;
        this.f9809x = obj2;
        this.f9807v = c0662l0;
    }

    @Override // com.google.android.gms.internal.measurement.AbstractRunnableC0642h0
    public final void a() {
        J jAsInterface;
        Bundle bundle;
        switch (this.f9806u) {
            case n4.u0.f15495q /* 0 */:
                try {
                    C0662l0 c0662l0 = (C0662l0) this.f9807v;
                    c0662l0.getClass();
                    Context context = (Context) this.f9808w;
                    P2.w.f(context);
                    try {
                        jAsInterface = I.asInterface(W2.e.c(context, W2.e.f7076b, ModuleDescriptor.MODULE_ID).b("com.google.android.gms.measurement.internal.AppMeasurementDynamiteService"));
                    } catch (W2.b e8) {
                        c0662l0.a(e8, true, false);
                        jAsInterface = null;
                    }
                    c0662l0.f9907h = jAsInterface;
                    if (c0662l0.f9907h != null) {
                        int iA = W2.e.a(context, ModuleDescriptor.MODULE_ID);
                        U u8 = new U(119002L, Math.max(iA, r2), W2.e.d(context, ModuleDescriptor.MODULE_ID, false) < iA, null, null, null, (Bundle) this.f9809x, d3.G0.b(context));
                        J j8 = c0662l0.f9907h;
                        P2.w.f(j8);
                        j8.initialize(new V2.b(context), u8, this.f9864q);
                    } else {
                        Log.w(c0662l0.f9900a, "Failed to connect to measurement client.");
                    }
                } catch (Exception e9) {
                    ((C0662l0) this.f9807v).a(e9, true, false);
                    return;
                }
                break;
            case 1:
                J j9 = ((C0662l0) this.f9807v).f9907h;
                P2.w.f(j9);
                j9.getMaxUserProperties((String) this.f9808w, (G) this.f9809x);
                break;
            case 2:
                Bundle bundle2 = (Bundle) this.f9809x;
                if (bundle2 != null) {
                    bundle = new Bundle();
                    if (bundle2.containsKey("com.google.app_measurement.screen_service")) {
                        Object obj = bundle2.get("com.google.app_measurement.screen_service");
                        if (obj instanceof Bundle) {
                            bundle.putBundle("com.google.app_measurement.screen_service", (Bundle) obj);
                        }
                    }
                } else {
                    bundle = null;
                }
                J j10 = ((C0657k0) this.f9807v).f9883q.f9907h;
                P2.w.f(j10);
                j10.onActivityCreatedByScionActivityInfo(W.a((Activity) this.f9808w), bundle, this.f9865r);
                break;
            default:
                J j11 = ((C0657k0) this.f9807v).f9883q.f9907h;
                P2.w.f(j11);
                j11.onActivitySaveInstanceStateByScionActivityInfo(W.a((Activity) this.f9808w), (G) this.f9809x, this.f9865r);
                break;
        }
    }

    @Override // com.google.android.gms.internal.measurement.AbstractRunnableC0642h0
    public void b() {
        switch (this.f9806u) {
            case 1:
                ((G) this.f9809x).m(null);
                break;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0607a0(C0657k0 c0657k0, Activity activity, G g8) {
        super(c0657k0.f9883q, true);
        this.f9806u = 3;
        this.f9808w = activity;
        this.f9809x = g8;
        this.f9807v = c0657k0;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0607a0(C0657k0 c0657k0, Bundle bundle, Activity activity) {
        super(c0657k0.f9883q, true);
        this.f9806u = 2;
        this.f9809x = bundle;
        this.f9808w = activity;
        this.f9807v = c0657k0;
    }
}
