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

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import com.google.android.gms.common.api.Status;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p242.p246.C4200;
import p138.p176.p177.p242.p246.p247.p248.C4221;
import p138.p176.p177.p242.p246.p255.C4320;
import p138.p176.p177.p242.p258.p263.C4401;
import p138.p176.p177.p242.p258.p263.C4538;
import p138.p176.p177.p242.p258.p263.InterfaceC4466;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.ˮ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4828 extends AbstractC4812 {

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

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

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

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public String f14527;

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

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

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public List<String> f14530;

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

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public String f14532;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public String f14533;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public String f14534;

    public C4828(C4974 c4974, long j) {
        super(c4974);
        this.f14529 = j;
    }

    /* JADX WARN: Removed duplicated region for block: B:139:0x02e1  */
    /* JADX WARN: Removed duplicated region for block: B:150:0x0313  */
    /* JADX WARN: Removed duplicated region for block: B:165:0x02bb A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:33:0x00aa  */
    /* JADX WARN: Removed duplicated region for block: B:60:0x016e  */
    @Override // p138.p176.p177.p242.p265.p266.AbstractC4812
    /* JADX INFO: renamed from: ޒ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void mo8065() {
        String str;
        boolean z;
        boolean z2;
        Integer numValueOf;
        String string;
        String packageName = this.f14588.f15009.getPackageName();
        PackageManager packageManager = this.f14588.f15009.getPackageManager();
        String str2 = "Unknown";
        String str3 = "";
        String installerPackageName = "unknown";
        int i = Integer.MIN_VALUE;
        if (packageManager == null) {
            mo8165().f14444.m8035("PackageManager is null, app identity information might be inaccurate. appId", C4794.m8038(packageName));
        } else {
            try {
                installerPackageName = packageManager.getInstallerPackageName(packageName);
            } catch (IllegalArgumentException unused) {
                mo8165().f14444.m8035("Error retrieving app installer package name. appId", C4794.m8038(packageName));
            }
            if (installerPackageName == null) {
                installerPackageName = "manual_install";
            } else if ("com.android.vending".equals(installerPackageName)) {
                installerPackageName = "";
            }
            try {
                PackageInfo packageInfo = packageManager.getPackageInfo(this.f14588.f15009.getPackageName(), 0);
                if (packageInfo != null) {
                    CharSequence applicationLabel = packageManager.getApplicationLabel(packageInfo.applicationInfo);
                    String string2 = !TextUtils.isEmpty(applicationLabel) ? applicationLabel.toString() : "Unknown";
                    try {
                        str2 = packageInfo.versionName;
                        i = packageInfo.versionCode;
                    } catch (PackageManager.NameNotFoundException unused2) {
                        str = str2;
                        str2 = string2;
                        mo8165().f14444.m8036("Error retrieving package info. appId, appName", C4794.m8038(packageName), str2);
                        str2 = str;
                    }
                }
            } catch (PackageManager.NameNotFoundException unused3) {
                str = "Unknown";
            }
        }
        this.f14524 = packageName;
        this.f14527 = installerPackageName;
        this.f14525 = str2;
        this.f14526 = i;
        this.f14528 = 0L;
        C4974 c4974 = this.f14588;
        C4785 c4785 = c4974.f15014;
        Status statusM6902 = C4221.m6902(c4974.f15009);
        boolean z3 = true;
        if (statusM6902 == null) {
            z = false;
        } else {
            if (statusM6902.f2079 <= 0) {
                z = true;
            }
        }
        boolean z4 = !TextUtils.isEmpty(this.f14588.f15010) && "am".equals(this.f14588.f15011);
        boolean z5 = z | z4;
        if (!z5) {
            if (statusM6902 == null) {
                mo8165().f14445.m8034("GoogleService failed to initialize (no status)");
            } else {
                mo8165().f14445.m8036("GoogleService failed to initialize, status", Integer.valueOf(statusM6902.f2079), statusM6902.f2080);
            }
        }
        if (z5) {
            int iM8496 = this.f14588.m8496();
            switch (iM8496) {
                case 0:
                    mo8165().f14452.m8034("App measurement collection enabled");
                    break;
                case 1:
                    mo8165().f14450.m8034("App measurement deactivated via the manifest");
                    break;
                case 2:
                    mo8165().f14452.m8034("App measurement deactivated via the init parameters");
                    break;
                case 3:
                    mo8165().f14450.m8034("App measurement disabled by setAnalyticsCollectionEnabled(false)");
                    break;
                case 4:
                    mo8165().f14450.m8034("App measurement disabled via the manifest");
                    break;
                case 5:
                    mo8165().f14452.m8034("App measurement disabled via the init parameters");
                    break;
                case 6:
                    mo8165().f14449.m8034("App measurement deactivated via resources. This method is being deprecated. Please refer to https://firebase.google.com/support/guides/disable-analytics");
                    break;
                case 7:
                    mo8165().f14450.m8034("App measurement disabled via the global data collection setting");
                    break;
                default:
                    mo8165().f14450.m8034("App measurement disabled");
                    mo8165().f14445.m8034("Invalid scion state in identity");
                    break;
            }
            z2 = iM8496 == 0;
        }
        this.f14532 = "";
        this.f14533 = "";
        this.f14534 = "";
        C4974 c49742 = this.f14588;
        C4785 c47852 = c49742.f15014;
        if (z4) {
            this.f14533 = c49742.f15010;
        }
        List<String> listAsList = null;
        try {
            if (((InterfaceC4466) C4401.f13690.mo7259()).mo7477() && this.f14588.f15015.m8177(C4915.f14922)) {
                Context context = this.f14588.f15009;
                C0567.m1910(context);
                Resources resources = context.getResources();
                int identifier = resources.getIdentifier("google_app_id", "string", resources.getResourcePackageName(C4200.common_google_play_services_unknown_issue));
                string = identifier == 0 ? null : resources.getString(identifier);
            } else {
                string = C4221.m6903("getGoogleAppId").f13459;
            }
            this.f14532 = TextUtils.isEmpty(string) ? "" : string;
            if (C4538.m7580() && this.f14588.f15015.m8177(C4915.f14896)) {
                Context context2 = this.f14588.f15009;
                C0567.m1910(context2);
                Resources resources2 = context2.getResources();
                String resourcePackageName = resources2.getResourcePackageName(C4200.common_google_play_services_unknown_issue);
                int identifier2 = resources2.getIdentifier("ga_app_id", "string", resourcePackageName);
                String string3 = identifier2 == 0 ? null : resources2.getString(identifier2);
                if (!TextUtils.isEmpty(string3)) {
                    str3 = string3;
                }
                this.f14534 = str3;
                if (!TextUtils.isEmpty(string) || !TextUtils.isEmpty(string3)) {
                    int identifier3 = resources2.getIdentifier("admob_app_id", "string", resourcePackageName);
                    this.f14533 = identifier3 == 0 ? null : resources2.getString(identifier3);
                }
            } else if (!TextUtils.isEmpty(string)) {
                Context context3 = this.f14588.f15009;
                C0567.m1910(context3);
                Resources resources3 = context3.getResources();
                int identifier4 = resources3.getIdentifier("admob_app_id", "string", resources3.getResourcePackageName(C4200.common_google_play_services_unknown_issue));
                this.f14533 = identifier4 == 0 ? null : resources3.getString(identifier4);
            }
            if (z2) {
                mo8165().f14452.m8036("App measurement enabled for app package, google app id", this.f14524, TextUtils.isEmpty(this.f14532) ? this.f14533 : this.f14532);
            }
        } catch (IllegalStateException e) {
            mo8165().f14444.m8036("Fetching Google App Id failed with exception. appId", C4794.m8038(packageName), e);
        }
        this.f14530 = null;
        if (this.f14588.f15015.m8177(C4915.f14884)) {
            C4974 c49743 = this.f14588;
            C4785 c47853 = c49743.f15014;
            C4869 c4869 = c49743.f15015;
            if (c4869 == null) {
                throw null;
            }
            C0567.m1926("analytics.safelisted_events");
            Bundle bundleM8192 = c4869.m8192();
            if (bundleM8192 == null) {
                c4869.mo8165().f14444.m8034("Failed to load metadata: Metadata bundle is null");
            } else {
                if (bundleM8192.containsKey("analytics.safelisted_events")) {
                    numValueOf = Integer.valueOf(bundleM8192.getInt("analytics.safelisted_events"));
                }
                if (numValueOf != null) {
                    try {
                        String[] stringArray = c4869.f14588.f15009.getResources().getStringArray(numValueOf.intValue());
                        if (stringArray != null) {
                            listAsList = Arrays.asList(stringArray);
                        }
                    } catch (Resources.NotFoundException e2) {
                        c4869.mo8165().f14444.m8035("Failed to load string array from metadata: resource not found", e2);
                    }
                }
                if (listAsList != null) {
                    if (listAsList.size() == 0) {
                        mo8165().f14449.m8034("Safelisted event list is empty. Ignoring");
                    } else {
                        Iterator<String> it = listAsList.iterator();
                        while (it.hasNext()) {
                            if (!m8167().m8264("safelisted event", it.next())) {
                            }
                        }
                    }
                    z3 = false;
                }
                if (z3) {
                    this.f14530 = listAsList;
                }
            }
            numValueOf = null;
            if (numValueOf != null) {
            }
            if (listAsList != null) {
            }
            if (z3) {
            }
        }
        if (packageManager != null) {
            this.f14531 = C4320.m7219(this.f14588.f15009) ? 1 : 0;
        } else {
            this.f14531 = 0;
        }
    }

    @Override // p138.p176.p177.p242.p265.p266.AbstractC4812
    /* JADX INFO: renamed from: ޕ */
    public final boolean mo7982() {
        return true;
    }
}
