package p138.p176.p177.p242.p265.p266;

import android.app.Application;
import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.TextUtils;
import java.util.concurrent.atomic.AtomicInteger;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p242.p246.p247.p248.C4221;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p177.p242.p246.p253.C4312;
import p138.p176.p177.p242.p246.p253.InterfaceC4311;
import p138.p176.p177.p242.p246.p255.C4322;
import p138.p176.p177.p242.p258.p263.AbstractC4718;
import p138.p176.p177.p242.p258.p263.C4517;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.৲, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C4974 implements InterfaceC4973 {

    /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
    public static volatile C4974 f15008;

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

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

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

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

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final boolean f15013;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final C4785 f15014;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final C4869 f15015;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final C4874 f15016;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final C4794 f15017;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final C4771 f15018;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final C4943 f15019;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final C4887 f15020;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final C4824 f15021;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final InterfaceC4311 f15022;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C4765 f15023;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final C4757 f15024;

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final C4923 f15025;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public final C4838 f15026;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public C4821 f15027;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public C4987 f15028;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public C4907 f15029;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public C4828 f15030;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public C4880 f15031;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public Boolean f15033;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public long f15034;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public volatile Boolean f15035;

    /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
    public Boolean f15036;

    /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
    public Boolean f15037;

    /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
    public int f15038;

    /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
    public final long f15040;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public boolean f15032 = false;

    /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
    public AtomicInteger f15039 = new AtomicInteger(0);

    public C4974(C4868 c4868) {
        long jCurrentTimeMillis;
        Bundle bundle;
        boolean z = false;
        C0567.m1910(c4868);
        C4785 c4785 = new C4785();
        this.f15014 = c4785;
        C4303.f13597 = c4785;
        this.f15009 = c4868.f14623;
        this.f15010 = c4868.f14624;
        this.f15011 = c4868.f14625;
        this.f15012 = c4868.f14626;
        this.f15013 = c4868.f14630;
        this.f15035 = c4868.f14627;
        C4517 c4517 = c4868.f14629;
        if (c4517 != null && (bundle = c4517.f13930) != null) {
            Object obj = bundle.get("measurementEnabled");
            if (obj instanceof Boolean) {
                this.f15036 = (Boolean) obj;
            }
            Object obj2 = c4517.f13930.get("measurementDeactivated");
            if (obj2 instanceof Boolean) {
                this.f15037 = (Boolean) obj2;
            }
        }
        AbstractC4718.m7889(this.f15009);
        C4312 c4312 = C4312.f13603;
        this.f15022 = c4312;
        Long l = c4868.f14631;
        RunnableC4986 runnableC4986 = null;
        if (l != null) {
            jCurrentTimeMillis = l.longValue();
        } else {
            if (c4312 == null) {
                throw null;
            }
            jCurrentTimeMillis = System.currentTimeMillis();
        }
        this.f15040 = jCurrentTimeMillis;
        this.f15015 = new C4869(this);
        C4874 c4874 = new C4874(this);
        c4874.m8483();
        this.f15016 = c4874;
        C4794 c4794 = new C4794(this);
        c4794.m8483();
        this.f15017 = c4794;
        C4887 c4887 = new C4887(this);
        c4887.m8483();
        this.f15020 = c4887;
        C4824 c4824 = new C4824(this);
        c4824.m8483();
        this.f15021 = c4824;
        this.f15025 = new C4923(this);
        C4765 c4765 = new C4765(this);
        c4765.m8067();
        this.f15023 = c4765;
        C4757 c4757 = new C4757(this);
        c4757.m8067();
        this.f15024 = c4757;
        C4943 c4943 = new C4943(this);
        c4943.m8067();
        this.f15019 = c4943;
        C4838 c4838 = new C4838(this);
        c4838.m8483();
        this.f15026 = c4838;
        C4771 c4771 = new C4771(this);
        c4771.m8483();
        this.f15018 = c4771;
        C4517 c45172 = c4868.f14629;
        if (c45172 != null && c45172.f13925 != 0) {
            z = true;
        }
        boolean z2 = !z;
        if (this.f15009.getApplicationContext() instanceof Application) {
            C4757 c4757M8503 = m8503();
            if (c4757M8503.f14588.f15009.getApplicationContext() instanceof Application) {
                Application application = (Application) c4757M8503.f14588.f15009.getApplicationContext();
                if (c4757M8503.f14327 == null) {
                    c4757M8503.f14327 = new C4956(c4757M8503, runnableC4986);
                }
                if (z2) {
                    application.unregisterActivityLifecycleCallbacks(c4757M8503.f14327);
                    application.registerActivityLifecycleCallbacks(c4757M8503.f14327);
                    c4757M8503.mo8165().f14452.m8034("Registered activity lifecycle callback");
                }
            }
        } else {
            mo8165().f14447.m8034("Application context is not an Application");
        }
        C4771 c47712 = this.f15018;
        RunnableC4817 runnableC4817 = new RunnableC4817(this, c4868);
        c47712.m8482();
        C0567.m1910(runnableC4817);
        c47712.m8005(new C4894<>(c47712, runnableC4817, "Task exception on worker thread"));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C4974 m8489(Context context, Bundle bundle) {
        return m8490(context, new C4517(0L, 0L, true, null, null, null, bundle), null);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C4974 m8490(Context context, C4517 c4517, Long l) {
        Bundle bundle;
        if (c4517 != null && (c4517.f13928 == null || c4517.f13929 == null)) {
            c4517 = new C4517(c4517.f13924, c4517.f13925, c4517.f13926, c4517.f13927, null, null, c4517.f13930);
        }
        C0567.m1910(context);
        C0567.m1910(context.getApplicationContext());
        if (f15008 == null) {
            synchronized (C4974.class) {
                if (f15008 == null) {
                    f15008 = new C4974(new C4868(context, c4517, l));
                }
            }
        } else if (c4517 != null && (bundle = c4517.f13930) != null && bundle.containsKey("dataCollectionDefaultEnabled")) {
            f15008.f15035 = Boolean.valueOf(c4517.f13930.getBoolean("dataCollectionDefaultEnabled"));
        }
        return f15008;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m8491(AbstractC4812 abstractC4812) {
        if (abstractC4812 == null) {
            throw new IllegalStateException("Component not created");
        }
        if (abstractC4812.f14482) {
            return;
        }
        String strValueOf = String.valueOf(abstractC4812.getClass());
        StringBuilder sb = new StringBuilder(strValueOf.length() + 27);
        sb.append("Component not initialized: ");
        sb.append(strValueOf);
        throw new IllegalStateException(sb.toString());
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m8492(C4852 c4852) {
        if (c4852 == null) {
            throw new IllegalStateException("Component not created");
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m8493(AbstractC4954 abstractC4954) {
        if (abstractC4954 == null) {
            throw new IllegalStateException("Component not created");
        }
        if (abstractC4954.m8485()) {
            return;
        }
        String strValueOf = String.valueOf(abstractC4954.getClass());
        StringBuilder sb = new StringBuilder(strValueOf.length() + 27);
        sb.append("Component not initialized: ");
        sb.append(strValueOf);
        throw new IllegalStateException(sb.toString());
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final boolean m8494() {
        return this.f15035 != null && this.f15035.booleanValue();
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final boolean m8495() {
        return m8496() == 0;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final int m8496() {
        mo8163().mo8008();
        if (this.f15015.m8188()) {
            return 1;
        }
        Boolean bool = this.f15037;
        if (bool != null && bool.booleanValue()) {
            return 2;
        }
        Boolean boolM8200 = m8501().m8200();
        if (boolM8200 != null) {
            return boolM8200.booleanValue() ? 0 : 3;
        }
        C4869 c4869 = this.f15015;
        C4785 c4785 = c4869.f14588.f15014;
        Boolean boolM8181 = c4869.m8181("firebase_analytics_collection_enabled");
        if (boolM8181 != null) {
            return boolM8181.booleanValue() ? 0 : 4;
        }
        Boolean bool2 = this.f15036;
        if (bool2 != null) {
            return bool2.booleanValue() ? 0 : 5;
        }
        if (C4221.m6903("isMeasurementExplicitlyDisabled").f13461) {
            return 6;
        }
        return (!this.f15015.m8177(C4915.f14873) || this.f15035 == null || this.f15035.booleanValue()) ? 0 : 7;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final void m8497() {
        throw new IllegalStateException("Unexpected call on client side");
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0037  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x00c4  */
    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean m8498() {
        if (!this.f15032) {
            throw new IllegalStateException("AppMeasurement is not initialized");
        }
        mo8163().mo8008();
        Boolean bool = this.f15033;
        if (bool == null || this.f15034 == 0) {
            if (((C4312) this.f15022) == null) {
                throw null;
            }
            this.f15034 = SystemClock.elapsedRealtime();
            Boolean boolValueOf = Boolean.valueOf(m8504().m8267("android.permission.INTERNET") && m8504().m8267("android.permission.ACCESS_NETWORK_STATE") && (C4322.m7223(this.f15009).m7221() || this.f15015.m8191() || (C4881.m8208(this.f15009) && C4887.m8222(this.f15009))));
            this.f15033 = boolValueOf;
            if (boolValueOf.booleanValue()) {
                C4887 c4887M8504 = m8504();
                C4828 c4828M8510 = m8510();
                c4828M8510.m8066();
                String str = c4828M8510.f14532;
                C4828 c4828M85102 = m8510();
                c4828M85102.m8066();
                String str2 = c4828M85102.f14533;
                C4828 c4828M85103 = m8510();
                c4828M85103.m8066();
                if (!c4887M8504.m8260(str, str2, c4828M85103.f14534)) {
                    C4828 c4828M85104 = m8510();
                    c4828M85104.m8066();
                    boolean z = TextUtils.isEmpty(c4828M85104.f14533) ? false : true;
                    this.f15033 = Boolean.valueOf(z);
                }
            }
        } else if (!bool.booleanValue()) {
            if (((C4312) this.f15022) == null) {
                throw null;
            }
            if (Math.abs(SystemClock.elapsedRealtime() - this.f15034) > 1000) {
            }
        }
        return this.f15033.booleanValue();
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4973
    /* JADX INFO: renamed from: ރ */
    public final C4785 mo8162() {
        return this.f15014;
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4973
    /* JADX INFO: renamed from: ބ */
    public final C4771 mo8163() {
        m8493((AbstractC4954) this.f15018);
        return this.f15018;
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4973
    /* JADX INFO: renamed from: ޅ */
    public final InterfaceC4311 mo8164() {
        return this.f15022;
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4973
    /* JADX INFO: renamed from: ކ */
    public final C4794 mo8165() {
        m8493((AbstractC4954) this.f15017);
        return this.f15017;
    }

    @Override // p138.p176.p177.p242.p265.p266.InterfaceC4973
    /* JADX INFO: renamed from: އ */
    public final Context mo8166() {
        return this.f15009;
    }

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final C4838 m8499() {
        m8493((AbstractC4954) this.f15026);
        return this.f15026;
    }

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final C4869 m8500() {
        return this.f15015;
    }

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final C4874 m8501() {
        m8492((C4852) this.f15016);
        return this.f15016;
    }

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final C4943 m8502() {
        m8491((AbstractC4812) this.f15019);
        return this.f15019;
    }

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public final C4757 m8503() {
        m8491((AbstractC4812) this.f15024);
        return this.f15024;
    }

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final C4887 m8504() {
        m8492((C4852) this.f15020);
        return this.f15020;
    }

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final C4824 m8505() {
        m8492((C4852) this.f15021);
        return this.f15021;
    }

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public final boolean m8506() {
        return TextUtils.isEmpty(this.f15010);
    }

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public final C4765 m8507() {
        m8491((AbstractC4812) this.f15023);
        return this.f15023;
    }

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public final C4987 m8508() {
        m8491((AbstractC4812) this.f15028);
        return this.f15028;
    }

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public final C4907 m8509() {
        m8493((AbstractC4954) this.f15029);
        return this.f15029;
    }

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public final C4828 m8510() {
        m8491((AbstractC4812) this.f15030);
        return this.f15030;
    }

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public final C4923 m8511() {
        C4923 c4923 = this.f15025;
        if (c4923 != null) {
            return c4923;
        }
        throw new IllegalStateException("Component not created");
    }
}
