Step Record v1.1.5版本的 MD5 值为:5797275f89198878d2f00ee92d534382
以下内容为反编译后的 t1H1KH1K.java 源代码,内容仅作参考
package com.vungle.ads.internal.network;
import android.app.UiModeManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.PowerManager;
import android.security.NetworkSecurityPolicy;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import android.webkit.URLUtil;
import androidx.annotation.VisibleForTesting;
import com.anythink.expressad.videocommon.e.b;
import com.applovin.sdk.AppLovinEventTypes;
import com.chartboost.heliumsdk.impl.H1KHK;
import com.chartboost.heliumsdk.impl.HKH;
import com.chartboost.heliumsdk.impl.HtKHKHKt;
import com.chartboost.heliumsdk.impl.K1H;
import com.chartboost.heliumsdk.impl.KH1SzKKS;
import com.chartboost.heliumsdk.impl.KStKzHS;
import com.chartboost.heliumsdk.impl.KzHt;
import com.chartboost.heliumsdk.impl.KzHtt;
import com.chartboost.heliumsdk.impl.KzzztHK;
import com.chartboost.heliumsdk.impl.S1t1HtH;
import com.chartboost.heliumsdk.impl.SHHHS1K;
import com.chartboost.heliumsdk.impl.SK1Ht1;
import com.chartboost.heliumsdk.impl.SKzKK1Kt;
import com.chartboost.heliumsdk.impl.Stztzt1;
import com.chartboost.heliumsdk.impl.Sz1zSK;
import com.chartboost.heliumsdk.impl.SzHS;
import com.chartboost.heliumsdk.impl.tHHKztKSH;
import com.chartboost.heliumsdk.impl.tKSt1tzKz;
import com.chartboost.heliumsdk.impl.tSKtStKH1;
import com.chartboost.heliumsdk.impl.ttHtzKt;
import com.chartboost.heliumsdk.impl.tz1t;
import com.chartboost.heliumsdk.impl.zHtK;
import com.chartboost.heliumsdk.impl.zt;
import com.chartboost.heliumsdk.impl.zzSSH;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.vungle.ads.SKHKzK;
import com.vungle.ads.VungleAds;
import com.vungle.ads.internal.load.SKHKzK;
import com.vungle.ads.internal.model.AdPayload;
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.DeviceNode;
import com.vungle.ads.internal.protos.Sdk$MetricBatch;
import com.vungle.ads.internal.protos.Sdk$SDKError;
import com.vungle.ads.internal.protos.Sdk$SDKErrorBatch;
import com.vungle.ads.internal.protos.Sdk$SDKMetric;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.SocketAddress;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
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.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
public final class t1H1KH1K {
private static final String BASE_URL;
public static final C0435t1H1KH1K Companion;
private static final String MANUFACTURER_AMAZON = "Amazon";
private static final String TAG = "VungleApiClient";
private static VungleAds.WrapperFramework WRAPPER_FRAMEWORK_SELECTED;
private static String headerUa;
private static final Json json;
private static final Set<Interceptor> logInterceptors;
private static final Set<Interceptor> networkInterceptors;
private VungleApi api;
private AppNode appBody;
private String appSetId;
private final Context applicationContext;
private DeviceNode baseDeviceInfo;
private final tHHKztKSH filePreferences;
private VungleApi gzipApi;
private Boolean isGooglePlayServicesAvailable;
private final com.vungle.ads.internal.platform.SKHKzK platform;
private Interceptor responseInterceptor;
private Map<String, Long> retryAfterDataMap;
private String uaString;
public static final class HtSH implements Interceptor {
private static final String CONTENT_ENCODING = "Content-Encoding";
public static final SKHKzK Companion = new SKHKzK(null);
private static final String GZIP = "gzip";
public static final class SKHKzK {
private SKHKzK() {
}
public SKHKzK(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
}
public static final class C0434t1H1KH1K extends RequestBody {
final tz1t $output;
final RequestBody $requestBody;
public C0434t1H1KH1K(RequestBody requestBody, tz1t tz1tVar) {
this.$requestBody = requestBody;
this.$output = tz1tVar;
}
@Override
public long contentLength() {
return this.$output.KtH1t1;
}
@Override
public MediaType getContentType() {
return this.$requestBody.getContentType();
}
@Override
public void writeTo(HKH hkh) throws IOException {
ttHtzKt.tzttS1SS1(hkh, "sink");
hkh.zSz(this.$output.HSK11S());
}
}
private final RequestBody gzip(RequestBody requestBody) throws IOException {
tz1t tz1tVar = new tz1t();
Sz1zSK zHH = KzHt.zHH(new SKzKK1Kt(tz1tVar));
requestBody.writeTo(zHH);
zHH.close();
return new C0434t1H1KH1K(requestBody, tz1tVar);
}
@Override
public Response intercept(Interceptor.Chain chain) throws IOException {
ttHtzKt.tzttS1SS1(chain, "chain");
Request request = chain.request();
RequestBody body = request.body();
if (body != null && request.header(CONTENT_ENCODING) == null) {
return chain.proceed(request.newBuilder().header(CONTENT_ENCODING, "gzip").method(request.method(), gzip(body)).build());
}
return chain.proceed(request);
}
}
public static final class SKHKzK extends tKSt1tzKz implements Function1<JsonBuilder, Unit> {
public static final SKHKzK INSTANCE = new SKHKzK();
public SKHKzK() {
super(1);
}
@Override
public Unit invoke(JsonBuilder jsonBuilder) {
invoke2(jsonBuilder);
return Unit.SKHKzK;
}
public final void invoke2(JsonBuilder jsonBuilder) {
ttHtzKt.tzttS1SS1(jsonBuilder, "$this$Json");
jsonBuilder.setIgnoreUnknownKeys(true);
jsonBuilder.setEncodeDefaults(true);
jsonBuilder.setExplicitNulls(false);
}
}
public static final class Sz1tH implements KStKzHS<Void> {
final SKHKzK.t1H1KH1K $requestListener;
public Sz1tH(SKHKzK.t1H1KH1K t1h1kh1k) {
this.$requestListener = t1h1kh1k;
}
@Override
public void onFailure(zzSSH<Void> zzssh, Throwable th) {
this.$requestListener.onFailure();
}
@Override
public void onResponse(zzSSH<Void> zzssh, KzzztHK<Void> kzzztHK) {
this.$requestListener.onSuccess();
}
}
public static final class C0435t1H1KH1K {
private C0435t1H1KH1K() {
}
public C0435t1H1KH1K(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final String defaultHeader() {
String str;
if (ttHtzKt.SKHKzK("Amazon", Build.MANUFACTURER)) {
str = "VungleAmazon/";
} else {
str = "VungleDroid/";
}
return str.concat("7.1.0");
}
public final String getBASE_URL$vungle_ads_release() {
return t1H1KH1K.BASE_URL;
}
public final String getHeaderUa() {
return t1H1KH1K.headerUa;
}
public final VungleAds.WrapperFramework getWRAPPER_FRAMEWORK_SELECTED$vungle_ads_release() {
return t1H1KH1K.WRAPPER_FRAMEWORK_SELECTED;
}
public final void reset$vungle_ads_release() {
setWRAPPER_FRAMEWORK_SELECTED$vungle_ads_release(null);
setHeaderUa(defaultHeader());
}
public final void setHeaderUa(String str) {
ttHtzKt.tzttS1SS1(str, "<set-?>");
t1H1KH1K.headerUa = str;
}
public final void setWRAPPER_FRAMEWORK_SELECTED$vungle_ads_release(VungleAds.WrapperFramework wrapperFramework) {
t1H1KH1K.WRAPPER_FRAMEWORK_SELECTED = wrapperFramework;
}
}
public static final class t1S1zKHK extends ProxySelector {
@Override
public void connectFailed(URI uri, SocketAddress socketAddress, IOException iOException) {
try {
ProxySelector.getDefault().connectFailed(uri, socketAddress, iOException);
} catch (Exception unused) {
}
}
@Override
public List<Proxy> select(URI uri) {
try {
List<Proxy> select = ProxySelector.getDefault().select(uri);
ttHtzKt.tz(select, "{\n …ri)\n }");
return select;
} catch (Exception unused) {
return SHHHS1K.tHH1Kt(Proxy.NO_PROXY);
}
}
}
public static final class tz implements HtKHKHKt<String> {
final KH1SzKKS $uaMetric;
final t1H1KH1K this$0;
public tz(KH1SzKKS kH1SzKKS, t1H1KH1K t1h1kh1k) {
this.$uaMetric = kH1SzKKS;
this.this$0 = t1h1kh1k;
}
@Override
public void accept(String str) {
if (str == null) {
Log.e(t1H1KH1K.TAG, "Cannot Get UserAgent. Setting Default Device UserAgent");
com.vungle.ads.SKHKzK.INSTANCE.logError$vungle_ads_release(7, "Fail to get user agent.", (r13 & 4) != 0 ? null : null, (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
} else {
this.$uaMetric.markEnd();
com.vungle.ads.SKHKzK.INSTANCE.logMetric$vungle_ads_release(this.$uaMetric.getMetricType(), (r15 & 2) != 0 ? 0L : this.$uaMetric.calculateIntervalDuration(), (r15 & 4) != 0 ? null : null, (r15 & 8) != 0 ? null : null, (r15 & 16) != 0 ? null : null, (r15 & 32) == 0 ? null : null);
this.this$0.uaString = str;
}
}
}
public static final class tzttS1SS1 implements KStKzHS<Void> {
final SKHKzK.t1H1KH1K $requestListener;
public tzttS1SS1(SKHKzK.t1H1KH1K t1h1kh1k) {
this.$requestListener = t1h1kh1k;
}
@Override
public void onFailure(zzSSH<Void> zzssh, Throwable th) {
this.$requestListener.onFailure();
}
@Override
public void onResponse(zzSSH<Void> zzssh, KzzztHK<Void> kzzztHK) {
this.$requestListener.onSuccess();
}
}
static {
C0435t1H1KH1K c0435t1H1KH1K = new C0435t1H1KH1K(null);
Companion = c0435t1H1KH1K;
BASE_URL = "https://config.ads.vungle.com/";
headerUa = c0435t1H1KH1K.defaultHeader();
networkInterceptors = new HashSet();
logInterceptors = new HashSet();
json = JsonKt.Json$default(null, SKHKzK.INSTANCE, 1, null);
}
public t1H1KH1K(Context context, com.vungle.ads.internal.platform.SKHKzK sKHKzK, tHHKztKSH thhkztksh) {
ttHtzKt.tzttS1SS1(context, "applicationContext");
ttHtzKt.tzttS1SS1(sKHKzK, "platform");
ttHtzKt.tzttS1SS1(thhkztksh, "filePreferences");
this.applicationContext = context;
this.platform = sKHKzK;
this.filePreferences = thhkztksh;
this.uaString = System.getProperty("http.agent");
this.appSetId = "";
this.retryAfterDataMap = new ConcurrentHashMap();
this.responseInterceptor = new Interceptor() {
@Override
public final Response intercept(Interceptor.Chain chain) {
Response m75responseInterceptor$lambda0;
m75responseInterceptor$lambda0 = com.vungle.ads.internal.network.t1H1KH1K.m75responseInterceptor$lambda0(com.vungle.ads.internal.network.t1H1KH1K.this, chain);
return m75responseInterceptor$lambda0;
}
};
OkHttpClient.Builder proxySelector = new OkHttpClient.Builder().addInterceptor(this.responseInterceptor).proxySelector(new t1S1zKHK());
OkHttpClient build = proxySelector.build();
OkHttpClient build2 = proxySelector.addInterceptor(new HtSH()).build();
this.api = new Stztzt1(build);
this.gzipApi = new Stztzt1(build2);
}
private final String bodyToString(RequestBody requestBody) {
try {
tz1t tz1tVar = new tz1t();
if (requestBody == null) {
return "";
}
requestBody.writeTo(tz1tVar);
return tz1tVar.readUtf8();
} catch (Exception unused) {
return "";
}
}
private final Response defaultErrorResponse(Request request) {
return new Response.Builder().request(request).code(500).protocol(Protocol.HTTP_1_1).message("Server is busy").body(ResponseBody.INSTANCE.create("{\"Error\":\"Server is busy\"}", MediaType.INSTANCE.parse("application/json; charset=utf-8"))).build();
}
@VisibleForTesting
public static void getAppBody$vungle_ads_release$annotations() {
}
private final DeviceNode getBasicDeviceBody(Context context) {
String str;
DisplayMetrics displayMetrics = new DisplayMetrics();
Object systemService = context.getSystemService("window");
ttHtzKt.t1S1zKHK(systemService, "null cannot be cast to non-null type android.view.WindowManager");
Display defaultDisplay = ((WindowManager) systemService).getDefaultDisplay();
if (defaultDisplay != null) {
defaultDisplay.getMetrics(displayMetrics);
}
String str2 = Build.MANUFACTURER;
ttHtzKt.tz(str2, "MANUFACTURER");
String str3 = Build.MODEL;
ttHtzKt.tz(str3, "MODEL");
String str4 = Build.VERSION.RELEASE;
ttHtzKt.tz(str4, "RELEASE");
Object systemService2 = context.getSystemService("phone");
ttHtzKt.t1S1zKHK(systemService2, "null cannot be cast to non-null type android.telephony.TelephonyManager");
String networkOperatorName = ((TelephonyManager) systemService2).getNetworkOperatorName();
if (ttHtzKt.SKHKzK("Amazon", str2)) {
str = "amazon";
} else {
str = "android";
}
DeviceNode deviceNode = new DeviceNode(str2, str3, str4, networkOperatorName, str, displayMetrics.widthPixels, displayMetrics.heightPixels, this.uaString, (String) null, (Integer) null, (DeviceNode.DeviceExt) null, 1792, (DefaultConstructorMarker) null);
try {
String userAgent = this.platform.getUserAgent();
this.uaString = userAgent;
deviceNode.setUa(userAgent);
initUserAgentLazy();
} catch (Exception e) {
Log.e(TAG, "Cannot Get UserAgent. Setting Default Device UserAgent." + e.getLocalizedMessage());
}
return deviceNode;
}
private final String getConnectionType() {
if (KzHt.KKzzzzH1(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") == 0) {
Object systemService = this.applicationContext.getSystemService("connectivity");
ttHtzKt.t1S1zKHK(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
if (activeNetworkInfo != null) {
int type = activeNetworkInfo.getType();
if (type != 0) {
if (type != 1 && type != 6) {
if (type != 7) {
if (type != 9) {
return "UNKNOWN";
}
return "ETHERNET";
}
return "BLUETOOTH";
}
return "WIFI";
}
return "MOBILE";
}
return "NONE";
}
return null;
}
private final String getConnectionTypeDetail() {
if (KzHt.KKzzzzH1(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") == 0) {
Object systemService = this.applicationContext.getSystemService("connectivity");
ttHtzKt.t1S1zKHK(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
if (activeNetworkInfo != null) {
return getConnectionTypeDetail(activeNetworkInfo.getSubtype());
}
return "unknown";
}
return null;
}
private final String getConnectionTypeDetail(int i) {
if (i == 0) {
return "unknown";
}
if (i == 1) {
return "gprs";
}
if (i == 2) {
return "edge";
}
if (i == 20) {
return "unknown";
}
switch (i) {
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 (i) {
case 12:
return "cdma_evdo_b";
case 13:
return "LTE";
case 14:
return "hrpd";
default:
return "unknown";
}
}
}
private final DeviceNode getDeviceBody() throws IllegalStateException {
return getDeviceBody$vungle_ads_release(false);
}
private final CommonRequestBody.RequestExt getExtBody() {
boolean z;
boolean z2;
boolean z3;
String configExtension = SzHS.INSTANCE.getConfigExtension();
boolean z4 = true;
if (configExtension != null) {
if (configExtension.length() == 0) {
z3 = true;
} else {
z3 = false;
}
if (z3) {
z = true;
if (z) {
configExtension = this.filePreferences.getString("config_extension");
}
if (configExtension == null && configExtension.length() != 0) {
z2 = false;
} else {
z2 = true;
}
if (z2) {
if ("".length() != 0) {
z4 = false;
}
if (z4) {
return null;
}
}
return new CommonRequestBody.RequestExt(configExtension, "");
}
}
z = false;
if (z) {
}
if (configExtension == null) {
}
z2 = true;
if (z2) {
}
return new CommonRequestBody.RequestExt(configExtension, "");
}
@VisibleForTesting
public static void getGzipApi$vungle_ads_release$annotations() {
}
private final String getPlacementID(RequestBody requestBody) {
List<String> placements;
try {
Json json2 = json;
String bodyToString = bodyToString(requestBody);
KSerializer<Object> serializer = SerializersKt.serializer(json2.getSerializersModule(), tSKtStKH1.tz(CommonRequestBody.class));
ttHtzKt.t1S1zKHK(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 "";
}
String str = placements.get(0);
if (str == null) {
return "";
}
return str;
} catch (Exception unused) {
return "";
}
}
@VisibleForTesting
public static void getResponseInterceptor$vungle_ads_release$annotations() {
}
@VisibleForTesting
public static void getRetryAfterDataMap$vungle_ads_release$annotations() {
}
private final CommonRequestBody.User getUserBody() {
CommonRequestBody.User user = new CommonRequestBody.User((CommonRequestBody.GDPR) null, (CommonRequestBody.CCPA) null, (CommonRequestBody.COPPA) null, 7, (DefaultConstructorMarker) null);
H1KHK h1khk = H1KHK.INSTANCE;
user.setGdpr(new CommonRequestBody.GDPR(h1khk.getConsentStatus(), h1khk.getConsentSource(), h1khk.getConsentTimestamp(), h1khk.getConsentMessageVersion()));
user.setCcpa(new CommonRequestBody.CCPA(h1khk.getCcpaStatus()));
if (h1khk.getCoppaStatus() != zt.COPPA_NOTSET) {
user.setCoppa(new CommonRequestBody.COPPA(h1khk.getCoppaStatus().getValue()));
}
return user;
}
private final void initUserAgentLazy() {
KH1SzKKS kH1SzKKS = new KH1SzKKS(Sdk$SDKMetric.t1H1KH1K.USER_AGENT_LOAD_DURATION_MS);
kH1SzKKS.markStart();
this.platform.getUserAgentLazy(new tz(kH1SzKKS, this));
}
public static final Response m75responseInterceptor$lambda0(t1H1KH1K t1h1kh1k, Interceptor.Chain chain) {
boolean z;
ttHtzKt.tzttS1SS1(t1h1kh1k, "this$0");
ttHtzKt.tzttS1SS1(chain, "chain");
Request request = chain.request();
try {
try {
Response proceed = chain.proceed(request);
String str = proceed.headers().get("Retry-After");
boolean z2 = true;
if (str != null && str.length() != 0) {
z = false;
} else {
z = true;
}
if (!z) {
try {
long parseLong = Long.parseLong(str);
if (parseLong > 0) {
String encodedPath = request.url().encodedPath();
long currentTimeMillis = (parseLong * 1000) + System.currentTimeMillis();
if (S1t1HtH.zKzHS(encodedPath, "ads")) {
String placementID = t1h1kh1k.getPlacementID(request.body());
if (placementID.length() <= 0) {
z2 = false;
}
if (z2) {
t1h1kh1k.retryAfterDataMap.put(placementID, Long.valueOf(currentTimeMillis));
return proceed;
}
return proceed;
}
return proceed;
}
return proceed;
} catch (Exception unused) {
Log.d(TAG, "Retry-After value is not an valid value");
return proceed;
}
}
return proceed;
} catch (OutOfMemoryError unused2) {
KzHtt.Companion.e(TAG, "OOM for " + request.url());
return t1h1kh1k.defaultErrorResponse(request);
}
} catch (Exception e) {
KzHtt.Companion.e(TAG, "Exception: " + e.getMessage() + " for " + request.url());
return t1h1kh1k.defaultErrorResponse(request);
}
}
@VisibleForTesting
public final void addPlaySvcAvailabilityInCookie(boolean z) {
this.filePreferences.put("isPlaySvcAvailable", z).apply();
}
public final boolean checkIsRetryAfterActive(String str) {
long j;
ttHtzKt.tzttS1SS1(str, "placementID");
Long l = this.retryAfterDataMap.get(str);
if (l != null) {
j = l.longValue();
} else {
j = 0;
}
if (j > System.currentTimeMillis()) {
return true;
}
this.retryAfterDataMap.remove(str);
return false;
}
public final zzSSH<ConfigPayload> config() throws IOException {
AppNode appNode = this.appBody;
if (appNode == null) {
return null;
}
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody$vungle_ads_release(true), appNode, getUserBody(), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
CommonRequestBody.RequestExt extBody = getExtBody();
if (extBody != null) {
commonRequestBody.setExt(extBody);
}
SK1Ht1 sK1Ht1 = SK1Ht1.INSTANCE;
String str = BASE_URL;
if (!sK1Ht1.isValidUrl(str)) {
str = "https://config.ads.vungle.com/";
}
if (!S1t1HtH.zKzHS(str, "/")) {
str = str.concat("/");
}
return this.api.config(headerUa, str + "config", commonRequestBody);
}
public final AppNode getAppBody$vungle_ads_release() {
return this.appBody;
}
@VisibleForTesting
public final synchronized DeviceNode getDeviceBody$vungle_ads_release(boolean z) throws IllegalStateException {
DeviceNode copy$default;
String str;
Boolean bool;
int i;
Object[] objArr;
Intent registerReceiver;
String str2;
String connectionType;
String connectionTypeDetail;
int i2;
String str3;
boolean z2;
DeviceNode.VungleExt vungleExt;
String str4;
DeviceNode deviceNode = this.baseDeviceInfo;
if (deviceNode == null) {
deviceNode = getBasicDeviceBody(this.applicationContext);
this.baseDeviceInfo = deviceNode;
}
copy$default = DeviceNode.copy$default(deviceNode, null, null, null, null, null, 0, 0, null, null, null, null, 2047, null);
DeviceNode.AndroidAmazonExt androidAmazonExt = new DeviceNode.AndroidAmazonExt(null, null == true ? 1 : 0, 3, null == true ? 1 : 0);
zHtK advertisingInfo = this.platform.getAdvertisingInfo();
if (advertisingInfo != null) {
str = advertisingInfo.getAdvertisingId();
} else {
str = null;
}
if (advertisingInfo != null) {
bool = Boolean.valueOf(advertisingInfo.getLimitAdTracking());
} else {
bool = null;
}
H1KHK h1khk = H1KHK.INSTANCE;
if (h1khk.shouldSendAdIds()) {
if (str != null) {
if (ttHtzKt.SKHKzK("Amazon", Build.MANUFACTURER)) {
androidAmazonExt.setAmazonAdvertisingId(str);
} else {
androidAmazonExt.setGaid(str);
}
copy$default.setIfa(str);
} else {
String androidId = this.platform.getAndroidId();
if (androidId == null) {
str4 = "";
} else {
str4 = androidId;
}
copy$default.setIfa(str4);
if (androidId != null) {
androidAmazonExt.setAndroidId(androidId);
}
}
}
if (!h1khk.shouldSendAdIds() || z) {
copy$default.setIfa(null);
androidAmazonExt.setAndroidId(null);
androidAmazonExt.setGaid(null);
androidAmazonExt.setAmazonAdvertisingId(null);
}
Boolean bool2 = Boolean.TRUE;
int i3 = 0;
int i4 = 1;
if (ttHtzKt.SKHKzK(bool, bool2)) {
i = 1;
} else {
i = 0;
}
copy$default.setLmt(i);
androidAmazonExt.setGooglePlayServicesAvailable(ttHtzKt.SKHKzK(bool2, isGooglePlayServicesAvailable()));
String appSetId = this.platform.getAppSetId();
this.appSetId = appSetId;
if (appSetId != null && appSetId.length() != 0) {
objArr = false;
if (objArr == false) {
androidAmazonExt.setAppSetId(this.appSetId);
}
registerReceiver = this.applicationContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
int i5 = 2;
if (registerReceiver == null) {
int intExtra = registerReceiver.getIntExtra(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1);
int intExtra2 = registerReceiver.getIntExtra("scale", -1);
if (intExtra > 0 && intExtra2 > 0) {
androidAmazonExt.setBatteryLevel(intExtra / intExtra2);
}
int intExtra3 = registerReceiver.getIntExtra("status", -1);
if (intExtra3 != -1) {
if (intExtra3 != 2 && intExtra3 != 5) {
str2 = "NOT_CHARGING";
} else {
int intExtra4 = registerReceiver.getIntExtra("plugged", -1);
if (intExtra4 != 1) {
if (intExtra4 != 2) {
if (intExtra4 != 4) {
str2 = "BATTERY_PLUGGED_OTHERS";
} else {
str2 = "BATTERY_PLUGGED_WIRELESS";
}
} else {
str2 = "BATTERY_PLUGGED_USB";
}
} else {
str2 = "BATTERY_PLUGGED_AC";
}
}
} else {
str2 = "UNKNOWN";
}
} else {
str2 = "UNKNOWN";
}
androidAmazonExt.setBatteryState(str2);
Object systemService = this.applicationContext.getSystemService("power");
ttHtzKt.t1S1zKHK(systemService, "null cannot be cast to non-null type android.os.PowerManager");
androidAmazonExt.setBatterySaverEnabled(((PowerManager) systemService).isPowerSaveMode() ? 1 : 0);
connectionType = getConnectionType();
if (connectionType != null) {
androidAmazonExt.setConnectionType(connectionType);
}
connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
androidAmazonExt.setConnectionTypeDetail(connectionTypeDetail);
}
androidAmazonExt.setLocale(Locale.getDefault().toString());
androidAmazonExt.setLanguage(Locale.getDefault().getLanguage());
androidAmazonExt.setTimeZone(TimeZone.getDefault().getID());
androidAmazonExt.setVolumeLevel(this.platform.getVolumeLevel());
if (!this.platform.isSoundEnabled()) {
i2 = 1;
} else {
i2 = 0;
}
androidAmazonExt.setSoundEnabled(i2);
str3 = Build.MANUFACTURER;
if (!ttHtzKt.SKHKzK("Amazon", str3)) {
z2 = this.applicationContext.getPackageManager().hasSystemFeature("amazon.hardware.fire_tv");
} else {
Object systemService2 = this.applicationContext.getSystemService("uimode");
ttHtzKt.t1S1zKHK(systemService2, "null cannot be cast to non-null type android.app.UiModeManager");
if (((UiModeManager) systemService2).getCurrentModeType() == 4) {
z2 = true;
} else {
z2 = false;
}
}
androidAmazonExt.setTv(z2);
androidAmazonExt.setSideloadEnabled(this.platform.isSideLoaded());
if (this.platform.isSdCardPresent()) {
i3 = 1;
}
androidAmazonExt.setSdCardAvailable(i3);
androidAmazonExt.setOsName(Build.FINGERPRINT);
copy$default.setUa(this.uaString);
if (!ttHtzKt.SKHKzK("Amazon", str3)) {
vungleExt = new DeviceNode.VungleExt((DeviceNode.AndroidAmazonExt) (null == true ? 1 : 0), androidAmazonExt, i4, (DefaultConstructorMarker) (null == true ? 1 : 0));
} else {
vungleExt = new DeviceNode.VungleExt(androidAmazonExt, (DeviceNode.AndroidAmazonExt) (null == true ? 1 : 0), i5, (DefaultConstructorMarker) (null == true ? 1 : 0));
}
copy$default.setExt(new DeviceNode.DeviceExt(vungleExt));
}
objArr = true;
if (objArr == false) {
}
registerReceiver = this.applicationContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
int i52 = 2;
if (registerReceiver == null) {
}
androidAmazonExt.setBatteryState(str2);
Object systemService3 = this.applicationContext.getSystemService("power");
ttHtzKt.t1S1zKHK(systemService3, "null cannot be cast to non-null type android.os.PowerManager");
androidAmazonExt.setBatterySaverEnabled(((PowerManager) systemService3).isPowerSaveMode() ? 1 : 0);
connectionType = getConnectionType();
if (connectionType != null) {
}
connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
}
androidAmazonExt.setLocale(Locale.getDefault().toString());
androidAmazonExt.setLanguage(Locale.getDefault().getLanguage());
androidAmazonExt.setTimeZone(TimeZone.getDefault().getID());
androidAmazonExt.setVolumeLevel(this.platform.getVolumeLevel());
if (!this.platform.isSoundEnabled()) {
}
androidAmazonExt.setSoundEnabled(i2);
str3 = Build.MANUFACTURER;
if (!ttHtzKt.SKHKzK("Amazon", str3)) {
}
androidAmazonExt.setTv(z2);
androidAmazonExt.setSideloadEnabled(this.platform.isSideLoaded());
if (this.platform.isSdCardPresent()) {
}
androidAmazonExt.setSdCardAvailable(i3);
androidAmazonExt.setOsName(Build.FINGERPRINT);
copy$default.setUa(this.uaString);
if (!ttHtzKt.SKHKzK("Amazon", str3)) {
}
copy$default.setExt(new DeviceNode.DeviceExt(vungleExt));
return copy$default;
}
public final VungleApi getGzipApi$vungle_ads_release() {
return this.gzipApi;
}
@VisibleForTesting
public final Boolean getPlayServicesAvailabilityFromAPI() {
boolean z;
Boolean bool = null;
try {
GoogleApiAvailabilityLight googleApiAvailabilityLight = GoogleApiAvailabilityLight.getInstance();
ttHtzKt.tz(googleApiAvailabilityLight, "getInstance()");
if (googleApiAvailabilityLight.isGooglePlayServicesAvailable(this.applicationContext) == 0) {
z = true;
} else {
z = false;
}
bool = Boolean.valueOf(z);
addPlaySvcAvailabilityInCookie(bool.booleanValue());
return bool;
} catch (Exception unused) {
Log.w(TAG, "Unexpected exception from Play services lib.");
return bool;
} catch (NoClassDefFoundError unused2) {
Log.w(TAG, "Play services Not available");
Boolean bool2 = Boolean.FALSE;
try {
addPlaySvcAvailabilityInCookie(false);
return bool2;
} catch (Exception unused3) {
Log.w(TAG, "Failure to write GPS availability to DB");
return bool2;
}
}
}
@VisibleForTesting
public final Boolean getPlayServicesAvailabilityFromCookie() {
return this.filePreferences.getBoolean("isPlaySvcAvailable");
}
public final Interceptor getResponseInterceptor$vungle_ads_release() {
return this.responseInterceptor;
}
public final Map<String, Long> getRetryAfterDataMap$vungle_ads_release() {
return this.retryAfterDataMap;
}
public final long getRetryAfterHeaderValue(String str) {
ttHtzKt.tzttS1SS1(str, "placementID");
Long l = this.retryAfterDataMap.get(str);
if (l != null) {
return l.longValue();
}
return 0L;
}
public final synchronized void initialize(String str) {
PackageInfo packageInfo;
ttHtzKt.tzttS1SS1(str, b.u);
this.api.setAppId(str);
this.gzipApi.setAppId(str);
String str2 = "1.0";
try {
if (Build.VERSION.SDK_INT >= 33) {
packageInfo = this.applicationContext.getPackageManager().getPackageInfo(this.applicationContext.getPackageName(), PackageManager.PackageInfoFlags.of(0L));
ttHtzKt.tz(packageInfo, "{\n ap… )\n }");
} else {
packageInfo = this.applicationContext.getPackageManager().getPackageInfo(this.applicationContext.getPackageName(), 0);
ttHtzKt.tz(packageInfo, "{\n ap… )\n }");
}
String str3 = packageInfo.versionName;
ttHtzKt.tz(str3, "packageInfo.versionName");
str2 = str3;
} catch (Exception unused) {
}
this.baseDeviceInfo = getBasicDeviceBody(this.applicationContext);
String packageName = this.applicationContext.getPackageName();
ttHtzKt.tz(packageName, "applicationContext.packageName");
this.appBody = new AppNode(packageName, str2, str);
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 SKHKzK.t1H1KH1K pingTPAT(String str) {
boolean z;
ttHtzKt.tzttS1SS1(str, "url");
if (str.length() == 0) {
z = true;
} else {
z = false;
}
if (!z && HttpUrl.INSTANCE.parse(str) != null) {
try {
if (!NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(new URL(str).getHost()) && URLUtil.isHttpUrl(str)) {
return new SKHKzK.t1H1KH1K(121, "Clear Text Traffic is blocked", null, false, 12, null);
}
try {
String str2 = this.uaString;
if (str2 == null) {
str2 = "";
}
KzzztHK<Void> execute = this.api.pingTPAT(str2, str).execute();
Integer num = null;
if (execute != null && execute.isSuccessful()) {
return null;
}
if (K1H.Kz1(SHHHS1K.zH(301, 302, 307, 308), num)) {
return new SKHKzK.t1H1KH1K(29, "Tpat ping was redirected with code " + num, null, false, 12, null);
}
return new SKHKzK.t1H1KH1K(121, "Tpat ping was not successful", null, false, 12, null);
} catch (Exception e) {
int i = 121;
String localizedMessage = e.getLocalizedMessage();
if (localizedMessage == null) {
localizedMessage = "IOException";
}
return new SKHKzK.t1H1KH1K(i, localizedMessage, null, false, 12, null);
}
} catch (MalformedURLException e2) {
int i2 = 121;
String localizedMessage2 = e2.getLocalizedMessage();
if (localizedMessage2 == null) {
localizedMessage2 = "MalformedURLException";
}
return new SKHKzK.t1H1KH1K(i2, localizedMessage2, null, true, 4, null);
}
}
return new SKHKzK.t1H1KH1K(121, "Invalid URL : ".concat(str), null, true, 4, null);
}
public final void reportErrors(BlockingQueue<Sdk$SDKError.SKHKzK> blockingQueue, SKHKzK.t1H1KH1K t1h1kh1k) {
boolean z;
ttHtzKt.tzttS1SS1(blockingQueue, "errors");
ttHtzKt.tzttS1SS1(t1h1kh1k, "requestListener");
String errorLoggingEndpoint = SzHS.INSTANCE.getErrorLoggingEndpoint();
if (errorLoggingEndpoint != null && errorLoggingEndpoint.length() != 0) {
z = false;
} else {
z = true;
}
if (z) {
t1h1kh1k.onFailure();
return;
}
for (Sdk$SDKError.SKHKzK sKHKzK : blockingQueue) {
String connectionType = getConnectionType();
if (connectionType != null) {
sKHKzK.setConnectionType(connectionType);
}
String connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
sKHKzK.setConnectionTypeDetail(connectionTypeDetail);
sKHKzK.setConnectionTypeDetailAndroid(connectionTypeDetail);
}
}
ArrayList arrayList = new ArrayList();
Iterator<Sdk$SDKError.SKHKzK> it = blockingQueue.iterator();
while (it.hasNext()) {
arrayList.add(it.next().build());
}
Sdk$SDKErrorBatch build = Sdk$SDKErrorBatch.newBuilder().addAllErrors(arrayList).build();
RequestBody.Companion companion = RequestBody.INSTANCE;
byte[] byteArray = build.toByteArray();
ttHtzKt.tz(byteArray, "batch.toByteArray()");
this.api.sendErrors(headerUa, errorLoggingEndpoint, companion.create(byteArray, MediaType.INSTANCE.parse("application/x-protobuf"), 0, build.toByteArray().length)).enqueue(new tzttS1SS1(t1h1kh1k));
}
public final void reportMetrics(BlockingQueue<Sdk$SDKMetric.SKHKzK> blockingQueue, SKHKzK.t1H1KH1K t1h1kh1k) {
boolean z;
ttHtzKt.tzttS1SS1(blockingQueue, "metrics");
ttHtzKt.tzttS1SS1(t1h1kh1k, "requestListener");
String metricsEndpoint = SzHS.INSTANCE.getMetricsEndpoint();
if (metricsEndpoint != null && metricsEndpoint.length() != 0) {
z = false;
} else {
z = true;
}
if (z) {
t1h1kh1k.onFailure();
return;
}
for (Sdk$SDKMetric.SKHKzK sKHKzK : blockingQueue) {
String connectionType = getConnectionType();
if (connectionType != null) {
sKHKzK.setConnectionType(connectionType);
}
String connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
sKHKzK.setConnectionTypeDetail(connectionTypeDetail);
}
}
ArrayList arrayList = new ArrayList();
Iterator<Sdk$SDKMetric.SKHKzK> it = blockingQueue.iterator();
while (it.hasNext()) {
arrayList.add(it.next().build());
}
Sdk$MetricBatch build = Sdk$MetricBatch.newBuilder().addAllMetrics(arrayList).build();
RequestBody.Companion companion = RequestBody.INSTANCE;
MediaType parse = MediaType.INSTANCE.parse("application/x-protobuf");
byte[] byteArray = build.toByteArray();
ttHtzKt.tz(byteArray, "batch.toByteArray()");
this.api.sendMetrics(headerUa, metricsEndpoint, RequestBody.Companion.create$default(companion, parse, byteArray, 0, 0, 12, (Object) null)).enqueue(new Sz1tH(t1h1kh1k));
}
public final zzSSH<AdPayload> requestAd(String str, String str2, boolean z) throws IllegalStateException {
boolean z2;
boolean z3;
ttHtzKt.tzttS1SS1(str, "placement");
String adsEndpoint = SzHS.INSTANCE.getAdsEndpoint();
if (adsEndpoint != null && adsEndpoint.length() != 0) {
z2 = false;
} else {
z2 = true;
}
if (z2) {
return null;
}
CommonRequestBody requestBody = requestBody();
CommonRequestBody.RequestParam requestParam = new CommonRequestBody.RequestParam(SHHHS1K.tHH1Kt(str), Boolean.valueOf(z), (String) null, (Long) null, (String) null, (String) null, (String) null, 124, (DefaultConstructorMarker) null);
if (str2 != null && str2.length() != 0) {
z3 = false;
} else {
z3 = true;
}
if (!z3) {
requestParam.setAdSize(str2);
}
requestBody.setRequest(requestParam);
return this.gzipApi.ads(headerUa, adsEndpoint, requestBody);
}
public final CommonRequestBody requestBody() throws IllegalStateException {
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody(), this.appBody, getUserBody(), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
CommonRequestBody.RequestExt extBody = getExtBody();
if (extBody != null) {
commonRequestBody.setExt(extBody);
}
return commonRequestBody;
}
public final zzSSH<Void> ri(CommonRequestBody.RequestParam requestParam) {
boolean z;
AppNode appNode;
ttHtzKt.tzttS1SS1(requestParam, com.vungle.ads.internal.ui.SKHKzK.REQUEST_KEY_EXTRA);
String riEndpoint = SzHS.INSTANCE.getRiEndpoint();
if (riEndpoint != null && riEndpoint.length() != 0) {
z = false;
} else {
z = true;
}
if (z || (appNode = this.appBody) == null) {
return null;
}
CommonRequestBody commonRequestBody = new CommonRequestBody(getDeviceBody(), appNode, getUserBody(), (CommonRequestBody.RequestExt) null, (CommonRequestBody.RequestParam) null, 24, (DefaultConstructorMarker) null);
commonRequestBody.setRequest(requestParam);
CommonRequestBody.RequestExt extBody = getExtBody();
if (extBody != null) {
commonRequestBody.setExt(extBody);
}
return this.api.ri(headerUa, riEndpoint, commonRequestBody);
}
public final void setAppBody$vungle_ads_release(AppNode appNode) {
this.appBody = appNode;
}
public final void setGzipApi$vungle_ads_release(VungleApi vungleApi) {
ttHtzKt.tzttS1SS1(vungleApi, "<set-?>");
this.gzipApi = vungleApi;
}
public final void setResponseInterceptor$vungle_ads_release(Interceptor interceptor) {
ttHtzKt.tzttS1SS1(interceptor, "<set-?>");
this.responseInterceptor = interceptor;
}
public final void setRetryAfterDataMap$vungle_ads_release(Map<String, Long> map) {
ttHtzKt.tzttS1SS1(map, "<set-?>");
this.retryAfterDataMap = map;
}
}