正在查看: Clean Center v0.5.5 应用的 la.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clean Center v0.5.5 应用的 la.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.applovin.impl;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.text.format.Formatter;
import com.applovin.impl.ka;
import com.applovin.impl.sdk.AppLovinError;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxError;
import com.applovin.sdk.AppLovinAdSize;
import com.applovin.sdk.AppLovinEventTypes;
import com.applovin.sdk.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import java.io.File;
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 class la {
private static final int g = (int) TimeUnit.SECONDS.toMillis(30);
private JSONObject a;
private final ExecutorService b;
private final Map c = Collections.synchronizedMap(new HashMap());
private final Set d = Collections.synchronizedSet(new HashSet());
protected final com.applovin.impl.sdk.j e;
protected final com.applovin.impl.sdk.n f;
public la(com.applovin.impl.sdk.j jVar) {
this.e = jVar;
this.f = jVar.I();
this.b = Executors.newFixedThreadPool(1, new a(jVar));
}
class a implements ThreadFactory {
final com.applovin.impl.sdk.j a;
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, "AppLovinSdk:health_events_reporter");
thread.setDaemon(true);
thread.setPriority(((Integer) this.a.a(sj.U)).intValue());
thread.setUncaughtExceptionHandler(new C0103a());
return thread;
}
a(com.applovin.impl.sdk.j jVar) {
this.a = jVar;
}
class C0103a implements Thread.UncaughtExceptionHandler {
C0103a() {
}
@Override
public void uncaughtException(Thread thread, Throwable th) {
a.this.a.I();
if (com.applovin.impl.sdk.n.a()) {
a.this.a.I().a("HealthEventsReporter", "Caught unhandled exception", th);
}
}
}
}
private void c(ka kaVar, Object obj, List list) {
HttpURLConnection httpURLConnection;
Throwable th;
if (kaVar.a() == ka.b.AD || kaVar.a() == ka.b.USER_SESSION || !yp.a(((Integer) this.e.a(sj.D)).intValue())) {
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
Map map = (Map) it.next();
try {
httpURLConnection = (HttpURLConnection) a(kaVar, obj, map).openConnection();
try {
int i = g;
httpURLConnection.setConnectTimeout(i);
httpURLConnection.setReadTimeout(i);
httpURLConnection.setDefaultUseCaches(false);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setUseCaches(false);
httpURLConnection.setInstanceFollowRedirects(true);
httpURLConnection.setDoOutput(false);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("AppLovin-Event-Type", kaVar.b());
int responseCode = httpURLConnection.getResponseCode();
if (com.applovin.impl.sdk.n.a()) {
this.f.a("HealthEventsReporter", kaVar.b() + " reported with code " + responseCode + " and extra parameters " + map);
}
this.c.put(kaVar, Long.valueOf(System.currentTimeMillis()));
} catch (Throwable th2) {
th = th2;
try {
if (com.applovin.impl.sdk.n.a()) {
this.f.d("HealthEventsReporter", "Failed to report " + kaVar.b() + " with extra parameters " + map, th);
}
yp.a(httpURLConnection, this.e);
} finally {
yp.a(httpURLConnection, this.e);
}
}
} catch (Throwable th3) {
httpURLConnection = null;
th = th3;
}
}
}
private void d(final ka kaVar, final Object obj, List list) {
final String str = (String) this.e.a(sj.E);
if (TextUtils.isEmpty(str)) {
return;
}
double a2 = kaVar.a(this.e);
if (yp.a(a2)) {
if (((Boolean) this.e.a(sj.K)).booleanValue()) {
a(str, kaVar, obj, a(kaVar, a2, obj, list));
return;
}
Iterator it = list.iterator();
while (it.hasNext()) {
final JSONObject a3 = a(kaVar, a2, obj, Collections.singletonList((Map) it.next()));
this.b.execute(new Runnable() {
@Override
public final void run() {
la.this.a(str, kaVar, obj, a3);
}
});
}
}
}
private URL a(ka kaVar, Object obj, Map map) {
StringBuilder sb = new StringBuilder("https://ms.applovin.com/1.0/sdk/error?");
Iterator it = b(kaVar, obj, map).entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
String encode = URLEncoder.encode((String) entry.getKey(), "UTF-8");
sb.append(encode).append("=").append(URLEncoder.encode((String) entry.getValue(), "UTF-8"));
if (it.hasNext()) {
sb.append("&");
}
}
return new URL(sb.toString());
}
private Map b(ka kaVar, Object obj, Map map) {
HashMap hashMap = new HashMap();
hashMap.put("type", kaVar.b());
if (kaVar == ka.P || kaVar == ka.d0 || kaVar == ka.b0) {
if (((Boolean) this.e.a(sj.p4)).booleanValue()) {
CollectionUtils.putStringIfValid("wvvc", String.valueOf(sr.d()), hashMap);
CollectionUtils.putStringIfValid("wvv", sr.c(), hashMap);
CollectionUtils.putStringIfValid("wvpn", sr.b(), hashMap);
}
CollectionUtils.putStringIfValid("oglv", this.e.x().E(), hashMap);
}
Map H = this.e.x().H();
hashMap.put("platform", String.valueOf(H.get("platform")));
hashMap.put(com.anythink.expressad.foundation.g.a.bH, String.valueOf(H.get(com.anythink.expressad.foundation.g.a.bH)));
hashMap.put(com.anythink.expressad.f.a.b.h, this.e.s().getCountryCode());
hashMap.put("applovin_random_token", this.e.Z());
hashMap.put("compass_random_token", this.e.r());
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(com.anythink.expressad.foundation.g.a.bs, String.valueOf(AppLovinSdk.VERSION));
CollectionUtils.putStringIfValid("ad_review_sdk_version", v.b(), hashMap);
hashMap.put("md", (String) this.e.a(sj.v));
a(hashMap);
a(obj, hashMap);
if (map != null) {
hashMap.putAll(map);
}
return hashMap;
}
public static Map a(com.applovin.impl.sdk.ad.b bVar) {
return a(bVar, false, (com.applovin.impl.sdk.j) null);
}
public static Map a(com.applovin.impl.sdk.ad.b bVar, boolean z, com.applovin.impl.sdk.j jVar) {
HashMap hashMap = new HashMap();
if (bVar != null) {
CollectionUtils.putStringIfValid("ad_domain", bVar.getAdDomain(), hashMap);
CollectionUtils.putStringIfValid("ad_id", String.valueOf(bVar.getAdIdNumber()), hashMap);
MaxAdFormat d = bVar.getAdZone().d();
CollectionUtils.putStringIfValid("ad_format", d != null ? d.getLabel() : null, hashMap);
CollectionUtils.putStringIfValid("ad_zone_id", bVar.getAdZone().e(), hashMap);
CollectionUtils.putStringIfValid("clcode", bVar.getClCode(), hashMap);
CollectionUtils.putStringIfValid("dsp_id", bVar.getDspId(), hashMap);
CollectionUtils.putStringIfValid("dsp_name", bVar.getDspName(), hashMap);
CollectionUtils.putStringIfValid("ad_size", bVar.getSize().getLabel(), hashMap);
CollectionUtils.putBooleanIfValid("is_persisted_ad", Boolean.valueOf(bVar.G0()), hashMap);
if (z) {
if (((Boolean) jVar.a(sj.N)).booleanValue()) {
List i = bVar.i();
HashMap hashMap2 = new HashMap();
Iterator it = i.iterator();
while (it.hasNext()) {
String path = ((Uri) it.next()).getPath();
hashMap2.put(path, Formatter.formatFileSize(com.applovin.impl.sdk.j.m(), new File(path).length()));
}
hashMap.put(com.anythink.expressad.a.K, hashMap2.toString());
}
if ((bVar instanceof com.applovin.impl.sdk.ad.a) && ((Boolean) jVar.a(sj.O)).booleanValue()) {
hashMap.put("details", ((com.applovin.impl.sdk.ad.a) bVar).l1());
}
}
}
return hashMap;
}
public void a(String str, ka kaVar, Object obj, JSONObject jSONObject) {
HttpURLConnection httpURLConnection = null;
try {
URL url = new URL(str);
byte[] bytes = jSONObject.toString().getBytes("UTF-8");
HttpURLConnection httpURLConnection2 = (HttpURLConnection) url.openConnection();
try {
int i = g;
httpURLConnection2.setConnectTimeout(i);
httpURLConnection2.setReadTimeout(i);
httpURLConnection2.setRequestProperty(com.anythink.expressad.foundation.g.f.g.b.a, "application/json; charset=utf-8");
httpURLConnection2.setDefaultUseCaches(false);
httpURLConnection2.setAllowUserInteraction(false);
httpURLConnection2.setUseCaches(false);
httpURLConnection2.setInstanceFollowRedirects(true);
httpURLConnection2.setDoOutput(true);
httpURLConnection2.setFixedLengthStreamingMode(bytes.length);
httpURLConnection2.setRequestMethod("POST");
httpURLConnection2.setRequestProperty("AppLovin-Event-Type", kaVar.b());
OutputStream outputStream = httpURLConnection2.getOutputStream();
outputStream.write(bytes);
outputStream.close();
int responseCode = httpURLConnection2.getResponseCode();
if (com.applovin.impl.sdk.n.a()) {
this.f.a("HealthEventsReporter", kaVar.b() + " reported with code " + responseCode);
}
this.c.put(kaVar, Long.valueOf(System.currentTimeMillis()));
yp.a(httpURLConnection2, this.e);
} catch (Throwable th) {
th = th;
httpURLConnection = httpURLConnection2;
try {
if (com.applovin.impl.sdk.n.a()) {
this.f.d("HealthEventsReporter", "Failed to report " + kaVar.b(), th);
}
} finally {
yp.a(httpURLConnection, this.e);
}
}
} catch (Throwable th2) {
th = th2;
}
}
private AppLovinAdSize a(h0 h0Var, com.applovin.impl.sdk.ad.b bVar) {
AppLovinAdSize f = h0Var != null ? h0Var.f() : null;
if (f != null) {
return f;
}
if (bVar != null) {
return bVar.getSize();
}
return null;
}
private JSONObject a(ka kaVar, double d, Object obj, List list) {
JSONObject jSONObject = new JSONObject();
JsonUtils.putLong(jSONObject, "ts_ms", System.currentTimeMillis());
if (kaVar == ka.P || kaVar == ka.d0 || kaVar == ka.b0) {
if (((Boolean) this.e.a(sj.p4)).booleanValue()) {
JsonUtils.putStringIfValid(jSONObject, "wvvc", String.valueOf(sr.d()));
JsonUtils.putStringIfValid(jSONObject, "wvv", sr.c());
JsonUtils.putStringIfValid(jSONObject, "wvpn", sr.b());
}
JsonUtils.putStringIfValid(jSONObject, "oglv", this.e.x().E());
}
JSONObject jSONObject2 = new JSONObject();
Map H = this.e.x().H();
JsonUtils.putObject(jSONObject2, "platform", H.get("platform"));
JsonUtils.putObject(jSONObject2, "os", H.get("os"));
JsonUtils.putObject(jSONObject2, "brand", H.get("brand"));
JsonUtils.putObject(jSONObject2, "model", H.get("model"));
JsonUtils.putObject(jSONObject2, "revision", H.get("revision"));
JsonUtils.putObject(jSONObject2, com.anythink.expressad.foundation.g.a.bH, H.get(com.anythink.expressad.foundation.g.a.bH));
JsonUtils.putObject(jSONObject2, com.anythink.expressad.f.a.b.h, this.e.s().getCountryCode());
JsonUtils.putObject(jSONObject2, "applovin_random_token", this.e.Z());
JsonUtils.putObject(jSONObject2, "ad_review_sdk_version", StringUtils.emptyIfNull(v.b()));
Map B = this.e.x().B();
JsonUtils.putObject(jSONObject2, com.anythink.expressad.foundation.g.a.bs, B.get(com.anythink.expressad.foundation.g.a.bs));
JsonUtils.putObject(jSONObject2, "plugin_version", this.e.a(sj.K3));
JsonUtils.putObject(jSONObject2, "app_version", B.get("app_version"));
JsonUtils.putObject(jSONObject2, "package_name", B.get("package_name"));
JsonUtils.putObject(jSONObject2, "first_install", Boolean.toString(Boolean.TRUE.equals((Boolean) B.get("first_install_v2"))));
JsonUtils.putObject(jSONObject2, "md", this.e.a(sj.v));
JsonUtils.putObject(jSONObject2, "mediation_provider", this.e.N());
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", kaVar.b());
JsonUtils.putDouble(jSONObject3, "weight", d);
JsonUtils.putString(jSONObject3, AppLovinEventTypes.USER_COMPLETED_LEVEL, "DEBUG");
a(obj, map);
JsonUtils.putAll(jSONObject3, (Map<String, ?>) map);
jSONArray.put(jSONObject3);
}
JsonUtils.putObject(jSONObject, "events", jSONArray);
return jSONObject;
}
public static Map a(fe feVar) {
Map a2 = a((oe) feVar);
CollectionUtils.putStringIfValid("bcode", feVar.B(), a2);
CollectionUtils.putStringIfValid(com.anythink.expressad.foundation.d.d.n, feVar.getCreativeId(), a2);
CollectionUtils.putStringIfValid("ad_unit_id", feVar.getAdUnitId(), a2);
CollectionUtils.putStringIfValid("ad_format", feVar.getFormat().getLabel(), a2);
return a2;
}
private List a(String str) {
List<Integer> integerList = JsonUtils.getIntegerList(this.a, StringUtils.getHost(str), null);
return integerList == null ? JsonUtils.getIntegerList(this.a, com.anythink.core.express.b.a.f, null) : integerList;
}
private boolean a(ka kaVar, long j) {
Long l = (Long) this.c.get(kaVar);
return System.currentTimeMillis() - (l != null ? l.longValue() : -1L) < j;
}
public void a() {
this.a = JsonUtils.deserialize((String) this.e.a(sj.M));
}
public void a(String str, String str2, int i) {
a(str, str2, i, new HashMap());
}
public void a(String str, String str2, int i, HashMap hashMap) {
List a2 = a(str2);
boolean z = a2 != null;
if (z && a2.contains(Integer.valueOf(i))) {
return;
}
if (z || i >= 400) {
hashMap.put("source", str);
hashMap.put("url", StringUtils.emptyIfNull(str2));
hashMap.put("code", String.valueOf(i));
a(ka.Y, (Map) hashMap);
}
}
private void a(Object obj, Map map) {
if (map == null) {
return;
}
if (obj == null) {
obj = this.e.B().a();
}
if (obj 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) obj).getAdIdNumber()));
} else if (obj instanceof fe) {
fe feVar = (fe) obj;
map.put("fs_ad_network", feVar.getNetworkName());
map.put("fs_ad_creative_id", feVar.getCreativeId());
} else {
map.put("fs_ad_network", "None");
map.put("fs_ad_creative_id", "None");
}
}
private void a(java.util.Map r6) {
throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.la.a(java.util.Map):void");
}
public void a(final ka kaVar, final Object obj, final List list, long j) {
if (a(kaVar, j)) {
return;
}
try {
if (yp.h()) {
this.b.execute(new Runnable() {
@Override
public final void run() {
la.this.b(kaVar, obj, list);
}
});
} else {
b(kaVar, obj, list);
}
} catch (Throwable th) {
if (com.applovin.impl.sdk.n.a()) {
this.f.d("HealthEventsReporter", "Failed to report " + kaVar.b() + " with extra parameters collection " + list, th);
}
}
}
public void a(ka kaVar, h0 h0Var, AppLovinError appLovinError) {
a(kaVar, h0Var, (com.applovin.impl.sdk.ad.b) null, appLovinError);
}
private void a(ka kaVar, h0 h0Var, com.applovin.impl.sdk.ad.b bVar, AppLovinError appLovinError) {
if (((Boolean) this.e.a(sj.L)).booleanValue() && this.e.y0()) {
return;
}
HashMap hashMap = new HashMap();
if (bVar != null) {
hashMap.putAll(a(bVar));
}
if (h0Var != null) {
CollectionUtils.putStringIfValid("ad_zone_id", h0Var.e(), hashMap);
MaxAdFormat d = h0Var.d();
if (d != null) {
CollectionUtils.putStringIfValid("ad_format", d.getLabel(), hashMap);
}
}
AppLovinAdSize a2 = a(h0Var, bVar);
if (a2 != null) {
CollectionUtils.putStringIfValid("ad_size", a2.getLabel(), hashMap);
}
if (appLovinError != null) {
CollectionUtils.putStringIfValid("error_message", appLovinError.getMessage(), hashMap);
CollectionUtils.putStringIfValid("error_code", String.valueOf(appLovinError.getCode()), hashMap);
}
a(kaVar, (Map) hashMap);
}
public void a(ka kaVar, fe feVar) {
a(kaVar, feVar.getFormat(), feVar.getAdUnitId(), feVar, null);
}
public void a(ka kaVar, fe feVar, MaxError maxError) {
a(kaVar, feVar.getFormat(), feVar.getAdUnitId(), feVar, maxError);
}
public void a(ka kaVar, com.applovin.impl.sdk.ad.b bVar) {
a(kaVar, bVar != null ? bVar.getAdZone() : null, bVar, (AppLovinError) null);
}
private void a(ka kaVar, MaxAdFormat maxAdFormat, String str, fe feVar, MaxError maxError) {
HashMap hashMap = new HashMap();
if (feVar != null) {
hashMap.putAll(a(feVar));
} else {
CollectionUtils.putStringIfValid("ad_unit_id", str, hashMap);
CollectionUtils.putStringIfValid("ad_format", maxAdFormat.getLabel(), hashMap);
}
if (maxError != null) {
CollectionUtils.putStringIfValid("error_message", maxError.getMessage(), hashMap);
CollectionUtils.putStringIfValid("error_code", String.valueOf(maxError.getCode()), hashMap);
CollectionUtils.putStringIfValid("mediated_network_error_message", maxError.getMediatedNetworkErrorMessage(), hashMap);
CollectionUtils.putStringIfValid("mediated_network_error_code", String.valueOf(maxError.getMediatedNetworkErrorCode()), hashMap);
}
a(kaVar, (Map) hashMap);
}
public void a(ka kaVar, MaxAdFormat maxAdFormat, String str, MaxError maxError) {
a(kaVar, maxAdFormat, str, null, maxError);
}
public void a(ka kaVar, Object obj, Map map, long j) {
ArrayList arrayList = new ArrayList();
arrayList.add(map);
a(kaVar, obj, arrayList, j);
}
public void a(ka kaVar, String str) {
a(kaVar, str, (Map) new HashMap());
}
public void a(ka kaVar, String str, Map map) {
map.put("source", str);
a(kaVar, map);
}
public void a(ka kaVar, String str, Map map, String str2) {
if (!StringUtils.isValidString(str2) || this.d.add(str2)) {
map.put("source", str);
a(kaVar, str, map);
}
}
public void a(ka kaVar, Map map) {
a(kaVar, (Object) null, map, 0L);
}
public void a(ka kaVar, Map map, long j) {
a(kaVar, (Object) null, map, j);
}
public void a(String str, String str2, Throwable th) {
a(str, str2, th, new HashMap());
}
public void a(String str, String str2, Throwable th, Map map) {
a(str + ":" + str2, th, map);
}
public void a(String str, Throwable th) {
a(str, th, new HashMap());
}
public void a(String str, Throwable th, Map map) {
map.put("source", str);
map.put("top_main_method", th.toString());
ArrayList arrayList = new ArrayList();
arrayList.add(map);
for (Throwable th2 : th.getSuppressed()) {
HashMap hashMap = new HashMap();
CollectionUtils.putStringIfValid("source", str, hashMap);
CollectionUtils.putStringIfValid("top_main_method", th.toString(), hashMap);
CollectionUtils.putStringIfValid("suppressed_throwable", th2.toString(), hashMap);
arrayList.add(hashMap);
}
a(ka.R, (Object) null, arrayList, 0L);
}
public void a(String str, String str2, com.applovin.impl.sdk.ad.b bVar) {
HashMap hashMap = new HashMap();
hashMap.put("source", str);
hashMap.put("error_message", str2);
if (bVar != null) {
hashMap.putAll(a(bVar, true, this.e));
boolean K0 = bVar.K0();
hashMap.put("is_video_stream", String.valueOf(K0));
if (K0 && (bVar instanceof com.applovin.impl.sdk.ad.a)) {
CollectionUtils.putStringIfValid("video_url", ((com.applovin.impl.sdk.ad.a) bVar).o1(), hashMap);
} else {
CollectionUtils.putStringIfValid("video_url", bVar.Q(), hashMap);
}
}
a(ka.W, (Map) hashMap);
}
public static Map a(oe oeVar) {
HashMap hashMap = new HashMap(3);
CollectionUtils.putStringIfValid("network_name", oeVar.c(), hashMap);
String b = oeVar.b();
CollectionUtils.putStringIfValid(com.anythink.core.common.j.C, oeVar.b(), hashMap);
CollectionUtils.putStringIfValid("adapter_version", ze.a(b).getAdapterVersion(), hashMap);
return hashMap;
}
public static Map a(MaxError maxError) {
HashMap hashMap = new HashMap(4);
CollectionUtils.putStringIfValid("error_message", maxError.getMessage(), hashMap);
CollectionUtils.putStringIfValid("error_code", String.valueOf(maxError.getCode()), hashMap);
CollectionUtils.putStringIfValid("mediated_network_error_message", maxError.getMediatedNetworkErrorMessage(), hashMap);
CollectionUtils.putStringIfValid("mediated_network_error_code", String.valueOf(maxError.getMediatedNetworkErrorCode()), hashMap);
return hashMap;
}
public void b(ka kaVar, Object obj, List list) {
if (AppLovinSdkUtils.isEmulator()) {
return;
}
if (com.applovin.impl.sdk.n.a()) {
this.f.a("HealthEventsReporter", "Reporting " + kaVar.b() + " with extra parameters collection " + list);
}
c(kaVar, obj, list);
d(kaVar, obj, list);
}
}