package p138.p176.p177.p242.p258.p263;

import android.annotation.SuppressLint;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import p138.p176.p177.p242.p246.p251.C4303;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ރ.ނ.ၦ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC4718<T> {

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    @SuppressLint({"StaticFieldLeak"})
    public static Context f14238;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static InterfaceC4731<AbstractC4730<C4715>> f14239;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C4724 f14241;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final String f14242;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final T f14243;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public volatile int f14244 = -1;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public volatile T f14245;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public static final Object f14237 = new Object();

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public static final AtomicInteger f14240 = new AtomicInteger();

    /* JADX WARN: Multi-variable type inference failed */
    public /* synthetic */ AbstractC4718(C4724 c4724, String str, Object obj, boolean z, C4720 c4720) {
        if (c4724.f14248 == null) {
            throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI");
        }
        this.f14241 = c4724;
        this.f14242 = str;
        this.f14243 = obj;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ AbstractC4718 m7885(C4724 c4724, String str) {
        return new C4722(c4724, str, Double.valueOf(-3.0d), false);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ AbstractC4718 m7886(C4724 c4724, String str, long j) {
        return new C4720(c4724, str, Long.valueOf(j), false);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ AbstractC4718 m7887(C4724 c4724, String str, String str2) {
        return new C4725(c4724, str, str2, false);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ AbstractC4718 m7888(C4724 c4724, String str, boolean z) {
        return new C4723(c4724, str, Boolean.valueOf(z), false);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m7889(Context context) {
        synchronized (f14237) {
            Context applicationContext = context.getApplicationContext();
            if (applicationContext != null) {
                context = applicationContext;
            }
            if (f14238 != context) {
                C4704.m7874();
                C4727.m7896();
                C4714.m7883();
                f14240.incrementAndGet();
                f14238 = context;
                f14239 = C4303.m7053(C4721.f14247);
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public abstract T mo7890(Object obj);

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final String m7891() {
        return m7892(this.f14241.f14250);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final String m7892(String str) {
        if (str != null && str.isEmpty()) {
            return this.f14242;
        }
        String strValueOf = String.valueOf(str);
        String strValueOf2 = String.valueOf(this.f14242);
        return strValueOf2.length() != 0 ? strValueOf.concat(strValueOf2) : new String(strValueOf);
    }

    /* JADX WARN: Removed duplicated region for block: B:37:0x009b  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x009c A[Catch: all -> 0x0123, TryCatch #0 {, blocks: (B:5:0x000b, B:7:0x000f, B:9:0x0013, B:11:0x0023, B:17:0x0035, B:19:0x003b, B:21:0x0047, B:25:0x0060, B:27:0x006a, B:45:0x00bb, B:47:0x00c9, B:50:0x00dd, B:54:0x00ee, B:56:0x00f8, B:57:0x00fd, B:58:0x0102, B:60:0x010b, B:61:0x010e, B:62:0x0113, B:63:0x0114, B:38:0x009c, B:40:0x00b0, B:44:0x00b9, B:23:0x0058, B:28:0x006f, B:30:0x0078, B:32:0x008a, B:34:0x0095, B:33:0x008f, B:64:0x0119, B:65:0x0120, B:66:0x0121), top: B:73:0x000b }] */
    /* JADX WARN: Removed duplicated region for block: B:47:0x00c9 A[Catch: all -> 0x0123, TryCatch #0 {, blocks: (B:5:0x000b, B:7:0x000f, B:9:0x0013, B:11:0x0023, B:17:0x0035, B:19:0x003b, B:21:0x0047, B:25:0x0060, B:27:0x006a, B:45:0x00bb, B:47:0x00c9, B:50:0x00dd, B:54:0x00ee, B:56:0x00f8, B:57:0x00fd, B:58:0x0102, B:60:0x010b, B:61:0x010e, B:62:0x0113, B:63:0x0114, B:38:0x009c, B:40:0x00b0, B:44:0x00b9, B:23:0x0058, B:28:0x006f, B:30:0x0078, B:32:0x008a, B:34:0x0095, B:33:0x008f, B:64:0x0119, B:65:0x0120, B:66:0x0121), top: B:73:0x000b }] */
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final T m7893() {
        T tMo7890;
        AbstractC4730<C4715> abstractC4730Mo7259;
        Object objMo7875;
        int i = f14240.get();
        if (this.f14244 < i) {
            synchronized (this) {
                if (this.f14244 < i) {
                    if (f14238 == null) {
                        throw new IllegalStateException("Must call PhenotypeFlag.init() first");
                    }
                    String str = (String) C4714.m7882(f14238).mo7875("gms:phenotype:phenotype_flag:debug_bypass_phenotype");
                    String str2 = null;
                    if (!(str != null && C4684.f14175.matcher(str).matches())) {
                        InterfaceC4711 interfaceC4711M7873 = this.f14241.f14248 != null ? C4717.m7884(f14238, this.f14241.f14248) ? C4704.m7873(f14238.getContentResolver(), this.f14241.f14248) : null : C4727.m7895(f14238, null);
                        if (interfaceC4711M7873 != null && (objMo7875 = interfaceC4711M7873.mo7875(m7891())) != null) {
                            tMo7890 = mo7890(objMo7875);
                        }
                        if (tMo7890 == null) {
                            Object objMo78752 = C4714.m7882(f14238).mo7875(m7892(this.f14241.f14249));
                            tMo7890 = objMo78752 != null ? mo7890(objMo78752) : null;
                            if (tMo7890 == null) {
                                tMo7890 = this.f14243;
                            }
                        }
                        abstractC4730Mo7259 = f14239.mo7259();
                        if (abstractC4730Mo7259.mo7898()) {
                            C4715 c4715Mo7899 = abstractC4730Mo7259.mo7899();
                            Uri uri = this.f14241.f14248;
                            String str3 = this.f14241.f14250;
                            String strConcat = this.f14242;
                            if (c4715Mo7899 == null) {
                                throw null;
                            }
                            if (uri != null) {
                                Map<String, String> map = c4715Mo7899.f14234.get(uri.toString());
                                if (map != null) {
                                    if (str3 != null) {
                                        String strValueOf = String.valueOf(strConcat);
                                        strConcat = strValueOf.length() != 0 ? str3.concat(strValueOf) : new String(str3);
                                    }
                                    str2 = map.get(strConcat);
                                }
                            }
                            tMo7890 = str2 == null ? this.f14243 : mo7890((Object) str2);
                        }
                        this.f14245 = tMo7890;
                        this.f14244 = i;
                    } else if (Log.isLoggable("PhenotypeFlag", 3)) {
                        String strValueOf2 = String.valueOf(m7891());
                        Log.d("PhenotypeFlag", strValueOf2.length() != 0 ? "Bypass reading Phenotype values for flag: ".concat(strValueOf2) : new String("Bypass reading Phenotype values for flag: "));
                    }
                    tMo7890 = null;
                    if (tMo7890 == null) {
                    }
                    abstractC4730Mo7259 = f14239.mo7259();
                    if (abstractC4730Mo7259.mo7898()) {
                    }
                    this.f14245 = tMo7890;
                    this.f14244 = i;
                }
            }
        }
        return this.f14245;
    }
}
