package com.google.android.gms.measurement;

import android.content.Context;
import android.os.Bundle;
import android.os.SystemClock;
import androidx.annotation.Keep;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p177.p242.p246.p253.C4312;
import p138.p176.p177.p242.p265.p266.C4754;
import p138.p176.p177.p242.p265.p266.C4757;
import p138.p176.p177.p242.p265.p266.C4765;
import p138.p176.p177.p242.p265.p266.C4923;
import p138.p176.p177.p242.p265.p266.C4974;
import p138.p176.p177.p242.p265.p266.InterfaceC4774;
import p138.p176.p177.p242.p265.p266.InterfaceC5003;

/* JADX INFO: loaded from: classes.dex */
@Deprecated
public class AppMeasurement {

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public static volatile AppMeasurement f2121;

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

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

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

    public static class ConditionalUserProperty {

        @Keep
        public boolean mActive;

        @Keep
        public String mAppId;

        @Keep
        public long mCreationTimestamp;

        @Keep
        public String mExpiredEventName;

        @Keep
        public Bundle mExpiredEventParams;

        @Keep
        public String mName;

        @Keep
        public String mOrigin;

        @Keep
        public long mTimeToLive;

        @Keep
        public String mTimedOutEventName;

        @Keep
        public Bundle mTimedOutEventParams;

        @Keep
        public String mTriggerEventName;

        @Keep
        public long mTriggerTimeout;

        @Keep
        public String mTriggeredEventName;

        @Keep
        public Bundle mTriggeredEventParams;

        @Keep
        public long mTriggeredTimestamp;

        @Keep
        public Object mValue;

        public ConditionalUserProperty() {
        }

        public ConditionalUserProperty(Bundle bundle) {
            C0567.m1910(bundle);
            this.mAppId = (String) C4303.m7007(bundle, "app_id", (Class<Object>) String.class, (Object) null);
            this.mOrigin = (String) C4303.m7007(bundle, "origin", (Class<Object>) String.class, (Object) null);
            this.mName = (String) C4303.m7007(bundle, "name", (Class<Object>) String.class, (Object) null);
            this.mValue = C4303.m7007(bundle, "value", (Class<Object>) Object.class, (Object) null);
            this.mTriggerEventName = (String) C4303.m7007(bundle, "trigger_event_name", (Class<Object>) String.class, (Object) null);
            this.mTriggerTimeout = ((Long) C4303.m7007(bundle, "trigger_timeout", (Class<long>) Long.class, 0L)).longValue();
            this.mTimedOutEventName = (String) C4303.m7007(bundle, "timed_out_event_name", (Class<Object>) String.class, (Object) null);
            this.mTimedOutEventParams = (Bundle) C4303.m7007(bundle, "timed_out_event_params", (Class<Object>) Bundle.class, (Object) null);
            this.mTriggeredEventName = (String) C4303.m7007(bundle, "triggered_event_name", (Class<Object>) String.class, (Object) null);
            this.mTriggeredEventParams = (Bundle) C4303.m7007(bundle, "triggered_event_params", (Class<Object>) Bundle.class, (Object) null);
            this.mTimeToLive = ((Long) C4303.m7007(bundle, "time_to_live", (Class<long>) Long.class, 0L)).longValue();
            this.mExpiredEventName = (String) C4303.m7007(bundle, "expired_event_name", (Class<Object>) String.class, (Object) null);
            this.mExpiredEventParams = (Bundle) C4303.m7007(bundle, "expired_event_params", (Class<Object>) Bundle.class, (Object) null);
            this.mActive = ((Boolean) C4303.m7007(bundle, "active", (Class<boolean>) Boolean.class, false)).booleanValue();
            this.mCreationTimestamp = ((Long) C4303.m7007(bundle, "creation_timestamp", (Class<long>) Long.class, 0L)).longValue();
            this.mTriggeredTimestamp = ((Long) C4303.m7007(bundle, "triggered_timestamp", (Class<long>) Long.class, 0L)).longValue();
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final Bundle m1411() {
            Bundle bundle = new Bundle();
            String str = this.mAppId;
            if (str != null) {
                bundle.putString("app_id", str);
            }
            String str2 = this.mOrigin;
            if (str2 != null) {
                bundle.putString("origin", str2);
            }
            String str3 = this.mName;
            if (str3 != null) {
                bundle.putString("name", str3);
            }
            Object obj = this.mValue;
            if (obj != null) {
                C4303.m7087(bundle, obj);
            }
            String str4 = this.mTriggerEventName;
            if (str4 != null) {
                bundle.putString("trigger_event_name", str4);
            }
            bundle.putLong("trigger_timeout", this.mTriggerTimeout);
            String str5 = this.mTimedOutEventName;
            if (str5 != null) {
                bundle.putString("timed_out_event_name", str5);
            }
            Bundle bundle2 = this.mTimedOutEventParams;
            if (bundle2 != null) {
                bundle.putBundle("timed_out_event_params", bundle2);
            }
            String str6 = this.mTriggeredEventName;
            if (str6 != null) {
                bundle.putString("triggered_event_name", str6);
            }
            Bundle bundle3 = this.mTriggeredEventParams;
            if (bundle3 != null) {
                bundle.putBundle("triggered_event_params", bundle3);
            }
            bundle.putLong("time_to_live", this.mTimeToLive);
            String str7 = this.mExpiredEventName;
            if (str7 != null) {
                bundle.putString("expired_event_name", str7);
            }
            Bundle bundle4 = this.mExpiredEventParams;
            if (bundle4 != null) {
                bundle.putBundle("expired_event_params", bundle4);
            }
            bundle.putLong("creation_timestamp", this.mCreationTimestamp);
            bundle.putBoolean("active", this.mActive);
            bundle.putLong("triggered_timestamp", this.mTriggeredTimestamp);
            return bundle;
        }
    }

