Currency Plus v2.10.8版本的 MD5 值为:8586f74edd9ace5aa261a19c9da51484
以下内容为反编译后的 h.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 com.amazon.device.ads.DtbConstants;
import com.applovin.sdk.AppLovinEventTypes;
import com.google.ads.mediation.vungle.VungleConstants;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.vungle.ads.VungleAds;
import com.vungle.ads.d;
import com.vungle.ads.internal.load.c;
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 com.vungle.ads.internal.util.i;
import com.vungle.ads.k0;
import fi.a0;
import gi.e0;
import gi.t;
import gi.u;
import j$.util.concurrent.ConcurrentHashMap;
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.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.BlockingQueue;
import km.b0;
import km.c0;
import km.d0;
import km.h0;
import km.i0;
import km.j0;
import km.x;
import km.y;
import km.z;
import sg.g;
import sg.i;
import si.l;
import ti.g0;
import ti.n;
import ym.f0;
import ym.s;
public final class h {
private static final String BASE_URL;
public static final b 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 cm.a json;
private static final Set<y> logInterceptors;
private static final Set<y> networkInterceptors;
private VungleApi api;
private sg.d appBody;
private String appSetId;
private final Context applicationContext;
private sg.i baseDeviceInfo;
private final vg.a filePreferences;
private VungleApi gzipApi;
private Boolean isGooglePlayServicesAvailable;
private final com.vungle.ads.internal.platform.b platform;
private y responseInterceptor;
private Map<String, Long> retryAfterDataMap;
private String uaString;
public static final class a extends n implements l<cm.d, a0> {
public static final a INSTANCE = new a();
public a() {
super(1);
}
@Override
public a0 invoke(cm.d dVar) {
invoke2(dVar);
return a0.f17744a;
}
public final void invoke2(cm.d dVar) {
ti.l.f(dVar, "$this$Json");
dVar.f6639c = true;
dVar.f6637a = true;
dVar.f6638b = false;
}
}
public static final class b {
private b() {
}
public b(ti.g gVar) {
this();
}
public final String defaultHeader() {
return (ti.l.a("Amazon", Build.MANUFACTURER) ? "VungleAmazon/" : "VungleDroid/").concat("7.1.0");
}
public final String getBASE_URL$vungle_ads_release() {
return h.BASE_URL;
}
public final String getHeaderUa() {
return h.headerUa;
}
public final VungleAds.WrapperFramework getWRAPPER_FRAMEWORK_SELECTED$vungle_ads_release() {
return h.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) {
ti.l.f(str, "<set-?>");
h.headerUa = str;
}
public final void setWRAPPER_FRAMEWORK_SELECTED$vungle_ads_release(VungleAds.WrapperFramework wrapperFramework) {
h.WRAPPER_FRAMEWORK_SELECTED = wrapperFramework;
}
}
public static final class c implements y {
private static final String CONTENT_ENCODING = "Content-Encoding";
public static final a Companion = new a(null);
private static final String GZIP = "gzip";
public static final class a {
private a() {
}
public a(ti.g gVar) {
this();
}
}
public static final class b extends h0 {
final ym.g $output;
final h0 $requestBody;
public b(h0 h0Var, ym.g gVar) {
this.$requestBody = h0Var;
this.$output = gVar;
}
@Override
public long contentLength() {
return this.$output.f35881b;
}
@Override
public z contentType() {
return this.$requestBody.contentType();
}
@Override
public void writeTo(ym.h hVar) throws IOException {
ti.l.f(hVar, "sink");
hVar.T0(this.$output.j0());
}
}
private final h0 gzip(h0 h0Var) throws IOException {
ym.g gVar = new ym.g();
f0 b10 = ym.z.b(new s(gVar));
h0Var.writeTo(b10);
b10.close();
return new b(h0Var, gVar);
}
@Override
public i0 intercept(y.a aVar) throws IOException {
ti.l.f(aVar, "chain");
d0 e10 = aVar.e();
h0 h0Var = e10.f22465d;
if (h0Var == null || e10.f22464c.a(CONTENT_ENCODING) != null) {
return aVar.a(e10);
}
d0.a aVar2 = new d0.a(e10);
aVar2.d(CONTENT_ENCODING, GZIP);
aVar2.e(e10.f22463b, gzip(h0Var));
return aVar.a(aVar2.b());
}
}
public static final class d 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);
ti.l.e(select, "{\n …ri)\n }");
return select;
} catch (Exception unused) {
return t.b(Proxy.NO_PROXY);
}
}
}
public static final class e implements q4.a<String> {
final k0 $uaMetric;
final h this$0;
public e(k0 k0Var, h hVar) {
this.$uaMetric = k0Var;
this.this$0 = hVar;
}
@Override
public void accept(String str) {
if (str == null) {
Log.e(h.TAG, "Cannot Get UserAgent. Setting Default Device UserAgent");
com.vungle.ads.d.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);
return;
}
this.$uaMetric.markEnd();
com.vungle.ads.d.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 f implements com.vungle.ads.internal.network.b<Void> {
final d.b $requestListener;
public f(d.b bVar) {
this.$requestListener = bVar;
}
@Override
public void onFailure(com.vungle.ads.internal.network.a<Void> aVar, Throwable th2) {
this.$requestListener.onFailure();
}
@Override
public void onResponse(com.vungle.ads.internal.network.a<Void> aVar, com.vungle.ads.internal.network.d<Void> dVar) {
this.$requestListener.onSuccess();
}
}
public static final class g implements com.vungle.ads.internal.network.b<Void> {
final d.b $requestListener;
public g(d.b bVar) {
this.$requestListener = bVar;
}
@Override
public void onFailure(com.vungle.ads.internal.network.a<Void> aVar, Throwable th2) {
this.$requestListener.onFailure();
}
@Override
public void onResponse(com.vungle.ads.internal.network.a<Void> aVar, com.vungle.ads.internal.network.d<Void> dVar) {
this.$requestListener.onSuccess();
}
}
static {
b bVar = new b(null);
Companion = bVar;
BASE_URL = "https://config.ads.vungle.com/";
headerUa = bVar.defaultHeader();
networkInterceptors = new HashSet();
logInterceptors = new HashSet();
json = hh.c.d(a.INSTANCE);
}
public h(Context context, com.vungle.ads.internal.platform.b bVar, vg.a aVar) {
ti.l.f(context, "applicationContext");
ti.l.f(bVar, "platform");
ti.l.f(aVar, "filePreferences");
this.applicationContext = context;
this.platform = bVar;
this.filePreferences = aVar;
this.uaString = System.getProperty("http.agent");
this.appSetId = "";
this.retryAfterDataMap = new ConcurrentHashMap();
this.responseInterceptor = new y() {
@Override
public final i0 intercept(y.a aVar2) {
i0 m96responseInterceptor$lambda0;
m96responseInterceptor$lambda0 = h.m96responseInterceptor$lambda0(h.this, (qm.f) aVar2);
return m96responseInterceptor$lambda0;
}
};
b0.a aVar2 = new b0.a();
y yVar = this.responseInterceptor;
ti.l.f(yVar, "interceptor");
ArrayList arrayList = aVar2.f22402c;
arrayList.add(yVar);
d dVar = new d();
if (!ti.l.a(dVar, aVar2.f22413n)) {
aVar2.D = null;
}
aVar2.f22413n = dVar;
b0 b0Var = new b0(aVar2);
arrayList.add(new c());
b0 b0Var2 = new b0(aVar2);
this.api = new i(b0Var);
this.gzipApi = new i(b0Var2);
}
private final String bodyToString(h0 h0Var) {
try {
ym.g gVar = new ym.g();
if (h0Var != null) {
h0Var.writeTo(gVar);
return gVar.f0();
}
return "";
} catch (Exception unused) {
return "";
}
}
private final i0 defaultErrorResponse(d0 d0Var) {
i0.a aVar = new i0.a();
ti.l.f(d0Var, com.vungle.ads.internal.ui.a.REQUEST_KEY_EXTRA);
aVar.f22528a = d0Var;
aVar.f22530c = 500;
aVar.f22529b = c0.HTTP_1_1;
aVar.f22531d = "Server is busy";
j0.b bVar = j0.Companion;
z.f22653d.getClass();
z b10 = z.a.b("application/json; charset=utf-8");
bVar.getClass();
aVar.f22534g = j0.b.a("{\"Error\":\"Server is busy\"}", b10);
return aVar.a();
}
public static void getAppBody$vungle_ads_release$annotations() {
}
private final sg.i getBasicDeviceBody(Context context) {
DisplayMetrics displayMetrics = new DisplayMetrics();
Object systemService = context.getSystemService("window");
ti.l.d(systemService, "null cannot be cast to non-null type android.view.WindowManager");
Display defaultDisplay = ((WindowManager) systemService).getDefaultDisplay();
if (defaultDisplay != null) {
defaultDisplay.getMetrics(displayMetrics);
}
String str = Build.MANUFACTURER;
ti.l.e(str, "MANUFACTURER");
String str2 = Build.MODEL;
ti.l.e(str2, "MODEL");
String str3 = Build.VERSION.RELEASE;
ti.l.e(str3, "RELEASE");
Object systemService2 = context.getSystemService("phone");
ti.l.d(systemService2, "null cannot be cast to non-null type android.telephony.TelephonyManager");
sg.i iVar = new sg.i(str, str2, str3, ((TelephonyManager) systemService2).getNetworkOperatorName(), ti.l.a("Amazon", str) ? "amazon" : DtbConstants.NATIVE_OS_NAME, displayMetrics.widthPixels, displayMetrics.heightPixels, this.uaString, (String) null, (Integer) null, (i.e) null, 1792, (ti.g) null);
try {
String userAgent = this.platform.getUserAgent();
this.uaString = userAgent;
iVar.setUa(userAgent);
initUserAgentLazy();
} catch (Exception e10) {
Log.e(TAG, "Cannot Get UserAgent. Setting Default Device UserAgent." + e10.getLocalizedMessage());
}
return iVar;
}
private final String getConnectionType() {
if (yg.t.q(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") == 0) {
Object systemService = this.applicationContext.getSystemService("connectivity");
ti.l.d(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
if (activeNetworkInfo != null) {
int type = activeNetworkInfo.getType();
return type != 0 ? (type == 1 || type == 6) ? "WIFI" : type != 7 ? type != 9 ? "UNKNOWN" : "ETHERNET" : "BLUETOOTH" : "MOBILE";
}
return "NONE";
}
return null;
}
private final String getConnectionTypeDetail() {
if (yg.t.q(this.applicationContext, "android.permission.ACCESS_NETWORK_STATE") == 0) {
Object systemService = this.applicationContext.getSystemService("connectivity");
ti.l.d(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
NetworkInfo activeNetworkInfo = ((ConnectivityManager) systemService).getActiveNetworkInfo();
return activeNetworkInfo != null ? getConnectionTypeDetail(activeNetworkInfo.getSubtype()) : "unknown";
}
return null;
}
private final String getConnectionTypeDetail(int i10) {
if (i10 != 0) {
if (i10 != 1) {
if (i10 != 2) {
if (i10 != 20) {
switch (i10) {
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 (i10) {
case 12:
return "cdma_evdo_b";
case 13:
return "LTE";
case 14:
return "hrpd";
default:
return "unknown";
}
}
}
return "unknown";
}
return "edge";
}
return "gprs";
}
return "unknown";
}
private final sg.i getDeviceBody() throws IllegalStateException {
return getDeviceBody$vungle_ads_release(false);
}
private final g.f getExtBody() {
String configExtension = com.vungle.ads.internal.c.INSTANCE.getConfigExtension();
if (configExtension != null && configExtension.length() == 0) {
configExtension = this.filePreferences.getString("config_extension");
}
if ((configExtension == null || configExtension.length() == 0) && "".length() == 0) {
return null;
}
return new g.f(configExtension, "");
}
public static void getGzipApi$vungle_ads_release$annotations() {
}
private final String getPlacementID(h0 h0Var) {
List<String> placements;
try {
cm.a aVar = json;
g.C0612g request = ((sg.g) aVar.a(nl.k0.W0(aVar.f6627b, g0.a(sg.g.class)), bodyToString(h0Var))).getRequest();
if (request == null || (placements = request.getPlacements()) == null) {
return "";
}
String str = placements.get(0);
return str == null ? "" : str;
} catch (Exception unused) {
return "";
}
}
public static void getResponseInterceptor$vungle_ads_release$annotations() {
}
public static void getRetryAfterDataMap$vungle_ads_release$annotations() {
}
private final g.h getUserBody() {
g.h hVar = new g.h((g.e) null, (g.b) null, (g.c) null, 7, (ti.g) null);
wg.c cVar = wg.c.INSTANCE;
hVar.setGdpr(new g.e(cVar.getConsentStatus(), cVar.getConsentSource(), cVar.getConsentTimestamp(), cVar.getConsentMessageVersion()));
hVar.setCcpa(new g.b(cVar.getCcpaStatus()));
if (cVar.getCoppaStatus() != wg.a.COPPA_NOTSET) {
hVar.setCoppa(new g.c(cVar.getCoppaStatus().getValue()));
}
return hVar;
}
private final void initUserAgentLazy() {
k0 k0Var = new k0(Sdk$SDKMetric.b.USER_AGENT_LOAD_DURATION_MS);
k0Var.markStart();
this.platform.getUserAgentLazy(new e(k0Var, this));
}
public static final i0 m96responseInterceptor$lambda0(h hVar, y.a aVar) {
ti.l.f(hVar, "this$0");
ti.l.f(aVar, "chain");
d0 e10 = aVar.e();
try {
try {
i0 a10 = aVar.a(e10);
String a11 = a10.f22519f.a("Retry-After");
if (a11 == null || a11.length() == 0) {
return a10;
}
try {
long parseLong = Long.parseLong(a11);
if (parseLong > 0) {
String b10 = e10.f22462a.b();
long currentTimeMillis = (parseLong * 1000) + System.currentTimeMillis();
if (ll.t.h(b10, "ads", false)) {
String placementID = hVar.getPlacementID(e10.f22465d);
if (placementID.length() > 0) {
hVar.retryAfterDataMap.put(placementID, Long.valueOf(currentTimeMillis));
return a10;
}
return a10;
}
return a10;
}
return a10;
} catch (Exception unused) {
Log.d(TAG, "Retry-After value is not an valid value");
return a10;
}
} catch (OutOfMemoryError unused2) {
i.a aVar2 = com.vungle.ads.internal.util.i.Companion;
aVar2.e(TAG, "OOM for " + e10.f22462a);
return hVar.defaultErrorResponse(e10);
}
} catch (Exception e11) {
i.a aVar3 = com.vungle.ads.internal.util.i.Companion;
aVar3.e(TAG, "Exception: " + e11.getMessage() + " for " + e10.f22462a);
return hVar.defaultErrorResponse(e10);
}
}
public final void addPlaySvcAvailabilityInCookie(boolean z10) {
this.filePreferences.put("isPlaySvcAvailable", z10).apply();
}
public final boolean checkIsRetryAfterActive(String str) {
ti.l.f(str, VungleConstants.KEY_PLACEMENT_ID);
Long l10 = this.retryAfterDataMap.get(str);
if ((l10 != null ? l10.longValue() : 0L) > System.currentTimeMillis()) {
return true;
}
this.retryAfterDataMap.remove(str);
return false;
}
public final com.vungle.ads.internal.network.a<sg.h> config() throws IOException {
sg.d dVar = this.appBody;
if (dVar == null) {
return null;
}
sg.g gVar = new sg.g(getDeviceBody$vungle_ads_release(true), dVar, getUserBody(), (g.f) null, (g.C0612g) null, 24, (ti.g) null);
g.f extBody = getExtBody();
if (extBody != null) {
gVar.setExt(extBody);
}
com.vungle.ads.internal.util.e eVar = com.vungle.ads.internal.util.e.INSTANCE;
String str = BASE_URL;
if (!eVar.isValidUrl(str)) {
str = "https://config.ads.vungle.com/";
}
if (!ll.t.h(str, "/", false)) {
str = str.concat("/");
}
VungleApi vungleApi = this.api;
String str2 = headerUa;
return vungleApi.config(str2, str + "config", gVar);
}
public final sg.d getAppBody$vungle_ads_release() {
return this.appBody;
}
public final synchronized sg.i getDeviceBody$vungle_ads_release(boolean z10) throws IllegalStateException {
sg.i copy$default;
String str;
try {
sg.i iVar = this.baseDeviceInfo;
if (iVar == null) {
iVar = getBasicDeviceBody(this.applicationContext);
this.baseDeviceInfo = iVar;
}
copy$default = sg.i.copy$default(iVar, null, null, null, null, null, 0, 0, null, null, null, null, 2047, null);
i.b bVar = new i.b(null, null, 3, null);
sg.c advertisingInfo = this.platform.getAdvertisingInfo();
String advertisingId = advertisingInfo != null ? advertisingInfo.getAdvertisingId() : null;
Boolean valueOf = advertisingInfo != null ? Boolean.valueOf(advertisingInfo.getLimitAdTracking()) : null;
wg.c cVar = wg.c.INSTANCE;
if (cVar.shouldSendAdIds()) {
if (advertisingId != null) {
if (ti.l.a("Amazon", Build.MANUFACTURER)) {
bVar.setAmazonAdvertisingId(advertisingId);
} else {
bVar.setGaid(advertisingId);
}
copy$default.setIfa(advertisingId);
} else {
String androidId = this.platform.getAndroidId();
copy$default.setIfa(androidId == null ? "" : androidId);
if (androidId != null) {
bVar.setAndroidId(androidId);
}
}
}
if (!cVar.shouldSendAdIds() || z10) {
copy$default.setIfa(null);
bVar.setAndroidId(null);
bVar.setGaid(null);
bVar.setAmazonAdvertisingId(null);
}
Boolean bool = Boolean.TRUE;
boolean z11 = false;
copy$default.setLmt(ti.l.a(valueOf, bool) ? 1 : 0);
bVar.setGooglePlayServicesAvailable(ti.l.a(bool, isGooglePlayServicesAvailable()));
String appSetId = this.platform.getAppSetId();
this.appSetId = appSetId;
if (appSetId != null && appSetId.length() != 0) {
bVar.setAppSetId(this.appSetId);
}
Intent registerReceiver = this.applicationContext.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
if (registerReceiver != null) {
int intExtra = registerReceiver.getIntExtra(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1);
int intExtra2 = registerReceiver.getIntExtra("scale", -1);
if (intExtra > 0 && intExtra2 > 0) {
bVar.setBatteryLevel(intExtra / intExtra2);
}
int intExtra3 = registerReceiver.getIntExtra(xa.c.STATUS, -1);
if (intExtra3 == -1) {
str = "UNKNOWN";
} else if (intExtra3 == 2 || intExtra3 == 5) {
int intExtra4 = registerReceiver.getIntExtra("plugged", -1);
str = intExtra4 != 1 ? intExtra4 != 2 ? intExtra4 != 4 ? "BATTERY_PLUGGED_OTHERS" : "BATTERY_PLUGGED_WIRELESS" : "BATTERY_PLUGGED_USB" : "BATTERY_PLUGGED_AC";
} else {
str = "NOT_CHARGING";
}
} else {
str = "UNKNOWN";
}
bVar.setBatteryState(str);
Object systemService = this.applicationContext.getSystemService("power");
ti.l.d(systemService, "null cannot be cast to non-null type android.os.PowerManager");
bVar.setBatterySaverEnabled(((PowerManager) systemService).isPowerSaveMode() ? 1 : 0);
String connectionType = getConnectionType();
if (connectionType != null) {
bVar.setConnectionType(connectionType);
}
String connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
bVar.setConnectionTypeDetail(connectionTypeDetail);
}
bVar.setLocale(Locale.getDefault().toString());
bVar.setLanguage(Locale.getDefault().getLanguage());
bVar.setTimeZone(TimeZone.getDefault().getID());
bVar.setVolumeLevel(this.platform.getVolumeLevel());
bVar.setSoundEnabled(this.platform.isSoundEnabled() ? 1 : 0);
String str2 = Build.MANUFACTURER;
if (ti.l.a("Amazon", str2)) {
z11 = this.applicationContext.getPackageManager().hasSystemFeature("amazon.hardware.fire_tv");
} else {
Object systemService2 = this.applicationContext.getSystemService("uimode");
ti.l.d(systemService2, "null cannot be cast to non-null type android.app.UiModeManager");
if (((UiModeManager) systemService2).getCurrentModeType() == 4) {
z11 = true;
}
}
bVar.setTv(z11);
bVar.setSideloadEnabled(this.platform.isSideLoaded());
bVar.setSdCardAvailable(this.platform.isSdCardPresent() ? 1 : 0);
bVar.setOsName(Build.FINGERPRINT);
copy$default.setUa(this.uaString);
copy$default.setExt(new i.e(ti.l.a("Amazon", str2) ? new i.f((i.b) null, bVar, 1, (ti.g) null) : new i.f(bVar, (i.b) null, 2, (ti.g) null)));
} catch (Throwable th2) {
throw th2;
}
return copy$default;
}
public final VungleApi getGzipApi$vungle_ads_release() {
return this.gzipApi;
}
public final Boolean getPlayServicesAvailabilityFromAPI() {
Boolean bool = null;
try {
GoogleApiAvailabilityLight googleApiAvailabilityLight = GoogleApiAvailabilityLight.getInstance();
ti.l.e(googleApiAvailabilityLight, "getInstance()");
bool = Boolean.valueOf(googleApiAvailabilityLight.isGooglePlayServicesAvailable(this.applicationContext) == 0);
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;
}
}
}
public final Boolean getPlayServicesAvailabilityFromCookie() {
return this.filePreferences.getBoolean("isPlaySvcAvailable");
}
public final y 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) {
ti.l.f(str, VungleConstants.KEY_PLACEMENT_ID);
Long l10 = this.retryAfterDataMap.get(str);
if (l10 != null) {
return l10.longValue();
}
return 0L;
}
public final synchronized void initialize(String str) {
PackageInfo packageInfo;
PackageManager.PackageInfoFlags of2;
try {
ti.l.f(str, "appId");
this.api.setAppId(str);
this.gzipApi.setAppId(str);
String str2 = "1.0";
try {
if (Build.VERSION.SDK_INT >= 33) {
PackageManager packageManager = this.applicationContext.getPackageManager();
String packageName = this.applicationContext.getPackageName();
of2 = PackageManager.PackageInfoFlags.of(0L);
packageInfo = packageManager.getPackageInfo(packageName, of2);
ti.l.e(packageInfo, "{\n ap… )\n }");
} else {
packageInfo = this.applicationContext.getPackageManager().getPackageInfo(this.applicationContext.getPackageName(), 0);
ti.l.e(packageInfo, "{\n ap… )\n }");
}
String str3 = packageInfo.versionName;
ti.l.e(str3, "packageInfo.versionName");
str2 = str3;
} catch (Exception unused) {
}
this.baseDeviceInfo = getBasicDeviceBody(this.applicationContext);
String packageName2 = this.applicationContext.getPackageName();
ti.l.e(packageName2, "applicationContext.packageName");
this.appBody = new sg.d(packageName2, str2, str);
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromAPI();
} catch (Throwable th2) {
throw th2;
}
}
public final Boolean isGooglePlayServicesAvailable() {
if (this.isGooglePlayServicesAvailable == null) {
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromCookie();
}
if (this.isGooglePlayServicesAvailable == null) {
this.isGooglePlayServicesAvailable = getPlayServicesAvailabilityFromAPI();
}
return this.isGooglePlayServicesAvailable;
}
public final c.b pingTPAT(String str) {
ti.l.f(str, "url");
if (str.length() != 0) {
x.f22632k.getClass();
if (x.b.e(str) != null) {
try {
if ((Build.VERSION.SDK_INT >= 24 ? NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted(new URL(str).getHost()) : NetworkSecurityPolicy.getInstance().isCleartextTrafficPermitted()) || !URLUtil.isHttpUrl(str)) {
try {
String str2 = this.uaString;
if (str2 == null) {
str2 = "";
}
com.vungle.ads.internal.network.d<Void> execute = this.api.pingTPAT(str2, str).execute();
Integer num = null;
if (execute != null && execute.isSuccessful()) {
return null;
}
if (e0.w(u.g(301, 302, 307, 308), num)) {
return new c.b(29, "Tpat ping was redirected with code " + num, null, false, 12, null);
}
return new c.b(121, "Tpat ping was not successful", null, false, 12, null);
} catch (Exception e10) {
String localizedMessage = e10.getLocalizedMessage();
if (localizedMessage == null) {
localizedMessage = "IOException";
}
return new c.b(121, localizedMessage, null, false, 12, null);
}
}
return new c.b(121, "Clear Text Traffic is blocked", null, false, 12, null);
} catch (MalformedURLException e11) {
String localizedMessage2 = e11.getLocalizedMessage();
if (localizedMessage2 == null) {
localizedMessage2 = "MalformedURLException";
}
return new c.b(121, localizedMessage2, null, true, 4, null);
}
}
}
return new c.b(121, "Invalid URL : ".concat(str), null, true, 4, null);
}
public final void reportErrors(BlockingQueue<Sdk$SDKError.a> blockingQueue, d.b bVar) {
ti.l.f(blockingQueue, "errors");
ti.l.f(bVar, "requestListener");
String errorLoggingEndpoint = com.vungle.ads.internal.c.INSTANCE.getErrorLoggingEndpoint();
if (errorLoggingEndpoint == null || errorLoggingEndpoint.length() == 0) {
bVar.onFailure();
return;
}
for (Sdk$SDKError.a aVar : blockingQueue) {
String connectionType = getConnectionType();
if (connectionType != null) {
aVar.setConnectionType(connectionType);
}
String connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
aVar.setConnectionTypeDetail(connectionTypeDetail);
aVar.setConnectionTypeDetailAndroid(connectionTypeDetail);
}
}
ArrayList arrayList = new ArrayList();
for (Sdk$SDKError.a aVar2 : blockingQueue) {
arrayList.add(aVar2.build());
}
Sdk$SDKErrorBatch build = Sdk$SDKErrorBatch.newBuilder().addAllErrors(arrayList).build();
h0.a aVar3 = h0.Companion;
byte[] byteArray = build.toByteArray();
ti.l.e(byteArray, "batch.toByteArray()");
z.f22653d.getClass();
z b10 = z.a.b("application/x-protobuf");
int length = build.toByteArray().length;
aVar3.getClass();
this.api.sendErrors(headerUa, errorLoggingEndpoint, h0.a.b(byteArray, b10, 0, length)).enqueue(new f(bVar));
}
public final void reportMetrics(BlockingQueue<Sdk$SDKMetric.a> blockingQueue, d.b bVar) {
ti.l.f(blockingQueue, "metrics");
ti.l.f(bVar, "requestListener");
String metricsEndpoint = com.vungle.ads.internal.c.INSTANCE.getMetricsEndpoint();
if (metricsEndpoint == null || metricsEndpoint.length() == 0) {
bVar.onFailure();
return;
}
for (Sdk$SDKMetric.a aVar : blockingQueue) {
String connectionType = getConnectionType();
if (connectionType != null) {
aVar.setConnectionType(connectionType);
}
String connectionTypeDetail = getConnectionTypeDetail();
if (connectionTypeDetail != null) {
aVar.setConnectionTypeDetail(connectionTypeDetail);
}
}
ArrayList arrayList = new ArrayList();
for (Sdk$SDKMetric.a aVar2 : blockingQueue) {
arrayList.add(aVar2.build());
}
h0.a aVar3 = h0.Companion;
z.f22653d.getClass();
z b10 = z.a.b("application/x-protobuf");
byte[] byteArray = Sdk$MetricBatch.newBuilder().addAllMetrics(arrayList).build().toByteArray();
ti.l.e(byteArray, "batch.toByteArray()");
this.api.sendMetrics(headerUa, metricsEndpoint, h0.a.c(aVar3, b10, byteArray, 0, 12)).enqueue(new g(bVar));
}
public final com.vungle.ads.internal.network.a<sg.b> requestAd(String str, String str2, boolean z10) throws IllegalStateException {
ti.l.f(str, xa.c.PLACEMENT);
String adsEndpoint = com.vungle.ads.internal.c.INSTANCE.getAdsEndpoint();
if (adsEndpoint == null || adsEndpoint.length() == 0) {
return null;
}
sg.g requestBody = requestBody();
g.C0612g c0612g = new g.C0612g(t.b(str), Boolean.valueOf(z10), (String) null, (Long) null, (String) null, (String) null, (String) null, 124, (ti.g) null);
if (str2 != null && str2.length() != 0) {
c0612g.setAdSize(str2);
}
requestBody.setRequest(c0612g);
return this.gzipApi.ads(headerUa, adsEndpoint, requestBody);
}
public final sg.g requestBody() throws IllegalStateException {
sg.g gVar = new sg.g(getDeviceBody(), this.appBody, getUserBody(), (g.f) null, (g.C0612g) null, 24, (ti.g) null);
g.f extBody = getExtBody();
if (extBody != null) {
gVar.setExt(extBody);
}
return gVar;
}
public final com.vungle.ads.internal.network.a<Void> ri(g.C0612g c0612g) {
sg.d dVar;
ti.l.f(c0612g, com.vungle.ads.internal.ui.a.REQUEST_KEY_EXTRA);
String riEndpoint = com.vungle.ads.internal.c.INSTANCE.getRiEndpoint();
if (riEndpoint == null || riEndpoint.length() == 0 || (dVar = this.appBody) == null) {
return null;
}
sg.g gVar = new sg.g(getDeviceBody(), dVar, getUserBody(), (g.f) null, (g.C0612g) null, 24, (ti.g) null);
gVar.setRequest(c0612g);
g.f extBody = getExtBody();
if (extBody != null) {
gVar.setExt(extBody);
}
return this.api.ri(headerUa, riEndpoint, gVar);
}
public final void setAppBody$vungle_ads_release(sg.d dVar) {
this.appBody = dVar;
}
public final void setGzipApi$vungle_ads_release(VungleApi vungleApi) {
ti.l.f(vungleApi, "<set-?>");
this.gzipApi = vungleApi;
}
public final void setResponseInterceptor$vungle_ads_release(y yVar) {
ti.l.f(yVar, "<set-?>");
this.responseInterceptor = yVar;
}
public final void setRetryAfterDataMap$vungle_ads_release(Map<String, Long> map) {
ti.l.f(map, "<set-?>");
this.retryAfterDataMap = map;
}
}