package com.google.android.gms.measurement;

import P2.w;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Keep;
import b3.AbstractC0537c;
import b3.C0535a;
import b3.C0536b;
import com.google.android.gms.internal.measurement.U;
import com.google.firebase.analytics.FirebaseAnalytics;
import d3.C0817r0;
import d3.G0;
import d3.Z0;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static volatile AppMeasurement f10088b;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final AbstractC0537c f10089a;

    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 AppMeasurement(C0817r0 c0817r0) {
        this.f10089a = new C0535a(c0817r0);
    }

    /* JADX WARN: Unreachable blocks removed: 1, instructions: 1 */
    @Keep
    @Deprecated
    public static AppMeasurement getInstance(Context context) {
        if (f10088b == null) {
            synchronized (AppMeasurement.class) {
                if (f10088b == null) {
                    Z0 z02 = (Z0) FirebaseAnalytics.class.getDeclaredMethod("getScionFrontendApiImplementation", Context.class, Bundle.class).invoke(null, context, null);
                    if (z02 != null) {
                        f10088b = new AppMeasurement(z02);
                    } else {
                        f10088b = new AppMeasurement(C0817r0.q(context, new U(0L, 0L, true, null, null, null, null, null), null));
                    }
                }
            }
        }
        return f10088b;
    }

    @Keep
    public void beginAdUnitExposure(String str) {
        this.f10089a.b(str);
    }

    @Keep
    public void clearConditionalUserProperty(String str, String str2, Bundle bundle) {
        this.f10089a.i(str, str2, bundle);
    }

    @Keep
    public void endAdUnitExposure(String str) {
        this.f10089a.e(str);
    }

    @Keep
    public long generateEventId() {
        return this.f10089a.k();
    }

    @Keep
    public String getAppInstanceId() {
        return this.f10089a.a();
    }

    @Keep
    public List<ConditionalUserProperty> getConditionalUserProperties(String str, String str2) {
        List<Bundle> listM = this.f10089a.m(str, str2);
        ArrayList arrayList = new ArrayList(listM == null ? 0 : listM.size());
        for (Bundle bundle : listM) {
            ConditionalUserProperty conditionalUserProperty = new ConditionalUserProperty();
            w.f(bundle);
            conditionalUserProperty.mAppId = (String) G0.a(bundle, "app_id", String.class, null);
            conditionalUserProperty.mOrigin = (String) G0.a(bundle, "origin", String.class, null);
            conditionalUserProperty.mName = (String) G0.a(bundle, "name", String.class, null);
            conditionalUserProperty.mValue = G0.a(bundle, "value", Object.class, null);
            conditionalUserProperty.mTriggerEventName = (String) G0.a(bundle, "trigger_event_name", String.class, null);
            conditionalUserProperty.mTriggerTimeout = ((Long) G0.a(bundle, "trigger_timeout", Long.class, 0L)).longValue();
            conditionalUserProperty.mTimedOutEventName = (String) G0.a(bundle, "timed_out_event_name", String.class, null);
            conditionalUserProperty.mTimedOutEventParams = (Bundle) G0.a(bundle, "timed_out_event_params", Bundle.class, null);
            conditionalUserProperty.mTriggeredEventName = (String) G0.a(bundle, "triggered_event_name", String.class, null);
            conditionalUserProperty.mTriggeredEventParams = (Bundle) G0.a(bundle, "triggered_event_params", Bundle.class, null);
            conditionalUserProperty.mTimeToLive = ((Long) G0.a(bundle, "time_to_live", Long.class, 0L)).longValue();
            conditionalUserProperty.mExpiredEventName = (String) G0.a(bundle, "expired_event_name", String.class, null);
            conditionalUserProperty.mExpiredEventParams = (Bundle) G0.a(bundle, "expired_event_params", Bundle.class, null);
            conditionalUserProperty.mActive = ((Boolean) G0.a(bundle, "active", Boolean.class, Boolean.FALSE)).booleanValue();
            conditionalUserProperty.mCreationTimestamp = ((Long) G0.a(bundle, "creation_timestamp", Long.class, 0L)).longValue();
            conditionalUserProperty.mTriggeredTimestamp = ((Long) G0.a(bundle, "triggered_timestamp", Long.class, 0L)).longValue();
            arrayList.add(conditionalUserProperty);
        }
        return arrayList;
    }

    @Keep
    public String getCurrentScreenClass() {
        return this.f10089a.c();
    }

    @Keep
    public String getCurrentScreenName() {
        return this.f10089a.g();
    }

    @Keep
    public String getGmpAppId() {
        return this.f10089a.l();
    }

    @Keep
    public int getMaxUserProperties(String str) {
        return this.f10089a.f(str);
    }

    @Keep
    public Map<String, Object> getUserProperties(String str, String str2, boolean z8) {
        return this.f10089a.d(str, str2, z8);
    }

    @Keep
    public void logEventInternal(String str, String str2, Bundle bundle) {
        this.f10089a.j(str, str2, bundle);
    }

    @Keep
    public void setConditionalUserProperty(ConditionalUserProperty conditionalUserProperty) {
        w.f(conditionalUserProperty);
        Bundle bundle = new Bundle();
        String str = conditionalUserProperty.mAppId;
        if (str != null) {
            bundle.putString("app_id", str);
        }
        String str2 = conditionalUserProperty.mOrigin;
        if (str2 != null) {
            bundle.putString("origin", str2);
        }
        String str3 = conditionalUserProperty.mName;
        if (str3 != null) {
            bundle.putString("name", str3);
        }
        Object obj = conditionalUserProperty.mValue;
        if (obj != null) {
            G0.e(bundle, obj);
        }
        String str4 = conditionalUserProperty.mTriggerEventName;
        if (str4 != null) {
            bundle.putString("trigger_event_name", str4);
        }
        bundle.putLong("trigger_timeout", conditionalUserProperty.mTriggerTimeout);
        String str5 = conditionalUserProperty.mTimedOutEventName;
        if (str5 != null) {
            bundle.putString("timed_out_event_name", str5);
        }
        Bundle bundle2 = conditionalUserProperty.mTimedOutEventParams;
        if (bundle2 != null) {
            bundle.putBundle("timed_out_event_params", bundle2);
        }
        String str6 = conditionalUserProperty.mTriggeredEventName;
        if (str6 != null) {
            bundle.putString("triggered_event_name", str6);
        }
        Bundle bundle3 = conditionalUserProperty.mTriggeredEventParams;
        if (bundle3 != null) {
            bundle.putBundle("triggered_event_params", bundle3);
        }
        bundle.putLong("time_to_live", conditionalUserProperty.mTimeToLive);
        String str7 = conditionalUserProperty.mExpiredEventName;
        if (str7 != null) {
            bundle.putString("expired_event_name", str7);
        }
        Bundle bundle4 = conditionalUserProperty.mExpiredEventParams;
        if (bundle4 != null) {
            bundle.putBundle("expired_event_params", bundle4);
        }
        bundle.putLong("creation_timestamp", conditionalUserProperty.mCreationTimestamp);
        bundle.putBoolean("active", conditionalUserProperty.mActive);
        bundle.putLong("triggered_timestamp", conditionalUserProperty.mTriggeredTimestamp);
        this.f10089a.h(bundle);
    }

    public AppMeasurement(Z0 z02) {
        this.f10089a = new C0536b(z02);
    }
}
