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

import android.content.Context;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

/* JADX INFO: loaded from: classes2.dex */
public abstract class tb1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final Object f16840a = new Object();

    @Nullable
    @VisibleForTesting
    static w8.h zza;

    @Nullable
    @VisibleForTesting
    public static z7.a zzb;

    public static void a(Context context, boolean z10) {
        synchronized (f16840a) {
            try {
                if (zzb == null) {
                    zzb = new n8.h(context);
                }
                w8.h hVar = zza;
                if (hVar == null || ((hVar.i() && !zza.j()) || (z10 && zza.i()))) {
                    try {
                        z7.a aVar = zzb;
                        com.google.android.gms.common.internal.w.f(aVar, "the appSetIdClient shouldn't be null");
                        zza = aVar.a();
                    } catch (ArrayIndexOutOfBoundsException e10) {
                        String message = e10.getMessage();
                        StringBuilder sb = new StringBuilder(String.valueOf(message).length() + 31);
                        sb.append("Failed to get app set ID info: ");
                        sb.append(message);
                        p7.l0.g(sb.toString());
                        zza = w8.k.d(e10);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Nullable
    public static w8.h zzb(Context context) {
        w8.h hVar;
        a(context, false);
        synchronized (f16840a) {
            hVar = zza;
        }
        return hVar;
    }
}
