package C4;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import d4.C0843b;
import d4.p;
import java.util.Collections;
import java.util.HashSet;
import n4.u0;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class c implements D4.b {

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

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

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

    public /* synthetic */ c(W3.f fVar, Context context) {
        this.f1324a = 1;
        this.f1326c = fVar;
        this.f1325b = context;
    }

    @Override // D4.b
    public final Object get() {
        ApplicationInfo applicationInfo;
        Bundle bundle;
        switch (this.f1324a) {
            case u0.f15495q /* 0 */:
                return new j((Context) this.f1325b, (String) this.f1326c);
            case 1:
                W3.f fVar = (W3.f) this.f1326c;
                String strD = fVar.d();
                Context contextB = (Context) this.f1325b;
                I4.a aVar = new I4.a();
                int i = Build.VERSION.SDK_INT;
                if (i >= 24) {
                    contextB = i >= 24 ? B.g.b(contextB) : null;
                }
                SharedPreferences sharedPreferences = contextB.getSharedPreferences("com.google.firebase.common.prefs:" + strD, 0);
                boolean z8 = true;
                if (sharedPreferences.contains("firebase_data_collection_default_enabled")) {
                    z8 = sharedPreferences.getBoolean("firebase_data_collection_default_enabled", true);
                } else {
                    try {
                        PackageManager packageManager = contextB.getPackageManager();
                        if (packageManager != null && (applicationInfo = packageManager.getApplicationInfo(contextB.getPackageName(), 128)) != null && (bundle = applicationInfo.metaData) != null && bundle.containsKey("firebase_data_collection_default_enabled")) {
                            z8 = applicationInfo.metaData.getBoolean("firebase_data_collection_default_enabled");
                        }
                        break;
                    } catch (PackageManager.NameNotFoundException unused) {
                    }
                }
                aVar.f3375a = z8;
                return aVar;
            default:
                d4.e eVar = (d4.e) this.f1325b;
                eVar.getClass();
                C0843b c0843b = (C0843b) this.f1326c;
                d4.d dVar = c0843b.f12251f;
                K2.e eVar2 = new K2.e();
                HashSet hashSet = new HashSet();
                HashSet hashSet2 = new HashSet();
                HashSet hashSet3 = new HashSet();
                HashSet hashSet4 = new HashSet();
                HashSet hashSet5 = new HashSet();
                for (d4.h hVar : c0843b.f12248c) {
                    int i5 = hVar.f12268c;
                    boolean z9 = i5 == 0;
                    int i8 = hVar.f12267b;
                    p pVar = hVar.f12266a;
                    if (z9) {
                        if (i8 == 2) {
                            hashSet4.add(pVar);
                        } else {
                            hashSet.add(pVar);
                        }
                    } else if (i5 == 2) {
                        hashSet3.add(pVar);
                    } else if (i8 == 2) {
                        hashSet5.add(pVar);
                    } else {
                        hashSet2.add(pVar);
                    }
                }
                if (!c0843b.f12252g.isEmpty()) {
                    hashSet.add(p.a(B4.a.class));
                }
                eVar2.f3552q = Collections.unmodifiableSet(hashSet);
                eVar2.f3553r = Collections.unmodifiableSet(hashSet2);
                eVar2.f3554s = Collections.unmodifiableSet(hashSet3);
                eVar2.f3555t = Collections.unmodifiableSet(hashSet4);
                Collections.unmodifiableSet(hashSet5);
                eVar2.f3556u = eVar;
                return dVar.p(eVar2);
        }
    }

    public /* synthetic */ c(Object obj, int i, Object obj2) {
        this.f1324a = i;
        this.f1325b = obj;
        this.f1326c = obj2;
    }
}
