正在查看: CityMall v1.42.1 应用的 AdIdentifierHelper.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: CityMall v1.42.1 应用的 AdIdentifierHelper.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.adster.sdk.mediation.analytics;
import K6.A;
import K6.q;
import U6.c;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.os.Build;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import e7.H;
import e7.g;
import e7.z;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.CancellationException;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.j;
import kotlin.jvm.functions.Function2;
import kotlin.text.d;
import kotlinx.coroutines.CompletableJob;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.o;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata
public final class AdIdentifierHelper implements CoroutineScope {
@NotNull
private final String INVALID_ID;
@NotNull
private final String INVALID_IP;
@NotNull
private final String SESSION_ID;
@NotNull
private volatile String adId;
@NotNull
private final Context context;
@NotNull
private final Map<String, String> deviceDetails;
@NotNull
private CompletableJob job;
@NotNull
private String publicIP;
@DebugMetadata(c = "com.adster.sdk.mediation.analytics.AdIdentifierHelper$fetchPublicIPAsync$1", f = "AnalyticsHelper.kt", l = {}, m = "invokeSuspend")
public static final class a extends j implements Function2<CoroutineScope, Continuation<? super A>, Object> {
public a(Continuation<? super a> continuation) {
super(2, continuation);
}
@NotNull
public final Continuation<A> create(@Nullable Object obj, @NotNull Continuation<?> continuation) {
return AdIdentifierHelper.this.new a(continuation);
}
public final Object invoke(Object obj, Object obj2) {
return create((CoroutineScope) obj, (Continuation) obj2).invokeSuspend(A.a);
}
@Nullable
public final Object invokeSuspend(@NotNull Object obj) {
P6.b.c();
q.b(obj);
AdIdentifierHelper.this.fetchPublicIP();
return A.a;
}
}
@DebugMetadata(c = "com.adster.sdk.mediation.analytics.AdIdentifierHelper$setAdvertisingIdAsync$1", f = "AnalyticsHelper.kt", l = {}, m = "invokeSuspend")
public static final class b extends j implements Function2<CoroutineScope, Continuation<? super A>, Object> {
public b(Continuation<? super b> continuation) {
super(2, continuation);
}
@NotNull
public final Continuation<A> create(@Nullable Object obj, @NotNull Continuation<?> continuation) {
return AdIdentifierHelper.this.new b(continuation);
}
public final Object invoke(Object obj, Object obj2) {
return create((CoroutineScope) obj, (Continuation) obj2).invokeSuspend(A.a);
}
@Nullable
public final Object invokeSuspend(@NotNull Object obj) {
P6.b.c();
q.b(obj);
AdIdentifierHelper.this.setAdId();
return A.a;
}
}
public AdIdentifierHelper(@NotNull Context context) {
kotlin.jvm.internal.j.i(context, "context");
this.context = context;
this.job = o.b((Job) null, 1, (Object) null);
this.INVALID_ID = "000-000-000";
this.INVALID_IP = "000-00-00-00";
this.SESSION_ID = ULID.INSTANCE.generate();
this.deviceDetails = new LinkedHashMap();
setAdvertisingIdAsync();
fetchPublicIPAsync();
setDeviceDetails();
this.adId = "";
this.publicIP = "";
}
public final void fetchPublicIP() {
String str;
try {
URLConnection openConnection = new URL("https://api.ipify.org").openConnection();
kotlin.jvm.internal.j.g(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection");
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
httpURLConnection.setRequestMethod("GET");
if (httpURLConnection.getResponseCode() == 200) {
InputStream inputStream = httpURLConnection.getInputStream();
kotlin.jvm.internal.j.h(inputStream, "connection.inputStream");
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, d.b), 8192);
try {
str = U6.o.d(bufferedReader);
c.a(bufferedReader, (Throwable) null);
} finally {
}
} else {
str = this.INVALID_IP;
}
} catch (Exception unused) {
str = this.INVALID_IP;
}
this.publicIP = str;
}
private final Job fetchPublicIPAsync() {
return g.d(this, (CoroutineContext) null, (z) null, new a(null), 3, (Object) null);
}
public final void setAdId() {
String str;
try {
AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(this.context);
kotlin.jvm.internal.j.h(advertisingIdInfo, "getAdvertisingIdInfo(context)");
if (advertisingIdInfo.isLimitAdTrackingEnabled() || (str = advertisingIdInfo.getId()) == null) {
str = this.INVALID_ID;
}
kotlin.jvm.internal.j.h(str, "{\n val info =…else INVALID_ID\n }");
} catch (Exception unused) {
str = this.INVALID_ID;
}
this.adId = str;
}
private final Job setAdvertisingIdAsync() {
return g.d(this, (CoroutineContext) null, (z) null, new b(null), 3, (Object) null);
}
private final void setDeviceDetails() {
Map<String, String> map = this.deviceDetails;
String str = Build.BRAND;
kotlin.jvm.internal.j.h(str, "BRAND");
map.put(DeviceDetailConstants.PARAM_BRAND, str);
Map<String, String> map2 = this.deviceDetails;
String str2 = Build.MANUFACTURER;
kotlin.jvm.internal.j.h(str2, "MANUFACTURER");
map2.put(DeviceDetailConstants.PARAM_MANUFACTURER, str2);
Map<String, String> map3 = this.deviceDetails;
String str3 = Build.MODEL;
kotlin.jvm.internal.j.h(str3, "MODEL");
map3.put(DeviceDetailConstants.PARAM_MODEL, str3);
Map<String, String> map4 = this.deviceDetails;
String str4 = Build.DEVICE;
kotlin.jvm.internal.j.h(str4, "DEVICE");
map4.put(DeviceDetailConstants.PARAM_DEVICE, str4);
Map<String, String> map5 = this.deviceDetails;
String str5 = Build.PRODUCT;
kotlin.jvm.internal.j.h(str5, "PRODUCT");
map5.put(DeviceDetailConstants.PARAM_PRODUCT, str5);
Map<String, String> map6 = this.deviceDetails;
String str6 = Build.VERSION.RELEASE;
kotlin.jvm.internal.j.h(str6, "RELEASE");
map6.put(DeviceDetailConstants.PARAM_ANDROID_VERSION, str6);
this.deviceDetails.put(DeviceDetailConstants.PARAM_SDK_VERSION, String.valueOf(Build.VERSION.SDK_INT));
}
@NotNull
public final String getAdvertisingId() {
if (this.adId.length() > 0) {
return this.adId;
}
if (this.job.f()) {
Job.a.a(this.job, (CancellationException) null, 1, (Object) null);
}
setAdId();
return this.adId;
}
@NotNull
public CoroutineContext getCoroutineContext() {
return H.b().Y0(this.job);
}
@NotNull
public final String getCurrentNetworkType(@NotNull Context context) {
NetworkCapabilities networkCapabilities;
kotlin.jvm.internal.j.i(context, "context");
try {
Object systemService = context.getSystemService("connectivity");
kotlin.jvm.internal.j.g(systemService, "null cannot be cast to non-null type android.net.ConnectivityManager");
ConnectivityManager connectivityManager = (ConnectivityManager) systemService;
Network activeNetwork = connectivityManager.getActiveNetwork();
return (activeNetwork == null || (networkCapabilities = connectivityManager.getNetworkCapabilities(activeNetwork)) == null) ? "NONE" : networkCapabilities.hasTransport(1) ? "WIFI" : networkCapabilities.hasTransport(0) ? "CELLULAR" : networkCapabilities.hasTransport(3) ? "ETHERNET" : "UNKNOWN";
} catch (Throwable th) {
th.getMessage();
return "NONE";
}
}
@NotNull
public final Map<String, String> getDeviceDetails() {
return this.deviceDetails;
}
@NotNull
public final String getPublicIP() {
if (this.publicIP.length() > 0) {
return this.publicIP;
}
if (this.job.f()) {
Job.a.a(this.job, (CancellationException) null, 1, (Object) null);
}
fetchPublicIP();
return this.publicIP;
}
@NotNull
public final String getSessionId() {
return this.SESSION_ID;
}
@NotNull
public final String getUserAgentString() {
String property = System.getProperty("http.agent");
if (property == null) {
property = "";
}
if (property.length() != 0) {
return property;
}
String property2 = System.getProperty("http.agent");
return property2 == null ? "" : property2;
}
}