package o;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Yo, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0637Yo {
    public final SharedPreferences a;
    public final C0076Cy b;
    public final Object c;
    public Qc0 d;
    public boolean e;
    public Boolean f;
    public final Qc0 g;

    public C0637Yo(C0076Cy c0076Cy) {
        PackageManager packageManager;
        ApplicationInfo applicationInfo;
        Bundle bundle;
        Object obj = new Object();
        this.c = obj;
        this.d = new Qc0();
        this.e = false;
        this.g = new Qc0();
        c0076Cy.a();
        Context context = c0076Cy.a;
        this.b = c0076Cy;
        SharedPreferences sharedPreferences = context.getSharedPreferences("com.google.firebase.crashlytics", 0);
        this.a = sharedPreferences;
        Boolean boolValueOf = sharedPreferences.contains("firebase_crashlytics_collection_enabled") ? Boolean.valueOf(sharedPreferences.getBoolean("firebase_crashlytics_collection_enabled", true)) : null;
        if (boolValueOf == null) {
            try {
                packageManager = context.getPackageManager();
            } catch (PackageManager.NameNotFoundException unused) {
            }
            Boolean boolValueOf2 = (packageManager == null || (applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 128)) == null || (bundle = applicationInfo.metaData) == null || !bundle.containsKey("firebase_crashlytics_collection_enabled")) ? null : Boolean.valueOf(applicationInfo.metaData.getBoolean("firebase_crashlytics_collection_enabled"));
            boolValueOf = boolValueOf2 == null ? null : Boolean.valueOf(Boolean.TRUE.equals(boolValueOf2));
        }
        this.f = boolValueOf;
        synchronized (obj) {
            try {
                if (a()) {
                    this.d.d(null);
                    this.e = true;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final synchronized boolean a() {
        boolean zH;
        Boolean bool = this.f;
        if (bool != null) {
            zH = bool.booleanValue();
        } else {
            try {
                zH = this.b.h();
            } catch (IllegalStateException unused) {
                zH = false;
            }
        }
        Log.isLoggable("FirebaseCrashlytics", 3);
        return zH;
    }
}
