导航菜单

页面标题

页面副标题

Jurassic World v1.83.4 - ma.java 源代码

正在查看: Jurassic World v1.83.4 应用的 ma.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.applovin.impl;

import android.os.Build;
import android.text.TextUtils;
import com.applovin.impl.la;
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.AppLovinSdk;
import com.applovin.sdk.AppLovinSdkUtils;
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
import com.facebook.internal.security.CertificateUtil;
import com.google.common.net.HttpHeaders;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.google.firebase.perf.FirebasePerformance;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.OutputStream;
import java.lang.Thread;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
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 ma {
    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 ma(com.applovin.impl.sdk.j jVar) {
        this.e = jVar;
        this.f = jVar.J();
        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.Y)).intValue());
            thread.setUncaughtExceptionHandler(new C0012a());
            return thread;
        }

        a(com.applovin.impl.sdk.j jVar) {
            this.a = jVar;
        }

        class C0012a implements Thread.UncaughtExceptionHandler {
            C0012a() {
            }

            @Override
            public void uncaughtException(Thread thread, Throwable th) {
                a.this.a.J();
                if (com.applovin.impl.sdk.n.a()) {
                    a.this.a.J().a("HealthEventsReporter", "Caught unhandled exception", th);
                }
            }
        }
    }

    private void c(la laVar, Object obj, List list) {
        HttpURLConnection httpURLConnection;
        Throwable th;
        if (laVar.a() == la.b.AD || laVar.a() == la.b.USER_SESSION || !yp.a(((Integer) this.e.a(sj.J)).intValue())) {
            return;
        }
        Iterator it = list.iterator();
        while (it.hasNext()) {
            Map map = (Map) it.next();
            try {
                httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(a(laVar, 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(FirebasePerformance.HttpMethod.POST);
                    int responseCode = httpURLConnection.getResponseCode();
                    if (com.applovin.impl.sdk.n.a()) {
                        this.f.a("HealthEventsReporter", laVar.b() + " reported with code " + responseCode + " and extra parameters " + map);
                    }
                    this.c.put(laVar, Long.valueOf(System.currentTimeMillis()));
                } catch (Throwable th2) {
                    th = th2;
                    try {
                        if (com.applovin.impl.sdk.n.a()) {
                            this.f.d("HealthEventsReporter", "Failed to report " + laVar.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 la laVar, final Object obj, List list) {
        final String str = (String) this.e.a(sj.K);
        if (TextUtils.isEmpty(str)) {
            return;
        }
        double a2 = laVar.a(this.e);
        if (yp.a(a2)) {
            if (((Boolean) this.e.a(sj.Q)).booleanValue()) {
                a(str, laVar, obj, a(laVar, a2, obj, list));
                return;
            }
            Iterator it = list.iterator();
            while (it.hasNext()) {
                final JSONObject a3 = a(laVar, a2, obj, Collections.singletonList((Map) it.next()));
                this.b.execute(new Runnable() {
                    @Override
                    public final void run() {
                        ma.this.a(str, laVar, obj, a3);
                    }
                });
            }
        }
    }

    private URL a(la laVar, Object obj, Map map) {
        StringBuilder sb = new StringBuilder("https://ms.applovin.com/1.0/sdk/error");
        sb.append("?");
        Iterator it = b(laVar, 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(la laVar, Object obj, Map map) {
        HashMap hashMap = new HashMap();
        hashMap.put("type", laVar.b());
        if (laVar == la.F || laVar == la.T || laVar == la.R) {
            if (((Boolean) this.e.a(sj.x4)).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.y().D(), hashMap);
        }
        Map G = this.e.y().G();
        hashMap.put("platform", String.valueOf(G.get("platform")));
        hashMap.put("country_code", String.valueOf(G.get("country_code")));
        hashMap.put("cc", this.e.r().getCountryCode());
        hashMap.put("applovin_random_token", this.e.a0());
        hashMap.put("compass_random_token", this.e.q());
        hashMap.put(DeviceRequestsHelper.DEVICE_INFO_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", 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) {
        HashMap hashMap = new HashMap(8);
        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(FirebaseAnalytics.Param.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);
        }
        return hashMap;
    }

    public void a(String str, la laVar, Object obj, JSONObject jSONObject) {
        byte[] bytes;
        HttpURLConnection httpURLConnection;
        HttpURLConnection httpURLConnection2 = null;
        try {
            URL url = new URL(str);
            bytes = jSONObject.toString().getBytes("UTF-8");
            httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
        } catch (Throwable th) {
            th = th;
        }
        try {
            int i = g;
            httpURLConnection.setConnectTimeout(i);
            httpURLConnection.setReadTimeout(i);
            httpURLConnection.setRequestProperty(HttpHeaders.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(FirebasePerformance.HttpMethod.POST);
            OutputStream outputStream = httpURLConnection.getOutputStream();
            outputStream.write(bytes);
            outputStream.close();
            int responseCode = httpURLConnection.getResponseCode();
            if (com.applovin.impl.sdk.n.a()) {
                this.f.a("HealthEventsReporter", laVar.b() + " reported with code " + responseCode);
            }
            this.c.put(laVar, Long.valueOf(System.currentTimeMillis()));
            yp.a(httpURLConnection, this.e);
        } catch (Throwable th2) {
            th = th2;
            httpURLConnection2 = httpURLConnection;
            try {
                if (com.applovin.impl.sdk.n.a()) {
                    this.f.d("HealthEventsReporter", "Failed to report " + laVar.b(), th);
                }
            } finally {
                yp.a(httpURLConnection2, this.e);
            }
        }
    }

    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(la laVar, double d, Object obj, List list) {
        JSONObject jSONObject = new JSONObject();
        JsonUtils.putLong(jSONObject, "ts_ms", System.currentTimeMillis());
        if (laVar == la.F || laVar == la.T || laVar == la.R) {
            if (((Boolean) this.e.a(sj.x4)).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.y().D());
        }
        JSONObject jSONObject2 = new JSONObject();
        Map G = this.e.y().G();
        JsonUtils.putObject(jSONObject2, "platform", G.get("platform"));
        JsonUtils.putObject(jSONObject2, "os", G.get("os"));
        JsonUtils.putObject(jSONObject2, "brand", G.get("brand"));
        JsonUtils.putObject(jSONObject2, DeviceRequestsHelper.DEVICE_INFO_MODEL, G.get(DeviceRequestsHelper.DEVICE_INFO_MODEL));
        JsonUtils.putObject(jSONObject2, "revision", G.get("revision"));
        JsonUtils.putObject(jSONObject2, "country_code", G.get("country_code"));
        JsonUtils.putObject(jSONObject2, "cc", this.e.r().getCountryCode());
        JsonUtils.putObject(jSONObject2, "applovin_random_token", this.e.a0());
        JsonUtils.putObject(jSONObject2, "ad_review_sdk_version", StringUtils.emptyIfNull(v.b()));
        Map A = this.e.y().A();
        JsonUtils.putObject(jSONObject2, "sdk_version", A.get("sdk_version"));
        JsonUtils.putObject(jSONObject2, "app_version", A.get("app_version"));
        JsonUtils.putObject(jSONObject2, "package_name", A.get("package_name"));
        JsonUtils.putObject(jSONObject2, "first_install", Boolean.toString(Boolean.TRUE.equals((Boolean) A.get("first_install_v2"))));
        JsonUtils.putObject(jSONObject2, "md", this.e.a(sj.v));
        JsonUtils.putObject(jSONObject2, "mediation_provider", this.e.O());
        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", laVar.b());
            JsonUtils.putDouble(jSONObject3, "weight", d);
            JsonUtils.putString(jSONObject3, "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(ge geVar) {
        Map a2 = a((pe) geVar);
        CollectionUtils.putStringIfValid("bcode", geVar.C(), a2);
        CollectionUtils.putStringIfValid("creative_id", geVar.getCreativeId(), a2);
        CollectionUtils.putStringIfValid("ad_unit_id", geVar.getAdUnitId(), a2);
        CollectionUtils.putStringIfValid(FirebaseAnalytics.Param.AD_FORMAT, geVar.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, "default", null) : integerList;
    }

    private boolean a(la laVar, long j) {
        Long l = (Long) this.c.get(laVar);
        return System.currentTimeMillis() - (l != null ? l.longValue() : -1L) < j;
    }

    public void a() {
        this.a = JsonUtils.deserialize((String) this.e.a(sj.S));
    }

    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(la.O, (Map) hashMap);
        }
    }

    private void a(Object obj, Map map) {
        if (map == null) {
            return;
        }
        if (obj == null) {
            obj = this.e.C().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 ge) {
            ge geVar = (ge) obj;
            map.put("fs_ad_network", geVar.getNetworkName());
            map.put("fs_ad_creative_id", geVar.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.ma.a(java.util.Map):void");
    }

    public void a(final la laVar, final Object obj, final List list, long j) {
        if (a(laVar, j)) {
            return;
        }
        try {
            if (yp.h()) {
                this.b.execute(new Runnable() {
                    @Override
                    public final void run() {
                        ma.this.b(laVar, obj, list);
                    }
                });
            } else {
                b(laVar, obj, list);
            }
        } catch (Throwable th) {
            if (com.applovin.impl.sdk.n.a()) {
                this.f.d("HealthEventsReporter", "Failed to report " + laVar.b() + " with extra parameters collection " + list, th);
            }
        }
    }

    public void a(la laVar, h0 h0Var, AppLovinError appLovinError) {
        a(laVar, h0Var, (com.applovin.impl.sdk.ad.b) null, appLovinError);
    }

    private void a(la laVar, h0 h0Var, com.applovin.impl.sdk.ad.b bVar, AppLovinError appLovinError) {
        if (((Boolean) this.e.a(sj.R)).booleanValue() && this.e.A0()) {
            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(FirebaseAnalytics.Param.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(laVar, (Map) hashMap);
    }

    public void a(la laVar, ge geVar) {
        a(laVar, geVar.getFormat(), geVar.getAdUnitId(), geVar, null);
    }

    public void a(la laVar, ge geVar, MaxError maxError) {
        a(laVar, geVar.getFormat(), geVar.getAdUnitId(), geVar, maxError);
    }

    public void a(la laVar, com.applovin.impl.sdk.ad.b bVar) {
        a(laVar, bVar != null ? bVar.getAdZone() : null, bVar, (AppLovinError) null);
    }

    private void a(la laVar, MaxAdFormat maxAdFormat, String str, ge geVar, MaxError maxError) {
        HashMap hashMap = new HashMap();
        if (geVar != null) {
            hashMap.putAll(a(geVar));
        } else {
            CollectionUtils.putStringIfValid("ad_unit_id", str, hashMap);
            CollectionUtils.putStringIfValid(FirebaseAnalytics.Param.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(laVar, (Map) hashMap);
    }

    public void a(la laVar, MaxAdFormat maxAdFormat, String str, MaxError maxError) {
        a(laVar, maxAdFormat, str, null, maxError);
    }

    public void a(la laVar, Object obj, Map map, long j) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(map);
        a(laVar, obj, arrayList, j);
    }

    public void a(la laVar, String str) {
        a(laVar, str, (Map) new HashMap());
    }

    public void a(la laVar, String str, Map map) {
        map.put("source", str);
        a(laVar, map);
    }

    public void a(la laVar, String str, Map map, String str2) {
        if (!StringUtils.isValidString(str2) || this.d.add(str2)) {
            map.put("source", str);
            a(laVar, str, map);
        }
    }

    public void a(la laVar, Map map) {
        a(laVar, (Object) null, map, 0L);
    }

    public void a(la laVar, Map map, long j) {
        a(laVar, (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 + CertificateUtil.DELIMITER + 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(la.H, (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));
            boolean H0 = bVar.H0();
            hashMap.put("is_video_stream", String.valueOf(H0));
            if (H0 && (bVar instanceof com.applovin.impl.sdk.ad.a)) {
                CollectionUtils.putStringIfValid("video_url", ((com.applovin.impl.sdk.ad.a) bVar).k1(), hashMap);
            } else {
                CollectionUtils.putStringIfValid("video_url", bVar.P(), hashMap);
            }
        }
        a(la.M, (Map) hashMap);
    }

    public static Map a(pe peVar) {
        HashMap hashMap = new HashMap(3);
        CollectionUtils.putStringIfValid("network_name", peVar.c(), hashMap);
        String b = peVar.b();
        CollectionUtils.putStringIfValid("adapter_class", peVar.b(), hashMap);
        CollectionUtils.putStringIfValid("adapter_version", af.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(la laVar, Object obj, List list) {
        if (AppLovinSdkUtils.isEmulator()) {
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.f.a("HealthEventsReporter", "Reporting " + laVar.b() + " with extra parameters collection " + list);
        }
        c(laVar, obj, list);
        d(laVar, obj, list);
    }
}