afun 2020238 v1.0版本的 MD5 值为:0e5438925c609ea263d060e5259b230d

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


package com.appsflyer.internal;

import android.os.Build;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.appsflyer.AFLogger;
import com.appsflyer.deeplink.DeepLink;
import com.appsflyer.deeplink.DeepLinkResult;
import com.appsflyer.internal.AFh1mSDK;
import java.io.IOException;
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.JSONException;
import org.json.JSONObject;
public final class AFc1oSDK extends AFg1pSDK {
    private final List<AFh1mSDK> AFLogger$LogLevel;
    private final CountDownLatch AFVersionDeclaration;
    private final AFc1kSDK AppsFlyer2dXConversionCallback;
    private final AFd1vSDK afErrorLogForExcManagerOnly;
    private final AFf1iSDK afWarnLog;
    private final AFg1uSDK getLevel;
    private final AFh1nSDK init;
    private final AFb1hSDK onAppOpenAttributionNative;
    private boolean onConversionDataSuccess;
    private int onDeepLinkingNative;
    private int onInstallConversionDataLoadedNative;
    private final ExecutorService onInstallConversionFailureNative;
    private int onResponseNative;

    public static DeepLinkResult AFInAppEventParameterName(AFc1oSDK aFc1oSDK) throws IOException, JSONException, InterruptedException {
        DeepLink AFInAppEventParameterName;
        while (true) {
            AFg1uSDK aFg1uSDK = aFc1oSDK.getLevel;
            int i = aFc1oSDK.onResponseNative;
            if (i <= 0 || i > 2) {
                AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - start", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i))));
            } else {
                int i2 = i - 1;
                aFg1uSDK.afErrorLog[i2] = System.currentTimeMillis();
                if (i2 == 0) {
                    long j = aFg1uSDK.AFLogger;
                    if (j != 0) {
                        aFg1uSDK.values.put("from_fg", Long.valueOf(aFg1uSDK.afErrorLog[i2] - j));
                        aFg1uSDK.AFKeystoreWrapper.valueOf("ddl", new JSONObject(aFg1uSDK.values).toString());
                    } else {
                        AFLogger.afInfoLog("Metrics: fg ts is missing");
                    }
                }
            }
            HttpURLConnection AFInAppEventType = new AFb1vSDK(aFc1oSDK, aFc1oSDK.onAppOpenAttributionNative).AFInAppEventType(aFc1oSDK.afWarnLog.afErrorLog);
            AFg1uSDK aFg1uSDK2 = aFc1oSDK.getLevel;
            int i3 = aFc1oSDK.onResponseNative;
            if (i3 <= 0 || i3 > 2) {
                AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - end", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i3))));
            } else {
                int i4 = i3 - 1;
                aFg1uSDK2.afRDLog[i4] = System.currentTimeMillis();
                long j2 = aFg1uSDK2.afErrorLog[i4];
                if (j2 != 0) {
                    long[] jArr = aFg1uSDK2.afDebugLog;
                    jArr[i4] = aFg1uSDK2.afRDLog[i4] - j2;
                    aFg1uSDK2.values.put("net", jArr);
                    aFg1uSDK2.AFKeystoreWrapper.valueOf("ddl", new JSONObject(aFg1uSDK2.values).toString());
                } else {
                    StringBuilder sb = new StringBuilder("Metrics: ddlStart[");
                    sb.append(i4);
                    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(AFb1tSDK.AFInAppEventType(AFInAppEventType));
            aFc1oSDK.onConversionDataSuccess = jSONObject.optBoolean("is_second_ping", true);
            if (!jSONObject.optBoolean("found")) {
                AFInAppEventParameterName = null;
            } else {
                AFInAppEventParameterName = DeepLink.AFInAppEventParameterName(jSONObject.optJSONObject("click_event"));
                AFInAppEventParameterName.AFInAppEventParameterName.put("is_deferred", true);
            }
            if (AFInAppEventParameterName != null) {
                return new DeepLinkResult(AFInAppEventParameterName, null);
            }
            if (aFc1oSDK.onResponseNative > 1 || !aFc1oSDK.getLevel() || !aFc1oSDK.onConversionDataSuccess) {
                break;
            }
            AFLogger.afDebugLog("[DDL] Waiting for referrers...");
            aFc1oSDK.AFVersionDeclaration.await();
            AFg1uSDK aFg1uSDK3 = aFc1oSDK.getLevel;
            long currentTimeMillis = System.currentTimeMillis();
            long j3 = aFg1uSDK3.afRDLog[0];
            if (j3 != 0) {
                aFg1uSDK3.values.put("rfr_wait", Long.valueOf(currentTimeMillis - j3));
                aFg1uSDK3.AFKeystoreWrapper.valueOf("ddl", new JSONObject(aFg1uSDK3.values).toString());
            } else {
                AFLogger.afInfoLog("Metrics: ddlEnd[0] ts is missing");
            }
            if (aFc1oSDK.onInstallConversionDataLoadedNative != aFc1oSDK.onDeepLinkingNative) {
                aFc1oSDK.afErrorLogForExcManagerOnly();
            } else {
                return new DeepLinkResult(null, null);
            }
        }
    }

    public AFc1oSDK(AFd1pSDK aFd1pSDK) {
        super(null, "https://%sdlsdk.%s/v1.0/android/", Boolean.FALSE, Boolean.TRUE, null);
        this.AFLogger$LogLevel = new ArrayList();
        this.AFVersionDeclaration = new CountDownLatch(1);
        this.getLevel = aFd1pSDK.AFLogger();
        this.afErrorLogForExcManagerOnly = aFd1pSDK.valueOf();
        this.afWarnLog = aFd1pSDK.afErrorLogForExcManagerOnly();
        this.init = aFd1pSDK.getLevel();
        this.onInstallConversionFailureNative = aFd1pSDK.AFInAppEventType();
        this.onAppOpenAttributionNative = aFd1pSDK.AFLogger$LogLevel();
        this.AppsFlyer2dXConversionCallback = aFd1pSDK.onInstallConversionDataLoadedNative();
    }

    public final DeepLinkResult AFLogger() {
        DeepLinkResult.Error error;
        AFLogger.afDebugLog("[DDL] start");
        FutureTask futureTask = new FutureTask(new Callable<DeepLinkResult>() {
            @Override
            public final DeepLinkResult call() throws Exception {
                AFc1oSDK.AFInAppEventType(AFc1oSDK.this);
                AFc1oSDK.this.afErrorLogForExcManagerOnly();
                return AFc1oSDK.AFInAppEventParameterName(AFc1oSDK.this);
            }
        });
        this.onInstallConversionFailureNative.execute(futureTask);
        try {
            DeepLinkResult deepLinkResult = (DeepLinkResult) futureTask.get(this.AppsFlyer2dXConversionCallback.AFLogger, TimeUnit.MILLISECONDS);
            this.getLevel.AFInAppEventType(deepLinkResult, this.AppsFlyer2dXConversionCallback.AFLogger);
            this.AppsFlyer2dXConversionCallback.valueOf(deepLinkResult);
            return deepLinkResult;
        } catch (InterruptedException e) {
            e = e;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true, false);
            if (!(e.getCause() instanceof IOException)) {
                error = DeepLinkResult.Error.NETWORK;
            } else {
                error = DeepLinkResult.Error.UNEXPECTED;
            }
            DeepLinkResult deepLinkResult2 = new DeepLinkResult(null, error);
            this.getLevel.AFInAppEventType(deepLinkResult2, this.AppsFlyer2dXConversionCallback.AFLogger);
            this.AppsFlyer2dXConversionCallback.valueOf(deepLinkResult2);
            return deepLinkResult2;
        } catch (ExecutionException e2) {
            e = e2;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true, false);
            if (!(e.getCause() instanceof IOException)) {
            }
            DeepLinkResult deepLinkResult22 = new DeepLinkResult(null, error);
            this.getLevel.AFInAppEventType(deepLinkResult22, this.AppsFlyer2dXConversionCallback.AFLogger);
            this.AppsFlyer2dXConversionCallback.valueOf(deepLinkResult22);
            return deepLinkResult22;
        } catch (TimeoutException e3) {
            AFLogger.afErrorLogForExcManagerOnly("[DDL] Timeout", e3);
            StringBuilder sb = new StringBuilder("[DDL] Timeout, didn't manage to find deferred deep link after ");
            sb.append(this.onResponseNative);
            sb.append(" attempt(s) within ");
            sb.append(this.AppsFlyer2dXConversionCallback.AFLogger);
            sb.append(" milliseconds");
            AFLogger.afDebugLog(sb.toString());
            DeepLinkResult deepLinkResult3 = new DeepLinkResult(null, DeepLinkResult.Error.TIMEOUT);
            this.getLevel.AFInAppEventType(deepLinkResult3, this.AppsFlyer2dXConversionCallback.AFLogger);
            this.AppsFlyer2dXConversionCallback.valueOf(deepLinkResult3);
            return deepLinkResult3;
        }
    }

