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

import android.content.SharedPreferences;
import android.text.TextUtils;
import java.util.concurrent.atomic.AtomicReference;
import p138.p176.p177.p242.p246.p253.C4312;
import p138.p176.p177.p242.p246.p255.C4322;
import p138.p176.p177.p242.p258.p263.C4658;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.ˍ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class RunnableC4817 implements Runnable {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final /* synthetic */ C4868 f14492;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final /* synthetic */ C4974 f14493;

    public RunnableC4817(C4974 c4974, C4868 c4868) {
        this.f14493 = c4974;
        this.f14492 = c4868;
    }

    /* JADX WARN: Removed duplicated region for block: B:59:0x0215  */
    /* JADX WARN: Removed duplicated region for block: B:84:0x0372  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        String strConcat;
        C4792 c4792;
        C4974 c4974 = this.f14493;
        C4868 c4868 = this.f14492;
        c4974.mo8163().mo8008();
        C4907 c4907 = new C4907(c4974);
        c4907.m8483();
        c4974.f15029 = c4907;
        C4828 c4828 = new C4828(c4974, c4868.f14628);
        c4828.m8067();
        c4974.f15030 = c4828;
        C4821 c4821 = new C4821(c4974);
        c4821.m8067();
        c4974.f15027 = c4821;
        C4987 c4987 = new C4987(c4974);
        c4987.m8067();
        c4974.f15028 = c4987;
        c4974.f15020.m8484();
        c4974.f15016.m8484();
        c4974.f15031 = new C4880(c4974);
        C4828 c48282 = c4974.f15030;
        if (c48282.f14482) {
            throw new IllegalStateException("Can't initialize twice");
        }
        c48282.mo8065();
        c48282.f14588.f15039.incrementAndGet();
        boolean z = true;
        c48282.f14482 = true;
        C4792 c47922 = c4974.mo8165().f14450;
        c4974.f15015.m8186();
        c47922.m8035("App measurement initialized, version", 28000L);
        c4974.mo8165().f14450.m8034("To enable debug logging run: adb shell setprop log.tag.FA VERBOSE");
        c4828.m8066();
        String str = c4828.f14524;
        if (TextUtils.isEmpty(c4974.f15010)) {
            if (c4974.m8504().m8268(str)) {
                c4792 = c4974.mo8165().f14450;
                strConcat = "Faster debug mode event logging enabled. To disable, run:\n  adb shell setprop debug.firebase.analytics.app .none.";
            } else {
                C4792 c47923 = c4974.mo8165().f14450;
                String strValueOf = String.valueOf(str);
                strConcat = strValueOf.length() != 0 ? "To enable faster debug mode event logging run:\n  adb shell setprop debug.firebase.analytics.app ".concat(strValueOf) : new String("To enable faster debug mode event logging run:\n  adb shell setprop debug.firebase.analytics.app ");
                c4792 = c47923;
            }
            c4792.m8034(strConcat);
        }
        c4974.mo8165().f14451.m8034("Debug-level message logging enabled");
        if (c4974.f15038 != c4974.f15039.get()) {
            c4974.mo8165().f14444.m8036("Not all components initialized", Integer.valueOf(c4974.f15038), Integer.valueOf(c4974.f15039.get()));
        }
        c4974.f15032 = true;
        C4974 c49742 = this.f14493;
        c49742.mo8163().mo8008();
        if (c49742.m8501().f14648.m8316() == 0) {
            C4898 c4898 = c49742.m8501().f14648;
            if (((C4312) c49742.f15022) == null) {
                throw null;
            }
            c4898.m8317(System.currentTimeMillis());
        }
        if (Long.valueOf(c49742.m8501().f14653.m8316()).longValue() == 0) {
            c49742.mo8165().f14452.m8035("Persisting first open", Long.valueOf(c49742.f15040));
            c49742.m8501().f14653.m8317(c49742.f15040);
        }
        if (c49742.f15015.m8177(C4915.f14881)) {
            C4768 c4768 = c49742.m8503().f14332;
            if (c4768.m8001() && c4768.m8000()) {
                c4768.f14371.m8501().f14671.m8084(null);
            }
        }
        if (c49742.m8498()) {
            C4828 c4828M8510 = c49742.m8510();
            c4828M8510.m8066();
            if (TextUtils.isEmpty(c4828M8510.f14532)) {
                C4828 c4828M85102 = c49742.m8510();
                c4828M85102.m8066();
                if (!TextUtils.isEmpty(c4828M85102.f14533)) {
                    c49742.m8504();
                    C4828 c4828M85103 = c49742.m8510();
                    c4828M85103.m8066();
                    String str2 = c4828M85103.f14532;
                    C4874 c4874M8501 = c49742.m8501();
                    c4874M8501.mo8008();
                    String string = c4874M8501.m8199().getString("gmp_app_id", null);
                    C4828 c4828M85104 = c49742.m8510();
                    c4828M85104.m8066();
                    String str3 = c4828M85104.f14533;
                    C4874 c4874M85012 = c49742.m8501();
                    c4874M85012.mo8008();
                    if (C4887.m8226(str2, string, str3, c4874M85012.m8199().getString("admob_app_id", null))) {
                        c49742.mo8165().f14450.m8034("Rechecking which service to use due to a GMP App Id change");
                        C4874 c4874M85013 = c49742.m8501();
                        c4874M85013.mo8008();
                        Boolean boolM8200 = c4874M85013.m8200();
                        SharedPreferences.Editor editorEdit = c4874M85013.m8199().edit();
                        editorEdit.clear();
                        editorEdit.apply();
                        if (boolM8200 != null) {
                            boolean zBooleanValue = boolM8200.booleanValue();
                            c4874M85013.mo8008();
                            SharedPreferences.Editor editorEdit2 = c4874M85013.m8199().edit();
                            editorEdit2.putBoolean("measurement_enabled", zBooleanValue);
                            editorEdit2.apply();
                        }
                        C4974.m8491((AbstractC4812) c49742.f15027);
                        c49742.f15027.m8087();
                        c49742.f15028.m8519();
                        c49742.f15028.m8518();
                        c49742.m8501().f14653.m8317(c49742.f15040);
                        c49742.m8501().f14655.m8084(null);
                    }
                    C4874 c4874M85014 = c49742.m8501();
                    C4828 c4828M85105 = c49742.m8510();
                    c4828M85105.m8066();
                    String str4 = c4828M85105.f14532;
                    c4874M85014.mo8008();
                    SharedPreferences.Editor editorEdit3 = c4874M85014.m8199().edit();
                    editorEdit3.putString("gmp_app_id", str4);
                    editorEdit3.apply();
                    C4874 c4874M85015 = c49742.m8501();
                    C4828 c4828M85106 = c49742.m8510();
                    c4828M85106.m8066();
                    String str5 = c4828M85106.f14533;
                    c4874M85015.mo8008();
                    SharedPreferences.Editor editorEdit4 = c4874M85015.m8199().edit();
                    editorEdit4.putString("admob_app_id", str5);
                    editorEdit4.apply();
                }
                c49742.m8503().f14331.set(c49742.m8501().f14655.m8083());
                if (C4658.m7795() && c49742.f15015.m8177(C4915.f14903)) {
                    C4887 c4887M8504 = c49742.m8504();
                    if (c4887M8504 == null) {
                        throw null;
                    }
                    try {
                        c4887M8504.f14588.f15009.getClassLoader().loadClass("com.google.firebase.remoteconfig.FirebaseRemoteConfig");
                    } catch (ClassNotFoundException unused) {
                        z = false;
                    }
                    if (!z && !TextUtils.isEmpty(c49742.m8501().f14670.m8083())) {
                        c49742.mo8165().f14447.m8034("Remote config removed with active feature rollouts");
                        c49742.m8501().f14670.m8084(null);
                    }
                }
                C4828 c4828M85107 = c49742.m8510();
                c4828M85107.m8066();
                if (TextUtils.isEmpty(c4828M85107.f14532)) {
                    C4828 c4828M85108 = c49742.m8510();
                    c4828M85108.m8066();
                    if (!TextUtils.isEmpty(c4828M85108.f14533)) {
                        boolean zM8495 = c49742.m8495();
                        if (!c49742.m8501().f14646.contains("deferred_analytics_collection") && !c49742.f15015.m8188()) {
                            c49742.m8501().m8195(!zM8495);
                        }
                        if (zM8495) {
                            c49742.m8503().m7984();
                        }
                        c49742.m8502().f14967.m8201();
                        C4987 c4987M8508 = c49742.m8508();
                        AtomicReference atomicReference = new AtomicReference();
                        c4987M8508.mo8008();
                        c4987M8508.m8066();
                        c4987M8508.m8514(new RunnableC4876(c4987M8508, atomicReference, c4987M8508.m8513(false)));
                    }
                }
            }
        } else if (c49742.m8495()) {
            if (!c49742.m8504().m8267("android.permission.INTERNET")) {
                c49742.mo8165().f14444.m8034("App is missing INTERNET permission");
            }
            if (!c49742.m8504().m8267("android.permission.ACCESS_NETWORK_STATE")) {
                c49742.mo8165().f14444.m8034("App is missing ACCESS_NETWORK_STATE permission");
            }
            if (!C4322.m7223(c49742.f15009).m7221() && !c49742.f15015.m8191()) {
                if (!C4881.m8208(c49742.f15009)) {
                    c49742.mo8165().f14444.m8034("AppMeasurementReceiver not registered/enabled");
                }
                if (!C4887.m8222(c49742.f15009)) {
                    c49742.mo8165().f14444.m8034("AppMeasurementService not registered/enabled");
                }
            }
            c49742.mo8165().f14444.m8034("Uploading is not possible. App measurement disabled");
        }
        c49742.m8501().f14663.m8204(c49742.f15015.m8177(C4915.f14880));
        c49742.m8501().f14664.m8204(c49742.f15015.m8177(C4915.f14882));
    }
}
