正在查看: Antivirus Cleaner v1.2.0.0 应用的 z1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Antivirus Cleaner v1.2.0.0 应用的 z1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.applovin.impl;
import android.os.Build;
import android.text.TextUtils;
import com.adjust.sdk.Constants;
import com.alex.AlexMaxConst;
import com.applovin.impl.sdk.SessionTracker;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.y1;
import com.applovin.sdk.AppLovinEventTypes;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import java.io.OutputStream;
import java.lang.Thread;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.json.JSONArray;
import org.json.JSONObject;
public abstract class z1 {
private static volatile ExecutorService f8308g;
protected final com.applovin.impl.sdk.j f8310a;
protected final com.applovin.impl.sdk.n f8311b;
private final y1.b f8312c;
private final Map f8313d = Collections.synchronizedMap(new HashMap());
private final Set f8314e = Collections.synchronizedSet(new HashSet());
private static final int f8307f = (int) TimeUnit.SECONDS.toMillis(30);
private static final Object f8309h = new Object();
public class a implements ThreadFactory {
public class C0100a implements Thread.UncaughtExceptionHandler {
public C0100a() {
}
@Override
public void uncaughtException(Thread thread, Throwable th) {
z1.this.f8310a.I();
if (com.applovin.impl.sdk.n.a()) {
z1.this.f8310a.I().a("HealthEventsReporter", "Caught unhandled exception", th);
}
}
}
public a() {
}
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, "AppLovinSdk:health_events_reporter");
thread.setDaemon(true);
thread.setPriority(((Integer) z1.this.f8310a.a(l4.Q)).intValue());
thread.setUncaughtExceptionHandler(new C0100a());
return thread;
}
}
public z1(com.applovin.impl.sdk.j jVar, y1.b bVar) {
this.f8310a = jVar;
this.f8311b = jVar.I();
this.f8312c = bVar;
a();
}
private void c(y1 y1Var, List list) {
HttpURLConnection httpURLConnection;
Throwable th;
if (y1Var.a() == y1.b.AD || y1Var.a() == y1.b.MEDIATED_AD || y1Var.a() == y1.b.USER_SESSION || !z6.a(((Integer) this.f8310a.a(l4.f6204z)).intValue())) {
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
Map map = (Map) it.next();
try {
httpURLConnection = (HttpURLConnection) a(y1Var, map).openConnection();
try {
int i4 = f8307f;
httpURLConnection.setConnectTimeout(i4);
httpURLConnection.setReadTimeout(i4);
httpURLConnection.setDefaultUseCaches(false);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setDoOutput(false);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("AppLovin-Event-Type", y1Var.b());
int responseCode = httpURLConnection.getResponseCode();
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.a("HealthEventsReporter", y1Var.b() + " reported with code " + responseCode + " and extra parameters " + map);
}
this.f8313d.put(y1Var, Long.valueOf(System.currentTimeMillis()));
} catch (Throwable th2) {
th = th2;
try {
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.d("HealthEventsReporter", "Failed to report " + y1Var.b() + " with extra parameters " + map, th);
}
z6.a(httpURLConnection, this.f8310a);
} finally {
z6.a(httpURLConnection, this.f8310a);
}
}
} catch (Throwable th3) {
httpURLConnection = null;
th = th3;
}
}
}
public void d(y1 y1Var, Map map) {
a(y1Var, map, 0L);
}
private void a() {
if (f8308g != null) {
return;
}
synchronized (f8309h) {
try {
if (f8308g != null) {
return;
}
f8308g = Executors.newFixedThreadPool(1, new a());
} catch (Throwable th) {
throw th;
}
}
}
private void d(final y1 y1Var, List list) {
final String str = (String) this.f8310a.a(l4.A);
if (TextUtils.isEmpty(str)) {
return;
}
double a4 = y1Var.a(this.f8310a);
if (z6.a(a4)) {
if (((Boolean) this.f8310a.a(l4.G)).booleanValue()) {
a(str, y1Var, a(y1Var, a4, list));
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
final JSONObject a5 = a(y1Var, a4, Collections.singletonList((Map) it.next()));
f8308g.execute(new Runnable() {
@Override
public final void run() {
z1.this.a(str, y1Var, a5);
}
});
}
}
}
public void a(String str, y1 y1Var, JSONObject jSONObject) {
byte[] bytes;
HttpURLConnection httpURLConnection;
HttpURLConnection httpURLConnection2 = null;
try {
URL url = new URL(str);
bytes = jSONObject.toString().getBytes(Constants.ENCODING);
httpURLConnection = (HttpURLConnection) url.openConnection();
} catch (Throwable th) {
th = th;
}
try {
int i4 = f8307f;
httpURLConnection.setConnectTimeout(i4);
httpURLConnection.setReadTimeout(i4);
httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=utf-8");
httpURLConnection.setDefaultUseCaches(false);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setFixedLengthStreamingMode(bytes.length);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("AppLovin-Event-Type", y1Var.b());
OutputStream outputStream = httpURLConnection.getOutputStream();
outputStream.write(bytes);
outputStream.close();
int responseCode = httpURLConnection.getResponseCode();
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.a("HealthEventsReporter", y1Var.b() + " reported with code " + responseCode);
}
this.f8313d.put(y1Var, Long.valueOf(System.currentTimeMillis()));
z6.a(httpURLConnection, this.f8310a);
} catch (Throwable th2) {
th = th2;
httpURLConnection2 = httpURLConnection;
try {
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.d("HealthEventsReporter", "Failed to report " + y1Var.b(), th);
}
} finally {
z6.a(httpURLConnection2, this.f8310a);
}
}
}
public void a(y1 y1Var, String str) {
a(y1Var, str, new HashMap());
}
public void a(y1 y1Var, String str, Map map) {
map.put("source", str);
d(y1Var, map);
}
public void a(y1 y1Var, String str, Map map, String str2) {
if (!StringUtils.isValidString(str2) || this.f8314e.add(str2)) {
map.put("source", str);
a(y1Var, str, map);
}
}
public void a(y1 y1Var, Map map, long j4) {
ArrayList arrayList = new ArrayList();
arrayList.add(map);
a(y1Var, arrayList, j4);
}
public void a(final y1 y1Var, final List list, long j4) {
if (a(y1Var, j4)) {
return;
}
try {
if (z6.h()) {
f8308g.execute(new Runnable() {
@Override
public final void run() {
z1.this.b(y1Var, list);
}
});
} else {
b(y1Var, list);
}
} catch (Throwable th) {
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.d("HealthEventsReporter", "Failed to report " + y1Var.b() + " with extra parameters collection " + list, th);
}
}
}
public void b(y1 y1Var, List list) {
if (AppLovinSdkUtils.isEmulator()) {
return;
}
if (com.applovin.impl.sdk.n.a()) {
this.f8311b.a("HealthEventsReporter", "Reporting " + y1Var.b() + " with extra parameters collection " + list);
}
if (this.f8312c != y1Var.a()) {
e1.a("Health event " + y1Var.b() + " category: " + y1Var.a() + " does not match the reporter category: " + this.f8312c, new Object[0]);
}
c(y1Var, list);
d(y1Var, list);
}
private Map c(y1 y1Var, Map map) {
HashMap hashMap = new HashMap(map);
if (y1Var == y1.f8224m0) {
hashMap.remove("details");
}
return hashMap;
}
private Map b(y1 y1Var, Map map) {
HashMap hashMap = new HashMap();
hashMap.put("type", y1Var.b());
if (y1Var == y1.f8216i0 || y1Var == y1.f8246x0 || y1Var == y1.f8242v0) {
if (((Boolean) this.f8310a.a(l4.X3)).booleanValue()) {
CollectionUtils.putStringIfValid("wvvc", String.valueOf(z7.d()), hashMap);
CollectionUtils.putStringIfValid("wvv", z7.c(), hashMap);
CollectionUtils.putStringIfValid("wvpn", z7.b(), hashMap);
}
CollectionUtils.putStringIfValid("oglv", this.f8310a.y().H(), hashMap);
}
Map K = this.f8310a.y().K();
hashMap.put("platform", String.valueOf(K.get("platform")));
hashMap.put(AlexMaxConst.KEY_COUNTRY_CODE, String.valueOf(K.get(AlexMaxConst.KEY_COUNTRY_CODE)));
hashMap.put("cc", this.f8310a.t().getCountryCode());
hashMap.put("applovin_random_token", this.f8310a.a0());
hashMap.put("compass_random_token", this.f8310a.s());
hashMap.put("model", Build.MODEL);
hashMap.put("brand", Build.MANUFACTURER);
hashMap.put("brand_name", Build.BRAND);
hashMap.put("hardware", Build.HARDWARE);
hashMap.put("revision", Build.DEVICE);
hashMap.put("os", Build.VERSION.RELEASE);
hashMap.put("api_level", String.valueOf(Build.VERSION.SDK_INT));
hashMap.put("sdk_version", String.valueOf(AppLovinSdk.VERSION));
CollectionUtils.putStringIfValid("ad_review_sdk_version", h.b(), hashMap);
hashMap.put("md", (String) this.f8310a.a(l4.f6176t));
b(hashMap);
a(hashMap);
if (map != null) {
hashMap.putAll(c(y1Var, map));
}
return hashMap;
}
private URL a(y1 y1Var, Map map) {
StringBuilder sb = new StringBuilder("https://ms.applovin.com/1.0/sdk/error");
sb.append("?");
Iterator it = b(y1Var, map).entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String encode = URLEncoder.encode((String) entry.getKey(), Constants.ENCODING);
String encode2 = URLEncoder.encode((String) entry.getValue(), Constants.ENCODING);
sb.append(encode);
sb.append("=");
sb.append(encode2);
if (it.hasNext()) {
sb.append("&");
}
}
return new URL(sb.toString());
}
private JSONObject a(y1 y1Var, double d4, List list) {
JSONObject jSONObject = new JSONObject();
JsonUtils.putLong(jSONObject, "ts_ms", System.currentTimeMillis());
if (y1Var == y1.f8216i0 || y1Var == y1.f8246x0 || y1Var == y1.f8242v0) {
if (((Boolean) this.f8310a.a(l4.X3)).booleanValue()) {
JsonUtils.putStringIfValid(jSONObject, "wvvc", String.valueOf(z7.d()));
JsonUtils.putStringIfValid(jSONObject, "wvv", z7.c());
JsonUtils.putStringIfValid(jSONObject, "wvpn", z7.b());
}
JsonUtils.putStringIfValid(jSONObject, "oglv", this.f8310a.y().H());
}
JSONObject jSONObject2 = new JSONObject();
Map K = this.f8310a.y().K();
JsonUtils.putObject(jSONObject2, "platform", K.get("platform"));
JsonUtils.putObject(jSONObject2, "os", K.get("os"));
JsonUtils.putObject(jSONObject2, "brand", K.get("brand"));
JsonUtils.putObject(jSONObject2, "model", K.get("model"));
JsonUtils.putObject(jSONObject2, "revision", K.get("revision"));
JsonUtils.putObject(jSONObject2, AlexMaxConst.KEY_COUNTRY_CODE, K.get(AlexMaxConst.KEY_COUNTRY_CODE));
JsonUtils.putObject(jSONObject2, "cc", this.f8310a.t().getCountryCode());
JsonUtils.putObject(jSONObject2, "applovin_random_token", this.f8310a.a0());
JsonUtils.putObject(jSONObject2, "ad_review_sdk_version", StringUtils.emptyIfNull(h.b()));
Map C = this.f8310a.y().C();
JsonUtils.putObject(jSONObject2, "sdk_version", C.get("sdk_version"));
JsonUtils.putObject(jSONObject2, "plugin_version", this.f8310a.a(l4.f6190v3));
JsonUtils.putObject(jSONObject2, "app_version", C.get("app_version"));
JsonUtils.putObject(jSONObject2, "package_name", C.get("package_name"));
JsonUtils.putObject(jSONObject2, "first_install", Boolean.toString(Boolean.TRUE.equals((Boolean) C.get("first_install_v2"))));
JsonUtils.putObject(jSONObject2, "md", this.f8310a.a(l4.f6176t));
JsonUtils.putObject(jSONObject2, "mediation_provider", this.f8310a.O());
SessionTracker f02 = this.f8310a.f0();
JsonUtils.putObject(jSONObject2, "app_state", f02.getCurrentApplicationState().b());
JsonUtils.putObject(jSONObject2, "app_state_duration_ms", Long.valueOf(f02.getCurrentApplicationStateDurationMillis()));
JsonUtils.putObject(jSONObject2, "session_duration_ms", Long.valueOf(System.currentTimeMillis() - com.applovin.impl.sdk.j.m()));
JsonUtils.putObject(jSONObject, "shared_fields", jSONObject2);
JSONArray jSONArray = new JSONArray();
Iterator it = list.iterator();
while (it.hasNext()) {
Map map = (Map) it.next();
JSONObject jSONObject3 = new JSONObject();
JsonUtils.putDouble(jSONObject3, "ts_ms", System.currentTimeMillis());
JsonUtils.putString(jSONObject3, "type", y1Var.b());
JsonUtils.putDouble(jSONObject3, "weight", d4);
JsonUtils.putString(jSONObject3, AppLovinEventTypes.USER_COMPLETED_LEVEL, "DEBUG");
a(map);
JsonUtils.putAll(jSONObject3, (Map<String, ?>) map);
jSONArray.put(jSONObject3);
}
JsonUtils.putObject(jSONObject, "events", jSONArray);
return jSONObject;
}
private void b(java.util.Map r6) {
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.z1.b(java.util.Map):void");
}
private void a(Map map) {
if (map == null) {
return;
}
Object a4 = this.f8310a.D().a();
if (a4 instanceof com.applovin.impl.sdk.ad.b) {
map.put("fs_ad_network", "AppLovin");
map.put("fs_ad_creative_id", Long.toString(((com.applovin.impl.sdk.ad.b) a4).getAdIdNumber()));
} else if (a4 instanceof q2) {
q2 q2Var = (q2) a4;
map.put("fs_ad_network", q2Var.getNetworkName());
map.put("fs_ad_creative_id", q2Var.getCreativeId());
} else {
map.put("fs_ad_network", "None");
map.put("fs_ad_creative_id", "None");
}
}
private boolean a(y1 y1Var, long j4) {
Long l4 = (Long) this.f8313d.get(y1Var);
return System.currentTimeMillis() - (l4 != null ? l4.longValue() : -1L) < j4;
}
}