    @Nullable
    private Map<String, Object> AFInAppEventType(final AFa1aSDK aFa1aSDK) {
        Boolean bool;
        boolean z = false;
        if (aFa1aSDK != null && aFa1aSDK.AFKeystoreWrapper != null && ((bool = aFa1aSDK.AFInAppEventParameterName) == null || !bool.booleanValue())) {
            z = true;
        }
        if (!z) {
            return null;
        }
        return new HashMap<String, Object>() {
            {
                put("type", "unhashed");
                put("value", aFa1aSDK.AFKeystoreWrapper);
            }
        };
    }

    private boolean getLevel() {
        int i;
        List list = (List) this.valueOf.get("referrers");
        if (list == null) {
            i = 0;
        } else {
            i = list.size();
        }
        return i < this.onDeepLinkingNative && !this.valueOf.containsKey("referrers");
    }

    public void afErrorLogForExcManagerOnly() {
        String[] strArr;
        this.onResponseNative++;
        StringBuilder sb = new StringBuilder("[DDL] Preparing request ");
        sb.append(this.onResponseNative);
        AFLogger.afDebugLog(sb.toString());
        if (this.onResponseNative == 1) {
            AFb1tSDK AFKeystoreWrapper = AFb1tSDK.AFKeystoreWrapper();
            this.valueOf.put("is_first", Boolean.valueOf(this.afErrorLogForExcManagerOnly.valueOf.AFKeystoreWrapper("appsFlyerCount", 0) == 0));
            Map<String, Object> map = this.valueOf;
            StringBuilder sb2 = new StringBuilder();
            sb2.append(Locale.getDefault().getLanguage());
            sb2.append("-");
            sb2.append(Locale.getDefault().getCountry());
            map.put("lang", sb2.toString());
            this.valueOf.put("os", Build.VERSION.RELEASE);
            this.valueOf.put("type", Build.MODEL);
            Map<String, Object> map2 = this.valueOf;
            AFd1vSDK aFd1vSDK = this.afErrorLogForExcManagerOnly;
            map2.put("request_id", AFb1iSDK.AFKeystoreWrapper(aFd1vSDK.AFKeystoreWrapper, aFd1vSDK.valueOf));
            AFc1bSDK aFc1bSDK = AFKeystoreWrapper.AFLogger;
            if (aFc1bSDK != null && (strArr = aFc1bSDK.AFKeystoreWrapper) != null) {
                this.valueOf.put("sharing_filter", strArr);
            }
            Map<String, Object> AFInAppEventType = AFInAppEventType(AFb1qSDK.AFKeystoreWrapper(this.afErrorLogForExcManagerOnly.AFKeystoreWrapper.AFInAppEventType, new HashMap()));
            Map<String, Object> AFInAppEventType2 = AFInAppEventType(AFb1qSDK.AFInAppEventParameterName(this.afErrorLogForExcManagerOnly.AFKeystoreWrapper.AFInAppEventType));
            if (AFInAppEventType != null) {
                this.valueOf.put("gaid", AFInAppEventType);
            }
            if (AFInAppEventType2 != null) {
                this.valueOf.put("oaid", AFInAppEventType2);
            }
        }
        Map<String, Object> map3 = this.valueOf;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US);
        long currentTimeMillis = System.currentTimeMillis();
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        map3.put("timestamp", simpleDateFormat.format(new Date(currentTimeMillis)));
        this.valueOf.put("request_count", Integer.valueOf(this.onResponseNative));
        ArrayList arrayList = new ArrayList();
        for (AFh1mSDK aFh1mSDK : this.AFLogger$LogLevel) {
            Map<String, String> valueOf = valueOf(aFh1mSDK);
            if (valueOf != null) {
                arrayList.add(valueOf);
            }
        }
        if (!arrayList.isEmpty()) {
            this.valueOf.put("referrers", arrayList);
        }
        AFInAppEventType(init());
    }

    @VisibleForTesting
    private String init() {
        return new AFi1zSDK(this.afErrorLogForExcManagerOnly).AFInAppEventParameterName(this.afWarnLog.afErrorLog, (String) this.valueOf.get("timestamp"));
    }

    public static class AnonymousClass5 {
        static final int[] AFKeystoreWrapper;

        static {
            int[] iArr = new int[AFh1mSDK.AFa1ySDK.values().length];
            AFKeystoreWrapper = iArr;
            try {
                iArr[AFh1mSDK.AFa1ySDK.FINISHED.ordinal()] = 1;
            } catch (NoSuchFieldError e) {
            }
            try {
                AFKeystoreWrapper[AFh1mSDK.AFa1ySDK.STARTED.ordinal()] = 2;
            } catch (NoSuchFieldError e2) {
            }
        }
    }

    public void AFInAppEventParameterName(AFh1mSDK aFh1mSDK) {
        if (AFInAppEventType(aFh1mSDK)) {
            this.AFLogger$LogLevel.add(aFh1mSDK);
            this.AFVersionDeclaration.countDown();
            StringBuilder sb = new StringBuilder("[DDL] Added non-organic ");
            sb.append(aFh1mSDK.getClass().getSimpleName());
            AFLogger.afDebugLog(sb.toString());
            return;
        }
        int i = this.onInstallConversionDataLoadedNative + 1;
        this.onInstallConversionDataLoadedNative = i;
        if (i == this.onDeepLinkingNative) {
            this.AFVersionDeclaration.countDown();
        }
    }

    private static boolean AFInAppEventType(AFh1mSDK aFh1mSDK) {
        Long l = (Long) aFh1mSDK.AFKeystoreWrapper.get("click_ts");
        return l != null && System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(l.longValue()) < TimeUnit.DAYS.toMillis(1L);
    }

    private static Map<String, String> valueOf(AFh1mSDK aFh1mSDK) {
        if (aFh1mSDK.afDebugLog == AFh1mSDK.AFa1ySDK.FINISHED) {
            HashMap hashMap = new HashMap();
            String str = (String) aFh1mSDK.AFKeystoreWrapper.get("referrer");
            if (str != null) {
                hashMap.put("source", (String) aFh1mSDK.AFKeystoreWrapper.get("source"));
                hashMap.put("value", str);
                return hashMap;
            }
            return null;
        }
        return null;
    }

    @Override
    public final AFe1kSDK AFInAppEventType() {
        return AFe1kSDK.DLSDK;
    }

    public static void AFInAppEventType(AFc1oSDK aFc1oSDK) {
        AFh1mSDK[] values;
        ArrayList<AFh1mSDK> arrayList = new ArrayList();
        for (AFh1mSDK aFh1mSDK : aFc1oSDK.init.values()) {
            if (aFh1mSDK != null && aFh1mSDK.afDebugLog != AFh1mSDK.AFa1ySDK.NOT_STARTED) {
                arrayList.add(aFh1mSDK);
            }
        }
        aFc1oSDK.onDeepLinkingNative = arrayList.size();
        for (final AFh1mSDK aFh1mSDK2 : arrayList) {
            switch (AnonymousClass5.AFKeystoreWrapper[aFh1mSDK2.afDebugLog.ordinal()]) {
                case 1:
                    StringBuilder sb = new StringBuilder("[DDL] ");
                    sb.append(aFh1mSDK2.AFKeystoreWrapper.get("source"));
                    sb.append(" referrer collected earlier");
                    AFLogger.afDebugLog(sb.toString());
                    aFc1oSDK.AFInAppEventParameterName(aFh1mSDK2);
                    break;
                case 2:
                    aFh1mSDK2.addObserver(new Observer() {
                        @Override
                        public final void update(Observable observable, Object obj) {
                            StringBuilder sb2 = new StringBuilder("[DDL] ");
                            sb2.append(aFh1mSDK2.AFKeystoreWrapper.get("source"));
                            sb2.append(" referrer collected via observer");
                            AFLogger.afDebugLog(sb2.toString());
                            AFc1oSDK.this.AFInAppEventParameterName((AFh1mSDK) observable);
                        }
                    });
                    break;
            }
        }
    }
}