    /* JADX INFO: renamed from: com.google.android.gms.measurement.AppMeasurement$֏, reason: contains not printable characters */
    public interface InterfaceC0335 extends InterfaceC5003 {
    }

    public AppMeasurement(InterfaceC4774 interfaceC4774) {
        C0567.m1910(interfaceC4774);
        this.f2123 = interfaceC4774;
        this.f2122 = null;
        this.f2124 = true;
    }

    public AppMeasurement(C4974 c4974) {
        C0567.m1910(c4974);
        this.f2122 = c4974;
        this.f2123 = null;
        this.f2124 = false;
    }

    @Keep
    @Deprecated
    public static AppMeasurement getInstance(Context context) {
        return m1408(context);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static AppMeasurement m1408(Context context) {
        if (f2121 == null) {
            synchronized (AppMeasurement.class) {
                if (f2121 == null) {
                    InterfaceC4774 interfaceC4774M1410 = m1410(context, null);
                    if (interfaceC4774M1410 != null) {
                        f2121 = new AppMeasurement(interfaceC4774M1410);
                    } else {
                        f2121 = new AppMeasurement(C4974.m8489(context, null));
                    }
                }
            }
        }
        return f2121;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static AppMeasurement m1409(Context context, Bundle bundle) {
        if (f2121 == null) {
            synchronized (AppMeasurement.class) {
                if (f2121 == null) {
                    InterfaceC4774 interfaceC4774M1410 = m1410(context, bundle);
                    if (interfaceC4774M1410 != null) {
                        f2121 = new AppMeasurement(interfaceC4774M1410);
                    } else {
                        f2121 = new AppMeasurement(C4974.m8489(context, bundle));
                    }
                }
            }
        }
        return f2121;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static InterfaceC4774 m1410(Context context, Bundle bundle) {
        try {
            return (InterfaceC4774) Class.forName("disabled_com.google.firebase.analytics.FirebaseAnalytics").getDeclaredMethod("getScionFrontendApiImplementation", Context.class, Bundle.class).invoke(null, context, bundle);
        } catch (ClassNotFoundException | Exception unused) {
            return null;
        }
    }

    @Keep
    public void beginAdUnitExposure(String str) {
        if (this.f2124) {
            this.f2123.mo8016(str);
            return;
        }
        C4923 c4923M8511 = this.f2122.m8511();
        if (((C4312) this.f2122.f15022) == null) {
            throw null;
        }
        c4923M8511.m8476(str, SystemClock.elapsedRealtime());
    }

    @Keep
    public void clearConditionalUserProperty(String str, String str2, Bundle bundle) {
        if (this.f2124) {
            this.f2123.mo8017(str, str2, bundle);
            return;
        }
        C4757 c4757M8503 = this.f2122.m8503();
        c4757M8503.mo8055();
        c4757M8503.m7977((String) null, str, str2, bundle);
    }

    @Keep
    public void clearConditionalUserPropertyAs(String str, String str2, String str3, Bundle bundle) {
        if (this.f2124) {
            throw new IllegalStateException("Unexpected call on client side");
        }
        C4757 c4757M8503 = this.f2122.m8503();
        if (c4757M8503 == null) {
            throw null;
        }
        C0567.m1926(str);
        c4757M8503.m8056();
        throw null;
    }

    @Keep
    public void endAdUnitExposure(String str) {
        if (this.f2124) {
            this.f2123.mo8023(str);
            return;
        }
        C4923 c4923M8511 = this.f2122.m8511();
        if (((C4312) this.f2122.f15022) == null) {
            throw null;
        }
        c4923M8511.m8479(str, SystemClock.elapsedRealtime());
    }

    @Keep
    public long generateEventId() {
        return this.f2124 ? this.f2123.mo8025() : this.f2122.m8504().m8272();
    }

    @Keep
    public String getAppInstanceId() {
        if (this.f2124) {
            return this.f2123.mo8022();
        }
        C4757 c4757M8503 = this.f2122.m8503();
        c4757M8503.mo8055();
        return c4757M8503.f14331.get();
    }

    @Keep
    public List<ConditionalUserProperty> getConditionalUserProperties(String str, String str2) {
        List<Bundle> listM7966;
        if (this.f2124) {
            listM7966 = this.f2123.mo8013(str, str2);
        } else {
            C4757 c4757M8503 = this.f2122.m8503();
            c4757M8503.mo8055();
            listM7966 = c4757M8503.m7966((String) null, str, str2);
        }
        ArrayList arrayList = new ArrayList(listM7966 == null ? 0 : listM7966.size());
        Iterator<Bundle> it = listM7966.iterator();
        while (it.hasNext()) {
            arrayList.add(new ConditionalUserProperty(it.next()));
        }
        return arrayList;
    }

    @Keep
    public List<ConditionalUserProperty> getConditionalUserPropertiesAs(String str, String str2, String str3) {
        if (this.f2124) {
            throw new IllegalStateException("Unexpected call on client side");
        }
        C4757 c4757M8503 = this.f2122.m8503();
        if (c4757M8503 == null) {
            throw null;
        }
        C0567.m1926(str);
        c4757M8503.m8056();
        throw null;
    }

    @Keep
    public String getCurrentScreenClass() {
        if (this.f2124) {
            return this.f2123.mo8020();
        }
        C4765 c4765M8507 = this.f2122.m8503().f14588.m8507();
        c4765M8507.mo8055();
        C4754 c4754 = c4765M8507.f14358;
        if (c4754 != null) {
            return c4754.f14285;
        }
        return null;
    }

    @Keep
    public String getCurrentScreenName() {
        if (this.f2124) {
            return this.f2123.mo8012();
        }
        C4765 c4765M8507 = this.f2122.m8503().f14588.m8507();
        c4765M8507.mo8055();
        C4754 c4754 = c4765M8507.f14358;
        if (c4754 != null) {
            return c4754.f14284;
        }
        return null;
    }

    @Keep
    public String getGmpAppId() {
        return this.f2124 ? this.f2123.mo8024() : this.f2122.m8503().m7985();
    }

    @Keep
    public int getMaxUserProperties(String str) {
        if (this.f2124) {
            return this.f2123.mo8019(str);
        }
        this.f2122.m8503();
        C0567.m1926(str);
        return 25;
    }

    @Keep
    public Map<String, Object> getUserProperties(String str, String str2, boolean z) {
        if (this.f2124) {
            return this.f2123.mo8014(str, str2, z);
        }
        C4757 c4757M8503 = this.f2122.m8503();
        c4757M8503.mo8055();
        return c4757M8503.m7967((String) null, str, str2, z);
    }

    @Keep
    public Map<String, Object> getUserPropertiesAs(String str, String str2, String str3, boolean z) {
        if (this.f2124) {
            throw new IllegalStateException("Unexpected call on client side");
        }
        C4757 c4757M8503 = this.f2122.m8503();
        if (c4757M8503 == null) {
            throw null;
        }
        C0567.m1926(str);
        c4757M8503.m8056();
        throw null;
    }

    @Keep
    public void logEventInternal(String str, String str2, Bundle bundle) {
        if (this.f2124) {
            this.f2123.mo8021(str, str2, bundle);
        } else {
            this.f2122.m8503().m7972(str, str2, bundle);
        }
    }

    @Keep
    public void setConditionalUserProperty(ConditionalUserProperty conditionalUserProperty) {
        C0567.m1910(conditionalUserProperty);
        if (this.f2124) {
            this.f2123.mo8015(conditionalUserProperty.m1411());
            return;
        }
        C4757 c4757M8503 = this.f2122.m8503();
        Bundle bundleM1411 = conditionalUserProperty.m1411();
        if (((C4312) c4757M8503.f14588.f15022) == null) {
            throw null;
        }
        c4757M8503.m7968(bundleM1411, System.currentTimeMillis());
    }

    @Keep
    public void setConditionalUserPropertyAs(ConditionalUserProperty conditionalUserProperty) {
        C0567.m1910(conditionalUserProperty);
        if (this.f2124) {
            throw new IllegalStateException("Unexpected call on client side");
        }
        C4757 c4757M8503 = this.f2122.m8503();
        Bundle bundleM1411 = conditionalUserProperty.m1411();
        if (c4757M8503 == null) {
            throw null;
        }
        C0567.m1910(bundleM1411);
        C0567.m1926(bundleM1411.getString("app_id"));
        c4757M8503.m8056();
        throw null;
    }
}
