Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9
以下内容为反编译后的 r.java 源代码,内容仅作参考
package com.applovin.impl.sdk;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.annotation.NonNull;
import com.amazon.device.ads.DtbDeviceData;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.sdk.AppLovinSdk;
import com.fyber.inneractive.sdk.activities.InneractiveRichMediaVideoPlayerActivityCore;
import com.google.android.gms.measurement.AppMeasurement;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.Thread;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;
public class r {
private static final int aFp = (int) TimeUnit.SECONDS.toMillis(30);
private final ExecutorService aFq;
private final Map<a, Long> aFr = Collections.synchronizedMap(new HashMap());
private final Set<String> aFs = Collections.synchronizedSet(new HashSet());
protected final x logger;
protected final n sdk;
public enum a {
ANR("anr"),
BLACK_VIEW("black_view"),
CACHE_ERROR("cache_error"),
CAUGHT_EXCEPTION("caught_exception"),
CRASH(AppMeasurement.CRASH_ORIGIN),
DISPLAY_ERROR("display_error"),
FILE_ERROR("file_error"),
GENERIC("generic"),
INTEGRATION_ERROR("integration_error"),
MEDIA_ERROR("media_error"),
NETWORK_ERROR("network_error"),
TASK_EXCEPTION("task_exception"),
TASK_LATENCY_ALERT("task_latency_alert"),
TEMPLATE_ERROR("template_error"),
WEB_VIEW_ERROR("web_view_error");
private final String Jn;
a(String str) {
this.Jn = str;
}
public String uf() {
return this.Jn;
}
}
public r(final n nVar) {
this.sdk = nVar;
this.logger = nVar.Ci();
this.aFq = Executors.newFixedThreadPool(1, new ThreadFactory() {
{
r.this = this;
}
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, "AppLovinSdk:error_reporter");
thread.setDaemon(true);
thread.setPriority(((Integer) nVar.a(com.applovin.impl.sdk.c.b.aMj)).intValue());
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
{
AnonymousClass1.this = this;
}
@Override
public void uncaughtException(@NonNull Thread thread2, @NonNull Throwable th) {
nVar.Ci();
if (x.FL()) {
nVar.Ci().c("ErrorReporter", "Caught unhandled exception", th);
}
}
});
return thread;
}
});
}
public void g(a aVar, Object obj, Map<String, String> map) {
if (com.applovin.impl.sdk.utils.t.m((Integer) this.sdk.a(com.applovin.impl.sdk.c.b.aLD))) {
b(aVar, obj, map);
}
if (((Boolean) this.sdk.a(com.applovin.impl.sdk.c.b.aLE)).booleanValue()) {
c(aVar, obj, map);
}
}
public static void a(r rVar, a aVar, Object obj, Map map) {
rVar.g(aVar, obj, map);
}
private void a(Object obj, Map<String, String> map) {
if (obj == null) {
obj = this.sdk.CA().FB();
}
if (obj instanceof com.applovin.impl.sdk.ad.e) {
map.put("fs_ad_network", "AppLovin");
map.put("fs_ad_creative_id", Long.toString(((com.applovin.impl.sdk.ad.e) obj).getAdIdNumber()));
} else if (!(obj instanceof com.applovin.impl.mediation.b.a)) {
map.put("fs_ad_network", "None");
map.put("fs_ad_creative_id", "None");
} else {
com.applovin.impl.mediation.b.a aVar = (com.applovin.impl.mediation.b.a) obj;
map.put("fs_ad_network", aVar.getNetworkName());
map.put("fs_ad_creative_id", aVar.getCreativeId());
}
}
private boolean a(a aVar, long j) {
Long l = this.aFr.get(aVar);
return System.currentTimeMillis() - (l != null ? l.longValue() : -1L) < j;
}
private void b(a aVar, Object obj, Map<String, String> map) {
if (x.FL()) {
x xVar = this.logger;
xVar.f("ErrorReporter", "Reporting " + aVar.uf() + " error...");
}
HttpURLConnection httpURLConnection = null;
try {
HttpURLConnection httpURLConnection2 = (HttpURLConnection) d(aVar, obj, map).openConnection();
try {
int i = aFp;
httpURLConnection2.setConnectTimeout(i);
httpURLConnection2.setReadTimeout(i);
httpURLConnection2.setDefaultUseCaches(false);
httpURLConnection2.setAllowUserInteraction(false);
httpURLConnection2.setUseCaches(false);
httpURLConnection2.setInstanceFollowRedirects(true);
httpURLConnection2.setDoOutput(false);
httpURLConnection2.setRequestMethod("POST");
int responseCode = httpURLConnection2.getResponseCode();
if (x.FL()) {
x xVar2 = this.logger;
xVar2.f("ErrorReporter", aVar.uf() + " reported with code " + responseCode);
}
this.aFr.put(aVar, Long.valueOf(System.currentTimeMillis()));
com.applovin.impl.sdk.utils.t.a(httpURLConnection2, this.sdk);
} catch (Throwable th) {
th = th;
httpURLConnection = httpURLConnection2;
try {
if (x.FL()) {
x xVar3 = this.logger;
xVar3.b("ErrorReporter", "Failed to report " + aVar.uf(), th);
}
} finally {
com.applovin.impl.sdk.utils.t.a(httpURLConnection, this.sdk);
}
}
} catch (Throwable th2) {
th = th2;
}
}
private void c(a aVar, Object obj, Map<String, String> map) {
byte[] bytes;
HttpURLConnection httpURLConnection;
String str = (String) this.sdk.a(com.applovin.impl.sdk.c.b.aLG);
if (StringUtils.isValidString(str) && com.applovin.impl.sdk.utils.t.m((Integer) this.sdk.a(com.applovin.impl.sdk.c.b.aLF))) {
HttpURLConnection httpURLConnection2 = null;
try {
URL url = new URL(str);
bytes = f(aVar, obj, map).toString().getBytes("UTF-8");
httpURLConnection = (HttpURLConnection) url.openConnection();
} catch (Throwable th) {
th = th;
}
try {
int i = aFp;
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("POST");
OutputStream outputStream = httpURLConnection.getOutputStream();
outputStream.write(bytes);
outputStream.close();
int responseCode = httpURLConnection.getResponseCode();
if (x.FL()) {
x xVar = this.logger;
xVar.f("ErrorReporter", aVar.uf() + " reported with code " + responseCode);
}
this.aFr.put(aVar, Long.valueOf(System.currentTimeMillis()));
com.applovin.impl.sdk.utils.t.a(httpURLConnection, this.sdk);
} catch (Throwable th2) {
th = th2;
httpURLConnection2 = httpURLConnection;
try {
if (x.FL()) {
x xVar2 = this.logger;
xVar2.b("ErrorReporter", "Failed to report " + aVar.uf(), th);
}
} finally {
com.applovin.impl.sdk.utils.t.a(httpURLConnection2, this.sdk);
}
}
}
}
private URL d(a aVar, Object obj, Map<String, String> map) throws MalformedURLException, UnsupportedEncodingException {
StringBuilder sb = new StringBuilder("https://ms.applovin.com/1.0/sdk/error?");
Iterator<Map.Entry<String, String>> it = e(aVar, obj, map).entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> next = it.next();
String encode = URLEncoder.encode(next.getKey(), "UTF-8");
String encode2 = URLEncoder.encode(next.getValue(), "UTF-8");
sb.append(encode);
sb.append("=");
sb.append(encode2);
if (it.hasNext()) {
sb.append("&");
}
}
return new URL(sb.toString());
}
private Map<String, String> e(a aVar, Object obj, Map<String, String> map) {
HashMap hashMap = new HashMap();
hashMap.put("type", aVar.uf());
if (aVar == a.BLACK_VIEW || aVar == a.WEB_VIEW_ERROR || aVar == a.TEMPLATE_ERROR) {
if (((Boolean) this.sdk.a(com.applovin.impl.sdk.c.b.aQM)).booleanValue()) {
CollectionUtils.putStringIfValid("wvvc", String.valueOf(af.FY()), hashMap);
CollectionUtils.putStringIfValid("wvv", af.FZ(), hashMap);
CollectionUtils.putStringIfValid("wvpn", af.Ga(), hashMap);
}
if (this.sdk.Cr() != null) {
CollectionUtils.putStringIfValid("oglv", this.sdk.Cq().Eu(), hashMap);
} else {
CollectionUtils.putStringIfValid("oglv", this.sdk.Co().DX(), hashMap);
}
}
if (this.sdk.Cr() != null) {
hashMap.put("platform", this.sdk.Cq().EB());
} else {
hashMap.put("platform", this.sdk.Co().Dt());
}
hashMap.put("applovin_random_token", this.sdk.BW());
hashMap.put("compass_random_token", this.sdk.BV());
hashMap.put(DtbDeviceData.DEVICE_DATA_MODEL_KEY, 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", f.getVersion(), hashMap);
hashMap.put("aei", String.valueOf(this.sdk.a(com.applovin.impl.sdk.c.b.aLQ)));
hashMap.put("mei", String.valueOf(this.sdk.a(com.applovin.impl.sdk.c.b.aLR)));
hashMap.put("md", (String) this.sdk.a(com.applovin.impl.sdk.c.b.aLS));
i(hashMap);
a(obj, hashMap);
if (map != null) {
hashMap.putAll(map);
}
return hashMap;
}
private JSONObject f(a aVar, Object obj, Map<String, String> map) {
Map<String, Object> Dx;
JSONObject jSONObject = new JSONObject();
JsonUtils.putStringIfValid(jSONObject, "event_type", aVar.uf());
if (aVar == a.BLACK_VIEW || aVar == a.WEB_VIEW_ERROR || aVar == a.TEMPLATE_ERROR) {
if (((Boolean) this.sdk.a(com.applovin.impl.sdk.c.b.aQM)).booleanValue()) {
JsonUtils.putStringIfValid(jSONObject, "wvvc", String.valueOf(af.FY()));
JsonUtils.putStringIfValid(jSONObject, "wvv", af.FZ());
JsonUtils.putStringIfValid(jSONObject, "wvpn", af.Ga());
}
if (this.sdk.Cr() != null) {
JsonUtils.putStringIfValid(jSONObject, "oglv", this.sdk.Cq().Eu());
} else {
JsonUtils.putStringIfValid(jSONObject, "oglv", this.sdk.Co().DX());
}
}
if (this.sdk.Cr() != null) {
JsonUtils.putStringIfValid(jSONObject, "platform", this.sdk.Cq().EB());
Dx = this.sdk.Cr().Ef();
} else {
JsonUtils.putStringIfValid(jSONObject, "platform", this.sdk.Co().Dt());
Dx = this.sdk.Co().Dx();
}
JsonUtils.putObject(jSONObject, "first_install", Dx.get("first_install_v2"));
JsonUtils.putStringIfValid(jSONObject, "rid", UUID.randomUUID().toString());
JsonUtils.putStringIfValid(jSONObject, "applovin_random_token", this.sdk.BW());
JsonUtils.putStringIfValid(jSONObject, "compass_random_token", this.sdk.BV());
JsonUtils.putStringIfValid(jSONObject, "ts_ms", String.valueOf(System.currentTimeMillis()));
JsonUtils.putStringIfValid(jSONObject, "cfug", String.valueOf(this.sdk.getConfiguration().getConsentFlowUserGeography()));
a(obj, map);
JsonUtils.putObject(jSONObject, "extra_parameters", map);
JsonUtils.putStringIfValid(jSONObject, "sdk_version", String.valueOf(AppLovinSdk.VERSION));
JsonUtils.putStringIfValid(jSONObject, "os", Build.VERSION.RELEASE);
JsonUtils.putStringIfValid(jSONObject, "api_level", String.valueOf(Build.VERSION.SDK_INT));
JsonUtils.putStringIfValid(jSONObject, "brand", Build.MANUFACTURER);
JsonUtils.putStringIfValid(jSONObject, "brand_name", Build.BRAND);
JsonUtils.putStringIfValid(jSONObject, "hardware", Build.HARDWARE);
JsonUtils.putStringIfValid(jSONObject, "revision", Build.DEVICE);
JsonUtils.putStringIfValid(jSONObject, DtbDeviceData.DEVICE_DATA_MODEL_KEY, Build.MODEL);
JsonUtils.putStringIfValid(jSONObject, "country", this.sdk.getConfiguration().getCountryCode());
JsonUtils.putStringIfValid(jSONObject, "aei", String.valueOf(this.sdk.a(com.applovin.impl.sdk.c.b.aLQ)));
JsonUtils.putStringIfValid(jSONObject, "mei", String.valueOf(this.sdk.a(com.applovin.impl.sdk.c.b.aLR)));
JsonUtils.putStringIfValid(jSONObject, "md", (String) this.sdk.a(com.applovin.impl.sdk.c.b.aLS));
JsonUtils.putObject(jSONObject, "package_name", Dx.get("package_name"));
JsonUtils.putObject(jSONObject, "app_version", Dx.get("app_version"));
JsonUtils.putStringIfValid(jSONObject, "mediation_provider", this.sdk.getMediationProvider());
JsonUtils.putInt(jSONObject, "installed_mediation_adapters_count", com.applovin.impl.mediation.e.c.f(this.sdk).length());
JsonUtils.putStringIfValid(jSONObject, "ad_review_sdk_version", f.getVersion());
return jSONObject;
}
private void i(Map<String, String> map) {
String str;
PackageInfo packageInfo;
PackageManager packageManager;
try {
packageManager = n.getApplicationContext().getPackageManager();
str = n.getApplicationContext().getPackageName();
} catch (Throwable unused) {
str = "";
}
try {
packageInfo = packageManager.getPackageInfo(str, 0);
} catch (Throwable unused2) {
packageInfo = null;
map.put("package_name", str);
map.put("app_version", packageInfo != null ? packageInfo.versionName : "");
map.put("app_version_code", String.valueOf(packageInfo != null ? packageInfo.versionCode : 0));
}
map.put("package_name", str);
map.put("app_version", packageInfo != null ? packageInfo.versionName : "");
map.put("app_version_code", String.valueOf(packageInfo != null ? packageInfo.versionCode : 0));
}
public void a(a aVar, Object obj, Map<String, String> map, long j) {
if (a(aVar, j)) {
return;
}
try {
if (com.applovin.impl.sdk.utils.t.Mq()) {
this.aFq.execute(new myobfuscated.u8.h(this, aVar, obj, map, 1));
} else {
g(aVar, obj, map);
}
} catch (Throwable th) {
if (x.FL()) {
x xVar = this.logger;
xVar.b("ErrorReporter", "Failed to report " + aVar.uf(), th);
}
}
}
public void a(a aVar, String str) {
a(aVar, str, (Map<String, String>) new HashMap());
}
public void a(a aVar, String str, Map<String, String> map) {
map.put("source", str);
a(aVar, map);
}
public void a(a aVar, String str, Map<String, String> map, String str2) {
if (!StringUtils.isValidString(str2) || this.aFs.add(str2)) {
map.put("source", str);
a(aVar, str, map);
}
}
public void a(a aVar, Map<String, String> map) {
a(aVar, (Object) null, map, 0L);
}
public void a(a aVar, Map<String, String> map, long j) {
a(aVar, (Object) null, map, j);
}
public void a(String str, String str2, int i, HashMap<String, String> hashMap) {
if (i < 400) {
return;
}
hashMap.put("source", str);
hashMap.put("url", StringUtils.emptyIfNull(str2));
hashMap.put("code", String.valueOf(i));
a(a.NETWORK_ERROR, (Map<String, String>) hashMap);
}
public void a(String str, String str2, com.applovin.impl.sdk.ad.e eVar) {
HashMap hashMap = new HashMap();
if (eVar != null) {
CollectionUtils.putStringIfValid("ad_size", eVar.getSize().toString(), hashMap);
CollectionUtils.putStringIfValid("ad_id", String.valueOf(eVar.getAdIdNumber()), hashMap);
CollectionUtils.putStringIfValid("dsp_name", eVar.getDspName(), hashMap);
CollectionUtils.putStringIfValid("dsp_id", eVar.getDspId(), hashMap);
CollectionUtils.putStringIfValid("ad_domain", eVar.getAdDomain(), hashMap);
CollectionUtils.putStringIfValid(InneractiveRichMediaVideoPlayerActivityCore.VIDEO_URL, eVar.Gh(), hashMap);
}
hashMap.put("source", str);
hashMap.put("top_main_method", str2);
a(a.MEDIA_ERROR, (Map<String, String>) hashMap);
}
public void a(String str, String str2, Throwable th, Map<String, String> map) {
a(myobfuscated.b02.b.n(str, ":", str2), th, map);
}
public void a(String str, Throwable th, Map<String, String> map) {
map.put("source", str);
map.put("top_main_method", th.toString());
a(a.CAUGHT_EXCEPTION, map);
}
public void c(String str, String str2, int i) {
a(str, str2, i, new HashMap<>());
}
public void d(String str, String str2, Throwable th) {
a(str, str2, th, new HashMap());
}
public void g(String str, Throwable th) {
a(str, th, new HashMap());
}
}