Play House Simulation v3.0版本的 MD5 值为:4dbd745af43e6bcde3a0dca90b9e5934

以下内容为反编译后的 ba.java 源代码,内容仅作参考


package com.appsflyer.internal;

import android.app.Application;
import androidx.annotation.VisibleForTesting;
import androidx.browser.trusted.sharing.ShareTarget;
import com.appsflyer.AFInAppEventParameterName;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.huawei.openalliance.ad.constant.bc;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONObject;

public final class ba implements Runnable {
    private static final List<String> AFInAppEventType = Arrays.asList("googleplay", "playstore", "googleplaystore");

    @VisibleForTesting
    private static String values = "https://%sgcdsdk.%s/install_data/v4.0/";
    public final ScheduledExecutorService AFInAppEventParameterName;
    private final String AFKeystoreWrapper;
    private final int AFLogger$LogLevel;
    private final af AFVersionDeclaration;
    private final AtomicInteger init;
    private final Application valueOf;

    public ba(af afVar, Application application, String str) {
        if (n.valueOf == null) {
            n.valueOf = new n();
        }
        this.AFInAppEventParameterName = n.valueOf.values();
        this.init = new AtomicInteger(0);
        this.AFVersionDeclaration = afVar;
        this.valueOf = application;
        this.AFKeystoreWrapper = str;
        this.AFLogger$LogLevel = 0;
    }

    public static void AFInAppEventParameterName(Map<String, Object> map) {
        StringBuilder sb = new StringBuilder("[GCD-A02] Calling onConversionDataSuccess with:\n");
        sb.append(map.toString());
        AFLogger.AFInAppEventType(sb.toString());
        af.AFKeystoreWrapper.onConversionDataSuccess(map);
    }

    public static void values(String str) {
        if (af.AFKeystoreWrapper != null) {
            AFLogger.AFInAppEventType("[GCD-A02] Calling onConversionFailure with:\n".concat(String.valueOf(str)));
            af.AFKeystoreWrapper.onConversionDataFail(str);
        }
    }

