Free Fire v1.103.1版本的 MD5 值为:f6c45f9f1485263aa5af0fb400f973fc

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


package com.appsflyer.internal;

import android.app.Application;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.deeplink.DeepLink;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.AFe1lSDK;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Observable;
import java.util.Observer;
import java.util.TimeZone;
import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.json.JSONObject;
public final class AFb1pSDK extends AFd1dSDK {
    private static String AFVersionDeclaration = "https://%sdlsdk.%s/v1.0/android/";
    public static long getLevel;
    private final List<AFe1lSDK> AFLogger$LogLevel;
    private final ExecutorService AppsFlyer2dXConversionCallback;
    private final CountDownLatch afWarnLog;
    private final AFd1cSDK onAppOpenAttributionNative;
    private final AFe1fSDK onAttributionFailureNative;
    private int onConversionDataFail;
    private int onConversionDataSuccess;
    private int onDeepLinkingNative;
    private final AFb1dSDK onInstallConversionDataLoadedNative;
    private final AFd1kSDK onInstallConversionFailureNative;
    private boolean onResponseNative;

    public static class AnonymousClass4 {
        static final int[] valueOf;

        static {
            int[] iArr = new int[AFe1lSDK.AFa1wSDK.values().length];
            valueOf = iArr;
            try {
                iArr[AFe1lSDK.AFa1wSDK.FINISHED.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                valueOf[AFe1lSDK.AFa1wSDK.STARTED.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public AFb1pSDK(Context context, AFc1xSDK aFc1xSDK) {
        super(null, AFVersionDeclaration, Boolean.FALSE, Boolean.TRUE, null, context);
        this.AFLogger$LogLevel = new ArrayList();
        this.afWarnLog = new CountDownLatch(1);
        this.onAppOpenAttributionNative = aFc1xSDK.afInfoLog();
        this.onInstallConversionDataLoadedNative = aFc1xSDK.values();
        this.onInstallConversionFailureNative = aFc1xSDK.AFLogger$LogLevel();
        this.onAttributionFailureNative = aFc1xSDK.AFVersionDeclaration();
        this.AppsFlyer2dXConversionCallback = aFc1xSDK.valueOf();
    }

    static void AFInAppEventParameterName(AFb1pSDK aFb1pSDK) {
        AFe1lSDK[] values;
        ArrayList<AFe1lSDK> arrayList = new ArrayList();
        for (AFe1lSDK aFe1lSDK : aFb1pSDK.onAttributionFailureNative.values()) {
            if (aFe1lSDK != null && aFe1lSDK.afRDLog != AFe1lSDK.AFa1wSDK.NOT_STARTED) {
                arrayList.add(aFe1lSDK);
            }
        }
        aFb1pSDK.onConversionDataSuccess = arrayList.size();
        for (final AFe1lSDK aFe1lSDK2 : arrayList) {
            int i10 = AnonymousClass4.valueOf[aFe1lSDK2.afRDLog.ordinal()];
            if (i10 == 1) {
                StringBuilder sb = new StringBuilder("[DDL] ");
                sb.append(aFe1lSDK2.AFInAppEventType.get("source"));
                sb.append(" referrer collected earlier");
                AFLogger.afDebugLog(sb.toString());
                aFb1pSDK.AFKeystoreWrapper(aFe1lSDK2);
            } else if (i10 == 2) {
                aFe1lSDK2.addObserver(new Observer() {
                    @Override
                    public final void update(Observable observable, Object obj) {
                        StringBuilder sb2 = new StringBuilder("[DDL] ");
                        sb2.append(aFe1lSDK2.AFInAppEventType.get("source"));
                        sb2.append(" referrer collected via observer");
                        AFLogger.afDebugLog(sb2.toString());
                        AFb1pSDK.this.AFKeystoreWrapper((AFe1lSDK) observable);
                    }
                });
            }
        }
    }

    public void AFKeystoreWrapper(AFe1lSDK aFe1lSDK) {
        if (values(aFe1lSDK)) {
            this.AFLogger$LogLevel.add(aFe1lSDK);
            this.afWarnLog.countDown();
            StringBuilder sb = new StringBuilder("[DDL] Added non-organic ");
            sb.append(aFe1lSDK.getClass().getSimpleName());
            AFLogger.afDebugLog(sb.toString());
            return;
        }
        int i10 = this.onDeepLinkingNative + 1;
        this.onDeepLinkingNative = i10;
        if (i10 == this.onConversionDataSuccess) {
            this.afWarnLog.countDown();
        }
    }

    private boolean AFVersionDeclaration() {
        List list = (List) this.values.get("referrers");
        return (list != null ? list.size() : 0) < this.onConversionDataSuccess && !this.values.containsKey("referrers");
    }

    public void getLevel() {
        HashMap hashMap;
        String[] strArr;
        this.onConversionDataFail++;
        StringBuilder sb = new StringBuilder("[DDL] Preparing request ");
        sb.append(this.onConversionDataFail);
        AFLogger.afDebugLog(sb.toString());
        if (this.onConversionDataFail == 1) {
            AFa1aSDK values = AFa1aSDK.values();
            this.values.put("is_first", Boolean.valueOf(this.onInstallConversionDataLoadedNative.valueOf.values("appsFlyerCount") == 0));
            Map<String, Object> map = this.values;
            StringBuilder sb2 = new StringBuilder();
            sb2.append(Locale.getDefault().getLanguage());
            sb2.append("-");
            sb2.append(Locale.getDefault().getCountry());
            map.put("lang", sb2.toString());
            this.values.put("os", Build.VERSION.RELEASE);
            this.values.put("type", Build.MODEL);
            this.values.put("request_id", AFb1rSDK.AFInAppEventParameterName(new WeakReference(this.onInstallConversionDataLoadedNative.AFInAppEventType.AFKeystoreWrapper)));
            AFa1eSDK aFa1eSDK = values.afRDLog;
            if (aFa1eSDK != null && (strArr = aFa1eSDK.AFKeystoreWrapper) != null) {
                this.values.put("sharing_filter", strArr);
            }
            Map<String, Object> values2 = values(AFb1ySDK.values(this.onInstallConversionDataLoadedNative.AFInAppEventType.AFKeystoreWrapper, new HashMap()));
            Map<String, Object> values3 = values(AFb1ySDK.AFKeystoreWrapper(this.onInstallConversionDataLoadedNative.AFInAppEventType.AFKeystoreWrapper));
            if (values2 != null) {
                this.values.put("gaid", values2);
            }
            if (values3 != null) {
                this.values.put("oaid", values3);
            }
        }
        Map<String, Object> map2 = this.values;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
        long currentTimeMillis = System.currentTimeMillis();
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        map2.put("timestamp", simpleDateFormat.format(new Date(currentTimeMillis)));
        this.values.put("request_count", Integer.valueOf(this.onConversionDataFail));
        ArrayList arrayList = new ArrayList();
        for (AFe1lSDK aFe1lSDK : this.AFLogger$LogLevel) {
            if (aFe1lSDK.afRDLog == AFe1lSDK.AFa1wSDK.FINISHED) {
                hashMap = new HashMap();
                String str = (String) aFe1lSDK.AFInAppEventType.get("referrer");
                if (str != null) {
                    hashMap.put("source", (String) aFe1lSDK.AFInAppEventType.get("source"));
                    hashMap.put("value", str);
                    if (hashMap == null) {
                        arrayList.add(hashMap);
                    }
                }
            }
            hashMap = null;
            if (hashMap == null) {
            }
        }
        if (!arrayList.isEmpty()) {
            this.values.put("referrers", arrayList);
        }
        String str2 = this.onInstallConversionFailureNative.AFInAppEventType;
        String packageName = this.onInstallConversionDataLoadedNative.AFInAppEventType.AFKeystoreWrapper.getPackageName();
        String values4 = this.onInstallConversionDataLoadedNative.values();
        String concat = (values4 == null || values4.trim().isEmpty()) ? "" : "-".concat(values4);
        Uri.Builder buildUpon = Uri.parse(String.format(AFVersionDeclaration, AppsFlyerLib.getInstance().getHostPrefix(), AFa1aSDK.values().getHostName())).buildUpon();
        StringBuilder sb3 = new StringBuilder();
        sb3.append(packageName);
        sb3.append(concat);
        Uri.Builder appendPath = buildUpon.appendPath(sb3.toString());
        StringBuilder sb4 = new StringBuilder();
        sb4.append(this.values.get("timestamp"));
        sb4.append(str2);
        AFInAppEventType(appendPath.appendQueryParameter("af_sig", AFb1sSDK.AFInAppEventType(sb4.toString(), str2)).appendQueryParameter("sdk_version", AFa1aSDK.AFKeystoreWrapper).build().toString());
    }

    static DeepLinkResult valueOf(AFb1pSDK aFb1pSDK, Context context) {
        DeepLink valueOf;
        while (true) {
            AFd1cSDK aFd1cSDK = aFb1pSDK.onAppOpenAttributionNative;
            int i10 = aFb1pSDK.onConversionDataFail;
            if (i10 <= 0 || i10 > 2) {
                AFLogger.afErrorLog(new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i10))));
            } else {
                int i11 = i10 - 1;
                aFd1cSDK.afRDLog[i11] = System.currentTimeMillis();
                if (i11 == 0) {
                    long j10 = aFd1cSDK.afErrorLog;
                    if (j10 != 0) {
                        aFd1cSDK.AFKeystoreWrapper.put("from_fg", Long.valueOf(aFd1cSDK.afRDLog[i11] - j10));
                        aFd1cSDK.AFInAppEventType.AFInAppEventParameterName("ddl", new JSONObject(aFd1cSDK.AFKeystoreWrapper).toString());
                    } else {
                        AFLogger.afInfoLog("Metrics: fg ts is missing");
                    }
                }
            }
            HttpURLConnection AFInAppEventType = new AFa1mSDK(aFb1pSDK).AFInAppEventType(aFb1pSDK.onInstallConversionFailureNative.AFInAppEventType);
            AFd1cSDK aFd1cSDK2 = aFb1pSDK.onAppOpenAttributionNative;
            int i12 = aFb1pSDK.onConversionDataFail;
            if (i12 <= 0 || i12 > 2) {
                AFLogger.afErrorLog(new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i12))));
            } else {
                int i13 = i12 - 1;
                aFd1cSDK2.afDebugLog[i13] = System.currentTimeMillis();
                long j11 = aFd1cSDK2.afRDLog[i13];
                if (j11 != 0) {
                    long[] jArr = aFd1cSDK2.AFLogger;
                    jArr[i13] = aFd1cSDK2.afDebugLog[i13] - j11;
                    aFd1cSDK2.AFKeystoreWrapper.put("net", jArr);
                    aFd1cSDK2.AFInAppEventType.AFInAppEventParameterName("ddl", new JSONObject(aFd1cSDK2.AFKeystoreWrapper).toString());
                } else {
                    StringBuilder sb = new StringBuilder("Metrics: ddlStart[");
                    sb.append(i13);
                    sb.append("] ts is missing");
                    AFLogger.afInfoLog(sb.toString());
                }
            }
            if (AFInAppEventType.getResponseCode() != 200) {
                StringBuilder sb2 = new StringBuilder("[DDL] Error occurred. Server response code = ");
                sb2.append(AFInAppEventType.getResponseCode());
                AFLogger.afDebugLog(sb2.toString());
                return new DeepLinkResult(null, DeepLinkResult.Error.HTTP_STATUS_CODE);
            }
            JSONObject jSONObject = new JSONObject(AFa1aSDK.AFInAppEventType(AFInAppEventType));
            aFb1pSDK.onResponseNative = jSONObject.optBoolean("is_second_ping", true);
            if (jSONObject.optBoolean("found")) {
                valueOf = DeepLink.valueOf(jSONObject.optJSONObject("click_event"));
                valueOf.valueOf.put("is_deferred", true);
            } else {
                valueOf = null;
            }
            if (valueOf != null) {
                return new DeepLinkResult(valueOf, null);
            }
            if (aFb1pSDK.onConversionDataFail > 1 || !aFb1pSDK.AFVersionDeclaration() || !aFb1pSDK.onResponseNative) {
                break;
            }
            AFLogger.afDebugLog("[DDL] Waiting for referrers...");
            aFb1pSDK.afWarnLog.await();
            AFd1cSDK aFd1cSDK3 = aFb1pSDK.onAppOpenAttributionNative;
            long currentTimeMillis = System.currentTimeMillis();
            long j12 = aFd1cSDK3.afDebugLog[0];
            if (j12 != 0) {
                aFd1cSDK3.AFKeystoreWrapper.put("rfr_wait", Long.valueOf(currentTimeMillis - j12));
                aFd1cSDK3.AFInAppEventType.AFInAppEventParameterName("ddl", new JSONObject(aFd1cSDK3.AFKeystoreWrapper).toString());
            } else {
                AFLogger.afInfoLog("Metrics: ddlEnd[0] ts is missing");
            }
            if (aFb1pSDK.onDeepLinkingNative == aFb1pSDK.onConversionDataSuccess) {
                return new DeepLinkResult(null, null);
            }
            aFb1pSDK.getLevel();
        }
    }

    private Map<String, Object> values(final AFa1rSDK aFa1rSDK) {
        Boolean bool;
        boolean z10 = false;
        if (aFa1rSDK != null && aFa1rSDK.AFKeystoreWrapper != null && ((bool = aFa1rSDK.valueOf) == null || !bool.booleanValue())) {
            z10 = true;
        }
        if (z10) {
            return new HashMap<String, Object>() {
                {
                    put("type", "unhashed");
                    put("value", AFa1rSDK.this.AFKeystoreWrapper);
                }
            };
        }
        return null;
    }

    private static boolean values(AFe1lSDK aFe1lSDK) {
        Long l10 = (Long) aFe1lSDK.AFInAppEventType.get("click_ts");
        return l10 != null && System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(l10.longValue()) < TimeUnit.DAYS.toMillis(1L);
    }

    @Override
    public final AFc1jSDK AFInAppEventParameterName() {
        return AFc1jSDK.DLSDK;
    }

    public final DeepLinkResult afErrorLog() {
        AFLogger.afDebugLog("[DDL] start");
        FutureTask futureTask = new FutureTask(new Callable<DeepLinkResult>() {
            @Override
            public final DeepLinkResult call() {
                Application application = AFb1pSDK.this.AFInAppEventType;
                AFb1pSDK.AFInAppEventParameterName(AFb1pSDK.this);
                AFb1pSDK.this.getLevel();
                return AFb1pSDK.valueOf(AFb1pSDK.this, application);
            }
        });
        this.AppsFlyer2dXConversionCallback.execute(futureTask);
        try {
            DeepLinkResult deepLinkResult = (DeepLinkResult) futureTask.get(getLevel, TimeUnit.MILLISECONDS);
            this.onAppOpenAttributionNative.valueOf(deepLinkResult, getLevel);
            AFb1lSDK.values(deepLinkResult);
            return deepLinkResult;
        } catch (InterruptedException e10) {
            e = e10;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true);
            DeepLinkResult deepLinkResult2 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
            this.onAppOpenAttributionNative.valueOf(deepLinkResult2, getLevel);
            AFb1lSDK.values(deepLinkResult2);
            return deepLinkResult2;
        } catch (ExecutionException e11) {
            e = e11;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true);
            DeepLinkResult deepLinkResult22 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
            this.onAppOpenAttributionNative.valueOf(deepLinkResult22, getLevel);
            AFb1lSDK.values(deepLinkResult22);
            return deepLinkResult22;
        } catch (TimeoutException unused) {
            StringBuilder sb = new StringBuilder("[DDL] Timeout, didn't manage to find deferred deep link after ");
            sb.append(this.onConversionDataFail);
            sb.append(" attempt(s) within ");
            sb.append(getLevel);
            sb.append(" milliseconds");
            AFLogger.afDebugLog(sb.toString());
            DeepLinkResult deepLinkResult3 = new DeepLinkResult(null, DeepLinkResult.Error.TIMEOUT);
            this.onAppOpenAttributionNative.valueOf(deepLinkResult3, getLevel);
            AFb1lSDK.values(deepLinkResult3);
            return deepLinkResult3;
        }
    }
}