package com.facebook.appevents.internal; import android.content.Context; import androidx.core.app.NotificationCompat; import com.facebook.LoggingBehavior; import com.facebook.appevents.AppEventsLogger; import com.facebook.internal.AttributionIdentifiers; import com.facebook.internal.Logger; import com.facebook.internal.Utility; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import kotlin.TuplesKt; import kotlin.collections.MapsKt__MapsKt; import kotlin.jvm.internal.Intrinsics; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class AppEventsLoggerUtility { private static final Map API_ACTIVITY_TYPE_TO_STRING; public static final AppEventsLoggerUtility INSTANCE = new AppEventsLoggerUtility(); private AppEventsLoggerUtility() { } static { HashMap hashMapOf; hashMapOf = MapsKt__MapsKt.hashMapOf(TuplesKt.to(GraphAPIActivityType.MOBILE_INSTALL_EVENT, "MOBILE_APP_INSTALL"), TuplesKt.to(GraphAPIActivityType.CUSTOM_APP_EVENTS, "CUSTOM_APP_EVENTS")); API_ACTIVITY_TYPE_TO_STRING = hashMapOf; } public static final JSONObject getJSONObjectForGraphAPICall(GraphAPIActivityType activityType, AttributionIdentifiers attributionIdentifiers, String str, boolean z, Context context) throws JSONException { Intrinsics.checkNotNullParameter(activityType, "activityType"); Intrinsics.checkNotNullParameter(context, "context"); JSONObject jSONObject = new JSONObject(); jSONObject.put(NotificationCompat.CATEGORY_EVENT, API_ACTIVITY_TYPE_TO_STRING.get(activityType)); String userID = AppEventsLogger.Companion.getUserID(); if (userID != null) { jSONObject.put("app_user_id", userID); } Utility.setAppEventAttributionParameters(jSONObject, attributionIdentifiers, str, z, context); try { Utility.setAppEventExtendedDeviceInfoParameters(jSONObject, context); } catch (Exception e) { Logger.Companion.log(LoggingBehavior.APP_EVENTS, "AppEvents", "Fetching extended device info parameters failed: '%s'", e.toString()); } JSONObject dataProcessingOptions = Utility.getDataProcessingOptions(); if (dataProcessingOptions != null) { Iterator keys = dataProcessingOptions.keys(); while (keys.hasNext()) { String next = keys.next(); jSONObject.put(next, dataProcessingOptions.get(next)); } } jSONObject.put("application_package_name", context.getPackageName()); return jSONObject; } public enum GraphAPIActivityType { MOBILE_INSTALL_EVENT, CUSTOM_APP_EVENTS; /* renamed from: values, reason: to resolve conflict with enum method */ public static GraphAPIActivityType[] valuesCustom() { GraphAPIActivityType[] valuesCustom = values(); return (GraphAPIActivityType[]) Arrays.copyOf(valuesCustom, valuesCustom.length); } } }