    @Override
    public final void run() {
        Application application;
        String str;
        int responseCode;
        String AFInAppEventType2;
        String str2 = this.AFKeystoreWrapper;
        if (str2 != null && str2.length() != 0) {
            if (this.AFVersionDeclaration.isStopped()) {
                AFLogger.AFInAppEventType("[GCD-E03] 'isStopTracking' enabled");
                values("'isStopTracking' enabled");
                return;
            }
            this.init.incrementAndGet();
            HttpURLConnection httpURLConnection = null;
            try {
                application = this.valueOf;
            } catch (Throwable th) {
                th = th;
            }
            if (application == null) {
                AFLogger.AFInAppEventType("[GCD-E06] Context null");
                values("Context null");
                this.init.decrementAndGet();
                return;
            }
            af afVar = this.AFVersionDeclaration;
            String AFInAppEventParameterName = afVar.AFInAppEventParameterName(application, afVar.AFInAppEventParameterName(application));
            if (AFInAppEventParameterName != null) {
                if (!AFInAppEventType.contains(AFInAppEventParameterName.toLowerCase())) {
                    str = "-".concat(AFInAppEventParameterName);
                    StringBuilder sb = new StringBuilder();
                    sb.append(String.format(values, AppsFlyerLib.getInstance().getHostPrefix(), af.AFInAppEventParameterName().getHostName()));
                    sb.append(this.valueOf.getPackageName());
                    sb.append(str);
                    sb.append("?devkey=");
                    sb.append(this.AFKeystoreWrapper);
                    sb.append("&device_id=");
                    sb.append(ak.AFKeystoreWrapper(new WeakReference(this.valueOf)));
                    String obj = sb.toString();
                    am.AFKeystoreWrapper().valueOf("server_request", obj, "");
                    an.AFKeystoreWrapper("[GCD-B01] URL: ".concat(String.valueOf(obj)));
                    long currentTimeMillis = System.currentTimeMillis();
                    HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL(obj).openConnection();
                    httpURLConnection2.setRequestMethod(ShareTarget.METHOD_GET);
                    httpURLConnection2.setConnectTimeout(10000);
                    httpURLConnection2.setRequestProperty("Connection", bc.b.Z);
                    httpURLConnection2.connect();
                    responseCode = httpURLConnection2.getResponseCode();
                    AFInAppEventType2 = af.AFInAppEventType(httpURLConnection2);
                    am.AFKeystoreWrapper().valueOf("server_response", obj, String.valueOf(responseCode), AFInAppEventType2);
                    if (responseCode != 200 && responseCode != 404) {
                        if ((responseCode != 403 || responseCode >= 500) && this.AFLogger$LogLevel < 2) {
                            ba baVar = new ba(this);
                            af.AFInAppEventParameterName(baVar.AFInAppEventParameterName, baVar, 10L, TimeUnit.MILLISECONDS);
                        } else {
                            values("Error connection to server: ".concat(String.valueOf(responseCode)));
                        }
                        this.init.decrementAndGet();
                        httpURLConnection2.disconnect();
                        this.AFInAppEventParameterName.shutdown();
                        AFLogger.AFInAppEventType("[GCD-A03] Server retrieving attempt finished");
                        return;
                    }
                    JSONObject jSONObject = new JSONObject();
                    jSONObject.put("net", System.currentTimeMillis() - currentTimeMillis);
                    jSONObject.put("retries", this.AFLogger$LogLevel);
                    this.AFVersionDeclaration.AFLogger$LogLevel.AFInAppEventType.edit().putString("gcd", jSONObject.toString()).apply();
                    an.AFKeystoreWrapper("Attribution data: ".concat(String.valueOf(AFInAppEventType2)));
                    if (AFInAppEventType2.length() > 0) {
                        Map<String, Object> AFInAppEventParameterName2 = ay.AFInAppEventParameterName(AFInAppEventType2);
                        Boolean bool = (Boolean) AFInAppEventParameterName2.get("iscache");
                        if (responseCode == 404) {
                            AFInAppEventParameterName2.remove("error_reason");
                            AFInAppEventParameterName2.remove("status_code");
                            AFInAppEventParameterName2.put("af_status", "Organic");
                            AFInAppEventParameterName2.put("af_message", "organic install");
                        }
                        if (bool != null && !bool.booleanValue()) {
                            this.AFVersionDeclaration.valueOf(this.valueOf, "appsflyerConversionDataCacheExpiration", System.currentTimeMillis());
                        }
                        if (AFInAppEventParameterName2.containsKey("af_siteid")) {
                            if (AFInAppEventParameterName2.containsKey(AFInAppEventParameterName.AF_CHANNEL)) {
                                StringBuilder sb2 = new StringBuilder("[Invite] Detected App-Invite via channel: ");
                                sb2.append(AFInAppEventParameterName2.get(AFInAppEventParameterName.AF_CHANNEL));
                                AFLogger.AFInAppEventType(sb2.toString());
                            } else {
                                AFLogger.AFInAppEventType(String.format("[CrossPromotion] App was installed via %s's Cross Promotion", AFInAppEventParameterName2.get("af_siteid")));
                            }
                        }
                        if (AFInAppEventParameterName2.containsKey("af_siteid")) {
                            StringBuilder sb3 = new StringBuilder("[Invite] Detected App-Invite via channel: ");
                            sb3.append(AFInAppEventParameterName2.get(AFInAppEventParameterName.AF_CHANNEL));
                            AFLogger.AFInAppEventType(sb3.toString());
                        }
                        AFInAppEventParameterName2.put("is_first_launch", Boolean.FALSE);
                        String jSONObject2 = new JSONObject(AFInAppEventParameterName2).toString();
                        if (jSONObject2 != null) {
                            af.AFInAppEventParameterName(this.valueOf, "attributionId", jSONObject2);
                        } else {
                            af.AFInAppEventParameterName(this.valueOf, "attributionId", AFInAppEventType2);
                        }
                        if (af.AFKeystoreWrapper != null && this.init.intValue() <= 1) {
                            try {
                                Map<String, Object> values2 = ay.values(this.valueOf);
                                if (!af.AFInAppEventType(this.valueOf).getBoolean("sixtyDayConversionData", false)) {
                                    values2.put("is_first_launch", Boolean.TRUE);
                                }
                                AFInAppEventParameterName2 = values2;
                            } catch (bb e) {
                                AFLogger.values("Exception while trying to fetch attribution data. ", e);
                            }
                            StringBuilder sb4 = new StringBuilder("[GCD-A02] Calling onConversionDataSuccess with:\n");
                            sb4.append(AFInAppEventParameterName2.toString());
                            AFLogger.AFInAppEventType(sb4.toString());
                            af.AFKeystoreWrapper.onConversionDataSuccess(AFInAppEventParameterName2);
                        }
                    }
                    this.init.decrementAndGet();
                    httpURLConnection2.disconnect();
                    this.AFInAppEventParameterName.shutdown();
                    AFLogger.AFInAppEventType("[GCD-A03] Server retrieving attempt finished");
                    return;
                }
                AFLogger.AFVersionDeclaration(String.format("AF detected using redundant Google-Play channel for attribution - %s. Using without channel postfix.", AFInAppEventParameterName));
            }
            str = "";
            StringBuilder sb5 = new StringBuilder();
            sb5.append(String.format(values, AppsFlyerLib.getInstance().getHostPrefix(), af.AFInAppEventParameterName().getHostName()));
            sb5.append(this.valueOf.getPackageName());
            sb5.append(str);
            sb5.append("?devkey=");
            sb5.append(this.AFKeystoreWrapper);
            sb5.append("&device_id=");
            sb5.append(ak.AFKeystoreWrapper(new WeakReference(this.valueOf)));
            String obj2 = sb5.toString();
            am.AFKeystoreWrapper().valueOf("server_request", obj2, "");
            an.AFKeystoreWrapper("[GCD-B01] URL: ".concat(String.valueOf(obj2)));
            long currentTimeMillis2 = System.currentTimeMillis();
            HttpURLConnection httpURLConnection22 = (HttpURLConnection) new URL(obj2).openConnection();
            httpURLConnection22.setRequestMethod(ShareTarget.METHOD_GET);
            httpURLConnection22.setConnectTimeout(10000);
            httpURLConnection22.setRequestProperty("Connection", bc.b.Z);
            httpURLConnection22.connect();
            responseCode = httpURLConnection22.getResponseCode();
            AFInAppEventType2 = af.AFInAppEventType(httpURLConnection22);
            am.AFKeystoreWrapper().valueOf("server_response", obj2, String.valueOf(responseCode), AFInAppEventType2);
            if (responseCode != 200) {
                if (responseCode != 403) {
                }
                ba baVar2 = new ba(this);
                af.AFInAppEventParameterName(baVar2.AFInAppEventParameterName, baVar2, 10L, TimeUnit.MILLISECONDS);
                this.init.decrementAndGet();
                httpURLConnection22.disconnect();
                this.AFInAppEventParameterName.shutdown();
                AFLogger.AFInAppEventType("[GCD-A03] Server retrieving attempt finished");
                return;
            }
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put("net", System.currentTimeMillis() - currentTimeMillis2);
            jSONObject3.put("retries", this.AFLogger$LogLevel);
            this.AFVersionDeclaration.AFLogger$LogLevel.AFInAppEventType.edit().putString("gcd", jSONObject3.toString()).apply();
            an.AFKeystoreWrapper("Attribution data: ".concat(String.valueOf(AFInAppEventType2)));
            if (AFInAppEventType2.length() > 0) {
            }
            this.init.decrementAndGet();
            httpURLConnection22.disconnect();
            this.AFInAppEventParameterName.shutdown();
            AFLogger.AFInAppEventType("[GCD-A03] Server retrieving attempt finished");
            return;
        }
        AFLogger.AFInAppEventType("[GCD-E05] AppsFlyer dev key is missing");
        values("AppsFlyer dev key is missing");
    }

    private ba(ba baVar) {
        if (n.valueOf == null) {
            n.valueOf = new n();
        }
        this.AFInAppEventParameterName = n.valueOf.values();
        this.init = new AtomicInteger(0);
        this.AFVersionDeclaration = baVar.AFVersionDeclaration;
        this.valueOf = baVar.valueOf;
        this.AFKeystoreWrapper = baVar.AFKeystoreWrapper;
        this.AFLogger$LogLevel = baVar.AFLogger$LogLevel + 1;
    }
}