package o;

import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.text.TextUtils;
import com.google.android.gms.common.internal.Preconditions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.pm0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class RunnableC2177pm0 implements Runnable {
    public final /* synthetic */ int l;
    public final /* synthetic */ Object m;
    public final /* synthetic */ Object n;

    /* renamed from: o, reason: collision with root package name */
    public final /* synthetic */ Object f680o;
    public final /* synthetic */ Object p;
    public final /* synthetic */ Object q;

    public /* synthetic */ RunnableC2177pm0(Object obj, Object obj2, Object obj3, Object obj4, Object obj5, int i) {
        this.l = i;
        this.q = obj;
        this.m = obj2;
        this.n = obj3;
        this.f680o = obj4;
        this.p = obj5;
    }

    @Override // java.lang.Runnable
    public final void run() {
        AtomicReference atomicReference;
        Vt0 vt0;
        InterfaceC2185pq0 interfaceC2185pq0;
        C2574tv0 c2574tv0;
        InterfaceC2185pq0 interfaceC2185pq02;
        switch (this.l) {
            case 0:
                try {
                    if (!(((C2595u70) this.m).l instanceof E)) {
                        String string = ((UUID) this.n).toString();
                        Dm0 dm0H = ((C2272qm0) this.q).c.h(string);
                        if (dm0H == null || Ag0.a(dm0H.b)) {
                            throw new IllegalStateException("Calls to setForegroundAsync() must complete before a ListenableWorker signals completion of work by returning an instance of Result.");
                        }
                        ((XY) ((C2272qm0) this.q).b).f(string, (UA) this.f680o);
                        ((Context) this.p).startService(C1493ic0.a((Context) this.p, C2887xC.o(dm0H), (UA) this.f680o));
                    }
                    ((C2595u70) this.m).i(null);
                    return;
                } catch (Throwable th) {
                    ((C2595u70) this.m).j(th);
                    return;
                }
            case 1:
                BinderC1237fs0 binderC1237fs0 = (BinderC1237fs0) this.m;
                C1531iw0 c1531iw0 = (C1531iw0) this.n;
                Bundle bundle = (Bundle) this.f680o;
                InterfaceC2469sq0 interfaceC2469sq0 = (InterfaceC2469sq0) this.p;
                String str = (String) this.q;
                C1051dv0 c1051dv0 = binderC1237fs0.d;
                c1051dv0.B();
                try {
                    interfaceC2469sq0.v(c1051dv0.c0(bundle, c1531iw0));
                    return;
                } catch (RemoteException e) {
                    c1051dv0.b().f.d("Failed to return trigger URIs for app", str, e);
                    return;
                }
            case 2:
                AtomicReference atomicReference2 = (AtomicReference) this.m;
                synchronized (atomicReference2) {
                    try {
                        try {
                            vt0 = (Vt0) this.q;
                            interfaceC2185pq0 = vt0.d;
                        } catch (RemoteException e2) {
                            Nq0 nq0 = ((Kr0) ((Vt0) this.q).a).f;
                            Kr0.l(nq0);
                            nq0.f.e("(legacy) Failed to get conditional properties; remote exception", null, (String) this.n, e2);
                            ((AtomicReference) this.m).set(Collections.EMPTY_LIST);
                            atomicReference = (AtomicReference) this.m;
                        }
                        if (interfaceC2185pq0 == null) {
                            Nq0 nq02 = ((Kr0) vt0.a).f;
                            Kr0.l(nq02);
                            nq02.f.e("(legacy) Failed to get conditional properties; not connected to service", null, (String) this.n, (String) this.f680o);
                            atomicReference2.set(Collections.EMPTY_LIST);
                            atomicReference2.notify();
                            return;
                        }
                        if (TextUtils.isEmpty(null)) {
                            C1531iw0 c1531iw02 = (C1531iw0) this.p;
                            Preconditions.checkNotNull(c1531iw02);
                            atomicReference2.set(interfaceC2185pq0.i((String) this.n, (String) this.f680o, c1531iw02));
                        } else {
                            atomicReference2.set(interfaceC2185pq0.s(null, (String) this.n, (String) this.f680o));
                        }
                        vt0.F();
                        atomicReference = (AtomicReference) this.m;
                        atomicReference.notify();
                        return;
                    } catch (Throwable th2) {
                        ((AtomicReference) this.m).notify();
                        throw th2;
                    }
                }
            default:
                InterfaceC2183pp0 interfaceC2183pp0 = (InterfaceC2183pp0) this.p;
                String str2 = (String) this.n;
                String str3 = (String) this.m;
                Vt0 vt02 = (Vt0) this.q;
                ArrayList arrayList = new ArrayList();
                try {
                    try {
                        interfaceC2185pq02 = vt02.d;
                    } catch (RemoteException e3) {
                        Nq0 nq03 = ((Kr0) vt02.a).f;
                        Kr0.l(nq03);
                        nq03.f.e("Failed to get conditional properties; remote exception", str3, str2, e3);
                    }
                    if (interfaceC2185pq02 == null) {
                        Kr0 kr0 = (Kr0) vt02.a;
                        Nq0 nq04 = kr0.f;
                        Kr0.l(nq04);
                        nq04.f.d("Failed to get conditional properties; not connected to service", str3, str2);
                        c2574tv0 = kr0.i;
                        Kr0.j(c2574tv0);
                        c2574tv0.f0(interfaceC2183pp0, arrayList);
                        return;
                    }
                    C1531iw0 c1531iw03 = (C1531iw0) this.f680o;
                    Preconditions.checkNotNull(c1531iw03);
                    arrayList = C2574tv0.g0(interfaceC2185pq02.i(str3, str2, c1531iw03));
                    vt02.F();
                    c2574tv0 = ((Kr0) vt02.a).i;
                    Kr0.j(c2574tv0);
                    c2574tv0.f0(interfaceC2183pp0, arrayList);
                    return;
                } catch (Throwable th3) {
                    C2574tv0 c2574tv02 = ((Kr0) vt02.a).i;
                    Kr0.j(c2574tv02);
                    c2574tv02.f0(interfaceC2183pp0, arrayList);
                    throw th3;
                }
        }
    }

    public /* synthetic */ RunnableC2177pm0(BinderC1237fs0 binderC1237fs0, C1531iw0 c1531iw0, Bundle bundle, InterfaceC2469sq0 interfaceC2469sq0, String str) {
        this.l = 1;
        this.m = binderC1237fs0;
        this.n = c1531iw0;
        this.f680o = bundle;
        this.p = interfaceC2469sq0;
        this.q = str;
    }
}
