导航菜单

页面标题

页面副标题

Pesohere v1.0.5 - AFb1mSDK.java 源代码

正在查看: Pesohere v1.0.5 应用的 AFb1mSDK.java JAVA 源代码文件

本页面展示 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.AFe1dSDK;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import com.wang.avi.BuildConfig;
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 AFb1mSDK extends AFe1sSDK {
    public static String AFVersionDeclaration = "https://%sdlsdk.%s/v1.0/android/";
    public static long getLevel;
    public final CountDownLatch AFLogger$LogLevel;
    public final AFe1vSDK AppsFlyer2dXConversionCallback;
    public final List<AFe1dSDK> afErrorLogForExcManagerOnly;
    public final ExecutorService init;
    public final AFe1aSDK onAppOpenAttributionNative;
    public int onAttributionFailureNative;
    public int onDeepLinkingNative;
    public final AFd1fSDK onInstallConversionDataLoadedNative;
    public final AFc1ySDK onInstallConversionFailureNative;
    public boolean onResponseErrorNative;
    public int onResponseNative;

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

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

    public AFb1mSDK(Context context, AFb1aSDK aFb1aSDK) {
        super(null, AFVersionDeclaration, Boolean.FALSE, Boolean.TRUE, null, context);
        this.afErrorLogForExcManagerOnly = new ArrayList();
        this.AFLogger$LogLevel = new CountDownLatch(1);
        this.AppsFlyer2dXConversionCallback = aFb1aSDK.AFLogger();
        this.onInstallConversionFailureNative = aFb1aSDK.values();
        this.onInstallConversionDataLoadedNative = aFb1aSDK.AFLogger$LogLevel();
        this.onAppOpenAttributionNative = aFb1aSDK.AFVersionDeclaration();
        this.init = aFb1aSDK.AFKeystoreWrapper();
    }

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

    public static boolean AFInAppEventType(AFe1dSDK aFe1dSDK) {
        Long l2 = (Long) aFe1dSDK.AFKeystoreWrapper.get("click_ts");
        return l2 != null && System.currentTimeMillis() - TimeUnit.SECONDS.toMillis(l2.longValue()) < TimeUnit.DAYS.toMillis(1L);
    }

    public void AFKeystoreWrapper(AFe1dSDK aFe1dSDK) {
        if (AFInAppEventType(aFe1dSDK)) {
            this.afErrorLogForExcManagerOnly.add(aFe1dSDK);
            this.AFLogger$LogLevel.countDown();
            StringBuilder sb = new StringBuilder("[DDL] Added non-organic ");
            sb.append(aFe1dSDK.getClass().getSimpleName());
            AFLogger.afDebugLog(sb.toString());
            return;
        }
        int i2 = this.onAttributionFailureNative + 1;
        this.onAttributionFailureNative = i2;
        if (i2 == this.onDeepLinkingNative) {
            this.AFLogger$LogLevel.countDown();
        }
    }

    public void AFLogger$LogLevel() {
        HashMap hashMap;
        String[] strArr;
        this.onResponseNative++;
        StringBuilder sb = new StringBuilder("[DDL] Preparing request ");
        sb.append(this.onResponseNative);
        AFLogger.afDebugLog(sb.toString());
        if (this.onResponseNative == 1) {
            AFb1zSDK AFInAppEventType = AFb1zSDK.AFInAppEventType();
            this.AFInAppEventType.put("is_first", Boolean.valueOf(this.onInstallConversionFailureNative.valueOf.AFInAppEventType("appsFlyerCount") == 0));
            Map<String, Object> map = this.AFInAppEventType;
            StringBuilder sb2 = new StringBuilder();
            sb2.append(Locale.getDefault().getLanguage());
            sb2.append("-");
            sb2.append(Locale.getDefault().getCountry());
            map.put("lang", sb2.toString());
            this.AFInAppEventType.put("os", Build.VERSION.RELEASE);
            this.AFInAppEventType.put("type", Build.MODEL);
            this.AFInAppEventType.put("request_id", AFb1sSDK.AFInAppEventType((WeakReference<Context>) new WeakReference(this.onInstallConversionFailureNative.AFInAppEventParameterName.valueOf)));
            AFa1dSDK aFa1dSDK = AFInAppEventType.afErrorLog;
            if (aFa1dSDK != null && (strArr = aFa1dSDK.AFInAppEventType) != null) {
                this.AFInAppEventType.put("sharing_filter", strArr);
            }
            Map<String, Object> AFInAppEventParameterName = AFInAppEventParameterName(AFb1ySDK.values(this.onInstallConversionFailureNative.AFInAppEventParameterName.valueOf, new HashMap()));
            Map<String, Object> AFInAppEventParameterName2 = AFInAppEventParameterName(AFb1ySDK.AFInAppEventParameterName(this.onInstallConversionFailureNative.AFInAppEventParameterName.valueOf));
            if (AFInAppEventParameterName != null) {
                this.AFInAppEventType.put("gaid", AFInAppEventParameterName);
            }
            if (AFInAppEventParameterName2 != null) {
                this.AFInAppEventType.put("oaid", AFInAppEventParameterName2);
            }
        }
        Map<String, Object> map2 = this.AFInAppEventType;
        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.AFInAppEventType.put("request_count", Integer.valueOf(this.onResponseNative));
        ArrayList arrayList = new ArrayList();
        for (AFe1dSDK aFe1dSDK : this.afErrorLogForExcManagerOnly) {
            if (aFe1dSDK.afErrorLog == AFe1dSDK.AFa1zSDK.FINISHED) {
                hashMap = new HashMap();
                String str = (String) aFe1dSDK.AFKeystoreWrapper.get("referrer");
                if (str != null) {
                    hashMap.put("source", (String) aFe1dSDK.AFKeystoreWrapper.get("source"));
                    hashMap.put(AppMeasurementSdk.ConditionalUserProperty.VALUE, str);
                    if (hashMap == null) {
                        arrayList.add(hashMap);
                    }
                }
            }
            hashMap = null;
            if (hashMap == null) {
            }
        }
        if (!arrayList.isEmpty()) {
            this.AFInAppEventType.put("referrers", arrayList);
        }
        String str2 = this.onInstallConversionDataLoadedNative.AFInAppEventType;
        String packageName = this.onInstallConversionFailureNative.AFInAppEventParameterName.valueOf.getPackageName();
        String AFInAppEventParameterName3 = this.onInstallConversionFailureNative.AFInAppEventParameterName();
        String concat = (AFInAppEventParameterName3 == null || AFInAppEventParameterName3.trim().isEmpty()) ? BuildConfig.FLAVOR : "-".concat(String.valueOf(AFInAppEventParameterName3));
        Uri.Builder buildUpon = Uri.parse(String.format(AFVersionDeclaration, AppsFlyerLib.getInstance().getHostPrefix(), AFb1zSDK.AFInAppEventType().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.AFInAppEventType.get("timestamp"));
        sb4.append(str2);
        AFInAppEventType(appendPath.appendQueryParameter("af_sig", AFb1vSDK.AFInAppEventType(sb4.toString(), str2)).appendQueryParameter("sdk_version", AFb1zSDK.values).build().toString());
    }

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

    public final DeepLinkResult afErrorLog() {
        AFLogger.afDebugLog("[DDL] start");
        FutureTask futureTask = new FutureTask(new Callable<DeepLinkResult>() {
            @Override
            public final DeepLinkResult call() {
                Application application = AFb1mSDK.this.valueOf;
                AFb1mSDK.AFInAppEventType(AFb1mSDK.this);
                AFb1mSDK.this.AFLogger$LogLevel();
                return AFb1mSDK.AFInAppEventType(AFb1mSDK.this, application);
            }
        });
        this.init.execute(futureTask);
        try {
            DeepLinkResult deepLinkResult = (DeepLinkResult) futureTask.get(getLevel, TimeUnit.MILLISECONDS);
            this.AppsFlyer2dXConversionCallback.AFInAppEventParameterName(deepLinkResult, getLevel);
            AFb1kSDK.AFInAppEventParameterName(deepLinkResult);
            return deepLinkResult;
        } catch (InterruptedException e2) {
            e = e2;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true);
            DeepLinkResult deepLinkResult2 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
            this.AppsFlyer2dXConversionCallback.AFInAppEventParameterName(deepLinkResult2, getLevel);
            AFb1kSDK.AFInAppEventParameterName(deepLinkResult2);
            return deepLinkResult2;
        } catch (ExecutionException e3) {
            e = e3;
            AFLogger.afErrorLog("[DDL] Error occurred", e, true);
            DeepLinkResult deepLinkResult22 = new DeepLinkResult(null, !(e.getCause() instanceof IOException) ? DeepLinkResult.Error.NETWORK : DeepLinkResult.Error.UNEXPECTED);
            this.AppsFlyer2dXConversionCallback.AFInAppEventParameterName(deepLinkResult22, getLevel);
            AFb1kSDK.AFInAppEventParameterName(deepLinkResult22);
            return deepLinkResult22;
        } catch (TimeoutException e4) {
            AFLogger.afErrorLogForExcManagerOnly("[DDL] Timeout", e4);
            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(getLevel);
            sb.append(" milliseconds");
            AFLogger.afDebugLog(sb.toString());
            DeepLinkResult deepLinkResult3 = new DeepLinkResult(null, DeepLinkResult.Error.TIMEOUT);
            this.AppsFlyer2dXConversionCallback.AFInAppEventParameterName(deepLinkResult3, getLevel);
            AFb1kSDK.AFInAppEventParameterName(deepLinkResult3);
            return deepLinkResult3;
        }
    }

    public static void AFInAppEventType(AFb1mSDK aFb1mSDK) {
        ArrayList<AFe1dSDK> arrayList = new ArrayList();
        for (AFe1dSDK aFe1dSDK : aFb1mSDK.onAppOpenAttributionNative.valueOf()) {
            if (aFe1dSDK != null && aFe1dSDK.afErrorLog != AFe1dSDK.AFa1zSDK.NOT_STARTED) {
                arrayList.add(aFe1dSDK);
            }
        }
        aFb1mSDK.onDeepLinkingNative = arrayList.size();
        for (final AFe1dSDK aFe1dSDK2 : arrayList) {
            int i2 = AnonymousClass4.AFInAppEventParameterName[aFe1dSDK2.afErrorLog.ordinal()];
            if (i2 == 1) {
                StringBuilder sb = new StringBuilder("[DDL] ");
                sb.append(aFe1dSDK2.AFKeystoreWrapper.get("source"));
                sb.append(" referrer collected earlier");
                AFLogger.afDebugLog(sb.toString());
                aFb1mSDK.AFKeystoreWrapper(aFe1dSDK2);
            } else if (i2 == 2) {
                aFe1dSDK2.addObserver(new Observer() {
                    @Override
                    public final void update(Observable observable, Object obj) {
                        StringBuilder sb2 = new StringBuilder("[DDL] ");
                        sb2.append(aFe1dSDK2.AFKeystoreWrapper.get("source"));
                        sb2.append(" referrer collected via observer");
                        AFLogger.afDebugLog(sb2.toString());
                        AFb1mSDK.this.AFKeystoreWrapper((AFe1dSDK) observable);
                    }
                });
            }
        }
    }

    @Override
    public final AFc1fSDK AFKeystoreWrapper() {
        return AFc1fSDK.DLSDK;
    }

    public static DeepLinkResult AFInAppEventType(AFb1mSDK aFb1mSDK, Context context) {
        DeepLink AFInAppEventParameterName;
        while (true) {
            AFe1vSDK aFe1vSDK = aFb1mSDK.AppsFlyer2dXConversionCallback;
            int i2 = aFb1mSDK.onResponseNative;
            if (i2 > 0 && i2 <= 2) {
                int i3 = i2 - 1;
                aFe1vSDK.afRDLog[i3] = System.currentTimeMillis();
                if (i3 == 0) {
                    long j2 = aFe1vSDK.afInfoLog;
                    if (j2 != 0) {
                        aFe1vSDK.AFInAppEventParameterName.put("from_fg", Long.valueOf(aFe1vSDK.afRDLog[i3] - j2));
                        aFe1vSDK.AFKeystoreWrapper.values("ddl", new JSONObject(aFe1vSDK.AFInAppEventParameterName).toString());
                    } else {
                        AFLogger.afInfoLog("Metrics: fg ts is missing");
                    }
                }
            } else {
                AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - start", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i2))));
            }
            HttpURLConnection AFInAppEventType = new AFa1lSDK(aFb1mSDK).AFInAppEventType(aFb1mSDK.onInstallConversionDataLoadedNative.AFInAppEventType);
            AFe1vSDK aFe1vSDK2 = aFb1mSDK.AppsFlyer2dXConversionCallback;
            int i4 = aFb1mSDK.onResponseNative;
            if (i4 > 0 && i4 <= 2) {
                int i5 = i4 - 1;
                aFe1vSDK2.afErrorLog[i5] = System.currentTimeMillis();
                long[] jArr = aFe1vSDK2.afRDLog;
                if (jArr[i5] != 0) {
                    long[] jArr2 = aFe1vSDK2.afDebugLog;
                    jArr2[i5] = aFe1vSDK2.afErrorLog[i5] - jArr[i5];
                    aFe1vSDK2.AFInAppEventParameterName.put("net", jArr2);
                    aFe1vSDK2.AFKeystoreWrapper.values("ddl", new JSONObject(aFe1vSDK2.AFInAppEventParameterName).toString());
                } else {
                    StringBuilder sb = new StringBuilder("Metrics: ddlStart[");
                    sb.append(i5);
                    sb.append("] ts is missing");
                    AFLogger.afInfoLog(sb.toString());
                }
            } else {
                AFLogger.afErrorLogForExcManagerOnly("Unexpected ddl requestCount - end", new IllegalStateException("Metrics: Unexpected ddl requestCount = ".concat(String.valueOf(i4))));
            }
            if (AFInAppEventType.getResponseCode() == 200) {
                JSONObject jSONObject = new JSONObject(AFb1zSDK.AFKeystoreWrapper(AFInAppEventType));
                aFb1mSDK.onResponseErrorNative = jSONObject.optBoolean("is_second_ping", true);
                if (jSONObject.optBoolean("found")) {
                    AFInAppEventParameterName = DeepLink.AFInAppEventParameterName(jSONObject.optJSONObject("click_event"));
                    AFInAppEventParameterName.AFKeystoreWrapper.put("is_deferred", true);
                } else {
                    AFInAppEventParameterName = null;
                }
                if (AFInAppEventParameterName != null) {
                    return new DeepLinkResult(AFInAppEventParameterName, null);
                }
                if (aFb1mSDK.onResponseNative > 1 || !aFb1mSDK.afWarnLog() || !aFb1mSDK.onResponseErrorNative) {
                    break;
                }
                AFLogger.afDebugLog("[DDL] Waiting for referrers...");
                aFb1mSDK.AFLogger$LogLevel.await();
                AFe1vSDK aFe1vSDK3 = aFb1mSDK.AppsFlyer2dXConversionCallback;
                long currentTimeMillis = System.currentTimeMillis();
                long[] jArr3 = aFe1vSDK3.afErrorLog;
                if (jArr3[0] != 0) {
                    aFe1vSDK3.AFInAppEventParameterName.put("rfr_wait", Long.valueOf(currentTimeMillis - jArr3[0]));
                    aFe1vSDK3.AFKeystoreWrapper.values("ddl", new JSONObject(aFe1vSDK3.AFInAppEventParameterName).toString());
                } else {
                    AFLogger.afInfoLog("Metrics: ddlEnd[0] ts is missing");
                }
                if (aFb1mSDK.onAttributionFailureNative == aFb1mSDK.onDeepLinkingNative) {
                    return new DeepLinkResult(null, null);
                }
                aFb1mSDK.AFLogger$LogLevel();
            } else {
                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);
            }
        }
    }
}