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

import android.os.Handler;
import dalvik.system.DexClassLoader;
import java.io.UnsupportedEncodingException;
import java.util.concurrent.CountDownLatch;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class v2 implements Runnable {

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

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

    public /* synthetic */ v2(Object obj, int i10) {
        this.f21265a = i10;
        this.f21266b = obj;
    }

    @Override // java.lang.Runnable
    public final void run() {
        boolean zBooleanValue;
        CountDownLatch countDownLatch;
        Class<?> clsLoadClass;
        switch (this.f21265a) {
            case 0:
                ((x2) this.f21266b).c();
                return;
            case 1:
                if (((g3) this.f21266b).f20929b != null) {
                    return;
                }
                synchronized (g3.f20925c) {
                    if (((g3) this.f21266b).f20929b != null) {
                        return;
                    }
                    boolean z10 = false;
                    try {
                        zBooleanValue = ((Boolean) l5.f21040e.c()).booleanValue();
                        break;
                    } catch (IllegalStateException unused) {
                        zBooleanValue = false;
                    }
                    if (zBooleanValue) {
                        try {
                            g3.f20926d = e.t0.g(((g3) this.f21266b).f20928a.f21348a);
                            z10 = zBooleanValue;
                        } catch (Throwable unused2) {
                        }
                    } else {
                        z10 = zBooleanValue;
                    }
                    ((g3) this.f21266b).f20929b = Boolean.valueOf(z10);
                    g3.f20925c.open();
                    return;
                }
            case 2:
                d4 d4Var = (d4) this.f21266b;
                Handler handler = d4.f20746j;
                d4Var.c();
                return;
            default:
                v4 v4Var = (v4) this.f21266b;
                try {
                    try {
                        y3 y3Var = v4Var.f21269a;
                        DexClassLoader dexClassLoader = y3Var.f21350c;
                        byte[] bArr = y3Var.f21352e;
                        String str = v4Var.f21270b;
                        y3Var.f21351d.getClass();
                        clsLoadClass = dexClassLoader.loadClass(new String(q3.b(bArr, str), "UTF-8"));
                    } catch (zzda | UnsupportedEncodingException | ClassNotFoundException | NoSuchMethodException unused3) {
                    }
                    if (clsLoadClass == null) {
                        countDownLatch = v4Var.f21274f;
                    } else {
                        y3 y3Var2 = v4Var.f21269a;
                        byte[] bArr2 = y3Var2.f21352e;
                        String str2 = v4Var.f21271c;
                        y3Var2.f21351d.getClass();
                        v4Var.f21272d = clsLoadClass.getMethod(new String(q3.b(bArr2, str2), "UTF-8"), v4Var.f21273e);
                        countDownLatch = v4Var.f21272d == null ? v4Var.f21274f : v4Var.f21274f;
                    }
                } catch (NullPointerException unused4) {
                    countDownLatch = v4Var.f21274f;
                } catch (Throwable th) {
                    v4Var.f21274f.countDown();
                    throw th;
                }
                countDownLatch.countDown();
                return;
        }
    }
}
