package d3;

import android.os.RemoteException;

/* JADX INFO: renamed from: d3.p1, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class RunnableC0813p1 implements Runnable {

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ X1 f12100r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ C0824t1 f12101s;

    public /* synthetic */ RunnableC0813p1(C0824t1 c0824t1, X1 x12, int i) {
        this.f12099q = i;
        this.f12100r = x12;
        this.f12101s = c0824t1;
    }

    @Override // java.lang.Runnable
    public final void run() throws Throwable {
        switch (this.f12099q) {
            case n4.u0.f15495q /* 0 */:
                C0824t1 c0824t1 = this.f12101s;
                K k8 = c0824t1.f12179t;
                C0817r0 c0817r0 = (C0817r0) c0824t1.f5146q;
                if (k8 != null) {
                    try {
                        k8.i(this.f12100r);
                    } catch (RemoteException e8) {
                        Z z8 = c0817r0.f12150y;
                        C0817r0.k(z8);
                        z8.f11875v.c(e8, "Failed to reset data on the service: remote exception");
                    }
                    c0824t1.U();
                } else {
                    Z z9 = c0817r0.f12150y;
                    C0817r0.k(z9);
                    z9.f11875v.b("Failed to reset data on the service: not connected to service");
                }
                break;
            case 1:
                C0824t1 c0824t12 = this.f12101s;
                K k9 = c0824t12.f12179t;
                C0817r0 c0817r02 = (C0817r0) c0824t12.f5146q;
                if (k9 == null) {
                    Z z10 = c0817r02.f12150y;
                    C0817r0.k(z10);
                    z10.f11875v.b("Discarding data. Failed to send app launch");
                } else {
                    try {
                        X1 x12 = this.f12100r;
                        C0784g c0784g = c0817r02.f12148w;
                        H h8 = I.f11570m1;
                        if (c0784g.R(null, h8)) {
                            c0824t12.L(k9, null, x12);
                        }
                        k9.n(x12);
                        c0817r02.o().K();
                        c0817r02.f12148w.R(null, h8);
                        c0824t12.L(k9, null, x12);
                        c0824t12.U();
                    } catch (RemoteException e9) {
                        Z z11 = c0817r02.f12150y;
                        C0817r0.k(z11);
                        z11.f11875v.c(e9, "Failed to send app launch to the service");
                        return;
                    }
                }
                break;
            case 2:
                C0824t1 c0824t13 = this.f12101s;
                K k10 = c0824t13.f12179t;
                C0817r0 c0817r03 = (C0817r0) c0824t13.f5146q;
                if (k10 == null) {
                    Z z12 = c0817r03.f12150y;
                    C0817r0.k(z12);
                    z12.f11878y.b("Failed to send app backgrounded");
                } else {
                    try {
                        k10.E(this.f12100r);
                        c0824t13.U();
                    } catch (RemoteException e10) {
                        Z z13 = c0817r03.f12150y;
                        C0817r0.k(z13);
                        z13.f11875v.c(e10, "Failed to send app backgrounded to the service");
                        return;
                    }
                }
                break;
            case 3:
                C0824t1 c0824t14 = this.f12101s;
                K k11 = c0824t14.f12179t;
                C0817r0 c0817r04 = (C0817r0) c0824t14.f5146q;
                if (k11 == null) {
                    Z z14 = c0817r04.f12150y;
                    C0817r0.k(z14);
                    z14.f11875v.b("Failed to send measurementEnabled to service");
                } else {
                    try {
                        k11.I(this.f12100r);
                        c0824t14.U();
                    } catch (RemoteException e11) {
                        Z z15 = c0817r04.f12150y;
                        C0817r0.k(z15);
                        z15.f11875v.c(e11, "Failed to send measurementEnabled to the service");
                        return;
                    }
                }
                break;
            default:
                C0824t1 c0824t15 = this.f12101s;
                K k12 = c0824t15.f12179t;
                C0817r0 c0817r05 = (C0817r0) c0824t15.f5146q;
                if (k12 == null) {
                    Z z16 = c0817r05.f12150y;
                    C0817r0.k(z16);
                    z16.f11875v.b("Failed to send consent settings to service");
                } else {
                    try {
                        k12.t(this.f12100r);
                        c0824t15.U();
                    } catch (RemoteException e12) {
                        Z z17 = c0817r05.f12150y;
                        C0817r0.k(z17);
                        z17.f11875v.c(e12, "Failed to send consent settings to the service");
                    }
                }
                break;
        }
    }
}
