Maxcredito v1.2.1版本的 MD5 值为:2605738f37f8ddb81288799ddcbfcbe8

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


package com.appsflyer.internal;

import android.app.Application;
import com.appsflyer.AFInAppEventParameterName;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.google.android.gms.search.SearchAuth;
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 bc implements Runnable {
    private static final List<String> AFInAppEventType = Arrays.asList("googleplay", "playstore", "googleplaystore");
    private static String valueOf = "https://%sgcdsdk.%s/install_data/v4.0/";
    private final String AFInAppEventParameterName;
    public final ScheduledExecutorService AFKeystoreWrapper;
    private final ah AFLogger$LogLevel;
    private final AtomicInteger AFVersionDeclaration;
    private final int init;
    private final Application values;

    public bc(ah ahVar, Application application, String str) {
        if (l.AFKeystoreWrapper == null) {
            l.AFKeystoreWrapper = new l();
        }
        this.AFKeystoreWrapper = l.AFKeystoreWrapper.values();
        this.AFVersionDeclaration = new AtomicInteger(0);
        this.AFLogger$LogLevel = ahVar;
        this.values = application;
        this.AFInAppEventParameterName = str;
        this.init = 0;
    }

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

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

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

    private bc(bc bcVar) {
        if (l.AFKeystoreWrapper == null) {
            l.AFKeystoreWrapper = new l();
        }
        this.AFKeystoreWrapper = l.AFKeystoreWrapper.values();
        this.AFVersionDeclaration = new AtomicInteger(0);
        this.AFLogger$LogLevel = bcVar.AFLogger$LogLevel;
        this.values = bcVar.values;
        this.AFInAppEventParameterName = bcVar.AFInAppEventParameterName;
        this.init = bcVar.init + 1;
    }
}