package defpackage;

import android.os.Bundle;
import android.os.RemoteException;
import android.text.TextUtils;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;

/* renamed from: ᵿᵽᵘ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class RunnableC5535 implements Runnable {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final /* synthetic */ Object f20790;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public final /* synthetic */ C0323 f20791;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final /* synthetic */ String f20792;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final /* synthetic */ boolean f20793;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final /* synthetic */ int f20794 = 0;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final /* synthetic */ C1331 f20795;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final /* synthetic */ String f20796;

    public RunnableC5535(C0323 c0323, String str, String str2, C1331 c1331, boolean z, InterfaceC5008 interfaceC5008) {
        this.f20792 = str;
        this.f20796 = str2;
        this.f20795 = c1331;
        this.f20793 = z;
        this.f20790 = interfaceC5008;
        this.f20791 = c0323;
    }

    public RunnableC5535(C0323 c0323, AtomicReference atomicReference, String str, String str2, C1331 c1331, boolean z) {
        this.f20790 = atomicReference;
        this.f20792 = str;
        this.f20796 = str2;
        this.f20795 = c1331;
        this.f20793 = z;
        this.f20791 = c0323;
    }

    @Override // java.lang.Runnable
    public final void run() throws Throwable {
        C4864 c4864;
        InterfaceC3519 interfaceC3519;
        C4205 c4205;
        AtomicReference atomicReference;
        C0323 c0323;
        InterfaceC3519 interfaceC35192;
        switch (this.f20794) {
            case 0:
                String str = this.f20796;
                String str2 = this.f20792;
                InterfaceC5008 interfaceC5008 = (InterfaceC5008) this.f20790;
                C0323 c03232 = this.f20791;
                Bundle bundle = new Bundle();
                try {
                    try {
                        interfaceC3519 = c03232.f2002;
                        c4205 = (C4205) ((ᵢˇᵭ) c03232).ᵧᵾˀˈ;
                    } catch (RemoteException e) {
                        e = e;
                    }
                    if (interfaceC3519 == null) {
                        C1736 c1736 = c4205.f15715;
                        C4205.m9132(c1736);
                        c1736.f6937.m6037("Failed to get user properties; not connected to service", str2, str);
                        c4864 = c4205.f15708;
                        C4205.m9134(c4864);
                        c4864.m10242(interfaceC5008, bundle);
                        return;
                    }
                    List<C3861> listMo2209 = interfaceC3519.mo2209(str2, str, this.f20793, this.f20795);
                    Bundle bundle2 = new Bundle();
                    if (listMo2209 != null) {
                        for (C3861 c3861 : listMo2209) {
                            String str3 = c3861.f14364;
                            String str4 = c3861.f14363;
                            if (str3 != null) {
                                bundle2.putString(str4, str3);
                            } else {
                                Long l = c3861.f14366;
                                if (l != null) {
                                    bundle2.putLong(str4, l.longValue());
                                } else {
                                    Double d = c3861.f14361;
                                    if (d != null) {
                                        bundle2.putDouble(str4, d.doubleValue());
                                    }
                                }
                            }
                        }
                    }
                    try {
                        c03232.m1736();
                        C4864 c48642 = c4205.f15708;
                        C4205.m9134(c48642);
                        c48642.m10242(interfaceC5008, bundle2);
                        return;
                    } catch (RemoteException e2) {
                        e = e2;
                        bundle = bundle2;
                        C1736 c17362 = ((C4205) ((ᵢˇᵭ) c03232).ᵧᵾˀˈ).f15715;
                        C4205.m9132(c17362);
                        c17362.f6937.m6037("Failed to get user properties; remote exception", str2, e);
                        c4864 = ((C4205) ((ᵢˇᵭ) c03232).ᵧᵾˀˈ).f15708;
                        C4205.m9134(c4864);
                        c4864.m10242(interfaceC5008, bundle);
                        return;
                    } catch (Throwable th) {
                        th = th;
                        bundle = bundle2;
                        C4864 c48643 = ((C4205) ((ᵢˇᵭ) c03232).ᵧᵾˀˈ).f15708;
                        C4205.m9134(c48643);
                        c48643.m10242(interfaceC5008, bundle);
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            default:
                AtomicReference atomicReference2 = (AtomicReference) this.f20790;
                synchronized (atomicReference2) {
                    try {
                        try {
                            c0323 = this.f20791;
                            interfaceC35192 = c0323.f2002;
                        } catch (RemoteException e3) {
                            C1736 c17363 = ((C4205) ((ᵢˇᵭ) this.f20791).ᵧᵾˀˈ).f15715;
                            C4205.m9132(c17363);
                            c17363.f6937.m6040("(legacy) Failed to get user properties; remote exception", null, this.f20792, e3);
                            ((AtomicReference) this.f20790).set(Collections.EMPTY_LIST);
                            atomicReference = (AtomicReference) this.f20790;
                        }
                        if (interfaceC35192 == null) {
                            C1736 c17364 = ((C4205) ((ᵢˇᵭ) c0323).ᵧᵾˀˈ).f15715;
                            C4205.m9132(c17364);
                            c17364.f6937.m6040("(legacy) Failed to get user properties; not connected to service", null, this.f20792, this.f20796);
                            atomicReference2.set(Collections.EMPTY_LIST);
                            atomicReference2.notify();
                            return;
                        }
                        if (TextUtils.isEmpty(null)) {
                            atomicReference2.set(interfaceC35192.mo2209(this.f20792, this.f20796, this.f20793, this.f20795));
                        } else {
                            atomicReference2.set(interfaceC35192.mo2189(null, this.f20792, this.f20796, this.f20793));
                        }
                        c0323.m1736();
                        atomicReference = (AtomicReference) this.f20790;
                        atomicReference.notify();
                        return;
                    } catch (Throwable th3) {
                        ((AtomicReference) this.f20790).notify();
                        throw th3;
                    }
                }
        }
    }
}
