正在查看: Handling Master v2 应用的 z1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Handling Master v2 应用的 z1.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.applovin.impl;
import android.os.Build;
import android.text.TextUtils;
import androidx.browser.trusted.sharing.ShareTarget;
import androidx.media3.common.C;
import com.applovin.impl.sdk.SessionTracker;
import com.applovin.impl.sdk.n;
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.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import java.io.OutputStream;
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.TimeUnit;
import org.json.JSONArray;
import org.json.JSONObject;
public abstract class z1 {
private static volatile ExecutorService g;
protected final com.applovin.impl.sdk.j a;
protected final n b;
private final y1.b c;
private final Map d = Collections.synchronizedMap(new HashMap());
private final Set e = Collections.synchronizedSet(new HashSet());
private static final int f = (int) TimeUnit.SECONDS.toMillis(30);
private static final Object h = new Object();
public z1(com.applovin.impl.sdk.j jVar, y1.b bVar) {
this.a = jVar;
this.b = jVar.I();
this.c = bVar;
a();
}
private void a() {
if (g != null) {
return;
}
synchronized (h) {
if (g != null) {
return;
}
g = Executors.newFixedThreadPool(1, new a(this));
}
}
private void c(y1 y1Var, List list) {
HttpURLConnection httpURLConnection;
Throwable th;
if (y1Var.a() == y1.b.a || y1Var.a() == y1.b.b || y1Var.a() == y1.b.d || !z6.a(((Integer) this.a.a(l4.z)).intValue())) {
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
Map map = (Map) it.next();
try {
httpURLConnection = (HttpURLConnection) a(y1Var, map).openConnection();
try {
int i = f;
httpURLConnection.setConnectTimeout(i);
httpURLConnection.setReadTimeout(i);
httpURLConnection.setDefaultUseCaches(false);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setDoOutput(false);
httpURLConnection.setRequestMethod(ShareTarget.METHOD_POST);
httpURLConnection.setRequestProperty("AppLovin-Event-Type", y1Var.b());
int responseCode = httpURLConnection.getResponseCode();
if (n.a()) {
this.b.a("HealthEventsReporter", y1Var.b() + " reported with code " + responseCode + " and extra parameters " + map);
}
this.d.put(y1Var, Long.valueOf(System.currentTimeMillis()));
} catch (Throwable th2) {
th = th2;
try {
if (n.a()) {
this.b.d("HealthEventsReporter", "Failed to report " + y1Var.b() + " with extra parameters " + map, th);
}
z6.a(httpURLConnection, this.a);
} finally {
z6.a(httpURLConnection, this.a);
}
}
} catch (Throwable th3) {
httpURLConnection = null;
th = th3;
}
}
}
public void d(y1 y1Var, Map map) {
a(y1Var, map, 0L);
}
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(C.UTF8_NAME);
httpURLConnection = (HttpURLConnection) url.openConnection();
} catch (Throwable th) {
th = th;
}
try {
int i = f;
httpURLConnection.setConnectTimeout(i);
httpURLConnection.setReadTimeout(i);
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(ShareTarget.METHOD_POST);
httpURLConnection.setRequestProperty("AppLovin-Event-Type", y1Var.b());
OutputStream outputStream = httpURLConnection.getOutputStream();
outputStream.write(bytes);
outputStream.close();
int responseCode = httpURLConnection.getResponseCode();
if (n.a()) {
this.b.a("HealthEventsReporter", y1Var.b() + " reported with code " + responseCode);
}
this.d.put(y1Var, Long.valueOf(System.currentTimeMillis()));
z6.a(httpURLConnection, this.a);
} catch (Throwable th2) {
th = th2;
httpURLConnection2 = httpURLConnection;
try {
if (n.a()) {
this.b.d("HealthEventsReporter", "Failed to report " + y1Var.b(), th);
}
} finally {
z6.a(httpURLConnection2, this.a);
}
}
}
private void d(final y1 y1Var, List list) {
final String str = (String) this.a.a(l4.A);
if (TextUtils.isEmpty(str)) {
return;
}
double a = y1Var.a(this.a);
if (z6.a(a)) {
if (((Boolean) this.a.a(l4.G)).booleanValue()) {
a(str, y1Var, a(y1Var, a, list));
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
final JSONObject a2 = a(y1Var, a, Collections.singletonList((Map) it.next()));
g.execute(new Runnable() {
@Override
public final void run() {
z1.this.a(str, y1Var, a2);
}
});
}
}
}
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.e.add(str2)) {
map.put("source", str);
a(y1Var, str, map);
}
}
public void a(y1 y1Var, Map map, long j) {
ArrayList arrayList = new ArrayList();
arrayList.add(map);
a(y1Var, arrayList, j);
}
public void a(final y1 y1Var, final List list, long j) {
if (a(y1Var, j)) {
return;
}
try {
if (z6.h()) {
g.execute(new Runnable() {
@Override
public final void run() {
z1.this.b(y1Var, list);
}
});
} else {
b(y1Var, list);
}
} catch (Throwable th) {
if (n.a()) {
this.b.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 (n.a()) {
this.b.a("HealthEventsReporter", "Reporting " + y1Var.b() + " with extra parameters collection " + list);
}
if (this.c != y1Var.a()) {
e1.a("Health event " + y1Var.b() + " category: " + y1Var.a() + " does not match the reporter category: " + this.c, new Object[0]);
}
c(y1Var, list);
d(y1Var, list);
}
private Map c(y1 y1Var, Map map) {
HashMap hashMap = new HashMap(map);
if (y1Var == y1.m0) {
hashMap.remove("details");
}
return hashMap;
}
private Map b(y1 y1Var, Map map) {
HashMap hashMap = new HashMap();
hashMap.put("type", y1Var.b());
if (y1Var == y1.i0 || y1Var == y1.x0 || y1Var == y1.v0) {
if (((Boolean) this.a.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.a.y().H(), hashMap);
}
Map K = this.a.y().K();
hashMap.put("platform", String.valueOf(K.get("platform")));
hashMap.put("country_code", String.valueOf(K.get("country_code")));
hashMap.put("cc", this.a.t().getCountryCode());
hashMap.put("applovin_random_token", this.a.a0());
hashMap.put("compass_random_token", this.a.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.a.a(l4.t));
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(), C.UTF8_NAME);
String encode2 = URLEncoder.encode((String) entry.getValue(), C.UTF8_NAME);
sb.append(encode);
sb.append("=");
sb.append(encode2);
if (it.hasNext()) {
sb.append("&");
}
}
return new URL(sb.toString());
}
private JSONObject a(y1 y1Var, double d, List list) {
JSONObject jSONObject = new JSONObject();
JsonUtils.putLong(jSONObject, "ts_ms", System.currentTimeMillis());
if (y1Var == y1.i0 || y1Var == y1.x0 || y1Var == y1.v0) {
if (((Boolean) this.a.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.a.y().H());
}
JSONObject jSONObject2 = new JSONObject();
Map K = this.a.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, "country_code", K.get("country_code"));
JsonUtils.putObject(jSONObject2, "cc", this.a.t().getCountryCode());
JsonUtils.putObject(jSONObject2, "applovin_random_token", this.a.a0());
JsonUtils.putObject(jSONObject2, "ad_review_sdk_version", StringUtils.emptyIfNull(h.b()));
Map C = this.a.y().C();
JsonUtils.putObject(jSONObject2, "sdk_version", C.get("sdk_version"));
JsonUtils.putObject(jSONObject2, "plugin_version", this.a.a(l4.v3));
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.a.a(l4.t));
JsonUtils.putObject(jSONObject2, "mediation_provider", this.a.O());
SessionTracker f0 = this.a.f0();
JsonUtils.putObject(jSONObject2, "app_state", f0.getCurrentApplicationState().b());
JsonUtils.putObject(jSONObject2, "app_state_duration_ms", Long.valueOf(f0.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", d);
JsonUtils.putString(jSONObject3, "level", "DEBUG");
a(map);
JsonUtils.putAll(jSONObject3, 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 a = this.a.D().a();
if (a 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) a).getAdIdNumber()));
} else if (a instanceof q2) {
q2 q2Var = (q2) a;
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 j) {
Long l = (Long) this.d.get(y1Var);
return System.currentTimeMillis() - (l != null ? l.longValue() : -1L) < j;
}
}