正在查看: Handling Master v2 应用的 VungleApiClient.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Handling Master v2 应用的 VungleApiClient.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.vungle.ads.internal.network;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.PermissionChecker;
import androidx.core.util.Consumer;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.unity3d.services.core.request.metrics.MetricCommonTags;
import com.unity3d.splash.BuildConfig;
import com.vungle.ads.AnalyticsClient;
import com.vungle.ads.ServiceLocator;
import com.vungle.ads.TimeIntervalMetric;
import com.vungle.ads.UserAgentError;
import com.vungle.ads.VungleAdSize;
import com.vungle.ads.VungleAds;
import com.vungle.ads.fpd.FirstPartyData;
import com.vungle.ads.internal.ConfigManager;
import com.vungle.ads.internal.model.AdPayload;
import com.vungle.ads.internal.model.AdvertisingInfo;
import com.vungle.ads.internal.model.AppNode;
import com.vungle.ads.internal.model.CommonRequestBody;
import com.vungle.ads.internal.model.ConfigPayload;
import com.vungle.ads.internal.model.Cookie;
import com.vungle.ads.internal.model.DeviceNode;
import com.vungle.ads.internal.model.ErrorInfo;
import com.vungle.ads.internal.model.Placement;
import com.vungle.ads.internal.persistence.FilePreferences;
import com.vungle.ads.internal.platform.AndroidPlatform;
import com.vungle.ads.internal.platform.Platform;
import com.vungle.ads.internal.privacy.COPPA;
import com.vungle.ads.internal.privacy.PrivacyManager;
import com.vungle.ads.internal.protos.Sdk;
import com.vungle.ads.internal.signals.SignalManager;
import com.vungle.ads.internal.util.FileUtility;
import com.vungle.ads.internal.util.LogEntry;
import com.vungle.ads.internal.util.Logger;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.annotation.AnnotationRetention;
import kotlin.collections.CollectionsKt__CollectionsJVMKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import kotlin.text.StringsKt__StringsJVMKt;
import kotlinx.serialization.KSerializer;
import kotlinx.serialization.SerializersKt;
import kotlinx.serialization.json.Json;
import kotlinx.serialization.json.JsonBuilder;
import kotlinx.serialization.json.JsonKt;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSink;
import okio.GzipSink;
import okio.Okio;
@Metadata(d1 = {"\u0000ô\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010%\n\u0002\u0010\u000e\n\u0002\u0010\t\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010$\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u0000 }2\u00020\u0001:\u0003}~\u007fB\u001d\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bJ\u0010\u00107\u001a\u0002082\u0006\u00109\u001a\u00020\u001eH\u0007J\u0012\u0010:\u001a\u00020)2\b\u0010;\u001a\u0004\u0018\u00010<H\u0002J\u000e\u0010=\u001a\u00020\u001e2\u0006\u0010>\u001a\u00020)J\u000e\u0010?\u001a\n\u0012\u0004\u0012\u00020A\u0018\u00010@J\u0010\u0010B\u001a\u00020C2\u0006\u0010;\u001a\u00020DH\u0002J\u0010\u0010E\u001a\u00020\u00162\u0006\u0010F\u001a\u00020\u0003H\u0002J\n\u0010G\u001a\u0004\u0018\u00010)H\u0002J\u000f\u0010H\u001a\u0004\u0018\u00010)H\u0000¢\u0006\u0002\bIJ\u000e\u0010H\u001a\u00020)2\u0006\u0010J\u001a\u00020KJ\b\u0010L\u001a\u00020\u0016H\u0002J\u0015\u0010L\u001a\u00020\u00162\u0006\u0010M\u001a\u00020\u001eH\u0001¢\u0006\u0002\bNJ\u0014\u0010O\u001a\u0004\u0018\u00010P2\b\b\u0002\u0010Q\u001a\u00020\u001eH\u0002J\u0012\u0010R\u001a\u00020)2\b\u0010S\u001a\u0004\u0018\u00010<H\u0002J\u000f\u0010T\u001a\u0004\u0018\u00010\u001eH\u0007¢\u0006\u0002\u0010UJ\u000f\u0010V\u001a\u0004\u0018\u00010\u001eH\u0007¢\u0006\u0002\u0010UJ\u000e\u0010W\u001a\u00020*2\u0006\u0010>\u001a\u00020)J\u0012\u0010X\u001a\u00020Y2\b\b\u0002\u0010Z\u001a\u00020\u001eH\u0002J\b\u0010[\u001a\u000208H\u0002J\u000e\u0010\\\u001a\u0002082\u0006\u0010]\u001a\u00020)J\u000f\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0007¢\u0006\u0002\u0010UJJ\u0010^\u001a\u0004\u0018\u00010_2\u0006\u0010`\u001a\u00020)2\u0016\b\u0002\u0010a\u001a\u0010\u0012\u0004\u0012\u00020)\u0012\u0004\u0012\u00020)\u0018\u00010b2\n\b\u0002\u0010c\u001a\u0004\u0018\u00010)2\b\b\u0002\u0010d\u001a\u00020e2\n\b\u0002\u0010f\u001a\u0004\u0018\u00010gJ\u001c\u0010h\u001a\u0002082\f\u0010i\u001a\b\u0012\u0004\u0012\u00020k0j2\u0006\u0010l\u001a\u00020mJ\u001c\u0010n\u001a\u0002082\f\u0010o\u001a\b\u0012\u0004\u0012\u00020p0j2\u0006\u0010l\u001a\u00020mJ \u0010q\u001a\n\u0012\u0004\u0012\u00020r\u0018\u00010@2\u0006\u0010s\u001a\u00020)2\b\u0010t\u001a\u0004\u0018\u00010uJ\u001a\u0010c\u001a\u00020v2\b\b\u0002\u0010Q\u001a\u00020\u001e2\b\b\u0002\u0010Z\u001a\u00020\u001eJ\u0016\u0010w\u001a\n\u0012\u0004\u0012\u00020x\u0018\u00010@2\u0006\u0010;\u001a\u00020yJ\u0016\u0010z\u001a\u0002082\u0006\u0010{\u001a\u00020)2\u0006\u0010|\u001a\u00020)R\u0010\u0010\t\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\fX\u0082\u000e¢\u0006\u0002\n\u0000R&\u0010\r\u001a\u0004\u0018\u00010\u000e8\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u000f\u0010\u0010\u001a\u0004\b\u0011\u0010\u0012\"\u0004\b\u0013\u0010\u0014R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0015\u001a\u0004\u0018\u00010\u0016X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u0017\u001a\u00020\f8\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\u0018\u0010\u0010\u001a\u0004\b\u0019\u0010\u001a\"\u0004\b\u001b\u0010\u001cR\u0012\u0010\u001d\u001a\u0004\u0018\u00010\u001eX\u0082\u000e¢\u0006\u0004\n\u0002\u0010\u001fR\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010 \u001a\u00020!8\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b\"\u0010\u0010\u001a\u0004\b#\u0010$\"\u0004\b%\u0010&R0\u0010'\u001a\u000e\u0012\u0004\u0012\u00020)\u0012\u0004\u0012\u00020*0(8\u0000@\u0000X\u0081\u000e¢\u0006\u0014\n\u0000\u0012\u0004\b+\u0010\u0010\u001a\u0004\b,\u0010-\"\u0004\b.\u0010/R\u001b\u00100\u001a\u0002018BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b4\u00105\u001a\u0004\b2\u00103R\u0010\u00106\u001a\u0004\u0018\u00010)X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0080\u0001"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient;", BuildConfig.FLAVOR, "applicationContext", "Landroid/content/Context;", "platform", "Lcom/vungle/ads/internal/platform/Platform;", "filePreferences", "Lcom/vungle/ads/internal/persistence/FilePreferences;", "(Landroid/content/Context;Lcom/vungle/ads/internal/platform/Platform;Lcom/vungle/ads/internal/persistence/FilePreferences;)V", "advertisingInfo", "Lcom/vungle/ads/internal/model/AdvertisingInfo;", "api", "Lcom/vungle/ads/internal/network/VungleApi;", "appBody", "Lcom/vungle/ads/internal/model/AppNode;", "getAppBody$vungle_ads_release$annotations", "()V", "getAppBody$vungle_ads_release", "()Lcom/vungle/ads/internal/model/AppNode;", "setAppBody$vungle_ads_release", "(Lcom/vungle/ads/internal/model/AppNode;)V", "baseDeviceInfo", "Lcom/vungle/ads/internal/model/DeviceNode;", "gzipApi", "getGzipApi$vungle_ads_release$annotations", "getGzipApi$vungle_ads_release", "()Lcom/vungle/ads/internal/network/VungleApi;", "setGzipApi$vungle_ads_release", "(Lcom/vungle/ads/internal/network/VungleApi;)V", "isGooglePlayServicesAvailable", BuildConfig.FLAVOR, "Ljava/lang/Boolean;", "responseInterceptor", "Lokhttp3/Interceptor;", "getResponseInterceptor$vungle_ads_release$annotations", "getResponseInterceptor$vungle_ads_release", "()Lokhttp3/Interceptor;", "setResponseInterceptor$vungle_ads_release", "(Lokhttp3/Interceptor;)V", "retryAfterDataMap", BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, "getRetryAfterDataMap$vungle_ads_release$annotations", "getRetryAfterDataMap$vungle_ads_release", "()Ljava/util/Map;", "setRetryAfterDataMap$vungle_ads_release", "(Ljava/util/Map;)V", "signalManager", "Lcom/vungle/ads/internal/signals/SignalManager;", "getSignalManager", "()Lcom/vungle/ads/internal/signals/SignalManager;", "signalManager$delegate", "Lkotlin/Lazy;", "uaString", "addPlaySvcAvailabilityInCookie", BuildConfig.FLAVOR, Cookie.IS_PLAY_SERVICE_AVAILABLE, "bodyToString", "request", "Lokhttp3/RequestBody;", "checkIsRetryAfterActive", "placementID", "config", "Lcom/vungle/ads/internal/network/Call;", "Lcom/vungle/ads/internal/model/ConfigPayload;", "defaultErrorResponse", "Lokhttp3/Response;", "Lokhttp3/Request;", "getBasicDeviceBody", "context", "getConnectionType", "getConnectionTypeDetail", "getConnectionTypeDetail$vungle_ads_release", "type", BuildConfig.FLAVOR, "getDeviceBody", "explicitBlock", "getDeviceBody$vungle_ads_release", "getExtBody", "Lcom/vungle/ads/internal/model/CommonRequestBody$RequestExt;", "withSignals", "getPlacementID", "body", "getPlayServicesAvailabilityFromAPI", "()Ljava/lang/Boolean;", "getPlayServicesAvailabilityFromCookie", "getRetryAfterHeaderValue", "getUserBody", "Lcom/vungle/ads/internal/model/CommonRequestBody$User;", "withFirstPartyData", "initUserAgentLazy", "initialize", "appId", "pingTPAT", "Lcom/vungle/ads/internal/model/ErrorInfo;", "url", "headers", BuildConfig.FLAVOR, "requestBody", "requestType", "Lcom/vungle/ads/internal/network/HttpMethod;", "logEntry", "Lcom/vungle/ads/internal/util/LogEntry;", "reportErrors", "errors", "Ljava/util/concurrent/BlockingQueue;", "Lcom/vungle/ads/internal/protos/Sdk$SDKError$Builder;", "requestListener", "Lcom/vungle/ads/AnalyticsClient$RequestListener;", "reportMetrics", "metrics", "Lcom/vungle/ads/internal/protos/Sdk$SDKMetric$Builder;", "requestAd", "Lcom/vungle/ads/internal/model/AdPayload;", "placement", "adSize", "Lcom/vungle/ads/VungleAdSize;", "Lcom/vungle/ads/internal/model/CommonRequestBody;", "ri", "Ljava/lang/Void;", "Lcom/vungle/ads/internal/model/CommonRequestBody$RequestParam;", "sendAdMarkup", "adMarkup", "endpoint", "Companion", "ConnectionTypeDetail", "GzipRequestInterceptor", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
public final class VungleApiClient {
private static final String TAG = "VungleApiClient";
private AdvertisingInfo advertisingInfo;
private VungleApi api;
private AppNode appBody;
private final Context applicationContext;
private DeviceNode baseDeviceInfo;
private final FilePreferences filePreferences;
private VungleApi gzipApi;
private Boolean isGooglePlayServicesAvailable;
private final Platform platform;
private Interceptor responseInterceptor;
private Map<String, Long> retryAfterDataMap;
private final Lazy signalManager;
private String uaString;
public static final Companion INSTANCE = new Companion(null);
private static final String BASE_URL = "https://config.ads.vungle.com/";
private static final Set<Interceptor> networkInterceptors = new HashSet();
private static final Set<Interceptor> logInterceptors = new HashSet();
private static final Json json = JsonKt.Json$default((Json) null, new Function1<JsonBuilder, Unit>() {
public Object invoke(Object obj) {
invoke((JsonBuilder) obj);
return Unit.INSTANCE;
}
public final void invoke(JsonBuilder Json) {
Intrinsics.checkNotNullParameter(Json, "$this$Json");
Json.setIgnoreUnknownKeys(true);
Json.setEncodeDefaults(true);
Json.setExplicitNulls(false);
}
}, 1, (Object) null);
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\"\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\r\u0010\u000e\u001a\u00020\u000fH\u0000¢\u0006\u0002\b\u0010R\u0014\u0010\u0003\u001a\u00020\u0004X\u0080D¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006R\u000e\u0010\u0007\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\b\u0012\u0004\u0012\u00020\f0\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\b\u0012\u0004\u0012\u00020\f0\u000bX\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0011"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient$Companion;", BuildConfig.FLAVOR, "()V", "BASE_URL", BuildConfig.FLAVOR, "getBASE_URL$vungle_ads_release", "()Ljava/lang/String;", "TAG", "json", "Lkotlinx/serialization/json/Json;", "logInterceptors", BuildConfig.FLAVOR, "Lokhttp3/Interceptor;", "networkInterceptors", "reset", BuildConfig.FLAVOR, "reset$vungle_ads_release", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
public static final class Companion {
private Companion() {
}
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final String getBASE_URL$vungle_ads_release() {
return VungleApiClient.BASE_URL;
}
public final void reset$vungle_ads_release() {
VungleHeader.INSTANCE.reset();
}
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0002\b\u0002\b\u0087\u0002\u0018\u0000 \u00022\u00020\u0001:\u0001\u0002B\u0000¨\u0006\u0003"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient$ConnectionTypeDetail;", BuildConfig.FLAVOR, "Companion", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
@Retention(RetentionPolicy.SOURCE)
@kotlin.annotation.Retention(AnnotationRetention.SOURCE)
public @interface ConnectionTypeDetail {
public static final String CDMA_1XRTT = "cdma_1xrtt";
public static final String CDMA_EVDO_0 = "cdma_evdo_0";
public static final String CDMA_EVDO_A = "cdma_evdo_a";
public static final String CDMA_EVDO_B = "cdma_evdo_b";
public static final Companion INSTANCE = Companion.$$INSTANCE;
public static final String EDGE = "edge";
public static final String FIFTH_G = "5g";
public static final String GPRS = "gprs";
public static final String HRPD = "hrpd";
public static final String HSDPA = "hsdpa";
public static final String HSUPA = "hsupa";
public static final String LTE = "lte";
public static final String UNKNOWN = "unknown";
public static final String WCDMA = "wcdma";
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\r\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u000f\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0004X\u0086T¢\u0006\u0002\n\u0000¨\u0006\u0011"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient$ConnectionTypeDetail$Companion;", BuildConfig.FLAVOR, "()V", "CDMA_1XRTT", BuildConfig.FLAVOR, "CDMA_EVDO_0", "CDMA_EVDO_A", "CDMA_EVDO_B", "EDGE", "FIFTH_G", "GPRS", "HRPD", "HSDPA", "HSUPA", "LTE", "UNKNOWN", "WCDMA", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
public static final class Companion {
static final Companion $$INSTANCE = new Companion();
public static final String CDMA_1XRTT = "cdma_1xrtt";
public static final String CDMA_EVDO_0 = "cdma_evdo_0";
public static final String CDMA_EVDO_A = "cdma_evdo_a";
public static final String CDMA_EVDO_B = "cdma_evdo_b";
public static final String EDGE = "edge";
public static final String FIFTH_G = "5g";
public static final String GPRS = "gprs";
public static final String HRPD = "hrpd";
public static final String HSDPA = "hsdpa";
public static final String HSUPA = "hsupa";
public static final String LTE = "lte";
public static final String UNKNOWN = "unknown";
public static final String WCDMA = "wcdma";
private Companion() {
}
}
}
@Metadata(d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0000\u0018\u0000 \n2\u00020\u0001:\u0001\nB\u0005¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J\u0010\u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\tH\u0016¨\u0006\u000b"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient$GzipRequestInterceptor;", "Lokhttp3/Interceptor;", "()V", GzipRequestInterceptor.GZIP, "Lokhttp3/RequestBody;", "requestBody", "intercept", "Lokhttp3/Response;", "chain", "Lokhttp3/Interceptor$Chain;", "Companion", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
public static final class GzipRequestInterceptor implements Interceptor {
private static final String CONTENT_ENCODING = "Content-Encoding";
public static final Companion INSTANCE = new Companion(null);
private static final String GZIP = "gzip";
@Metadata(d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0006"}, d2 = {"Lcom/vungle/ads/internal/network/VungleApiClient$GzipRequestInterceptor$Companion;", BuildConfig.FLAVOR, "()V", "CONTENT_ENCODING", BuildConfig.FLAVOR, "GZIP", "vungle-ads_release"}, k = 1, mv = {1, 7, 1}, xi = Sdk.SDKMetric.SDKMetricType.AD_SHOW_TO_VALIDATION_DURATION_MS_VALUE)
public static final class Companion {
private Companion() {
}
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
private final RequestBody gzip(final RequestBody requestBody) throws IOException {
final Buffer buffer = new Buffer();
BufferedSink buffer2 = Okio.buffer(new GzipSink(buffer));
requestBody.writeTo(buffer2);
buffer2.close();
return new RequestBody() {
public long contentLength() {
return buffer.size();
}
public MediaType contentType() {
return requestBody.contentType();
}
public void writeTo(BufferedSink sink) throws IOException {
Intrinsics.checkNotNullParameter(sink, "sink");
sink.write(buffer.snapshot());
}
};
}
public okhttp3.Response intercept(Interceptor.Chain chain) throws IOException {
Intrinsics.checkNotNullParameter(chain, "chain");
Request request = chain.request();
RequestBody body = request.body();
return (body == null || request.header(CONTENT_ENCODING) != null) ? chain.proceed(request) : chain.proceed(request.newBuilder().header(CONTENT_ENCODING, GZIP).method(request.method(), gzip(body)).build());
}
}
public VungleApiClient(final Context applicationContext, Platform platform, FilePreferences filePreferences) {
Intrinsics.checkNotNullParameter(applicationContext, "applicationContext");
Intrinsics.checkNotNullParameter(platform, "platform");
Intrinsics.checkNotNullParameter(filePreferences, "filePreferences");
this.applicationContext = applicationContext;
this.platform = platform;
this.filePreferences = filePreferences;
this.uaString = System.getProperty("http.agent");
ServiceLocator.Companion companion = ServiceLocator.INSTANCE;
this.signalManager = LazyKt.lazy(LazyThreadSafetyMode.SYNCHRONIZED, new Function0<SignalManager>() {
{
super(0);
}
public final SignalManager invoke() {
return ServiceLocator.INSTANCE.getInstance(applicationContext).getService(SignalManager.class);
}
});
this.retryAfterDataMap = new ConcurrentHashMap();
this.responseInterceptor = new Interceptor() {
public final okhttp3.Response intercept(Interceptor.Chain chain) {
okhttp3.Response m371responseInterceptor$lambda0;
m371responseInterceptor$lambda0 = VungleApiClient.m371responseInterceptor$lambda0(VungleApiClient.this, chain);
return m371responseInterceptor$lambda0;
}
};
OkHttpClient.Builder builder = new OkHttpClient.Builder();
TimeUnit timeUnit = TimeUnit.SECONDS;
OkHttpClient.Builder proxySelector = builder.readTimeout(60L, timeUnit).connectTimeout(60L, timeUnit).addInterceptor(this.responseInterceptor).proxySelector(new ProxySelector() {
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
try {
ProxySelector.getDefault().connectFailed(uri, sa, ioe);
} catch (Exception unused) {
}
}
@Override
public List<Proxy> select(URI uri) {
try {
List<Proxy> select = ProxySelector.getDefault().select(uri);
Intrinsics.checkNotNullExpressionValue(select, "{\n …ri)\n }");
return select;
} catch (Exception unused) {
return CollectionsKt__CollectionsJVMKt.listOf(Proxy.NO_PROXY);
}
}
});
OkHttpClient build = proxySelector.build();
OkHttpClient build2 = proxySelector.addInterceptor(new GzipRequestInterceptor()).build();
this.api = new VungleApiImpl(build);
this.gzipApi = new VungleApiImpl(build2);
}
private final String bodyToString(RequestBody request) {
try {
Buffer buffer = new Buffer();
if (request == null) {
return BuildConfig.FLAVOR;
}
request.writeTo(buffer);
return buffer.readUtf8();
} catch (Exception unused) {
return BuildConfig.FLAVOR;
}
}
private final okhttp3.Response defaultErrorResponse(Request request) {
return new Response.Builder().request(request).code(500).protocol(Protocol.HTTP_1_1).message("Server is busy").body(ResponseBody.Companion.create("{\"Error\":\"Server is busy\"}", MediaType.Companion.parse("application/json; charset=utf-8"))).build();
}
@VisibleForTesting
public static void getAppBody$vungle_ads_release$annotations() {
}
private final DeviceNode getBasicDeviceBody(Context context) {
DisplayMetrics displayMetrics = new DisplayMetrics();
Object systemService = context.getSystemService("window");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.view.WindowManager");
Display defaultDisplay = ((WindowManager) systemService).getDefaultDisplay();
if (defaultDisplay != null) {
defaultDisplay.getMetrics(displayMetrics);
}
String MANUFACTURER = Build.MANUFACTURER;
Intrinsics.checkNotNullExpressionValue(MANUFACTURER, "MANUFACTURER");
String MODEL = Build.MODEL;
Intrinsics.checkNotNullExpressionValue(MODEL, "MODEL");
String RELEASE = Build.VERSION.RELEASE;
Intrinsics.checkNotNullExpressionValue(RELEASE, "RELEASE");
DeviceNode deviceNode = new DeviceNode(MANUFACTURER, MODEL, RELEASE, AndroidPlatform.INSTANCE.getCarrierName$vungle_ads_release(context), Intrinsics.areEqual("Amazon", MANUFACTURER) ? "amazon" : MetricCommonTags.METRIC_COMMON_TAG_PLATFORM_ANDROID, displayMetrics.widthPixels, displayMetrics.heightPixels, this.uaString, (String) null, (Integer) null, (DeviceNode.VungleExt) null, 1792, (DefaultConstructorMarker) null);
try {
String userAgent = this.platform.getUserAgent();
this.uaString = userAgent;
deviceNode.setUa(userAgent);
initUserAgentLazy();
AdvertisingInfo advertisingInfo = this.advertisingInfo;
if (advertisingInfo == null) {
advertisingInfo = this.platform.getAdvertisingInfo();
}
this.advertisingInfo = advertisingInfo;
} catch (Exception e) {
Logger.INSTANCE.e(TAG, "Cannot Get UserAgent. Setting Default Device UserAgent." + e.getLocalizedMessage());
}
return deviceNode;
}
private final String getConnectionType() {
if (PermissionChecker.checkCallingOrSelfPermission(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") != 0) {
return null;
}
Object systemService = this.applicationContext.getSystemService("connectivity");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
if (activeNetworkInfo == null) {
return "NONE";
}
int type = activeNetworkInfo.getType();
return type != 0 ? (type == 1 || type == 6) ? "WIFI" : type != 7 ? type != 9 ? "UNKNOWN" : "ETHERNET" : "BLUETOOTH" : "MOBILE";
}
private final DeviceNode getDeviceBody() throws IllegalStateException {
return getDeviceBody$vungle_ads_release(false);
}
private final com.vungle.ads.internal.model.CommonRequestBody.RequestExt getExtBody(boolean r8) {
throw new UnsupportedOperationException("Method not decompiled: com.vungle.ads.internal.network.VungleApiClient.getExtBody(boolean):com.vungle.ads.internal.model.CommonRequestBody$RequestExt");
}
public static CommonRequestBody.RequestExt getExtBody$default(VungleApiClient vungleApiClient, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return vungleApiClient.getExtBody(z);
}
@VisibleForTesting
public static void getGzipApi$vungle_ads_release$annotations() {
}
private final String getPlacementID(RequestBody body) {
List<String> placements;
try {
Json json2 = json;
String bodyToString = bodyToString(body);
KSerializer serializer = SerializersKt.serializer(json2.getSerializersModule(), Reflection.typeOf(CommonRequestBody.class));
Intrinsics.checkNotNull(serializer, "null cannot be cast to non-null type kotlinx.serialization.KSerializer<T of kotlinx.serialization.internal.Platform_commonKt.cast>");
CommonRequestBody.RequestParam request = ((CommonRequestBody) json2.decodeFromString(serializer, bodyToString)).getRequest();
if (request == null || (placements = request.getPlacements()) == null) {
return BuildConfig.FLAVOR;
}
String str = placements.get(0);
return str == null ? BuildConfig.FLAVOR : str;
} catch (Exception unused) {
return BuildConfig.FLAVOR;
}
}
@VisibleForTesting
public static void getResponseInterceptor$vungle_ads_release$annotations() {
}
@VisibleForTesting
public static void getRetryAfterDataMap$vungle_ads_release$annotations() {
}
private final SignalManager getSignalManager() {
return (SignalManager) this.signalManager.getValue();
}
private final CommonRequestBody.User getUserBody(boolean withFirstPartyData) {
CommonRequestBody.User user = new CommonRequestBody.User((CommonRequestBody.GDPR) null, (CommonRequestBody.CCPA) null, (CommonRequestBody.COPPA) null, (FirstPartyData) null, (CommonRequestBody.IAB) null, 31, (DefaultConstructorMarker) null);
PrivacyManager privacyManager = PrivacyManager.INSTANCE;
user.setGdpr(new CommonRequestBody.GDPR(privacyManager.getConsentStatus(), privacyManager.getConsentSource(), privacyManager.getConsentTimestamp(), privacyManager.getConsentMessageVersion()));
user.setCcpa(new CommonRequestBody.CCPA(privacyManager.getCcpaStatus()));
if (privacyManager.getCoppaStatus() != COPPA.COPPA_NOTSET) {
user.setCoppa(new CommonRequestBody.COPPA(privacyManager.getCoppaStatus().getValue()));
}
if (privacyManager.shouldSendTCFString()) {
user.setIab(new CommonRequestBody.IAB(privacyManager.getIABTCFString()));
}
if (withFirstPartyData) {
user.setFpd(VungleAds.firstPartyData);
}
return user;
}
public static CommonRequestBody.User getUserBody$default(VungleApiClient vungleApiClient, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return vungleApiClient.getUserBody(z);
}
private final void initUserAgentLazy() {
final TimeIntervalMetric timeIntervalMetric = new TimeIntervalMetric(Sdk.SDKMetric.SDKMetricType.USER_AGENT_LOAD_DURATION_MS);
timeIntervalMetric.markStart();
this.platform.getUserAgentLazy(new Consumer<String>() {
public void accept(String uaString) {
if (uaString == null) {
Logger.INSTANCE.e("VungleApiClient", "Cannot Get UserAgent. Setting Default Device UserAgent");
new UserAgentError().logErrorNoReturnValue$vungle_ads_release();
} else {
TimeIntervalMetric.this.markEnd();
AnalyticsClient.logMetric$vungle_ads_release$default(AnalyticsClient.INSTANCE, TimeIntervalMetric.this, (LogEntry) null, (String) null, 6, (Object) null);
this.uaString = uaString;
}
}
});
}
public static ErrorInfo pingTPAT$default(VungleApiClient vungleApiClient, String str, Map map, String str2, HttpMethod httpMethod, LogEntry logEntry, int i, Object obj) {
Map map2 = (i & 2) != 0 ? null : map;
String str3 = (i & 4) != 0 ? null : str2;
if ((i & 8) != 0) {
httpMethod = HttpMethod.GET;
}
return vungleApiClient.pingTPAT(str, map2, str3, httpMethod, (i & 16) != 0 ? null : logEntry);
}
public static CommonRequestBody requestBody$default(VungleApiClient vungleApiClient, boolean z, boolean z2, int i, Object obj) throws IllegalStateException {
if ((i & 1) != 0) {
z = false;
}
if ((i & 2) != 0) {
z2 = false;
}
return vungleApiClient.requestBody(z, z2);
}
public static final okhttp3.Response m371responseInterceptor$lambda0(VungleApiClient this$0, Interceptor.Chain chain) {
Intrinsics.checkNotNullParameter(this$0, "this$0");
Intrinsics.checkNotNullParameter(chain, "chain");
Request request = chain.request();
try {
try {
okhttp3.Response proceed = chain.proceed(request);
String str = proceed.headers().get("Retry-After");
boolean z = true;
if (str == null || str.length() == 0) {
return proceed;
}
try {
long parseLong = Long.parseLong(str);
if (parseLong <= 0) {
return proceed;
}
String encodedPath = request.url().encodedPath();
long currentTimeMillis = (parseLong * 1000) + System.currentTimeMillis();
if (!StringsKt__StringsJVMKt.endsWith$default(encodedPath, "ads", false, 2, null)) {
return proceed;
}
String placementID = this$0.getPlacementID(request.body());
if (placementID.length() <= 0) {
z = false;
}
if (!z) {
return proceed;
}
this$0.retryAfterDataMap.put(placementID, Long.valueOf(currentTimeMillis));
return proceed;
} catch (Exception unused) {
Logger.INSTANCE.d(TAG, "Retry-After value is not an valid value");
return proceed;
}
} catch (OutOfMemoryError unused2) {
Logger.INSTANCE.e(TAG, "OOM for " + request.url());
return this$0.defaultErrorResponse(request);
}
} catch (Exception e) {
Logger.INSTANCE.e(TAG, "Exception: " + e.getMessage() + " for " + request.url());
return this$0.defaultErrorResponse(request);
}
}
@VisibleForTesting
public final void addPlaySvcAvailabilityInCookie(boolean isPlaySvcAvailable) {
this.filePreferences.put(Cookie.IS_PLAY_SERVICE_AVAILABLE, isPlaySvcAvailable).apply();
}
public final boolean checkIsRetryAfterActive(String placementID) {
Intrinsics.checkNotNullParameter(placementID, "placementID");
Long l = this.retryAfterDataMap.get(placementID);
if ((l != null ? l.longValue() : 0L) > System.currentTimeMillis()) {
return true;
}
this.retryAfterDataMap.remove(placementID);
return false;
}
public final Call<ConfigPayload> config() throws IOException {
AppNode appNode = this.appBody;
if (appNode == null) {
return null;
}
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody$vungle_ads_release(true), appNode, getUserBody$default(this, false, 1, null), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
CommonRequestBody.RequestExt extBody$default = getExtBody$default(this, false, 1, null);
if (extBody$default != null) {
commonRequestBody.setExt(extBody$default);
}
FileUtility fileUtility = FileUtility.INSTANCE;
String str = BASE_URL;
if (!fileUtility.isValidUrl(str)) {
str = "https://config.ads.vungle.com/";
}
if (!StringsKt__StringsJVMKt.endsWith$default(str, "/", false, 2, null)) {
str = str + '/';
}
return this.api.config(VungleHeader.INSTANCE.getHeaderUa(), str + "config", commonRequestBody);
}
public final AppNode getAppBody() {
return this.appBody;
}
public final String getConnectionTypeDetail(int type) {
if (type == 1) {
return "gprs";
}
if (type == 2) {
return "edge";
}
if (type == 20) {
return "5g";
}
switch (type) {
case 4:
return "wcdma";
case 5:
return "cdma_evdo_0";
case 6:
return "cdma_evdo_a";
case 7:
return "cdma_1xrtt";
case 8:
return "hsdpa";
case 9:
return "hsupa";
default:
switch (type) {
case 12:
return "cdma_evdo_b";
case 13:
return "lte";
case 14:
return "hrpd";
default:
return "unknown";
}
}
}
public final String getConnectionTypeDetail$vungle_ads_release() {
if (PermissionChecker.checkCallingOrSelfPermission(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") != 0) {
return null;
}
Object systemService = this.applicationContext.getSystemService("connectivity");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
return activeNetworkInfo != null ? getConnectionTypeDetail(activeNetworkInfo.getSubtype()) : "unknown";
}
@androidx.annotation.VisibleForTesting
public final synchronized com.vungle.ads.internal.model.DeviceNode getDeviceBody$vungle_ads_release(boolean r25) throws java.lang.IllegalStateException {
throw new UnsupportedOperationException("Method not decompiled: com.vungle.ads.internal.network.VungleApiClient.getDeviceBody$vungle_ads_release(boolean):com.vungle.ads.internal.model.DeviceNode");
}
public final VungleApi getGzipApi() {
return this.gzipApi;
}
@VisibleForTesting
public final Boolean getPlayServicesAvailabilityFromAPI() {
Boolean bool = null;
try {
GoogleApiAvailabilityLight googleApiAvailabilityLight = GoogleApiAvailabilityLight.getInstance();
Intrinsics.checkNotNullExpressionValue(googleApiAvailabilityLight, "getInstance()");
bool = Boolean.valueOf(googleApiAvailabilityLight.isGooglePlayServicesAvailable(this.applicationContext) == 0);
addPlaySvcAvailabilityInCookie(bool.booleanValue());
return bool;
} catch (Exception unused) {
Logger.INSTANCE.w(TAG, "Unexpected exception from Play services lib.");
return bool;
} catch (NoClassDefFoundError unused2) {
Logger.INSTANCE.w(TAG, "Play services Not available");
Boolean bool2 = Boolean.FALSE;
try {
addPlaySvcAvailabilityInCookie(false);
return bool2;
} catch (Exception unused3) {
Logger.INSTANCE.w(TAG, "Failure to write GPS availability to DB");
return bool2;
}
}
}
@VisibleForTesting
public final Boolean getPlayServicesAvailabilityFromCookie() {
return this.filePreferences.getBoolean(Cookie.IS_PLAY_SERVICE_AVAILABLE);
}
public final Interceptor getResponseInterceptor() {
return this.responseInterceptor;
}
public final Map<String, Long> getRetryAfterDataMap$vungle_ads_release() {
return this.retryAfterDataMap;
}
public final long getRetryAfterHeaderValue(String placementID) {
Intrinsics.checkNotNullParameter(placementID, "placementID");
Long l = this.retryAfterDataMap.get(placementID);
if (l != null) {
return l.longValue();
}
return 0L;
}
public final synchronized void initialize(String appId) {
PackageInfo packageInfo;
Intrinsics.checkNotNullParameter(appId, "appId");
this.api.setAppId(appId);
this.gzipApi.setAppId(appId);
String str = "1.0";
try {
if (Build.VERSION.SDK_INT >= 33) {
packageInfo = this.applicationContext.getPackageManager().getPackageInfo(this.applicationContext.getPackageName(), PackageManager.PackageInfoFlags.of(0L));
Intrinsics.checkNotNullExpressionValue(packageInfo, "{\n ap… )\n }");
} else {
packageInfo = this.applicationContext.getPackageManager().getPackageInfo(this.applicationContext.getPackageName(), 0);
Intrinsics.checkNotNullExpressionValue(packageInfo, "{\n ap… )\n }");
}
String str2 = packageInfo.versionName;
Intrinsics.checkNotNullExpressionValue(str2, "packageInfo.versionName");
str = str2;
} catch (Exception unused) {
}
this.baseDeviceInfo = getBasicDeviceBody(this.applicationContext);
String packageName = this.applicationContext.getPackageName();
Intrinsics.checkNotNullExpressionValue(packageName, "applicationContext.packageName");
this.appBody = new AppNode(packageName, str, appId);
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromAPI();
}
@VisibleForTesting
public final Boolean isGooglePlayServicesAvailable() {
if (this.isGooglePlayServicesAvailable == null) {
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromCookie();
}
if (this.isGooglePlayServicesAvailable == null) {
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromAPI();
}
return this.isGooglePlayServicesAvailable;
}
public final com.vungle.ads.internal.model.ErrorInfo pingTPAT(java.lang.String r10, java.util.Map<java.lang.String, java.lang.String> r11, java.lang.String r12, com.vungle.ads.internal.network.HttpMethod r13, com.vungle.ads.internal.util.LogEntry r14) {
throw new UnsupportedOperationException("Method not decompiled: com.vungle.ads.internal.network.VungleApiClient.pingTPAT(java.lang.String, java.util.Map, java.lang.String, com.vungle.ads.internal.network.HttpMethod, com.vungle.ads.internal.util.LogEntry):com.vungle.ads.internal.model.ErrorInfo");
}
public final void reportErrors(BlockingQueue<Sdk.SDKError.Builder> errors, final AnalyticsClient.RequestListener requestListener) {
Intrinsics.checkNotNullParameter(errors, "errors");
Intrinsics.checkNotNullParameter(requestListener, "requestListener");
String errorLoggingEndpoint = ConfigManager.INSTANCE.getErrorLoggingEndpoint();
if (errorLoggingEndpoint.length() == 0) {
requestListener.onFailure();
return;
}
LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
for (Sdk.SDKError.Builder builder : errors) {
builder.setSessionId(getSignalManager().getUuid());
Placement placement = ConfigManager.INSTANCE.getPlacement(builder.getPlacementReferenceId());
if (placement != null) {
builder.setIsHbPlacement(placement.getHeaderBidding() ? 1L : 0L);
String type = placement.getType();
if (type == null) {
type = BuildConfig.FLAVOR;
}
builder.setPlacementType(type);
}
String connectionType = getConnectionType();
if (connectionType != null) {
builder.setConnectionType(connectionType);
}
String connectionTypeDetail$vungle_ads_release = getConnectionTypeDetail$vungle_ads_release();
if (connectionTypeDetail$vungle_ads_release != null) {
builder.setConnectionTypeDetail(connectionTypeDetail$vungle_ads_release);
}
Sdk.SDKError sDKError = (Sdk.SDKError) builder.build();
Logger.INSTANCE.e(TAG, "Sending Error: " + sDKError.getReason());
linkedBlockingQueue.add(sDKError);
}
Sdk.SDKErrorBatch sDKErrorBatch = (Sdk.SDKErrorBatch) Sdk.SDKErrorBatch.newBuilder().addAllErrors(linkedBlockingQueue).build();
RequestBody.Companion companion = RequestBody.Companion;
byte[] byteArray = sDKErrorBatch.toByteArray();
Intrinsics.checkNotNullExpressionValue(byteArray, "batch.toByteArray()");
this.api.sendErrors(VungleHeader.INSTANCE.getHeaderUa(), errorLoggingEndpoint, companion.create(byteArray, MediaType.Companion.parse("application/x-protobuf"), 0, sDKErrorBatch.toByteArray().length)).enqueue(new Callback<Void>() {
@Override
public void onFailure(Call<Void> call, Throwable t) {
AnalyticsClient.RequestListener.this.onFailure();
}
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
AnalyticsClient.RequestListener.this.onSuccess();
}
});
}
public final void reportMetrics(BlockingQueue<Sdk.SDKMetric.Builder> metrics, final AnalyticsClient.RequestListener requestListener) {
Intrinsics.checkNotNullParameter(metrics, "metrics");
Intrinsics.checkNotNullParameter(requestListener, "requestListener");
String metricsEndpoint = ConfigManager.INSTANCE.getMetricsEndpoint();
if (metricsEndpoint.length() == 0) {
requestListener.onFailure();
return;
}
LinkedBlockingQueue linkedBlockingQueue = new LinkedBlockingQueue();
for (Sdk.SDKMetric.Builder builder : metrics) {
builder.setSessionId(getSignalManager().getUuid());
Placement placement = ConfigManager.INSTANCE.getPlacement(builder.getPlacementReferenceId());
if (placement != null) {
builder.setIsHbPlacement(placement.getHeaderBidding() ? 1L : 0L);
String type = placement.getType();
if (type == null) {
type = BuildConfig.FLAVOR;
}
builder.setPlacementType(type);
}
String connectionType = getConnectionType();
if (connectionType != null) {
builder.setConnectionType(connectionType);
}
String connectionTypeDetail$vungle_ads_release = getConnectionTypeDetail$vungle_ads_release();
if (connectionTypeDetail$vungle_ads_release != null) {
builder.setConnectionTypeDetail(connectionTypeDetail$vungle_ads_release);
}
Sdk.SDKMetric sDKMetric = (Sdk.SDKMetric) builder.build();
Logger.INSTANCE.e(TAG, "Sending Metric: " + sDKMetric.getType());
linkedBlockingQueue.add(sDKMetric);
}
Sdk.MetricBatch metricBatch = (Sdk.MetricBatch) Sdk.MetricBatch.newBuilder().addAllMetrics(linkedBlockingQueue).build();
RequestBody.Companion companion = RequestBody.Companion;
MediaType parse = MediaType.Companion.parse("application/x-protobuf");
byte[] byteArray = metricBatch.toByteArray();
Intrinsics.checkNotNullExpressionValue(byteArray, "batch.toByteArray()");
this.api.sendMetrics(VungleHeader.INSTANCE.getHeaderUa(), metricsEndpoint, RequestBody.Companion.create$default(companion, parse, byteArray, 0, 0, 12, (Object) null)).enqueue(new Callback<Void>() {
@Override
public void onFailure(Call<Void> call, Throwable t) {
AnalyticsClient.RequestListener.this.onFailure();
}
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
AnalyticsClient.RequestListener.this.onSuccess();
}
});
}
public final Call<AdPayload> requestAd(String placement, VungleAdSize adSize) throws IllegalStateException {
Intrinsics.checkNotNullParameter(placement, "placement");
ConfigManager configManager = ConfigManager.INSTANCE;
String adsEndpoint = configManager.getAdsEndpoint();
CommonRequestBody requestBody = requestBody(!configManager.signalsDisabled(), configManager.fpdEnabled());
CommonRequestBody.RequestParam requestParam = new CommonRequestBody.RequestParam(CollectionsKt__CollectionsJVMKt.listOf(placement), (CommonRequestBody.AdSizeParam) null, (Long) null, (String) null, (String) null, (String) null, 62, (DefaultConstructorMarker) null);
if (adSize != null) {
requestParam.setAdSize(new CommonRequestBody.AdSizeParam(adSize.getWidth(), adSize.getHeight()));
}
requestBody.setRequest(requestParam);
return this.gzipApi.ads(VungleHeader.INSTANCE.getHeaderUa(), adsEndpoint, requestBody);
}
public final CommonRequestBody requestBody(boolean withSignals, boolean withFirstPartyData) throws IllegalStateException {
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody(), this.appBody, getUserBody(withFirstPartyData), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
CommonRequestBody.RequestExt extBody = getExtBody(withSignals);
if (extBody != null) {
commonRequestBody.setExt(extBody);
}
return commonRequestBody;
}
public final Call<Void> ri(CommonRequestBody.RequestParam request) {
AppNode appNode;
Intrinsics.checkNotNullParameter(request, "request");
String riEndpoint = ConfigManager.INSTANCE.getRiEndpoint();
if ((riEndpoint == null || riEndpoint.length() == 0) || (appNode = this.appBody) == null) {
return null;
}
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody(), appNode, getUserBody$default(this, false, 1, null), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
commonRequestBody.setRequest(request);
CommonRequestBody.RequestExt extBody$default = getExtBody$default(this, false, 1, null);
if (extBody$default != null) {
commonRequestBody.setExt(extBody$default);
}
return this.api.ri(VungleHeader.INSTANCE.getHeaderUa(), riEndpoint, commonRequestBody);
}
public final void sendAdMarkup(String adMarkup, String endpoint) {
Intrinsics.checkNotNullParameter(adMarkup, "adMarkup");
Intrinsics.checkNotNullParameter(endpoint, "endpoint");
this.api.sendAdMarkup(endpoint, RequestBody.Companion.create(adMarkup, MediaType.Companion.parse("application/json"))).enqueue(new Callback<Void>() {
@Override
public void onFailure(Call<Void> call, Throwable t) {
}
@Override
public void onResponse(Call<Void> call, Response<Void> response) {
}
});
}
public final void setAppBody$vungle_ads_release(AppNode appNode) {
this.appBody = appNode;
}
public final void setGzipApi$vungle_ads_release(VungleApi vungleApi) {
Intrinsics.checkNotNullParameter(vungleApi, "<set-?>");
this.gzipApi = vungleApi;
}
public final void setResponseInterceptor$vungle_ads_release(Interceptor interceptor) {
Intrinsics.checkNotNullParameter(interceptor, "<set-?>");
this.responseInterceptor = interceptor;
}
public final void setRetryAfterDataMap$vungle_ads_release(Map<String, Long> map) {
Intrinsics.checkNotNullParameter(map, "<set-?>");
this.retryAfterDataMap = map;
}
}